In addition to my reply: I used to fetch the value using print_r function but that also tells that there is no value in data section. $dialstatus=$agi->get_variable(DIALSTATUS); print_r($dialstatus); <SIP/10036-000000b8>AGI Rx << GET VARIABLE DIALSTATUS <SIP/10036-000000b8>AGI Tx >> 200 result=1 (CANCEL) <SIP/10036-000000b8>AGI Rx << Array <SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command [Dec 3 01:18:47] ERROR[24839]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe <SIP/10036-000000b8>AGI Rx << ( <SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command [Dec 3 01:18:47] ERROR[24839]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe <SIP/10036-000000b8>AGI Rx << [code] => 200 <SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command [Dec 3 01:18:47] ERROR[24839]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe <SIP/10036-000000b8>AGI Rx << [result] => 1 <SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command [Dec 3 01:18:47] ERROR[24839]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe <SIP/10036-000000b8>AGI Rx << [data] =>
Regards, Kamlesh From: [email protected] To: [email protected] Subject: RE: [asterisk-users] DIALSTATUS Values Date: Fri, 2 Dec 2011 11:58:26 +0000 I believe the syntax is correct because, If I use $dd=$dialstatus["code"]; > > $agi->verbose("Status".$dd); it gives me: <SIP/10036-000000b2>AGI Rx << GET VARIABLE DIALSTATUS <SIP/10036-000000b2>AGI Tx >> 200 result=1 (ANSWER) <SIP/10036-000000b2>AGI Rx << VERBOSE "Status200" 1 If I use $dd=$dialstatus["result"]; > > $agi->verbose("Status".$dd); it gives me: <SIP/10036-000000b4>AGI Rx << GET VARIABLE DIALSTATUS <SIP/10036-000000b4>AGI Tx >> 200 result=1 (CANCEL) <SIP/10036-000000b4>AGI Rx << VERBOSE "Status1" 1 but if I use $dd=$dialstatus["data"]; > > $agi->verbose("Status".$dd); <SIP/10036-000000b6>AGI Rx << GET VARIABLE DIALSTATUS <SIP/10036-000000b6>AGI Tx >> 200 result=1 (CANCEL) <SIP/10036-000000b6>AGI Rx << VERBOSE "Status" 1 Regards, Kamlesh > To: [email protected] > From: [email protected] > Date: Fri, 2 Dec 2011 11:44:34 +0000 > Subject: Re: [asterisk-users] DIALSTATUS Values > > In article <[email protected]>, > Kamlesh Kumar <[email protected]> wrote: > > I tried to search the answer of my problem but unable to get resolution so > > sending to you > > guys. I'm using asterisk 1.6.2.7 and writing the AGI scripts using PHP. I'm > > unable to > > retrieve the DIALSTATUS value, during execution of AGI script, I get empty > > value. > > > > Extracts from AGI Script: > > > > #!/usr/bin/php -q > > #!/bin/bash > > <?php > > include_once ("phpagi-2.14/phpagi.php"); > > $agi = new AGI(); > > > > --------some codes for dial out------------ > > > > $dialstatus=$agi->get_variable(DIALSTATUS); > > Shouldn't that be: $dialstatus=$agi->get_variable("DIALSTATUS"); > > Having DIALSTATUS as a bare word might work in some versions of php, > but is likely to produce a warning. Although in your case, it does > appear to have worked. > > > $dd=$dialstatus["data"]; > > $agi->verbose("Status".$dd); > > > > In AGI debug, I get: > > <SIP/10036-00000096>AGI Tx >> agi_channel: SIP/10036-00000096 > > <SIP/10036-00000096>AGI Tx >> agi_language: en > > <SIP/10036-00000096>AGI Tx >> agi_type: SIP > > <SIP/10036-00000096>AGI Tx >> agi_uniqueid: 1322848927.172 > > <SIP/10036-00000096>AGI Tx >> agi_version: 1.6.2.7 > > <SIP/10036-00000096>AGI Tx >> agi_callerid: 10036 > > <SIP/10036-00000096>AGI Tx >> agi_calleridname: 10036 > > <SIP/10036-00000096>AGI Tx >> agi_dnid: 0012127773456 > > <SIP/10036-00000096>AGI Tx >> agi_rdnis: unknown > > <SIP/10036-00000096>AGI Tx >> agi_context: privoip > > <SIP/10036-00000096>AGI Tx >> agi_extension: 0012127773456 > > <SIP/10036-00000096>AGI Rx << GET VARIABLE DIALSTATUS > > <SIP/10036-00000096>AGI Tx >> 200 result=1 (ANSWER) > > This shows that AGI is indeed returning the value of DIALSTATUS, > which is ANSWER. > > > <SIP/10036-00000096>AGI Rx << VERBOSE "Status" 1 > > But you are not picking it up. > > > <SIP/10036-00000096>AGI Tx >> 200 result=1 > > > > Please help me in this. > > I'm not familiar with php-agi (I usualy write my AGI in C), but it > looks like $dialstatus["data"] is not the correct way to retrieve > the returned value. Or else there is a bug in php-agi. > > Cheers > Tony > -- > Tony Mountifield > Work: [email protected] - http://www.softins.co.uk > Play: [email protected] - http://tony.mountifield.org > > -- > _____________________________________________________________________ > -- 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
-- _____________________________________________________________________ -- 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
