<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
In addition to my reply:<BR> <BR>I used to fetch the value using print_r function but that also tells that there is no value in data section.<BR>$dialstatus=$agi->get_variable(DIALSTATUS);<BR>print_r($dialstatus);<BR> <BR><SIP/10036-000000b8>AGI Rx << GET VARIABLE DIALSTATUS<BR><SIP/10036-000000b8>AGI Tx >> 200 result=1 (CANCEL)<BR><SIP/10036-000000b8>AGI Rx << Array<BR><SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command<BR>[Dec 3 01:18:47] ERROR[24839]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe<BR><SIP/10036-000000b8>AGI Rx << (<BR><SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command<BR>[Dec 3 01:18:47] ERROR[24839]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe<BR><STRONG><SIP/10036-000000b8>AGI Rx << [code] => 200<BR></STRONG><SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command<BR>[Dec 3 01:18:47] ERROR[24839]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe<BR><STRONG><SIP/10036-000000b8>AGI Rx << [result] => 1<BR></STRONG><SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command<BR>[Dec 3 01:18:47] ERROR[24839]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe<BR><STRONG><SIP/10036-000000b8>AGI Rx << [data] =></STRONG><BR><BR>Regards,<BR>Kamlesh<BR><BR> <BR>
<DIV>
<HR id=stopSpelling>
From: kamlesh_kmr@hotmail.com<BR>To: asterisk-users@lists.digium.com<BR>Subject: RE: [asterisk-users] DIALSTATUS Values<BR>Date: Fri, 2 Dec 2011 11:58:26 +0000<BR><BR>
<META name=Generator content="Microsoft SafeHTML">
<STYLE>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
</STYLE>
<DIV dir=ltr>I believe the syntax is correct because,<BR> <BR>If I use <BR>$dd=$dialstatus["code"];<BR>> > $agi->verbose("Status".$dd);<BR><BR>it gives me: <BR><SIP/10036-000000b2>AGI Rx << GET VARIABLE DIALSTATUS<BR><SIP/10036-000000b2>AGI Tx >> 200 result=1 (ANSWER)<BR><STRONG><SIP/10036-000000b2>AGI Rx << VERBOSE "Status200" 1</STRONG><BR> <BR>If I use<BR>$dd=$dialstatus["result"];<BR>> > $agi->verbose("Status".$dd);<BR><BR>it gives me:<BR> <BR><SIP/10036-000000b4>AGI Rx << GET VARIABLE DIALSTATUS<BR><SIP/10036-000000b4>AGI Tx >> 200 result=1 (CANCEL)<BR><STRONG><SIP/10036-000000b4>AGI Rx << VERBOSE "Status1" 1<BR></STRONG> <BR>but if I use<BR>$dd=$dialstatus["data"];<BR>> > $agi->verbose("Status".$dd);<BR><BR><SIP/10036-000000b6>AGI Rx << GET VARIABLE DIALSTATUS<BR><SIP/10036-000000b6>AGI Tx >> 200 result=1 (CANCEL)<BR><STRONG><SIP/10036-000000b6>AGI Rx << VERBOSE "Status" 1</STRONG><BR><BR>Regards,<BR>Kamlesh<BR> <BR> <BR> <BR>
<DIV>> To: asterisk-users@lists.digium.com<BR>> From: tony@softins.co.uk<BR>> Date: Fri, 2 Dec 2011 11:44:34 +0000<BR>> Subject: Re: [asterisk-users] DIALSTATUS Values<BR>> <BR>> In article <SNT142-W45A64E47437777DE653DA591B60@phx.gbl>,<BR>> Kamlesh Kumar <kamlesh_kmr@hotmail.com> wrote:<BR>> > I tried to search the answer of my problem but unable to get resolution so sending to you<BR>> > guys. I'm using asterisk 1.6.2.7 and writing the AGI scripts using PHP. I'm unable to<BR>> > retrieve the DIALSTATUS value, during execution of AGI script, I get empty value.<BR>> > <BR>> > Extracts from AGI Script:<BR>> > <BR>> > #!/usr/bin/php -q<BR>> > #!/bin/bash<BR>> > <?php<BR>> > include_once ("phpagi-2.14/phpagi.php");<BR>> > $agi = new AGI();<BR>> > <BR>> > --------some codes for dial out------------<BR>> > <BR>> > $dialstatus=$agi->get_variable(DIALSTATUS);<BR>> <BR>> Shouldn't that be: $dialstatus=$agi->get_variable("DIALSTATUS");<BR>> <BR>> Having DIALSTATUS as a bare word might work in some versions of php,<BR>> but is likely to produce a warning. Although in your case, it does<BR>> appear to have worked.<BR>> <BR>> > $dd=$dialstatus["data"];<BR>> > $agi->verbose("Status".$dd);<BR>> > <BR>> > In AGI debug, I get: <BR>> > <SIP/10036-00000096>AGI Tx >> agi_channel: SIP/10036-00000096<BR>> > <SIP/10036-00000096>AGI Tx >> agi_language: en<BR>> > <SIP/10036-00000096>AGI Tx >> agi_type: SIP<BR>> > <SIP/10036-00000096>AGI Tx >> agi_uniqueid: 1322848927.172<BR>> > <SIP/10036-00000096>AGI Tx >> agi_version: 1.6.2.7<BR>> > <SIP/10036-00000096>AGI Tx >> agi_callerid: 10036<BR>> > <SIP/10036-00000096>AGI Tx >> agi_calleridname: 10036<BR>> > <SIP/10036-00000096>AGI Tx >> agi_dnid: 0012127773456<BR>> > <SIP/10036-00000096>AGI Tx >> agi_rdnis: unknown<BR>> > <SIP/10036-00000096>AGI Tx >> agi_context: privoip<BR>> > <SIP/10036-00000096>AGI Tx >> agi_extension: 0012127773456<BR>> > <SIP/10036-00000096>AGI Rx << GET VARIABLE DIALSTATUS<BR>> > <SIP/10036-00000096>AGI Tx >> 200 result=1 (ANSWER)<BR>> <BR>> This shows that AGI is indeed returning the value of DIALSTATUS,<BR>> which is ANSWER.<BR>> <BR>> > <SIP/10036-00000096>AGI Rx << VERBOSE "Status" 1<BR>> <BR>> But you are not picking it up.<BR>> <BR>> > <SIP/10036-00000096>AGI Tx >> 200 result=1<BR>> > <BR>> > Please help me in this.<BR>> <BR>> I'm not familiar with php-agi (I usualy write my AGI in C), but it<BR>> looks like $dialstatus["data"] is not the correct way to retrieve<BR>> the returned value. Or else there is a bug in php-agi.<BR>> <BR>> Cheers<BR>> Tony<BR>> -- <BR>> Tony Mountifield<BR>> Work: tony@softins.co.uk - http://www.softins.co.uk<BR>> Play: tony@mountifield.org - http://tony.mountifield.org<BR>> <BR>> --<BR>> _____________________________________________________________________<BR>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --<BR>> New to Asterisk? Join us for a live introductory webinar every Thurs:<BR>> http://www.asterisk.org/hello<BR>> <BR>> asterisk-users mailing list<BR>> To UNSUBSCRIBE or update options visit:<BR>> http://lists.digium.com/mailman/listinfo/asterisk-users<BR></DIV></DIV></DIV>                                            </div></body>
</html>