Discussion:
[asterisk-users] Mailing a fax with mutt does not succeed
Daniel - Asterisk
2013-06-19 18:03:14 UTC
Permalink
Hello everyone,

I'm trying to send a received fax with mutt, when I try it from the Linux
shel it works, but when trying with Asterisk's System command it doesn't.

Successful Linux command:
echo | mutt -s "New fax" ***@gmail.com -a /tmp/faxes/201306191111.tif

Unsuccessful Asterisk Command:
same => n,System(mutt -s "New fax" ***@gmail.com -a
${FAXDEST}/${tempfax}.tif)

I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.

Any hint will be appreciated.

Elder D. Arohuanca
Lima - Peru
Andre Courchesne
2013-06-19 18:08:40 UTC
Permalink
Probably Asterisk does not know where mutt is, specify it's path in your System command.
Post by Daniel - Asterisk
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from the Linux shel it works, but when trying with Asterisk's System command it doesn't.
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
Daniel - Asterisk
2013-06-19 18:29:25 UTC
Permalink
Hi Andre,

I've tried with:
System(echo | /usr/bin/mutt -s "New fax" ***@gmail.com -a
${FAXDEST}/${tempfax})

with no success, value of SYSTEMSTATUS variable is APPERROR

Again it works from Linux shell.

Thanks in advance

Elder
Post by Andre Courchesne
Probably Asterisk does not know where mutt is, specify it's path in your System command.
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from the Linux
shel it works, but when trying with Asterisk's System command it doesn't.
/tmp/faxes/201306191111.tif
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
Andre Courchesne
2013-06-19 18:38:50 UTC
Permalink
Why "echo |" ?

Alsy are you sire of the content of ${FAXDEST} and ${tempfax}.

Add some NoOp before.
Post by Daniel - Asterisk
Hi Andre,
with no success, value of SYSTEMSTATUS variable is APPERROR
Again it works from Linux shell.
Thanks in advance
Elder
Probably Asterisk does not know where mutt is, specify it's path in your System command.
Post by Daniel - Asterisk
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from the Linux shel it works, but when trying with Asterisk's System command it doesn't.
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
Daniel - Asterisk
2013-06-19 19:50:30 UTC
Permalink
Hi Andre:

I added echo to provide STDIN, I'm sure on variable contents, please see
bellow


Hello Steve,

1. I've just addd echo at my sentence, please see output bellow.
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.
3. I don't get you, please give some advice to try using Verbose instead
System
4. I don't know how to get this, but I'm using /usr/bin/mutt as you can see
bellow.
5. I have redirected output of System this way : System(echo |
/usr/bin/mutt -s "New fax" ***@gmail.com -a ${FAXDEST}/${tempfax} >
/tmp/ocurrencies.txt 2>&1), ocurrencies.txt is empty.


DIALPLAN:
[ Context 'default' created by 'pbx_config' ]
'*95' => 1. NoOp(trying to send a fax to an email)
2. Set(FAXDEST=/tmp/faxes)
3. Set(tempfax=${SHELL(ls /tmp/faxes/*.tif):11})
4. NoOp(file name is: ${tempfax})
5. Goto(incoming-fax,fax,7)

[ Context 'incoming-fax' created by 'pbx_config' ]
'fax' => 1. Verbose(3,Incoming fax)
...
5. ReceiveFax(${FAXDEST}/${tempfax})
6. Verbose(3,- Fax receipt completed with status:
${FAXSTATUS})
7. System(echo | /usr/bin/mutt -s "New fax"
***@gmail.com -a ${FAXDEST}/${tempfax})
8. NoOp(System command status is: ${SYSTEMSTATUS})
9. Hangup()

ASTERISK CLI OUTPUT:
-- Goto (default,*95,1)
-- Executing [****@default:1] NoOp("SIP/40106-00001ea1", "trying to send
a fax to an email") in new stack
-- Executing [****@default:2] Set("SIP/40106-00001ea1",
"FAXDEST=/tmp/faxes") in new stack
-- Executing [****@default:3] Set("SIP/40106-00001ea1",
"tempfax=201306191111.tif") in new stack
-- Executing [****@default:4] NoOp("SIP/40106-00001ea1", "file name is:
201306191111.tif") in new stack
-- Executing [****@default:5] Goto("SIP/40106-00001ea1",
"incoming-fax,fax,7") in new stack
-- Goto (incoming-fax,fax,7)
-- Executing [***@incoming-fax:7] System("SIP/40106-00001ea1", "echo |
/usr/bin/mutt -s "New fax" ***@gmail.com -a
/tmp/faxes/201306191111.tif") in new stack
-- Executing [***@incoming-fax:8] NoOp("SIP/40106-00001ea1", "System
command status is: APPERROR") in new stack
-- Executing [***@incoming-fax:9] Hangup("SIP/40106-00001ea1", "") in
new stack


Elder D. Arohuanca
Lima - Peru
Post by Andre Courchesne
Why "echo |" ?
Alsy are you sire of the content of ${FAXDEST} and ${tempfax}.
Add some NoOp before.
Hi Andre,
with no success, value of SYSTEMSTATUS variable is APPERROR
Again it works from Linux shell.
Thanks in advance
Elder
Post by Andre Courchesne
Probably Asterisk does not know where mutt is, specify it's path in your System command.
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from the Linux
shel it works, but when trying with Asterisk's System command it doesn't.
/tmp/faxes/201306191111.tif
${FAXDEST}/${tempfax}.tif)
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
jg
2013-06-19 20:12:04 UTC
Permalink
More things to try:

(1) Is there any entry in /var/log/maillog (or equivalent log file)? If so, mutt basically works
and the messages should give some clues.
(2) What happens if you call mutt without any attachments?

I am using mutt in exactly the same way and it works.

jg
I added echo to provide STDIN, I'm sure on variable contents, please see bellow
Hello Steve,
1. I've just addd echo at my sentence, please see output bellow.
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.
3. I don't get you, please give some advice to try using Verbose instead System
4. I don't know how to get this, but I'm using /usr/bin/mutt as you can see bellow.
5. I have redirected output of System this way : System(echo | /usr/bin/mutt -s "New fax"
/tmp/ocurrencies.txt 2>&1), ocurrencies.txt is empty.
[ Context 'default' created by 'pbx_config' ]
'*95' => 1. NoOp(trying to send a fax to an email)
2. Set(FAXDEST=/tmp/faxes)
3. Set(tempfax=${SHELL(ls /tmp/faxes/*.tif):11})
4. NoOp(file name is: ${tempfax})
5. Goto(incoming-fax,fax,7)
[ Context 'incoming-fax' created by 'pbx_config' ]
'fax' => 1. Verbose(3,Incoming fax)
...
5. ReceiveFax(${FAXDEST}/${tempfax})
6. Verbose(3,- Fax receipt completed with status: ${FAXSTATUS})
8. NoOp(System command status is: ${SYSTEMSTATUS})
9. Hangup()
-- Goto (default,*95,1)
email") in new stack
stack
in new stack
-- Goto (incoming-fax,fax,7)
in new stack
APPERROR") in new stack
Elder D. Arohuanca
Lima - Peru
Why "echo |" ?
Alsy are you sire of the content of ${FAXDEST} and ${tempfax}.
Add some NoOp before.
Post by Daniel - Asterisk
Hi Andre,
with no success, value of SYSTEMSTATUS variable is APPERROR
Again it works from Linux shell.
Thanks in advance
Elder
Probably Asterisk does not know where mutt is, specify it's path in your System command.
Post by Daniel - Asterisk
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from the Linux shel it
works, but when trying with Asterisk's System command it doesn't.
/tmp/faxes/201306191111.tif
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com
<http://www.api-digital.com/> --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com
<http://www.api-digital.com/> --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
Mikhail Lischuk
2013-06-19 21:58:55 UTC
Permalink
This worked for me:

System(date | mutt -s "FAX from
${CALLERID(num)}" -a
/var/spool/asterisk/fax/${STRFTIME(,,%Y%m%d)}-${CALLERID(num)}.tiff
***@domain)

I don't see any difference with you (beside the echo
instead of date), so I guess you should look at the maillog to find out
what is happening. Or (as I did in the end) write AGI script to send the
goddamn mail using the language and method you like (I used Perl and
MIME::Lite::TT::HTML), and make Asterisk call that script.

jg
Post by jg
(1) Is there
any entry in /var/log/maillog (or equivalent log file)? If so, mutt
basically works and the messages should give some clues.
Post by jg
(2) What
happens if you call mutt without any attachments?
Post by jg
I am using mutt
in exactly the same way and it works.
Post by jg
jg
Am 19.06.2013 21:50,
Post by Daniel - Asterisk
I added echo to
provide STDIN, I'm sure on variable contents, please see bellow
Hello Steve,
Post by jg
Post by Daniel - Asterisk
1. I've just addd echo at my sentence, please see
output bellow.
Post by jg
Post by Daniel - Asterisk
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.
Post by jg
Post by Daniel - Asterisk
3. I don't get you, please give
some advice to try using Verbose instead System
Post by jg
Post by Daniel - Asterisk
4. I don't know how
to get this, but I'm using /usr/bin/mutt as you can see bellow.
Post by jg
Post by Daniel - Asterisk
5. I
have redirected output of System this way : System(echo | /usr/bin/mutt
-s "New fax" ***@gmail.com -a ${FAXDEST}/${tempfax} >
/tmp/ocurrencies.txt 2>&1), ocurrencies.txt is empty.
Post by jg
Post by Daniel - Asterisk
[ Context 'default' created by 'pbx_config' ]
'*95' => 1.
NoOp(trying to send a fax to an email)
Post by jg
Post by Daniel - Asterisk
2. Set(FAXDEST=/tmp/faxes)
3. Set(tempfax=${SHELL(ls /tmp/faxes/*.tif):11})
4. NoOp(file
name is: ${tempfax})
Post by jg
Post by Daniel - Asterisk
5. Goto(incoming-fax,fax,7)
[ Context
'incoming-fax' created by 'pbx_config' ]
Post by jg
Post by Daniel - Asterisk
'fax' => 1.
Verbose(3,Incoming fax)
Post by jg
Post by Daniel - Asterisk
...
5. ReceiveFax(${FAXDEST}/${tempfax})
6. Verbose(3,- Fax receipt completed with status: ${FAXSTATUS})
7. System(echo | /usr/bin/mutt -s "New fax" ***@gmail.com -a
${FAXDEST}/${tempfax})
${SYSTEMSTATUS})
Post by jg
Post by Daniel - Asterisk
9. Hangup()
-- Goto
(default,*95,1)
NoOp("SIP/40106-00001ea1", "trying to send a fax to an email") in new
stack
"FAXDEST=/tmp/faxes") in new stack
Set("SIP/40106-00001ea1", "tempfax=201306191111.tif") in new stack
Post by jg
Post by Daniel - Asterisk
--
Executing [****@default:4] NoOp("SIP/40106-00001ea1", "file name is:
201306191111.tif") in new stack
Goto("SIP/40106-00001ea1", "incoming-fax,fax,7") in new stack
Post by jg
Post by Daniel - Asterisk
-- Goto
(incoming-fax,fax,7)
System("SIP/40106-00001ea1", "echo | /usr/bin/mutt -s "New fax"
Post by jg
Post by Daniel - Asterisk
--
Executing [***@incoming-fax:8] NoOp("SIP/40106-00001ea1", "System
command status is: APPERROR") in new stack
Post by jg
Post by Daniel - Asterisk
-- Executing
Elder D. Arohuanca
Lima - Peru
On Wed, Jun 19, 2013 at
Post by Andre Courchesne
Why
"echo |" ?
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Alsy are you sire of the content of ${FAXDEST} and
${tempfax}.
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Add some NoOp before.
On 2013-06-19, at
Post by Daniel - Asterisk
Hi
Andre,
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
System(echo | /usr/bin/mutt -s
"New fax" ***@gmail.com -a ${FAXDEST}/${tempfax})
with no success, value of SYSTEMSTATUS variable is APPERROR
Again it works from Linux shell.
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Thanks in advance
Elder
On Wed, Jun 19, 2013 at 1:08 PM, Andre
Post by Andre Courchesne
Probably Asterisk
does not know where mutt is, specify it's path in your System command.
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Post by Andre Courchesne
On 2013-06-19, at 2:03 PM, Daniel - Asterisk
Post by Daniel - Asterisk
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from
the Linux shel it works, but when trying with Asterisk's System command
it doesn't.
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
echo |
same =>
n,System(mutt -s "New fax" ***@gmail.com -a
${FAXDEST}/${tempfax}.tif)
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
I'm using Asterisk 1.8.19.0
on Debian 6.0.6, Asterisk was installed by root.
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Any
hint will be appreciated.
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Elder D. Arohuanca
Lima - Peru --
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com [1]
--
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
http://www.asterisk.org/hello [2]
asterisk-users mailing list
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
To UNSUBSCRIBE or update options
http://lists.digium.com/mailman/listinfo/asterisk-users
[3]
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Post by Andre Courchesne
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com [1]
--
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Post by Andre Courchesne
http://www.asterisk.org/hello [2]
asterisk-users mailing list
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
Post by Andre Courchesne
To UNSUBSCRIBE or update options
http://lists.digium.com/mailman/listinfo/asterisk-users
[3]
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com [4]
--
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
Post by Daniel - Asterisk
http://www.asterisk.org/hello [2]
asterisk-users
mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users [3]
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com [4]
--
Post by jg
Post by Daniel - Asterisk
Post by Andre Courchesne
http://www.asterisk.org/hello [2]
asterisk-users
mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users [3]
Post by jg
Post by Daniel - Asterisk
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com [4]
--
Post by jg
Post by Daniel - Asterisk
http://www.asterisk.org/hello [2]
asterisk-users
mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users [3]
Post by jg
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com [4]
--
Post by jg
New to Asterisk? Join us for a live introductory webinar every
http://www.asterisk.org/hello [2]
asterisk-users mailing
list
http://lists.digium.com/mailman/listinfo/asterisk-users [3]
--
With
Best Regards
Mikhail Lischuk



Links:
------
[1]
http://www.api-digital.com/
[2] http://www.asterisk.org/hello
[3]
http://lists.digium.com/mailman/listinfo/asterisk-users
[4]
http://www.api-digital.com
Daniel - Asterisk
2013-06-20 21:27:22 UTC
Permalink
Hello jg:

When mutt is called from Asterisk's dialplan there's no output at mail.log

When I use:
echo | /usr/bin/mutt -s "New fax" ***@gmail.com -a
${FAXDEST}/${tempfax} > /tmp/ocurrencias.txt 2>&1
replacing FAXDEST and TEMPFAX with proper values, the output is as follows:

Jun 20 16:16:16 SERVER-NAME sendmail[21276]: My unqualified host name
(SERVER-NAME) unknown; sleeping for retry
Jun 20 16:17:16 SERVER-NAME sendmail[21276]: unable to qualify my own
domain name (SERVER-NAME) -- using short name
Jun 20 16:17:16 SERVER-NAME sendmail[21276]: r5KLHGgk021276: from=root,
size=116501, class=0, nrcpts=1, msgid=<***@SERVER-NAME>,
relay=***@localhost
Jun 20 16:17:17 SERVER-NAME sm-mta[21285]: r5KLHGNY021285:
from=<***@SERVER-NAME>, size=116646, class=0, nrcpts=1,
msgid=<***@SERVER-NAME>, proto=ESMTP, daemon=MTA-v4,
relay=localhost [127.0.0.1]
Jun 20 16:17:17 SERVER-NAME sendmail[21276]: r5KLHGgk021276: to=
***@gmail.com, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01,
mailer=relay, pri=146501, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0,
stat=Sent (r5KLHGNY021285 Message accepted for delivery)
Jun 20 16:17:19 SERVER-NAME sm-mta[21287]: STARTTLS=client, relay=
gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL,
cipher=RC4-SHA, bits=128/128
Jun 20 16:17:20 SERVER-NAME sm-mta[21287]: r5KLHGNY021285: to=<
***@gmail.com>, ctladdr=<***@SERVER-NAME> (0/0), delay=00:00:03,
xdelay=00:00:03, mailer=esmtp, pri=236646, relay=gmail-smtp-in.l.google.com.
[173.194.76.26], dsn=2.0.0, stat=Sent (OK 1371763040 f6si834075qaf.111 -
gsmtp)
ocurrencias.txt is empty also.

Elder Arohuanca
Post by jg
(1) Is there any entry in /var/log/maillog (or equivalent log file)? If
so, mutt basically works and the messages should give some clues.
(2) What happens if you call mutt without any attachments?
I am using mutt in exactly the same way and it works.
jg
I added echo to provide STDIN, I'm sure on variable contents, please see bellow
Hello Steve,
1. I've just addd echo at my sentence, please see output bellow.
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.
3. I don't get you, please give some advice to try using Verbose instead System
4. I don't know how to get this, but I'm using /usr/bin/mutt as you can see bellow.
5. I have redirected output of System this way : System(echo |
Post by Daniel - Asterisk
/tmp/ocurrencies.txt 2>&1), ocurrencies.txt is empty.
[ Context 'default' created by 'pbx_config' ]
'*95' => 1. NoOp(trying to send a fax to an email)
2. Set(FAXDEST=/tmp/faxes)
3. Set(tempfax=${SHELL(ls /tmp/faxes/*.tif):11})
4. NoOp(file name is: ${tempfax})
5. Goto(incoming-fax,fax,7)
[ Context 'incoming-fax' created by 'pbx_config' ]
'fax' => 1. Verbose(3,Incoming fax)
...
5. ReceiveFax(${FAXDEST}/${tempfax})
6. Verbose(3,- Fax receipt completed with status: ${FAXSTATUS})
7. System(echo | /usr/bin/mutt -s "New fax"
8. NoOp(System command status is: ${SYSTEMSTATUS})
9. Hangup()
-- Goto (default,*95,1)
send a fax to an email") in new stack
"FAXDEST=/tmp/faxes") in new stack
"tempfax=201306191111.tif") in new stack
is: 201306191111.tif") in new stack
"incoming-fax,fax,7") in new stack
-- Goto (incoming-fax,fax,7)
/tmp/faxes/201306191111.tif") in new stack
command status is: APPERROR") in new stack
Elder D. Arohuanca
Lima - Peru
Post by Daniel - Asterisk
Why "echo |" ?
Alsy are you sire of the content of ${FAXDEST} and ${tempfax}.
Add some NoOp before.
Hi Andre,
with no success, value of SYSTEMSTATUS variable is APPERROR
Again it works from Linux shell.
Thanks in advance
Elder
Post by Andre Courchesne
Probably Asterisk does not know where mutt is, specify it's path in your
System command.
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from the
Linux shel it works, but when trying with Asterisk's System command it
doesn't.
/tmp/faxes/201306191111.tif
${FAXDEST}/${tempfax}.tif)
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
Andre Courchesne - Gmail
2013-06-20 21:44:38 UTC
Permalink
Have you tried calling a bash script that in turns calls mutt. That way you could debug much easier, adding echo to a log file.

Sent from my iPhone
Post by Daniel - Asterisk
When mutt is called from Asterisk's dialplan there's no output at mail.log
Jun 20 16:16:16 SERVER-NAME sendmail[21276]: My unqualified host name (SERVER-NAME) unknown; sleeping for retry
Jun 20 16:17:16 SERVER-NAME sendmail[21276]: unable to qualify my own domain name (SERVER-NAME) -- using short name
Jun 20 16:17:19 SERVER-NAME sm-mta[21287]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=RC4-SHA, bits=128/128
ocurrencias.txt is empty also.
Elder Arohuanca
(1) Is there any entry in /var/log/maillog (or equivalent log file)? If so, mutt basically works and the messages should give some clues.
(2) What happens if you call mutt without any attachments?
I am using mutt in exactly the same way and it works.
jg
I added echo to provide STDIN, I'm sure on variable contents, please see bellow
Hello Steve,
1. I've just addd echo at my sentence, please see output bellow.
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.
3. I don't get you, please give some advice to try using Verbose instead System
4. I don't know how to get this, but I'm using /usr/bin/mutt as you can see bellow.
[ Context 'default' created by 'pbx_config' ]
'*95' => 1. NoOp(trying to send a fax to an email)
2. Set(FAXDEST=/tmp/faxes)
3. Set(tempfax=${SHELL(ls /tmp/faxes/*.tif):11})
4. NoOp(file name is: ${tempfax})
5. Goto(incoming-fax,fax,7)
[ Context 'incoming-fax' created by 'pbx_config' ]
'fax' => 1. Verbose(3,Incoming fax)
...
5. ReceiveFax(${FAXDEST}/${tempfax})
6. Verbose(3,- Fax receipt completed with status: ${FAXSTATUS})
8. NoOp(System command status is: ${SYSTEMSTATUS})
9. Hangup()
-- Goto (default,*95,1)
-- Goto (incoming-fax,fax,7)
Elder D. Arohuanca
Lima - Peru
Post by Andre Courchesne
Why "echo |" ?
Alsy are you sire of the content of ${FAXDEST} and ${tempfax}.
Add some NoOp before.
Post by Daniel - Asterisk
Hi Andre,
with no success, value of SYSTEMSTATUS variable is APPERROR
Again it works from Linux shell.
Thanks in advance
Elder
Post by Andre Courchesne
Probably Asterisk does not know where mutt is, specify it's path in your System command.
Post by Daniel - Asterisk
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from the Linux shel it works, but when trying with Asterisk's System command it doesn't.
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
jg
2013-06-20 21:55:17 UTC
Permalink
Hi Elder!

I am currently busy with a problem of one of my customers. I am pretty sure that your setup
requires only minor changes to make things work. I have several setups that use mutt exactly in
the same way as you are trying to do (except that I am using postfix instead of sendmail, but
this shouldn't matter). I'll have a look at your log entries tomorrow.

jg
Steve Edwards
2013-06-19 22:55:05 UTC
Permalink
Please don't top-post.
Post by Daniel - Asterisk
Post by Steve Edwards
1) Doesn't mutt expect the body on stdin? (Where's the 'echo' in the
Asterisk command?)
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."
Post by Daniel - Asterisk
Post by Steve Edwards
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.
Post by Daniel - Asterisk
Post by Steve Edwards
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?
Post by Daniel - Asterisk
Post by Steve Edwards
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.
Post by Daniel - Asterisk
Post by Steve Edwards
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 |
Post by Steve Edwards
/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=***@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 ***@sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
Steve Edwards
2013-06-19 18:28:22 UTC
Permalink
Post by Daniel - Asterisk
I'm trying to send a received fax with mutt, when I try it from the
Linux shel it works, but when trying with Asterisk's System command it
doesn't.
1) Doesn't mutt expect the body on stdin? (Where's the 'echo' in the
Asterisk command?)

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

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

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

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)
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards ***@sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
Ishfaq Malik
2013-06-20 07:49:10 UTC
Permalink
Hi

Login as user asterisk and then try it

e.g. sudo su asterisk

and then try to execute the command.

Last time I had this issue I had to set the shell environment for
asterisk with the

chsh

command
Post by Daniel - Asterisk
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from the
Linux shel it works, but when trying with Asterisk's System command it
doesn't.
-a /tmp/faxes/201306191111.tif
${FAXDEST}/${tempfax}.tif)
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
Ishfaq Malik <***@pack-net.co.uk>
Department: VOIP Support
Company: Packnet Limited
t: +44 (0)845 004 4994
f: +44 (0)161 660 9825
e: ***@pack-net.co.uk
w: http://www.pack-net.co.uk

Registered Address: PACKNET LIMITED, 2A ENTERPRISE HOUSE, LLOYD STREET
NORTH, MANCHESTER
SCIENCE PARK, MANCHESTER, M156SE
COMPANY REG NO. 04920552
Ishfaq Malik
2013-06-21 07:49:30 UTC
Permalink
Post by Daniel - Asterisk
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from the
Linux shel it works, but when trying with Asterisk's System command it
doesn't.
-a /tmp/faxes/201306191111.tif
${FAXDEST}/${tempfax}.tif)
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
I' though I sent this once already but here goes again...

Have you tried changing to asterisk user and then do the same command?

i.e.

sudo su asterisk

You may find that the asterisk user doesn't have a full shell
environment and you will ahve to set one using

chsh

Regards

Ish
--
Ishfaq Malik <***@pack-net.co.uk>
Department: VOIP Support
Company: Packnet Limited
t: +44 (0)845 004 4994
f: +44 (0)161 660 9825
e: ***@pack-net.co.uk
w: http://www.pack-net.co.uk

Registered Address: PACKNET LIMITED, 2A ENTERPRISE HOUSE, LLOYD STREET
NORTH, MANCHESTER
SCIENCE PARK, MANCHESTER, M156SE
COMPANY REG NO. 04920552
i***@gmail.com
2013-06-21 11:19:42 UTC
Permalink
How about sending the whole path to mutt in the system call
System(/usr/sbin/mutt) where ever it is

-----Original Message-----
From: Ishfaq Malik <***@pack-net.co.uk>
Sender: asterisk-users-***@lists.digium.com
Date: Fri, 21 Jun 2013 08:49:30
To: Asterisk Users Mailing List - Non-Commercial Discussion<asterisk-***@lists.digium.com>
Reply-To: Asterisk Users Mailing List - Non-Commercial Discussion
<asterisk-***@lists.digium.com>
Subject: Re: [asterisk-users] Mailing a fax with mutt does not succeed
Post by Daniel - Asterisk
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from the
Linux shel it works, but when trying with Asterisk's System command it
doesn't.
-a /tmp/faxes/201306191111.tif
${FAXDEST}/${tempfax}.tif)
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
I' though I sent this once already but here goes again...

Have you tried changing to asterisk user and then do the same command?

i.e.

sudo su asterisk

You may find that the asterisk user doesn't have a full shell
environment and you will ahve to set one using

chsh

Regards

Ish

--
Ishfaq Malik <***@pack-net.co.uk>
Department: VOIP Support
Company: Packnet Limited
t: +44 (0)845 004 4994
f: +44 (0)161 660 9825
e: ***@pack-net.co.uk
w: http://www.pack-net.co.uk

Registered Address: PACKNET LIMITED, 2A ENTERPRISE HOUSE, LLOYD STREET
NORTH, MANCHESTER
SCIENCE PARK, MANCHESTER, M156SE
COMPANY REG NO. 04920552
--
_____________________________________________________________________
-- 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
Bruce Marriner
2013-06-21 20:00:35 UTC
Permalink
I (sorry) haven't read this whole thread of e-mails but I am currently
using asterisk (11.3) to send received faxes via e-mail on a CentOS 6.4
system and it's working just fine. Perhaps my receive fax macro
dialplan that I'm testing with would be helpful... I'm using mailx
instead of mutt so if mutt is a requirement then I'm again sorry but
perhaps mailx could be an alternative for the OP..


[macro-ReceiveFAX]
; ${ARG1} - Email address(s) to send e-mail to.

exten => s,1,Verbose(0, macro-ReceiveFAX)
same => n,Set(CHANNEL(hangup_handler_push)=fax-hdlr,1(args));
same => n,Set(FAXPATH=/var/spool/asterisk/fax)
same => n,Set(FAXBASE=${STRFTIME(,,%C%y%m%d%H%M)})
same => n,Set(FAXFULL=${FAXPATH}/${FAXBASE}.tif)
same => n,Set(FAXMAIL=${ARG1})
same => n,NoOp(**** RECEIVING FAX : ${FAXFULL} to ${FAXMAIL} ****)
same => n,ReceiveFax(${FAXFULL},df)
exten => fax-hdlr,1,Verbose(0, ReceiveFax Handler : Fax Status =
${FAXSTATUS})
same => n,Goto(fax-${FAXOPT(status)},1)
same => n,Return()

exten => fax-SUCCESS,1,Verbose(0, ReceiveFAX SUCCESS Handler)
same => n,System(echo "Your fax is attached to this e-mail." | mail -s
"[FAX] Received ${FAXOPT(pages)} page fax from ${CALLERID(number)}" -a
${FAXPATH}/${FAXBASE}.tif ${FAXMAIL})
same => n,Return()

exten => fax-FAILED,1,Verbose(0, ReceiveFAX FAILED Handler)
same => n,System(echo "Unable to receive fax from caller." | mail -s
"[FAX] ${FAXOPT(status)} error: ${FAXOPT(error)} from
${CALLERID(number)}" ${FAXMAIL})
same => n,Return()

------ Original Message ------
From: ***@gmail.com
To: "Asterisk Users Mailing List - Non-Commercial Discussion"
<asterisk-***@lists.digium.com>
Sent: 6/21/2013 6:19:42 AM
Subject: Re: [asterisk-users] Mailing a fax with mutt does not succeed
How about sending the whole path to mutt in the system call
System(/usr/sbin/mutt) where ever it is
-----Original Message-----
Date: Fri, 21 Jun 2013 08:49:30
To: Asterisk Users Mailing List - Non-Commercial
Reply-To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Mailing a fax with mutt does not succeed
Post by Daniel - Asterisk
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from the
Linux shel it works, but when trying with Asterisk's System command
it
doesn't.
-a /tmp/faxes/201306191111.tif
${FAXDEST}/${tempfax}.tif)
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed
by
root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
I' though I sent this once already but here goes again...
Have you tried changing to asterisk user and then do the same command?
i.e.
sudo su asterisk
You may find that the asterisk user doesn't have a full shell
environment and you will ahve to set one using
chsh
Regards
Ish
--
Department: VOIP Support
Company: Packnet Limited
t: +44 (0)845 004 4994
f: +44 (0)161 660 9825
w: http://www.pack-net.co.uk
Registered Address: PACKNET LIMITED, 2A ENTERPRISE HOUSE, LLOYD STREET
NORTH, MANCHESTER
SCIENCE PARK, MANCHESTER, M156SE
COMPANY REG NO. 04920552
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/mailman/listinfo/asterisk-users
James Cloos
2013-06-21 22:40:38 UTC
Permalink
D> I'm trying to send a received fax with mutt, when I try it from the Linux
D> shel it works, but when trying with Asterisk's System command it doesn't.

Sending mail from a daemon is best done by calling /usr/sbin/sendmail directly,
without relying on an MUA.

The default mailcmd for app_voicemail is '/usr/sbin/sendmail -t' You
might also want to use the -oi flag.

-JimC
--
James Cloos <***@jhcloos.com> OpenPGP: 1024D/ED7DAEA6
Eric Cooper
2013-06-21 23:25:46 UTC
Permalink
Post by James Cloos
Sending mail from a daemon is best done by calling
/usr/sbin/sendmail directly, without relying on an MUA.
I disagree. It's a lot more painful to send a MIME attachment, which
is what you want to do when emailing the fax image.

Also, if you use /usr/bin/mail on a Debian-derived system, make sure
you've installed the heirloom-mailx package rather than the standard
bsd-mailx package, because the latter doesn't handle attachments with
the "-a" flag.
--
Eric Cooper e c c @ c m u . e d u
Larry Moore
2013-06-22 02:44:54 UTC
Permalink
Post by Daniel - Asterisk
Hello everyone,
I'm trying to send a received fax with mutt, when I try it from the
Linux shel it works, but when trying with Asterisk's System command it
doesn't.
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
Reading the responses to this thread I suspect the issue is that the
Muttrc file cannot be found, I am assuming the user:group Asterisk is
running as does not have a shell associated with it nor a home directory.

I am using OpenBSD and the above is true for my environment.

I have in my Asterisk Spool directory the folder structure
/var/spool/asterisk/fax/received. This folder is read-write for the
account Asterisk runs as.

On my system I set it up to use macros, one to receive the fax and
another to send the e-mail if one was received. The calling of the macro
to send the e-mail is performed in the Hangup extension.

I use extensions.ael on my system so here are the macros I set up;

macro fax-receive( fax-number, header-info, sender, recipient ) {
/*
${ARG1} is Receiving Station Fax Number
${ARG2} is Fax Header Information
${ARG3} is Fax Sender E-mail Address
${ARG4} is Fax Recipient E-mail Address
*/
NoOp(**** FAX RECEIVE ****);
Set(FAXOPT(localstationid)=${LOCAL(fax-number)});
Set(FAXOPT(headerinfo)=${LOCAL(header-info)});
Set(FROMADDR=${LOCAL(sender)});
Set(TOADDR=${LOCAL(recipient)});
NoOp(**** SETTING FAXOPT ****);
NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)});
NoOp(FAXOPT(headerinfo) : ${FAXOPT(headerinfo)});
NoOp(FAXOPT(localstationid) : ${FAXOPT(localstationid)});
Set(RXSTART=${EPOCH});
Set(FAXRXPATH=/var/spool/asterisk/fax/received);
Set(FAXRXFILE=fax-${CALLERID(number)}-${UNIQUEID});
NoOp(**** RECEIVING FAX : ${FAXRXFILE} ****);
ReceiveFAX(${FAXRXPATH}/${FAXRXFILE}.tif,fd);
NoOp(**** Subroutine Return ****);
return;
};

macro email_rxfax() {
Set(CALLDURATION=$[(${EPOCH}-${RXSTART})]);
System(FAXRXFILE=${FAXRXFILE} FAXRXPATH=${FAXRXPATH}
FAXRXSTATUS="${FAXOPT(status)}" FAXERROR="${FAXOPT(statusstr)}"
FROMADDR="${FROMADDR}" TOADDR="${TOADDR}"
LOCALSTATIONID="${FAXOPT(localstationid)}"
REMOTESTATIONID="${REMOTESTATIONID}" FAX
PAGES=${FAXOPT(pages)} FAXBITRATE=${FAXOPT(rate)}
FAXRESOLUTION=${FAXOPT(resolution)} CIDNUMBER="${CALLERID(number)}" CIDNAME
="${CALLERID(name)}" CALLDURATION=${CALLDURATION}
/usr/local/sbin/afax2email);
NoOp(**** STATUS : ${SYSTEMSTATUS} ****);
NoOp(**** Subroutine Return ****);
return;
};

Note, the System() line in email_rxfax() is one long line before the NoOp().

Here is an example entry in extensions.ael;


context fax-pstn1 {

fax => {
NoOp(Fax Received ${STRFTIME(,,%F %T %z)});
&fax-receive(+61 8 9XXXXXXX,Your Business
Name,FaxMaster@<your.domain.name>,lmoore@<your.domain.name>);
};

h => {
if ( "X${FAXRXFILE}" != "X" )
{
&email_rxfax();
}
NoOp(Call/Fax Ended ${STRFTIME(,,%F %T %z)});
};

};

Here is a sample extensions.ael entry for an incioming fax.

context fax-pstn1 {

fax => {
NoOp(Fax Received ${STRFTIME(,,%F %T %z)});
&fax-receive(+61 8 9XXXXXXX,Your Business
Name,FaxMaster@<your.domain.name>,lmoore@<your.domain.name>);
};

h => {
if ( "X${FAXRXFILE}" != "X" )
{
&email_rxfax();
}
NoOp(Call/Fax Ended ${STRFTIME(,,%F %T %z)});
};

};


I created a Muttrc file in /etc/asterisk, I use msmtp for the mail
progam, sendmail works but I didn't like the Envelope-
Steve Edwards
2013-06-22 06:17:37 UTC
Permalink
echo >> "$MSGFILE"
printf "%18s" "Sender: " >> "$MSGFILE"; printf "%-20s\n" "${REMOTESTATIONID}" >> "$MSGFILE"
printf "%18s" "Pages: " >> "$MSGFILE"; printf "%-20s\n" "${FAXPAGES}" >> "$MSGFILE"
printf "%18s" "Signal Rate: " >> "$MSGFILE"; printf "%-20s\n" "${FAXBITRATE} bit/s" >> "$MSGFILE"
printf "%18s" "CallerID Number: " >> "$MSGFILE"; printf "%-20s\n" "${CIDNUMBER}" >> "$MSGFILE"
printf "%18s" "CallerID Name: " >> "$MSGFILE"; printf "%-20s\n" "${CIDNAME}" >> "$MSGFILE"
printf "%18s" "Call Duration: " >> "$MSGFILE"; printf "%-20s\n" "${DURATION}" >> "$MSGFILE"
printf "%18s" "Status: " >> "$MSGFILE"; printf "%-20s\n" "${FAXERROR}" >> "$MSGFILE"
How about:

#!/bin/bash
FORMAT='%18s %-20s\n'
(
printf "${FORMAT}" 'Sender:' "${REMOTESTATIONID}"
printf "${FORMAT}" 'Pages:' "${FAXPAGES}"
printf "${FORMAT}" 'Signal Rate:' "${FAXBITRATE} bits/s"
printf "${FORMAT}" 'CallerID Number:' "${CIDNUMBER}"
printf "${FORMAT}" 'CallerID Name:' "${CIDNAME}"
printf "${FORMAT}" 'Call Duration:' "${DURATION}"
printf "${FORMAT}" 'Status:' "${FAXERROR}"
) >>${MSGFILE}
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards ***@sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
Larry Moore
2013-06-24 12:38:16 UTC
Permalink
Post by Steve Edwards
echo >> "$MSGFILE"
printf "%18s" "Sender: " >> "$MSGFILE"; printf "%-20s\n"
"${REMOTESTATIONID}" >> "$MSGFILE"
printf "%18s" "Pages: " >> "$MSGFILE"; printf "%-20s\n" "${FAXPAGES}"
"$MSGFILE"
printf "%18s" "Signal Rate: " >> "$MSGFILE"; printf "%-20s\n"
"${FAXBITRATE} bit/s" >> "$MSGFILE"
printf "%18s" "CallerID Number: " >> "$MSGFILE"; printf "%-20s\n"
"${CIDNUMBER}" >> "$MSGFILE"
printf "%18s" "CallerID Name: " >> "$MSGFILE"; printf "%-20s\n"
"${CIDNAME}" >> "$MSGFILE"
printf "%18s" "Call Duration: " >> "$MSGFILE"; printf "%-20s\n"
"${DURATION}" >> "$MSGFILE"
printf "%18s" "Status: " >> "$MSGFILE"; printf "%-20s\n" "${FAXERROR}"
"$MSGFILE"
#!/bin/bash
FORMAT='%18s %-20s\n'
(
printf "${FORMAT}" 'Sender:' "${REMOTESTATIONID}"
printf "${FORMAT}" 'Pages:' "${FAXPAGES}"
printf "${FORMAT}" 'Signal Rate:' "${FAXBITRATE} bits/s"
printf "${FORMAT}" 'CallerID Number:' "${CIDNUMBER}"
printf "${FORMAT}" 'CallerID Name:' "${CIDNAME}"
printf "${FORMAT}" 'Call Duration:' "${DURATION}"
printf "${FORMAT}" 'Status:' "${FAXERROR}"
) >>${MSGFILE}
Thank Steve,

That makes the section more readable and it works with /bin/ksh too.

Cheers,

Larry.
Daniel - Asterisk
2013-07-16 19:14:44 UTC
Permalink
Hello everyone, I'd changed the server and mutt started working, but I'll
test your advices and wil let you lnow ass soon as I can.

Thank you!

Elder
Post by Larry Moore
echo >> "$MSGFILE"
printf "%18s" "Sender: " >> "$MSGFILE"; printf "%-20s\n"
"${REMOTESTATIONID}" >> "$MSGFILE"
printf "%18s" "Pages: " >> "$MSGFILE"; printf "%-20s\n" "${FAXPAGES}"
"$MSGFILE"
printf "%18s" "Signal Rate: " >> "$MSGFILE"; printf "%-20s\n"
"${FAXBITRATE} bit/s" >> "$MSGFILE"
printf "%18s" "CallerID Number: " >> "$MSGFILE"; printf "%-20s\n"
"${CIDNUMBER}" >> "$MSGFILE"
printf "%18s" "CallerID Name: " >> "$MSGFILE"; printf "%-20s\n"
"${CIDNAME}" >> "$MSGFILE"
printf "%18s" "Call Duration: " >> "$MSGFILE"; printf "%-20s\n"
"${DURATION}" >> "$MSGFILE"
printf "%18s" "Status: " >> "$MSGFILE"; printf "%-20s\n" "${FAXERROR}"
"$MSGFILE"
#!/bin/bash
FORMAT='%18s %-20s\n'
(
printf "${FORMAT}" 'Sender:' "${REMOTESTATIONID}"
printf "${FORMAT}" 'Pages:' "${FAXPAGES}"
printf "${FORMAT}" 'Signal Rate:' "${FAXBITRATE} bits/s"
printf "${FORMAT}" 'CallerID Number:' "${CIDNUMBER}"
printf "${FORMAT}" 'CallerID Name:' "${CIDNAME}"
printf "${FORMAT}" 'Call Duration:' "${DURATION}"
printf "${FORMAT}" 'Status:' "${FAXERROR}"
) >>${MSGFILE}
Thank Steve,
That makes the section more readable and it works with /bin/ksh too.
Cheers,
Larry.
--
______________________________**______________________________**_________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
http://www.asterisk.org/hello
asterisk-users mailing list
http://lists.digium.com/**mailman/listinfo/asterisk-**users<http://lists.digium.com/mailman/listinfo/asterisk-users>
Loading...