Hi everybody,
Hope you can help me out with an issue I have. I am trying to send an email whenever the caller is answered with the voicemail. The issue is that the email is not sent from the script but when I run the same command outside of the script to send the email the email is sent.
So in /etc/asterisk/extensions.conf I have these four lines
exten => 200,1,Log(NOTICE, intern {DEVICE_STATE(SIP/{sip}-{CALLERID(NUM)})} from {sip}-{CALLERID(NUM)} to {sip}-${MACRO_EXTEN});
same => n,Set(verzendadres=testemail@inta.com);
same => n,AGI(m2mob.sh);
same => n,Dial(SIP/200);
In line 3 I execute the script m2mob.sh that should send out the email. Here the 6 lines of the script:
#!/bin/sh
#$1 email address
#$2 from-cid
#$3 to-cid
echo -e "test email” | mailx -A gmail -s “TestScript” receiverEmail@inta.com
exit 0
Although Asterisk is executing the script (I have put log commands in the script to verify) the email is not sent. When I execute the same script through the command line (sh m2mob.sh), the email is sent and received. So only when asterisk runs the script it does not send the email.
I am running Asterisk v11.25.3 on DietPi on a armv7l running Linux.
Any help would be really appreciated.
Thanks