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.

-- 
KB

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,"http://192.168.56.12:8088/ari/channels");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
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));

$result=curl_exec($ch);

(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?
thanks
 
_______________________________________________________________________
Oscar OXY
_______________________________________________
asterisk-app-dev mailing list

_______________________________________________
asterisk-app-dev mailing list
asterisk-app-dev@xxxxxxxxxxxxxxxx
http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev

[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