[asterisk-users] AGI PHP script
I have the below script that doesn't seem to be working. I don't know if I have something in the script wrong that I am just missing. Or if I don't have the php.ini set correctly for emailing This is the CLI output -- Executing [4099xxx...@port3_real:1] Goto(DAHDI/50-1, newhire,s,1) in new stack -- Goto (newhire,s,1) -- Executing [...@newhire:1] Ringing(DAHDI/50-1, ) in new stack -- Executing [...@newhire:2] Answer(DAHDI/50-1, ) in new stack -- Executing [...@newhire:3] Monitor(DAHDI/50-1, wav,/var/lib/asterisk/soun ds/NewHire/Newhire-1240503071.15148-4099819213-s,o) in new stack -- Executing [...@newhire:4] AGI(DAHDI/50-1, newhire.php) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/newhire.php -- DAHDI/50-1AGI Script newhire.php completed, returning 0 -- Auto fallthrough, channel 'DAHDI/50-1' status is 'UNKNOWN' -- Hungup 'DAHDI/50-1' Here is the script #!/usr/bin/php5 ?php // Get AGI vars from * $agivars = array(); while (!feof(STDIN)) { $agivar = trim(fgets(STDIN)); if ($agivar === '') { break; } $agivar = explode(':', $agivar); $agivars[$agivar[0]] = trim($agivar[1]); } extract($agivars); // Variable Declarations $agi_uniqueid; $agi_callerid; $agi_calleridname; $agi_extension; $agi_uniqueid; $UNIQUEID = $agi_uniqueid; $CALLERID = $agi_callerid; $EXTEN = $agi_extension; $attachment = /var/lib/asterisk/sounds/NewHire/Newhire-$UNIQUEID-$CALLERID-$EXTEN.wav ; $from = @xxx.com; $to =j...@answeringserv.com ; $subject=New Applicant; $headers = From: $from; $message =$UNIQUEID , $CALLERID , $EXTEN , $attachment; mail($to,$subject,$message,$headers); ? So is it anything obviously wrong with the script I'm missing? Besides something not being configured in php.ini correctly any other ideas? James Shigley Monroe Telephone Answering Service 409-981-9213 Infinity 5.5,UC 4.02.3803, Blink 3.0.104 Ecreator:2.21, eResponse 1.1.7 Webportal,WebApps, CONFIDENTIALITY NOTICE: This email, including any attachments, contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this email in error, please notify the sender immediately by reply to sender only message and destroy all electronic and hard copies of the communication, including attachments. Common sense is the collection of prejudices acquired by age eighteen. -- Albert Einstein Once you can accept the universe as matter expanding into nothing that is something,wearing stripes with plaid comes easy. -- Albert Einstein I know a little of everything, but a lot of nothing ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] AGI PHP script
Check you can run the script from th ecommand line and successfully send email... have you considered using phpagi for your scripts? 2009/4/23 James A. Shigley j...@answeringserv.com I have the below script that doesn’t seem to be working. I don’t know if I have something in the script wrong that I am just missing. Or if I don’t have the php.ini set correctly for emailing This is the CLI output -- Executing [4099xxx...@port3_real:1] Goto(DAHDI/50-1, newhire,s,1) in new stack -- Goto (newhire,s,1) -- Executing [...@newhire:1] Ringing(DAHDI/50-1, ) in new stack -- Executing [...@newhire:2] Answer(DAHDI/50-1, ) in new stack -- Executing [...@newhire:3] Monitor(DAHDI/50-1, wav,/var/lib/asterisk/soun ds/NewHire/Newhire-1240503071.15148-4099819213-s,o) in new stack -- Executing [...@newhire:4] AGI(DAHDI/50-1, newhire.php) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/newhire.php -- DAHDI/50-1AGI Script newhire.php completed, returning 0 -- Auto fallthrough, channel 'DAHDI/50-1' status is 'UNKNOWN' -- Hungup 'DAHDI/50-1' Here is the script #!/usr/bin/php5 ?php // Get AGI vars from * $agivars = array(); while (!feof(STDIN)) { $agivar = trim(fgets(STDIN)); if ($agivar === '') { break; } $agivar = explode(':', $agivar); $agivars[$agivar[0]] = trim($agivar[1]); } extract($agivars); // Variable Declarations $agi_uniqueid; $agi_callerid; $agi_calleridname; $agi_extension; $agi_uniqueid; $UNIQUEID = $agi_uniqueid; $CALLERID = $agi_callerid; $EXTEN = $agi_extension; $attachment = /var/lib/asterisk/sounds/NewHire/Newhire-$UNIQUEID-$CALLERID-$EXTEN.wav; $from = �...@xxx.com; $to =j...@answeringserv.com ; $subject=New Applicant; $headers = From: $from; $message =$UNIQUEID , $CALLERID , $EXTEN , $attachment; mail($to,$subject,$message,$headers); ? So is it anything obviously wrong with the script I’m missing? Besides something not being configured in php.ini correctly any other ideas? James Shigley *Monroe Telephone Answering Service* 409-981-9213** Infinity 5.5,UC 4.02.3803, Blink 3.0.104 Ecreator:2.21, eResponse 1.1.7 Webportal,WebApps, CONFIDENTIALITY NOTICE: This email, including any attachments, contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this email in error, please notify the sender immediately by reply to sender only message and destroy all electronic and hard copies of the communication, including attachments. Common sense is the collection of prejudices acquired by age eighteen. -- Albert Einstein Once you can accept the universe as matter expanding into nothing that is something,wearing stripes with plaid comes easy. -- Albert Einstein I know a little of everything, but a lot of nothing ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] AGI PHP script
you can try enabling agi debug on your console, you might be able to see if there's an error on your agi script. nhadie James A. Shigley wrote: I have the below script that doesn’t seem to be working. I don’t know if I have something in the script wrong that I am just missing. Or if I don’t have the php.ini set correctly for emailing This is the CLI output -- Executing [4099xxx...@port3_real:1] Goto(DAHDI/50-1, newhire,s,1) in new stack -- Goto (newhire,s,1) -- Executing [...@newhire:1] Ringing(DAHDI/50-1, ) in new stack -- Executing [...@newhire:2] Answer(DAHDI/50-1, ) in new stack -- Executing [...@newhire:3] Monitor(DAHDI/50-1, wav,/var/lib/asterisk/soun ds/NewHire/Newhire-1240503071.15148-4099819213-s,o) in new stack -- Executing [...@newhire:4] AGI(DAHDI/50-1, newhire.php) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/newhire.php -- DAHDI/50-1AGI Script newhire.php completed, returning 0 -- Auto fallthrough, channel 'DAHDI/50-1' status is 'UNKNOWN' -- Hungup 'DAHDI/50-1' Here is the script #!/usr/bin/php5 ?php // Get AGI vars from * $agivars = array(); while (!feof(STDIN)) { $agivar = trim(fgets(STDIN)); if ($agivar === '') { break; } $agivar = explode(':', $agivar); $agivars[$agivar[0]] = trim($agivar[1]); } extract($agivars); // Variable Declarations $agi_uniqueid; $agi_callerid; $agi_calleridname; $agi_extension; $agi_uniqueid; $UNIQUEID = $agi_uniqueid; $CALLERID = $agi_callerid; $EXTEN = $agi_extension; $attachment = /var/lib/asterisk/sounds/NewHire/Newhire-$UNIQUEID-$CALLERID-$EXTEN.wav; $from = �...@xxx.com; $to =j...@answeringserv.com ; $subject=New Applicant; $headers = From: $from; $message =$UNIQUEID , $CALLERID , $EXTEN , $attachment; mail($to,$subject,$message,$headers); ? So is it anything obviously wrong with the script I’m missing? Besides something not being configured in php.ini correctly any other ideas? James Shigley *Monroe Telephone Answering Service* 409-981-9213** Infinity 5.5,UC 4.02.3803, Blink 3.0.104 Ecreator:2.21, eResponse 1.1.7 Webportal,WebApps, CONFIDENTIALITY NOTICE: This email, including any attachments, contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this email in error, please notify the sender immediately by reply to sender only message and destroy all electronic and hard copies of the communication, including attachments. Common sense is the collection of prejudices acquired by age eighteen. -- Albert Einstein Once you can accept the universe as matter expanding into nothing that is something,wearing stripes with plaid comes easy. -- Albert Einstein I know a little of everything, but a lot of nothing ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] AGI PHP script
First run /var/lib/asterisk/agi-bin/newhire.php From linux command line to see if you don't have any error and that your AGI is executable. Then run 'agi debug' from the asterisk cli, place a call and see what was send and receive from your agi From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of James A. Shigley Sent: April-23-09 12:26 PM To: asterisk-users@lists.digium.com Subject: [asterisk-users] AGI PHP script I have the below script that doesn't seem to be working. I don't know if I have something in the script wrong that I am just missing. Or if I don't have the php.ini set correctly for emailing This is the CLI output -- Executing [4099xxx...@port3_real:1] Goto(DAHDI/50-1, newhire,s,1) in new stack -- Goto (newhire,s,1) -- Executing [...@newhire:1] Ringing(DAHDI/50-1, ) in new stack -- Executing [...@newhire:2] Answer(DAHDI/50-1, ) in new stack -- Executing [...@newhire:3] Monitor(DAHDI/50-1, wav,/var/lib/asterisk/soun ds/NewHire/Newhire-1240503071.15148-4099819213-s,o) in new stack -- Executing [...@newhire:4] AGI(DAHDI/50-1, newhire.php) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/newhire.php -- DAHDI/50-1AGI Script newhire.php completed, returning 0 -- Auto fallthrough, channel 'DAHDI/50-1' status is 'UNKNOWN' -- Hungup 'DAHDI/50-1' Here is the script #!/usr/bin/php5 ?php // Get AGI vars from * $agivars = array(); while (!feof(STDIN)) { $agivar = trim(fgets(STDIN)); if ($agivar === '') { break; } $agivar = explode(':', $agivar); $agivars[$agivar[0]] = trim($agivar[1]); } extract($agivars); // Variable Declarations $agi_uniqueid; $agi_callerid; $agi_calleridname; $agi_extension; $agi_uniqueid; $UNIQUEID = $agi_uniqueid; $CALLERID = $agi_callerid; $EXTEN = $agi_extension; $attachment = /var/lib/asterisk/sounds/NewHire/Newhire-$UNIQUEID-$CALLERID-$EXTEN.wav; $from = @xxx.com; $to =j...@answeringserv.com ; $subject=New Applicant; $headers = From: $from; $message =$UNIQUEID , $CALLERID , $EXTEN , $attachment; mail($to,$subject,$message,$headers); ? So is it anything obviously wrong with the script I'm missing? Besides something not being configured in php.ini correctly any other ideas? James Shigley Monroe Telephone Answering Service 409-981-9213 Infinity 5.5,UC 4.02.3803, Blink 3.0.104 Ecreator:2.21, eResponse 1.1.7 Webportal,WebApps, CONFIDENTIALITY NOTICE: This email, including any attachments, contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this email in error, please notify the sender immediately by reply to sender only message and destroy all electronic and hard copies of the communication, including attachments. Common sense is the collection of prejudices acquired by age eighteen. -- Albert Einstein Once you can accept the universe as matter expanding into nothing that is something,wearing stripes with plaid comes easy. -- Albert Einstein I know a little of everything, but a lot of nothing ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] AGI PHP script
This is the right suggestion: Run something like the following: [h...@mouth tmp]# echo this is a test | newhire.php If the script runs, check your maillog (/var/log/maillog) to see if there's any evidence of what may have happened. Geraint Lee wrote: Check you can run the script from th ecommand line and successfully send email... have you considered using phpagi for your scripts? 2009/4/23 James A. Shigley j...@answeringserv.com mailto:j...@answeringserv.com I have the below script that doesn’t seem to be working. I don’t know if I have something in the script wrong that I am just missing. Or if I don’t have the php.ini set correctly for emailing This is the CLI output -- Executing [4099xxx...@port3_real:1] Goto(DAHDI/50-1, newhire,s,1) in new stack -- Goto (newhire,s,1) -- Executing [...@newhire:1] Ringing(DAHDI/50-1, ) in new stack -- Executing [...@newhire:2] Answer(DAHDI/50-1, ) in new stack -- Executing [...@newhire:3] Monitor(DAHDI/50-1, wav,/var/lib/asterisk/soun ds/NewHire/Newhire-1240503071.15148-4099819213-s,o) in new stack -- Executing [...@newhire:4] AGI(DAHDI/50-1, newhire.php) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/newhire.php -- DAHDI/50-1AGI Script newhire.php completed, returning 0 -- Auto fallthrough, channel 'DAHDI/50-1' status is 'UNKNOWN' -- Hungup 'DAHDI/50-1' Here is the script #!/usr/bin/php5 ?php // Get AGI vars from * $agivars = array(); while (!feof(STDIN)) { $agivar = trim(fgets(STDIN)); if ($agivar === '') { break; } $agivar = explode(':', $agivar); $agivars[$agivar[0]] = trim($agivar[1]); } extract($agivars); // Variable Declarations $agi_uniqueid; $agi_callerid; $agi_calleridname; $agi_extension; $agi_uniqueid; $UNIQUEID = $agi_uniqueid; $CALLERID = $agi_callerid; $EXTEN = $agi_extension; $attachment = /var/lib/asterisk/sounds/NewHire/Newhire-$UNIQUEID-$CALLERID-$EXTEN.wav; $from = �...@xxx.com http://xxx.com; $to =j...@answeringserv.com mailto:j...@answeringserv.com ; $subject=New Applicant; $headers = From: $from; $message =$UNIQUEID , $CALLERID , $EXTEN , $attachment; mail($to,$subject,$message,$headers); ? So is it anything obviously wrong with the script I’m missing? Besides something not being configured in php.ini correctly any other ideas? James Shigley *Monroe Telephone Answering Service* 409-981-9213** Infinity 5.5,UC 4.02.3803, Blink 3.0.104 Ecreator:2.21, eResponse 1.1.7 Webportal,WebApps, CONFIDENTIALITY NOTICE: This email, including any attachments, contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this email in error, please notify the sender immediately by reply to sender only message and destroy all electronic and hard copies of the communication, including attachments. Common sense is the collection of prejudices acquired by age eighteen. -- Albert Einstein Once you can accept the universe as matter expanding into nothing that is something,wearing stripes with plaid comes easy. -- Albert Einstein I know a little of everything, but a lot of nothing ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] AGI PHP script
Actually I feel like an idiot. I had forgotten to put asterisk as an allowed sender in the server that those emails are going out of. (different from what * normally uses to email us) James Shigley Monroe Telephone Answering Service 409-981-9213 Infinity 5.5,UC 4.02.3803, Blink 3.0.104 Ecreator:2.21, eResponse 1.1.7 Webportal,WebApps, CONFIDENTIALITY NOTICE: This email, including any attachments, contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this email in error, please notify the sender immediately by reply to sender only message and destroy all electronic and hard copies of the communication, including attachments. Common sense is the collection of prejudices acquired by age eighteen. -- Albert Einstein Once you can accept the universe as matter expanding into nothing that is something,wearing stripes with plaid comes easy. -- Albert Einstein I know a little of everything, but a lot of nothing From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Ruddy Gbaguidi Sent: Thursday, April 23, 2009 11:57 AM To: 'Asterisk Users Mailing List - Non-Commercial Discussion' Subject: Re: [asterisk-users] AGI PHP script First run /var/lib/asterisk/agi-bin/newhire.php From linux command line to see if you don't have any error and that your AGI is executable. Then run 'agi debug' from the asterisk cli, place a call and see what was send and receive from your agi From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of James A. Shigley Sent: April-23-09 12:26 PM To: asterisk-users@lists.digium.com Subject: [asterisk-users] AGI PHP script I have the below script that doesn't seem to be working. I don't know if I have something in the script wrong that I am just missing. Or if I don't have the php.ini set correctly for emailing This is the CLI output -- Executing [4099xxx...@port3_real:1] Goto(DAHDI/50-1, newhire,s,1) in new stack -- Goto (newhire,s,1) -- Executing [...@newhire:1] Ringing(DAHDI/50-1, ) in new stack -- Executing [...@newhire:2] Answer(DAHDI/50-1, ) in new stack -- Executing [...@newhire:3] Monitor(DAHDI/50-1, wav,/var/lib/asterisk/soun ds/NewHire/Newhire-1240503071.15148-4099819213-s,o) in new stack -- Executing [...@newhire:4] AGI(DAHDI/50-1, newhire.php) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/newhire.php -- DAHDI/50-1AGI Script newhire.php completed, returning 0 -- Auto fallthrough, channel 'DAHDI/50-1' status is 'UNKNOWN' -- Hungup 'DAHDI/50-1' Here is the script #!/usr/bin/php5 ?php // Get AGI vars from * $agivars = array(); while (!feof(STDIN)) { $agivar = trim(fgets(STDIN)); if ($agivar === '') { break; } $agivar = explode(':', $agivar); $agivars[$agivar[0]] = trim($agivar[1]); } extract($agivars); // Variable Declarations $agi_uniqueid; $agi_callerid; $agi_calleridname; $agi_extension; $agi_uniqueid; $UNIQUEID = $agi_uniqueid; $CALLERID = $agi_callerid; $EXTEN = $agi_extension; $attachment = /var/lib/asterisk/sounds/NewHire/Newhire-$UNIQUEID-$CALLERID-$EXTEN.wav ; $from = @xxx.com; $to =j...@answeringserv.com ; $subject=New Applicant; $headers = From: $from; $message =$UNIQUEID , $CALLERID , $EXTEN , $attachment; mail($to,$subject,$message,$headers); ? So is it anything obviously wrong with the script I'm missing? Besides something not being configured in php.ini correctly any other ideas? James Shigley Monroe Telephone Answering Service 409-981-9213 Infinity 5.5,UC 4.02.3803, Blink 3.0.104 Ecreator:2.21, eResponse 1.1.7 Webportal,WebApps, CONFIDENTIALITY NOTICE: This email, including any attachments, contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this email in error, please notify the sender immediately by reply to sender only message and destroy all electronic and hard copies of the communication, including attachments. Common sense is the collection of prejudices acquired by age eighteen. -- Albert Einstein Once you can accept the universe as matter expanding into nothing that is something,wearing stripes with plaid comes easy. -- Albert Einstein I know a little of everything, but a lot of nothing ___ -- Bandwidth and Colocation Provided by http://www.api
Re: [asterisk-users] AGI PHP script
Un-top-posting and de-crufting, with some comments cast inline... 2009/4/23 James A. Shigley j...@answeringserv.com mailto:j...@answeringserv.com I have the below script that doesn?t seem to be working. I don?t know if I have something in the script wrong that I am just missing. Or if I don?t have the php.ini set correctly for emailing This is the CLI output -- Executing [4099xxx...@port3_real:1] Goto(DAHDI/50-1, newhire,s,1) in new stack -- Goto (newhire,s,1) -- Executing [...@newhire:1] Ringing(DAHDI/50-1, ) in new stack -- Executing [...@newhire:2] Answer(DAHDI/50-1, ) in new stack -- Executing [...@newhire:3] Monitor(DAHDI/50-1,wav,/var/lib/asterisk/sounds/NewHire/Newhire-1240503071.15148-4099819213-s,o) in new stack -- Executing [...@newhire:4] AGI(DAHDI/50-1, newhire.php) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/newhire.php -- DAHDI/50-1AGI Script newhire.php completed, returning 0 -- Auto fallthrough, channel 'DAHDI/50-1' status is 'UNKNOWN' -- Hungup 'DAHDI/50-1' Auto fallthrough means you fell off the end of your dialplan. I prefer to explicitly code a hangup so the next guy knows what was supposed to happen rather that what happened to happen :) When you post CLI output, the relevant snippet of extensions.conf can be helpful. Here is the script #!/usr/bin/php5 ?php // Get AGI vars from * $agivars = array(); while (!feof(STDIN)) { $agivar = trim(fgets(STDIN)); if ($agivar === '') { break; } $agivar = explode(':', $agivar); $agivars[$agivar[0]] = trim($agivar[1]); } extract($agivars); While your script is rather trivial, most coders use an established AGI library. Besides something not being configured in php.ini correctly any other ideas? Yes. Trim your signature splooge. On Thu, 23 Apr 2009, Mik Cheez wrote: Run something like the following: [h...@mouth tmp]# echo this is a test | newhire.php If the script runs, check your maillog (/var/log/maillog) to see if there's any evidence of what may have happened. You can feed the entire AGI environment through STDIN. Here's a sample script: # the standard AGI environment variables echo agi_accountcode: echo agi_callerid: 1234567890 echo agi_calleridname: agi-environment.sh echo agi_callingani2: 0 echo agi_callingpres: 0 echo agi_callingtns: 0 echo agi_callington: 0 echo agi_channel: SIP/1234567890 echo agi_context: newhire echo agi_dnid: * echo agi_enhanced: 0.0 echo agi_extension: 4099819213 echo agi_language: en echo agi_priority: 1 echo agi_rdnis: unknown echo agi_request: newhire.php echo agi_type: SIP echo agi_uniqueid: 1240503071.15148 echo Save it as agi-environment.sh and use it like: sh agi-environment.sh | newhire.php If you suspect an environment variable problem you could use: sh agi-environment.sh | env --ignore-environment newhire.php Your script doesn't do anything else with the AGI environment, but you can extend my script to include the proper response to most AGI requests. It's a very powerful debugging technique. I write my AGIs in C. It totally rocks to edit your source code in emacs with gdb running in another buffer reading the AGI environment and request responses from a text file while you step through your code line by line. I'm not a serious PHP hacker, but if you have a PHP IDE maybe the same technique would work. 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 -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
[Asterisk-Users] AGI/php script not working
Dear all I am just getting started with AGI so I wrote the following script as a simple test but all that happens is silence before it times out and hangs up can someone help to get me started? yet if i use the agi-test.agi script everything works I don't see the difference Thanks php -q ?php fputs(STDOUT 'SAY NUMBER 123 #*\n'); $lin = fgets(STDIN); ? yet all I get on the console is -- Launched AGI Script /var/lib/asterisk/agi-bin/test.php -- AGI Script test.php completed, returning 0 my conf file looks like exten = 4000,1,Wait,1 ; Wait exten = 4000,2,Answer ; Answer exten = 4000,3,AGI,test.php ; run script ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] AGI/php script not working
'SAY NUMBER 123 #* isn't a valid * command - it should be saynumber followed by a valid string of arguments. Do a show application saynumber in *. Iain --On Thursday, May 20, 2004 7:14 am -0400 Jer [EMAIL PROTECTED] wrote: Dear all I am just getting started with AGI so I wrote the following script as a simple test but all that happens is silence before it times out and hangs up can someone help to get me started? yet if i use the agi-test.agi script everything works I don't see the difference Thanks php -q ?php fputs(STDOUT 'SAY NUMBER 123 #*\n'); $lin = fgets(STDIN); ? yet all I get on the console is -- Launched AGI Script /var/lib/asterisk/agi-bin/test.php -- AGI Script test.php completed, returning 0 my conf file looks like exten = 4000,1,Wait,1 ; Wait exten = 4000,2,Answer ; Answer exten = 4000,3,AGI,test.php ; run script ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] AGI/php script not working
Iain Stevenson wrote: 'SAY NUMBER 123 #* isn't a valid * command - it should be saynumber followed by a valid string of arguments. Do a show application saynumber in *. In the meantime, you might as well try a show agi yourself :-) Apollon Koutlides ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] AGI/php script not working
OK, but I have AGI working and you don't - so please allow me the error since it's a while since I worked on this, Of course, it would help if * used consistent syntax for identical commands in extensions.conf and AGI, but that's another debate. Why not check the logs for php and * and post anything relevant here. Enable the maximum debugging support in *. Iain --On Thursday, May 20, 2004 2:44 pm +0300 Apollon Koutlides [EMAIL PROTECTED] wrote: Iain Stevenson wrote: 'SAY NUMBER 123 #* isn't a valid * command - it should be saynumber followed by a valid string of arguments. Do a show application saynumber in *. In the meantime, you might as well try a show agi yourself :-) Apollon Koutlides ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] AGI/php script not working
Hi! I am just getting started with AGI so I wrote the following script as a simple test but all that happens is silence before it times out and hangs up can someone help to get me started? Look here: http://www.voip-info.org/wiki-Asterisk+AGI+php php -q ?php fputs(STDOUT 'SAY NUMBER 123 #*\n'); $lin = fgets(STDIN); ? Is that really your entire script, or did you cut out most of the lines? If not, then I am afraid that you need to do quite some reading on both AGI and PHP first. Cheers, Philipp ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] AGI/php script not working
At 08:47 AM 5/20/2004, you wrote: -vvvc mode I see *CLI -- Executing Wait(Phone/phone0, 1) in new stack -- Executing Answer(Phone/phone0, ) in new stack -- Executing AGI(Phone/phone0, test.php) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/test.php -- AGI Script test.php completed, returning 0 my question is why don't I see the output on stderr OK, but I have AGI working and you don't - so please allow me the error since it's a while since I worked on this, Of course, it would help if * used consistent syntax for identical commands in extensions.conf and AGI, but that's another debate. Why not check the logs for php and * and post anything relevant here. Enable the maximum debugging support in *. Iain --On Thursday, May 20, 2004 2:44 pm +0300 Apollon Koutlides [EMAIL PROTECTED] wrote: Iain Stevenson wrote: 'SAY NUMBER 123 #* isn't a valid * command - it should be saynumber followed by a valid string of arguments. Do a show application saynumber in *. In the meantime, you might as well try a show agi yourself :-) Apollon Koutlides ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users