Un-top-posting and de-crufting, with some comments cast inline...
2009/4/23 James A. Shigley <[email protected]
<mailto:[email protected]>>
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-1>AGI 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 [email protected] 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