Please don't top-post.

On Wed, 19 Jun 2013, Steve Edwards wrote:

1) Doesn't mutt expect the body on stdin? (Where's the 'echo' in the Asterisk command?)

On Wed, 19 Jun 2013, Daniel - Asterisk wrote:

1. I've just addd echo at my sentence, please see output bellow.

Not that it's related to your issue...

Since mutt is expecting the body on stdin, why not put something in like "Hey, you've got FAX."

2) Is Asterisk executing as root? Does the Asterisk user ID have read access to the TIFF?

2. Asterisk is executing as root, I think Asterisk has access to read TIF files since I've used ls, chmod, cp & mv from Asterisk's CLI with '!' character.

This is not conclusive. The Asterisk 'daemon' is a separate process from your CLI process (and your shell process spawned from the CLI process). They do not 'have to' be executing as the same user. If the Asterisk daemon is executing as root, permissions should not be an issue -- unless you're doing something weird with /tmp/ and NFS.

3) If you use 'verbose()' instead of 'system()' does the command look like your shell command?

3. I don't get you, please give some advice to try using Verbose instead System

If you replace system() with verbose(), does the command you are trying to execute look correct? If you 'copy' the command from the Asterisk CLI and 'paste' it into a shell and execute it using sudo as the the user executing the Asterisk daemon, does it work?

4) Is mutt in the Asterisk user ID's path?

4. I don't know how to get this, but I'm using /usr/bin/mutt as you can see bellow.

Then that should be sufficient.

5) If you redirect the output in the system() command to a file, does that yield any clues? I.e., system(foo >/tmp/clue 2>&1)

5. I have redirected output of System this way : System(echo | /usr/bin/mutt -s "New fax" earohua...@gmail.com -a ${FAXDEST}/${tempfax}
>/tmp/ocurrencies.txt 2>&1), ocurrencies.txt is empty.

Sometimes the 'littlest' thing can trip you up. Usually it comes down to ownership, permissions, or environment variables.

Not that this is the proper way to figure this out, but this is what I would try next in desperation -- after crossing my fingers.

(Cut and paste each line from this email to a shell.)

AUSER=$(ps --no-heading -C asterisk --format user)

FILE=/tmp/faxes/201306191111.tif

MUSER=earohua...@gmail.com

echo body >/tmp/body

env --ignore sudo -u ${AUSER} /usr/bin/file ${FILE}

env --ignore sudo -u ${AUSER} /usr/bin/mutt -v

env --ignore sudo -u ${AUSER} /usr/bin/mutt -s in-body ${MUSER} </tmp/body

env --ignore sudo -u ${AUSER} /usr/bin/mutt -a /tmp/body -s as-attachment-and-body 
${MUSER} </tmp/body

env --ignore sudo -u ${AUSER} /usr/bin/mutt -a ${FILE} -s new-fax ${MUSER} 
</tmp/body

Good luck :)

--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwa...@sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
              http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to