Re: How do I get variables from ARI Asterisk?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


I don’t get the channel variables in the StasisStart, you only get the arguments for StasisStart.

Just grab the variable once you have the channel ID:

$this->pest->get("/ari/channels/" . $channelID . "/variable?variable=“ . $variableName);

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.


On Thursday, February 19, 2015 at 12:49 PM, Oscar wrote:

How do I get variables from ARI Asterisk?

I've done:

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,"");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERPWD, "asterisk:asterisk");
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch,CURLOPT_POST, true);

$variables = array("channelId"=>$data->channel->id);
$queryParameter = array("endpoint" => "SIP/201", "extension" => "201", "context" => "oscar", "priority" => "1", "app" => "call-center", "variables" => $variables);
curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($queryParameter));


(where $data->channel->id is datas from "generate an outbound call")

the calling work fine, but in websocket/app "call-center" I haven't got the args, why?

I receive:

  "type": "StasisStart",
  "timestamp": "2015-02-19T19:28:25.069+0100",
  "args": [],
  "channel": {
    "id": "asterisk_oscar-1424370499.121",
    "name": "SIP/201-0000003d",
    "state": "Up",
    "caller": {
      "name": "",
      "number": ""
    "connected": {
      "name": "",
      "number": ""
    "accountcode": "",
    "dialplan": {
      "context": "oscar",
      "exten": "",
      "priority": 1
    "creationtime": "2015-02-19T19:28:19.527+0100"
  "application": "call-center"

What do I mistake?
Oscar OXY
asterisk-app-dev mailing list

asterisk-app-dev mailing list

[Index of Archives]     [Asterisk SS7]     [Asterisk Announcements]     [Asterisk Users]     [PJ SIP]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Linux API]

  Powered by Linux