Hi All, I'm trying to use a php script to send voicemail e-mail so i can send custom e-mail message based on what mailbox. on my voicemail.conf i have mailcmd=/var/www/voicemail.php but when i tried to call an extension and goe to voicemail i'm not receiving the e-mail. but when i execute "php /var/www/voicemail.php" on the shell, i can receive the e-mail. how would i know the asterisk is actually executing that command? also i'm using unixodbc for my voicemail odbcstorage=mydb odbctable=mytable not sure if that has an effect or not. TIA Regards Ron
The ODBC isn't having an effect, otherwise you couldn't run it stand-alone. Voicemail.conf states that changing the /usr/bin/sendmail -t is done at your own risk. You could just do a system or AGI command to run your PHP script whenever the voicemail application is called, like this: - exten => s,1,dial... - exten => s,2,voicemail... - exten => s,3,AGI(php.agi) or - exten => s,3,system("/usr/bin/php /usr/bin/voicemail.php) -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Ron Sent: Wednesday, September 16, 2009 11:36 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: [asterisk-users] custom voicemail e-mail Hi All, I'm trying to use a php script to send voicemail e-mail so i can send custom e-mail message based on what mailbox. on my voicemail.conf i have mailcmd=/var/www/voicemail.php but when i tried to call an extension and goe to voicemail i'm not receiving the e-mail. but when i execute "php /var/www/voicemail.php" on the shell, i can receive the e-mail. how would i know the asterisk is actually executing that command? also i'm using unixodbc for my voicemail odbcstorage=mydb odbctable=mytable not sure if that has an effect or not. TIA Regards Ron _______________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
On Wednesday 16 September 2009 11:35:31 Ron wrote:> Hi All, > > I'm trying to use a php script to send voicemail e-mail so i can send > custom e-mail message based on what mailbox. > > on my voicemail.conf i have > > mailcmd=/var/www/voicemail.php > > but when i tried to call an extension and goe to voicemail i'm not > receiving the e-mail. > > but when i execute "php /var/www/voicemail.php" on the shell, i can > receive the e-mail.Make sure the first line of your script is: #!/usr/bin/php -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com & www.asterisk.org
thank you tilghman...that did the trick.. thanks again! Tilghman Lesher wrote:> On Wednesday 16 September 2009 12:38:59 Ron wrote: >> yup my scripts starts with that line, is there anyway to check on the >> logs if asterisk voicemail app is executing that command? thanks > > Okay, next sanity check is that your script is chmod 755 (executable). >
Hello Ron, I was thinking also to replace the email sent by the voicemail by a php script. My questions is simple, how do you manage to get the voicemail variables from the php script ? Or, maybe, you get from stdin the content of the "email" that should be send via sendmail ? Thanks in advance Best regards, Patrick
On Thu, 17 Sep 2009, Patrick wrote:> I was thinking also to replace the email sent by the voicemail by a php > script. My questions is simple, how do you manage to get the voicemail > variables from the php script ? Or, maybe, you get from stdin the > content of the "email" that should be send via sendmail ?Unfortunately: 1) The command line is the value of the "mailcmd" variable from voicemail.conf -- no additional arguments, nothing interesting like the channel, exten, etc. 2) The environment is boring, nothing of value here. 3) Stdin is the header and body ready to be processed by "sendmail -t" or your replacement. You could define emailbody to something like: emailbody=VM_CALLERID=${VM_CALLERID}\nVM_CIDNAME=${VM_CIDNAME}\nVM_CIDNUM=${VM_CIDNUM}\nVM_DATE=${VM_DATE}\nVM_DUR=${VM_DUR\ }\nVM_MAILBOX=${VM_MAILBOX}\nVM_MSGNUM=${VM_MSGNUM}\nVM_NAME=${VM_NAME}\n to make it somewhat easy to parse. If you need something else, you could stuff it into CALLERID(name) before calling the voicemail application. What do you want to accomplish? -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000