nicolaa
nicolaa

Reputation: 133

How to get information about an incoming call in Asterisk ARI

I am using Asterisk ARI

How to get information about an incoming call and who picked up the phone(operator extension)

I am receiving all events via WebSocket

var connection = new WebSocket("ws://ip:port/ari/events?app=qwer&subscribeAll=true&api_key=user:password")

A lot of events come and I can't figure it out

I thought I needed to use ChannelCreated, but in most cases, it comes empty (no numbers)

{
  "type": "ChannelCreated",
  "timestamp": "2020-09-30T09:13:28.451+0500",
  "channel": {
    "id": "id",
    "name": "SIP/",
    "state": "Down",
    "caller": {
      "name": "",
      "number": ""
    },
    "connected": {
      "name": "",
      "number": ""
    },
    "accountcode": "",
    "dialplan": {
      "context": "incoming",
      "exten": "s",
      "priority": 1
    },
    "creationtime": "2020-09-30T09:13:28.451+0500",
    "language": "en"
  },
  "application": "qwer"
}
{
  "variable": "QUEUENAME",
  "value": "operators",
  "type": "ChannelVarset",
  "timestamp": "2020-09-30T09:14:01.628+0500",
  "channel": {
    "id": "id",
    "name": "SIP/",
    "state": "Up",
    "caller": {
      "name": "78008888888",
      "number": "+79099999999"
    },
    "connected": {
      "name": "",
      "number": ""
    },
    "accountcode": "",
    "dialplan": {
      "context": "incoming",
      "exten": "incom",
      "priority": 15
    },
    "creationtime": "2020-09-30T09:12:38.097+0500",
    "language": "ru"
  },
  "application": "qwer"
}
{
  "variable": "QUEUESRVLEVELPERF",
  "value": "0.0",
  "type": "ChannelVarset",
  "timestamp": "2020-09-30T09:14:01.629+0500",
  "channel": {
    "id": "id",
    "name": "SIP/",
    "state": "Up",
    "caller": {
      "name": "78008888888",
      "number": "+79099999999"
    },
    "connected": {
      "name": "",
      "number": ""
    },
    "accountcode": "",
    "dialplan": {
      "context": "incoming",
      "exten": "incom",
      "priority": 15
    },
    "creationtime": "2020-09-30T09:12:38.097+0500",
    "language": "ru"
  },
  "application": "qwer"
}

Upvotes: 1

Views: 1377

Answers (1)

arheops
arheops

Reputation: 15259

ARI expect that you not use dialplan, instead use Stasis app.

If you do so, you will get events in ARI.

Answer event called Bridge.

Upvotes: 1

Related Questions