Thanks for pointing to the debug. I found that the path to phpagi was not right and since I fixed that everything seems to work fine.<div><br></div><div>Now, I want to know if I can use a phpagi command to check the status of SIP Peer if it is online and registered or not. I know I can use <b>grep with asterisk rx "sip show peers" </b>and use that as a shell script but I think there are better methods in Asterisk dialplan or in phpagi that it can be check.</div>
<div><br></div><div>Thanks,</div><div>Bruce<br><br><div class="gmail_quote">On Mon, Jun 14, 2010 at 5:27 PM, Carlos Chavez <span dir="ltr"><<a href="mailto:cursor@telecomabmex.com">cursor@telecomabmex.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> If you do an "agi set debug on" from the CLI and run your AGI you<br>
should see something like this:<br>
<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_request: auth.agi<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_channel: SIP/206-00000d9b<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_language: es<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_type: SIP<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_uniqueid: 1276192380.5115<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_version: 1.6.2.8<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_callerid: 206<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_calleridname: Carmen Saavedra<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_callingpres: 0<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_callingani2: 0<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_callington: 0<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_callingtns: 0<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_dnid: *22081019999282711<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_rdnis: unknown<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_context: oficina<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_extension: *22081019999282711<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_priority: 2<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_enhanced: 0.0<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_accountcode:<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_threadid: -1234945136<br>
[Jun 10 12:53:00] VERBOSE[8515] res_agi.c: <SIP/206-00000d9b>AGI Tx >><br>
agi_arg_1: ldnac<br>
<br>
As you can see agi_extension and agi_dnid should contain the number<br>
that the user dialed. Those are all the variables that are<br>
automatically sent to the AGI script from Asterisk. I do not know why<br>
you are getting the channel instead of the extension, you could try<br>
giving the extension as a parameter to the AGI script if you cannot get<br>
that from the included request variable.<br>
<div><div></div><div class="h5"><br>
On Mon, 2010-06-14 at 14:57 -0400, bruce bruce wrote:<br>
> Carlos, Thanks a lot for getting me started. That helps a great deal.<br>
><br>
><br>
> Currently, the $agi->request['agi_extension']; returns the SIP<br>
> channel info with IP and I want that to be the incoming DID number.<br>
><br>
><br>
> My dialplan output is this for line one:<br>
><br>
><br>
> exten => _x.,1,NoOp(${EXTEN})<br>
><br>
><br>
> 415444555<br>
><br>
><br>
> But with the agi_extension it comes back as:<br>
> NoOp("SIP/64.111.222.111-00000ca7", "")<br>
><br>
><br>
> Where can I find the list of command requests that can be sent to<br>
> Asterisk? Specially that for DID.<br>
><br>
><br>
> Thanks<br>
><br>
><br>
> On Mon, Jun 14, 2010 at 2:15 PM, Carlos Chavez<br>
> <<a href="mailto:cursor@telecomabmex.com">cursor@telecomabmex.com</a>> wrote:<br>
> On Mon, 2010-06-14 at 13:41 -0400, bruce bruce wrote:<br>
> > Hi Carlso,<br>
> ><br>
> ><br>
> > Thanks for the input. I have done this in php and am not<br>
> familiar with<br>
> > phpagi.<br>
> > So, there is absolutely no way to temporarily solve this<br>
> problem by<br>
> > getting the value back from php file?<br>
> ><br>
> ><br>
> > Wondering if it would require a lot of work to change the<br>
> php file to<br>
> > phpagi?<br>
> > Thanks,<br>
> > Bruce<br>
> ><br>
><br>
> Here is an example:<br>
><br>
> exten => _x.,1,AGI(sample.agi)<br>
> exten => _x.,n,NoOp(${var})<br>
><br>
><br>
> sample.agi:<br>
><br>
> #!/usr/bin/php -q<br>
> <?php<br>
> set_time_limit(30);<br>
> require('phpagi/phpagi.php');<br>
> $agi = new AGI();<br>
> $exten = $agi->request['agi_extension']; //Dialed extension<br>
> // the result is stored in $exten<br>
> // do something with your data<br>
> $agi->set_variable("var", $result);<br>
> $agi->verbose("The result was: $result", 3);<br>
> ?><br>
><br>
> You can even send parameters to the AGI via the command<br>
> line like:<br>
><br>
> exten => _x.,1,AGI(sample.agi,param1,param2) //Use comma for<br>
> 1.6 or |<br>
> for 1.4 or below<br>
><br>
> And access them via $argv[1], $argv[2] is there is some<br>
> extra<br>
> information that you cannot get via the AGI variables.<br>
><br>
> --<br>
><br>
> Telecomunicaciones Abiertas de México S.A. de C.V.<br>
> Carlos Chávez Prats<br>
> Director de Tecnología<br>
> +52-55-91169161 ext 2001<br>
><br>
><br>
> --<br>
> _____________________________________________________________________<br>
> -- Bandwidth and Colocation Provided by<br>
> <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
> New to Asterisk? Join us for a live introductory webinar every<br>
> Thurs:<br>
> <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
><br>
> asterisk-users mailing list<br>
> To UNSUBSCRIBE or update options visit:<br>
> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
><br>
><br>
</div></div>> --<br>
<div class="im">> _____________________________________________________________________<br>
> -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
> New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
> <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
><br>
> asterisk-users mailing list<br>
> To UNSUBSCRIBE or update options visit:<br>
> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
<br>
</div>--<br>
<div><div></div><div class="h5">Telecomunicaciones Abiertas de México S.A. de C.V.<br>
Carlos Chávez Prats<br>
Director de Tecnología<br>
+52-55-91169161 ext 2001<br>
</div></div><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br></div>