[asterisk-users] how to set callerid in php AGI file.

Zohair Raza engineerzuhairraza at gmail.com
Thu Jan 12 02:48:07 CST 2012


Hi,

Try setting CDR(clid)

Regards,
Zohair Raza





On Thu, Jan 12, 2012 at 12:44 PM, virendra bhati <virbhati at gmail.com> wrote:

> Hi,
> I am using phpagi for agi scripting. and want to update callerid number
> but didn't get any success. please help me how to update PHPAGI is new for
> me. Below is the code which I write.
>
> #!/usr/bin/php -q
> <?php
> set_time_limit(30);
> //require(.phpagi.php.);
> include("phpagi.php");
> $agi = new AGI();
>
> //answer the call
> $agi-> answer();
> $agi->verbose("------------------------------------------");
> $agi-> exec('Set',"CALLERID(num)=01133200274");
>
> $ani = $agi->request['agi_callerid'];
> $agi->noop("My CalleID: <<<<<<<=".$ani);
>
> $agi->set_variable("CALLERID(num)","01133200274");
> $ani = $agi->request['agi_callerid'];
> $agi->noop("My CalleID: <<<<<<<=".$ani);
>
> $agi-> exec('Dial',"SIP/00918885268942 at sip.trunk.gradwell.com,60,r");
> //$agi-> exec('Dial',"SIP/00918885268942 at voipon,60,r");
> ?>
>
> And CLI>
>
>  == Using SIP RTP CoS mark 5
>     -- Executing [101 at outbound:1] Answer("SIP/2209-000026d3", "") in new
> stack
>     -- Executing [101 at outbound:2] AGI("SIP/2209-000026d3",
> "/home/virendra.bhati/outdial.php") in new stack
>     -- Launched AGI Script /home/virendra.bhati/outdial.php
> <SIP/2209-000026d3>AGI Tx >> agi_request: /home/virendra.bhati/outdial.php
> <SIP/2209-000026d3>AGI Tx >> agi_channel: SIP/2209-000026d3
> <SIP/2209-000026d3>AGI Tx >> agi_language: en
> <SIP/2209-000026d3>AGI Tx >> agi_type: SIP
> <SIP/2209-000026d3>AGI Tx >> agi_uniqueid: 1326357644.10070
> <SIP/2209-000026d3>AGI Tx >> agi_version: 1.6.2.20
> <SIP/2209-000026d3>AGI Tx >> agi_callerid: 2209
> <SIP/2209-000026d3>AGI Tx >> agi_calleridname: unknown
> <SIP/2209-000026d3>AGI Tx >> agi_callingpres: 0
> <SIP/2209-000026d3>AGI Tx >> agi_callingani2: 0
> <SIP/2209-000026d3>AGI Tx >> agi_callington: 0
> <SIP/2209-000026d3>AGI Tx >> agi_callingtns: 0
> <SIP/2209-000026d3>AGI Tx >> agi_dnid: 101
> <SIP/2209-000026d3>AGI Tx >> agi_rdnis: unknown
> <SIP/2209-000026d3>AGI Tx >> agi_context: outbound
> <SIP/2209-000026d3>AGI Tx >> agi_extension: 101
> <SIP/2209-000026d3>AGI Tx >> agi_priority: 2
> <SIP/2209-000026d3>AGI Tx >> agi_enhanced: 0.0
> <SIP/2209-000026d3>AGI Tx >> agi_accountcode:
> <SIP/2209-000026d3>AGI Tx >> agi_threadid: 1386719552
> <SIP/2209-000026d3>AGI Tx >>
> <SIP/2209-000026d3>AGI Rx << ANSWER
> <SIP/2209-000026d3>AGI Tx >> 200 result=0
> <SIP/2209-000026d3>AGI Rx << VERBOSE
> "------------------------------------------" 1
>  /home/virendra.bhati/outdial.php:
> ------------------------------------------
> <SIP/2209-000026d3>AGI Tx >> 200 result=1
> <SIP/2209-000026d3>AGI Rx << EXEC Set CALLERID(num)=01133200274
>     -- AGI Script Executing Application: (Set) Options:
> (CALLERID(num)=01133200274)
> <SIP/2209-000026d3>AGI Tx >> 200 result=0
> <SIP/2209-000026d3>AGI Rx << NOOP "My CalleID: <<<<<<<=2209"
> <SIP/2209-000026d3>AGI Tx >> 200 result=0
> <SIP/2209-000026d3>AGI Rx << SET VARIABLE CALLERID(num) "01133200274"
> <SIP/2209-000026d3>AGI Tx >> 200 result=1
> <SIP/2209-000026d3>AGI Rx << NOOP "My CalleID: <<<<<<<=2209"
> <SIP/2209-000026d3>AGI Tx >> 200 result=0
> <SIP/2209-000026d3>AGI Rx << EXEC Dial SIP/
> 00918885268942 at sip.trunk.gradwell.com,60,r
>     -- AGI Script Executing Application: (Dial) Options: (SIP/
> 00918885268942 at sip.trunk.gradwell.com,60,r)
>   == Using SIP RTP CoS mark 5
>        > ast_get_srv: SRV lookup for '_sip._udp.sip.trunk.gradwell.com'
> mapped to host v-sip-trunk-out-f1.gradwell.net, port 5060
>     -- Called 00918885268942 at sip.trunk.gradwell.com
> [Jan 12 14:10:52] WARNING[28001]: chan_sip.c:18463 handle_response_invite:
> Received response: "Forbidden" from '"01133200274" <
> sip:01133200274 at 10.10.10.181>;tag=as76229e88'
>     -- SIP/sip.trunk.gradwell.com-000026d4 is circuit-busy
>   == Everyone is busy/congested at this time (1:0/1/0)
> <SIP/2209-000026d3>AGI Tx >> 200 result=0
>     -- <SIP/2209-000026d3>AGI Script /home/virendra.bhati/outdial.php
> completed, returning 0
>     -- Executing [101 at outbound:3] Hangup("SIP/2209-000026d3", "") in new
> stack
>
> --
>
> Thanks and regards
>
>  Virendra Bhati
> +91-8885268942
> Software Engineer
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120112/86c95258/attachment.htm>


More information about the asterisk-users mailing list