<html><body><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:13px"><div dir="ltr" id="yui_3_16_0_1_1424248714213_96652"><span id="yui_3_16_0_1_1424248714213_96651">thanks for the advice, and yes I'm confused, I'm newbie in asterisk.</span></div><div dir="ltr" id="yui_3_16_0_1_1424248714213_96652"><span><br></span></div><div dir="ltr" id="yui_3_16_0_1_1424248714213_96652"><span id="yui_3_16_0_1_1424248714213_96796">I understand over mistake, the script correct is:</span></div><div dir="ltr" id="yui_3_16_0_1_1424248714213_96652"><span><br></span></div><blockquote type="cite" id="yui_3_16_0_1_1424248714213_96743" style="margin-left: 0px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 16px; border-left-style: solid; border-width: 1px; padding-left: 10px;" class=""><div id="yui_3_16_0_1_1424248714213_96742" class="" style=""><div id="yui_3_16_0_1_1424248714213_96741" class="" style=""><div id="yui_3_16_0_1_1424248714213_96740" style="font-family: verdana, helvetica, sans-serif; font-size: 13px;" class=""><div id="yui_3_16_0_1_1424248714213_96747" class="" style="">$ch = curl_init();</div><div id="yui_3_16_0_1_1424248714213_96746" class="" style="">curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);</div><div id="yui_3_16_0_1_1424248714213_96749" class="" style="">curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);</div><div id="yui_3_16_0_1_1424248714213_96751" class="" style="">curl_setopt($ch, CURLOPT_URL,"<a rel="nofollow" shape="rect" target="_blank" href="http://192.168.56.12:8088/ari/channels" id="yui_3_16_0_1_1424248714213_96750" class="" style="">http://192.168.56.12:8088/ari/channels</a>");</div><div id="yui_3_16_0_1_1424248714213_96752" class="" style="">curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);</div><div id="yui_3_16_0_1_1424248714213_96753" class="" style="">curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);</div><div id="yui_3_16_0_1_1424248714213_96754" class="" style="">curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);</div><div id="yui_3_16_0_1_1424248714213_96756" class="" style="">curl_setopt($ch, CURLOPT_USERPWD, <span id="yui_3_16_0_1_1424248714213_96755" class="" style="">"asterisk:asterisk"</span>);</div><div id="yui_3_16_0_1_1424248714213_96758" class="" style="">curl_setopt( $ch, CURLOPT_HTTPHEADER, <span id="yui_3_16_0_1_1424248714213_96757" class="" style="">array</span>('Content-Type:application/json'));</div><div class="" style=""></div><div dir="ltr" class="" style=""></div><div id="yui_3_16_0_1_1424248714213_96759" class="" style="">curl_setopt($ch,CURLOPT_POST, true);</div><div id="yui_3_16_0_1_1424248714213_96760" class="" style=""><br clear="none" class="" style=""></div><div id="yui_3_16_0_1_1424248714213_96761" class="" style="">$variables = array("channelId"=>$data->channel-><span id="yui_3_16_0_1_1424248714213_96762" class="" style="">id</span>);</div><div id="yui_3_16_0_1_1424248714213_96763" class="" style="">$queryParameter = array("endpoint" => "SIP/201", "app" => "call-center", "variables" => $variables);</div><div class="" style=""></div><div id="yui_3_16_0_1_1424248714213_96764" class="" style="">curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($queryParameter));</div></div></div></div></blockquote><div dir="ltr" id="yui_3_16_0_1_1424248714213_96652"><span><br></span></div><div dir="ltr" id="yui_3_16_0_1_1424248714213_96652"><span id="yui_3_16_0_1_1424248714213_96926" class="" style="">that is, I used both extension/context/priority and app, I remove "</span>extension/context/priority" and the args's setted :-)</div><div dir="ltr" id="yui_3_16_0_1_1424248714213_96652"><br></div><div dir="ltr" id="yui_3_16_0_1_1424248714213_96652">in what contest I use the "variables"? and over all, an example in order to use them?</div><div dir="ltr" id="yui_3_16_0_1_1424248714213_96652"><br></div><div dir="ltr" id="yui_3_16_0_1_1424248714213_96652">in document I read:</div><div dir="ltr" id="yui_3_16_0_1_1424248714213_96652"><span style="color: rgb(133, 120, 102); font-family: MuseoSans300, sans-serif; font-size: 16px; font-weight: 700; line-height: 1.5;"><br></span></div><div dir="ltr" id="yui_3_16_0_1_1424248714213_96652"><span style="color: rgb(133, 120, 102); font-family: MuseoSans300, sans-serif; font-size: 16px; font-weight: 700; line-height: 1.5;" id="yui_3_16_0_1_1424248714213_97389">Body parameter</span></div><ul style="margin-top: 10px; margin-bottom: 0px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 18.1818180084229px;" class="" id="yui_3_16_0_1_1424248714213_97222"><li class="" style="" id="yui_3_16_0_1_1424248714213_97221">variables: containers - The "variables" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { "endpoint": "SIP/Alice", "variables": { "CALLERID(name)": "Alice" } }</li></ul><div id="yui_3_16_0_1_1424248714213_97223"><font color="#333333" face="Helvetica Neue, Helvetica, Arial, sans-serif"><span style="font-size: 14px; line-height: 18.1818180084229px;"><br></span></font></div><div id="yui_3_16_0_1_1424248714213_97224"><font color="#333333" face="Helvetica Neue, Helvetica, Arial, sans-serif"><span style="font-size: 14px; line-height: 18.1818180084229px;"><br></span></font></div><div></div><div id="yui_3_16_0_1_1424248714213_96680" dir="ltr">but I don't understand how and when use it... :-(</div><div id="yui_3_16_0_1_1424248714213_96680" dir="ltr">where are the body parameter?</div><div id="yui_3_16_0_1_1424248714213_96680" dir="ltr"><br></div><div id="yui_3_16_0_1_1424248714213_96680" dir="ltr">thanks a lot</div><div id="yui_3_16_0_1_1424248714213_96680" dir="ltr"><br></div><div class="signature" id="yui_3_16_0_1_1424248714213_96617"><div id="yui_3_16_0_1_1424248714213_96616"><span style="font-family:arial, helvetica, sans-serif;color:rgb(208, 208, 208);" id="yui_3_16_0_1_1424248714213_96615">_______________________________________________________________________</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><br>  <div style="font-family: verdana, helvetica, sans-serif; font-size: 13px;" id="yui_3_16_0_1_1424248714213_96620"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_1_1424248714213_96619"> <div dir="ltr" id="yui_3_16_0_1_1424248714213_96618"> <hr size="1" id="yui_3_16_0_1_1424248714213_96650">  <font size="2" face="Arial" id="yui_3_16_0_1_1424248714213_96625"> <b><span style="font-weight:bold;">Da:</span></b> Krandon <krandon.bruse@gmail.com><br> <b><span style="font-weight: bold;">A:</span></b> Oscar <scriviaoscar@yahoo.it>; Asterisk Application Development discussion <asterisk-app-dev@lists.digium.com> <br> <b><span style="font-weight: bold;">Inviato:</span></b> Venerdì 20 Febbraio 2015 4:19<br> <b><span style="font-weight: bold;">Oggetto:</span></b> Re: [asterisk-app-dev] How do I get variables from ARI Asterisk?<br> </font> </div> <div class="y_msg_container" id="yui_3_16_0_1_1424248714213_96621"><br><div id="yiv8528921939"><div id="yui_3_16_0_1_1424248714213_96624"><div id="yui_3_16_0_1_1424248714213_96623">
                    I<span style="font-size:14px;" id="yui_3_16_0_1_1424248714213_96622"> don’t get the channel variables in the StasisStart, you only get the arguments for StasisStart.</span></div><div id="yui_3_16_0_1_1424248714213_96681"><span style="font-size:14px;"><br clear="none"></span></div><div id="yui_3_16_0_1_1424248714213_96682"><span style="font-size:14px;" id="yui_3_16_0_1_1424248714213_96736">Just grab the variable once you have the channel ID:</span></div><div id="yui_3_16_0_1_1424248714213_96683"><span style="font-size:14px;"><br clear="none"></span></div><div id="yui_3_16_0_1_1424248714213_96687">$this->pest->get("/ari/channels/" . $channelID . "/variable?variable=“ . $variableName);</div><div id="yui_3_16_0_1_1424248714213_96684"><br clear="none"></div><div id="yui_3_16_0_1_1424248714213_96686"><span style="font-size:14px;" id="yui_3_16_0_1_1424248714213_96685">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 id="yui_3_16_0_1_1424248714213_96738"><div><br clear="none"></div><div>-- </div><div>KB<br clear="none"></div><div id="yui_3_16_0_1_1424248714213_96737"><br clear="none"></div></div>
                 
                <div class="qtdSeparateBR"><br><br></div><div class="yiv8528921939yqt3604327671" id="yiv8528921939yqt49168"><div style="color:#A0A0A8;">On Thursday, February 19, 2015 at 12:49 PM, Oscar wrote:</div>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;" id="yui_3_16_0_1_1424248714213_96743">
                    <span></span><div id="yui_3_16_0_1_1424248714213_96742"><div id="yui_3_16_0_1_1424248714213_96741"><div style="color:#000;background-color:#fff;font-family:verdana, helvetica, sans-serif;font-size:13px;" id="yui_3_16_0_1_1424248714213_96740"><div><span></span></div><div id="yui_3_16_0_1_1424248714213_96739"><span>How do I get variables from ARI Asterisk?<br clear="none"></span></div><div id="yui_3_16_0_1_1424248714213_96744"><span><br clear="none"></span></div><div dir="ltr" id="yui_3_16_0_1_1424248714213_96745">I've done:</div><div dir="ltr" id="yui_3_16_0_1_1424248714213_96772"><br clear="none"></div><div style="" id="yui_3_16_0_1_1424248714213_96747">$ch = curl_init();</div><div style="" id="yui_3_16_0_1_1424248714213_96746"><span style="">       </span><span style="">    </span><span style="">    </span>curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, <span style="">false</span>);</div><div style="" id="yui_3_16_0_1_1424248714213_96749"><span style="">      </span><span style="">    </span><span style="">    </span>curl_setopt($ch, CURLOPT_RETURNTRANSFER, <span style="">true</span>);</div><div style="" id="yui_3_16_0_1_1424248714213_96751"><span style=""><span style="">        </span><span style="">    </span><span style="">    </span>curl_setopt($ch, CURLOPT_URL,</span>"<a rel="nofollow" shape="rect" target="_blank" onclick="return theMainWindow.showLinkWarning(this)" href="http://192.168.56.12:8088/ari/channels" id="yui_3_16_0_1_1424248714213_96750">http://192.168.56.12:8088/ari/channels</a>"<span style="">);</span></div><div style="" id="yui_3_16_0_1_1424248714213_96752"><span style="">    </span><span style="">    </span><span style="">    </span>curl_setopt($ch, CURLOPT_RETURNTRANSFER, <span style="">true</span>);</div><div style="" id="yui_3_16_0_1_1424248714213_96753"><span style="">       </span><span style="">    </span><span style="">    </span>curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);</div><div style="" id="yui_3_16_0_1_1424248714213_96754"><span style=""> </span><span style="">    </span><span style="">    </span>curl_setopt($ch, CURLOPT_FOLLOWLOCATION, <span style="">true</span>);</div><div style="" id="yui_3_16_0_1_1424248714213_96756"><span style="">       </span><span style="">    </span><span style="">    </span>curl_setopt($ch, CURLOPT_USERPWD, <span style="" id="yui_3_16_0_1_1424248714213_96755">"asterisk:asterisk"</span>);</div><div style="" id="yui_3_16_0_1_1424248714213_96758"><span style="">     </span><span style="">    </span><span style="">    </span>curl_setopt( $ch, CURLOPT_HTTPHEADER, <span style="" id="yui_3_16_0_1_1424248714213_96757">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="" id="yui_3_16_0_1_1424248714213_96759"><span style="">       </span><span style="">    </span><span style="">    </span>curl_setopt($ch,CURLOPT_POST, <span style="">true</span>);</div><div style="" id="yui_3_16_0_1_1424248714213_96760"><br clear="none"></div><div style="" id="yui_3_16_0_1_1424248714213_96761">$variables = <span style="">array</span>(<span style="">"channelId"</span>=>$data-><span style="">channel</span>-><span style="" id="yui_3_16_0_1_1424248714213_96762">id</span>);</div><div style="" id="yui_3_16_0_1_1424248714213_96763"><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="" id="yui_3_16_0_1_1424248714213_96764"><span style="">       </span><span style="">    </span><span style="">    </span>curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($queryParameter));</div><div style=""><br clear="none"></div><div style="">







</div><div style=""><span style="">       </span>$result=curl_exec($ch);</div><div style=""><br clear="none"></div><div dir="ltr" style="">(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 clear="none"></div><div dir="ltr" style="">the calling work fine, but in websocket/app "call-center" I haven't got the args, why?</div><div dir="ltr" style=""><br clear="none"></div><div dir="ltr" style="">I receive:</div><div dir="ltr" style=""><br clear="none"></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 dir="ltr" style=""><br clear="none"></div>







<div dir="ltr" style=""><br clear="none"></div><div dir="ltr" style="">What do I mistake?</div><div dir="ltr" style="">thanks</div><div> </div><div><div><span style="font-family:arial, helvetica, sans-serif;color:rgb(208, 208, 208);">_______________________________________________________________________</span><br clear="none" 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 clear="none"></div></div></div></div><div><div>_______________________________________________</div><div>asterisk-app-dev mailing list</div><div><a rel="nofollow" shape="rect" ymailto="mailto:asterisk-app-dev@lists.digium.com" target="_blank" href="mailto:asterisk-app-dev@lists.digium.com">asterisk-app-dev@lists.digium.com</a></div><div><a rel="nofollow" shape="rect" target="_blank" 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>
                 
                 
                 
                 
                </blockquote></div>
                 
                <div>
                    <br clear="none">
                </div>
</div></div><br><br></div> </div> </div>  </div></body></html>