<div>
I<span style="font-size: 14px;"> don’t get the channel variables in the StasisStart, you only get the arguments for StasisStart.</span></div><div><span style="font-size: 14px;"><br></span></div><div><span style="font-size: 14px;">Just grab the variable once you have the channel ID:</span></div><div><span style="font-size: 14px;"><br></span></div><div>$this->pest->get("/ari/channels/" . $channelID . "/variable?variable=“ . $variableName);</div><div><br></div><div><span style="font-size: 14px;">I think you may be a little confused, however, as you are trying to save the channelId as a variable when you initiate the call. If you want to change the channelId of the call when you initiate it, simply change your $queryParameters to include “channelId” => “blahblah” then you can just reference channel blahblah (or enumerated blahblah) in the future.</span></div>
<div><div><br></div><div>-- </div><div>KB<br></div><div><br></div></div>
<p style="color: #A0A0A8;">On Thursday, February 19, 2015 at 12:49 PM, Oscar wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:13px"><div><span></span></div><div><span>How do I get variables from ARI Asterisk?<br></span></div><div><span><br></span></div><div dir="ltr">I've done:</div><div dir="ltr"><br></div><div style="">$ch = curl_init();</div><div style=""><span style=""> </span><span style=""> </span><span style=""> </span>curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, <span style="">false</span>);</div><div style=""><span style=""> </span><span style=""> </span><span style=""> </span>curl_setopt($ch, CURLOPT_RETURNTRANSFER, <span style="">true</span>);</div><div style=""><span style=""><span style=""> </span><span style=""> </span><span style=""> </span>curl_setopt($ch, CURLOPT_URL,</span>"<a href="http://192.168.56.12:8088/ari/channels">http://192.168.56.12:8088/ari/channels</a>"<span style="">);</span></div><div style=""><span style=""> </span><span style=""> </span><span style=""> </span>curl_setopt($ch, CURLOPT_RETURNTRANSFER, <span style="">true</span>);</div><div style=""><span style=""> </span><span style=""> </span><span style=""> </span>curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);</div><div style=""><span style=""> </span><span style=""> </span><span style=""> </span>curl_setopt($ch, CURLOPT_FOLLOWLOCATION, <span style="">true</span>);</div><div style=""><span style=""> </span><span style=""> </span><span style=""> </span>curl_setopt($ch, CURLOPT_USERPWD, <span style="">"asterisk:asterisk"</span>);</div><div style=""><span style=""> </span><span style=""> </span><span style=""> </span>curl_setopt( $ch, CURLOPT_HTTPHEADER, <span style="">array</span>(<span style="">'Content-Type:application/json'</span>));</div><div style=""><span style=""> </span><span style=""> </span><span style=""> </span></div><div dir="ltr">
</div><div style=""><span style=""> </span><span style=""> </span><span style=""> </span>curl_setopt($ch,CURLOPT_POST, <span style="">true</span>);</div><div style=""><br></div><div style="">$variables = <span style="">array</span>(<span style="">"channelId"</span>=>$data-><span style="">channel</span>-><span style="">id</span>);</div><div style=""><span style=""><span style=""> </span><span style=""> </span><span style=""> </span>$queryParameter = </span><span style="">array</span><span style="">(</span>"endpoint" <span style="">=> </span>"SIP/201"<span style="">, </span>"extension" <span style="">=> </span>"201"<span style="">, </span>"context" <span style="">=> </span>"oscar"<span style="">, </span>"priority" <span style="">=> </span>"1"<span style="">, </span>"app" <span style="">=> </span>"call-center"<span style="">, </span>"variables" <span style="">=> $variables);</span></div><div style="">
</div><div style=""><span style=""> </span><span style=""> </span><span style=""> </span>curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($queryParameter));</div><div style=""><br></div><div style="">
</div><div style=""><span style=""> </span>$result=curl_exec($ch);</div><div style=""><br></div><div style="" dir="ltr">(where $data-><span style="">channel</span>-><span style="">id is datas from "</span><span style="font-family: 'Courier New'; white-space: pre-wrap;">generate an outbound call"</span>)</div><div style=""><br></div><div style="" dir="ltr">the calling work fine, but in websocket/app "call-center" I haven't got the args, why?</div><div style="" dir="ltr"><br></div><div style="" dir="ltr">I receive:</div><div style="" dir="ltr"><br></div><div dir="ltr" style="">{</div><div dir="ltr" style=""> "type": "StasisStart",</div><div dir="ltr" style=""> "timestamp": "2015-02-19T19:28:25.069+0100",</div><div dir="ltr" style=""> "args": [],</div><div dir="ltr" style=""> "channel": {</div><div dir="ltr" style=""> "id": "asterisk_oscar-1424370499.121",</div><div dir="ltr" style=""> "name": "SIP/201-0000003d",</div><div dir="ltr" style=""> "state": "Up",</div><div dir="ltr" style=""> "caller": {</div><div dir="ltr" style=""> "name": "",</div><div dir="ltr" style=""> "number": ""</div><div dir="ltr" style=""> },</div><div dir="ltr" style=""> "connected": {</div><div dir="ltr" style=""> "name": "",</div><div dir="ltr" style=""> "number": ""</div><div dir="ltr" style=""> },</div><div dir="ltr" style=""> "accountcode": "",</div><div dir="ltr" style=""> "dialplan": {</div><div dir="ltr" style=""> "context": "oscar",</div><div dir="ltr" style=""> "exten": "",</div><div dir="ltr" style=""> "priority": 1</div><div dir="ltr" style=""> },</div><div dir="ltr" style=""> "creationtime": "2015-02-19T19:28:19.527+0100"</div><div dir="ltr" style=""> },</div><div dir="ltr" style=""> "application": "call-center"</div><div dir="ltr" style="">}</div><div style="" dir="ltr"><br></div>
<div style="" dir="ltr"><br></div><div style="" dir="ltr">What do I mistake?</div><div style="" dir="ltr">thanks</div><div> </div><div><div><span style="font-family:arial, helvetica, sans-serif;color:rgb(208, 208, 208);">_______________________________________________________________________</span><br style="font-family:arial, helvetica, sans-serif;color:rgb(208, 208, 208);"><span style="font-family:arial, helvetica, sans-serif;color:rgb(208, 208, 208);">Oscar OXY</span><br></div></div></div></div><div><div>_______________________________________________</div><div>asterisk-app-dev mailing list</div><div><a href="mailto:asterisk-app-dev@lists.digium.com">asterisk-app-dev@lists.digium.com</a></div><div><a href="http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev">http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev</a></div></div></div></span>
</blockquote>
<div>
<br>
</div>