Hi all,
I am trying to snoop a call in queue using Stasis application. The program used to work fine, but couple of days back it started giving “Channel not in Stasis application” error.
To debug I captured the HTTP messages between Stasis application and Asterisk. The application does the following steps:
- Get the values of two variables: SNOOP_CHAN and SNOOP_TYPE. First gives the channel to snoop and second the type
- List all channels and from all channels get the full channel id matching the SIP id to snoop
- Snoop the channel
- Create a bridge and add the calling channel and snoop channel.
The error occurs in the last step. I am not able to figure out why this happens, and looking for some clues to understand why one of this channel is not in Stasis application.
The HTTP requests are as follows:
GET /ari/channels/er-01-1652199362.2652/variable?variable=SNOOP_CHAN HTTP/1.1
Host: localhost:8088
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.27.1
Authorization: Basic dXNlci1uZnVpaTpJb01JN1dBV09U
HTTP/1.1 200 OK
Server: Asterisk
Date: Tue, 10 May 2022 16:16:02 GMT
Cache-Control: no-cache, no-store
Content-type: application/json
Content-Length: 31
{"value":"MCM-fpyQSE-20001139"}
GET /ari/channels/er-01-1652199362.2652/variable?variable=SNOOP_TYPE HTTP/1.1
Host: localhost:8088
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.27.1
Authorization: Basic dXNlci1uZnVpaTpJb01JN1dBV09U
HTTP/1.1 200 OK
Server: Asterisk
Date: Tue, 10 May 2022 16:16:02 GMT
Cache-Control: no-cache, no-store
Content-type: application/json
Content-Length: 17
{"value":"SNOOP"}
GET /ari/channels HTTP/1.1
Host: localhost:8088
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.27.1
Authorization: Basic dXNlci1uZnVpaTpJb01JN1dBV09U
HTTP/1.1 200 OK
Server: Asterisk
Date: Tue, 10 May 2022 16:16:02 GMT
Cache-Control: no-cache, no-store
Content-type: application/json
Content-Length: 1173
[{"id":"er-01-1652199329.2644","name":"PJSIP/erxin02-ex-01-00000148","state":"Up","caller":{"name":"07510680128","number":"07510680128"},"connected":{"name":"","number":"4466636600"},"accountcode":"","dialplan":{"context":"leaf-queue","exten":"s","priority":8,"app_name":"Queue","app_data":"queue-name-en,b(sub_crmurl^s^1(queue-name-en,,07510680128,07510680128,English,N))"},"creationtime":"2022-05-10T21:45:29.909+0530","language":"en"},{"id":"er-01-1652199332.2647","name":"PJSIP/MCM-fpyQSE-20001139-00000149","state":"Up","caller":{"name":"","number":"4466636600"},"connected":{"name":"07510680128","number":"07510680128"},"accountcode":"","dialplan":{"context":"mettle","exten":"s","priority":1,"app_name":"AppQueue","app_data":"(Outgoing Line)"},"creationtime":"2022-05-10T21:45:32.700+0530","language":"en"},{"id":"er-01-1652199362.2652","name":"PJSIP/MCM-Gvu8eu-20001020-0000014a","state":"Up","caller":{"name":"","number":"MCM-Gvu8eu-20001020"},"connected":{"name":"","number":""},"accountcode":"","dialplan":{"context":"mettle","exten":"102","priority":6,"app_name":"Stasis","app_data":"snoop"},"creationtime":"2022-05-10T21:46:02.075+0530","language":"en"}]
POST /ari/channels/er-01-1652199362.2652/play?media=sound%3Awelcome HTTP/1.1
Host: localhost:8088
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.27.1
Content-Length: 0
Authorization: Basic dXNlci1uZnVpaTpJb01JN1dBV09U
HTTP/1.1 201 Created
Server: Asterisk
Date: Tue, 10 May 2022 16:16:02 GMT
Cache-Control: no-cache, no-store
Location: /ari/playbacks/a56003a0-7e2f-444c-8d0a-7017f9060e93
Content-type: application/json
Content-Length: 151
{"id":"a56003a0-7e2f-444c-8d0a-7017f9060e93","media_uri":"sound:welcome","target_uri":"channel:er-01-1652199362.2652","language":"en","state":"queued"}
POST /ari/channels/er-01-1652199332.2647/snoop?spy=both&app=snoop&snoopId=snoop-er-01-1652199332.2647&whisper=none HTTP/1.1
Host: localhost:8088
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.27.1
Content-Length: 0
Authorization: Basic dXNlci1uZnVpaTpJb01JN1dBV09U
HTTP/1.1 200 OK
Server: Asterisk
Date: Tue, 10 May 2022 16:16:02 GMT
Cache-Control: no-cache, no-store
Content-type: application/json
Content-Length: 329
{"id":"snoop-er-01-1652199332.2647","name":"Snoop/er-01-1652199332.2647-00000054","state":"Up","caller":{"name":"","number":""},"connected":{"name":"","number":""},"accountcode":"","dialplan":{"context":"default","exten":"s","priority":1,"app_name":"","app_data":""},"creationtime":"2022-05-10T21:46:02.376+0530","language":"en"}
POST /ari/bridges?type=mixing HTTP/1.1
Host: localhost:8088
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.27.1
Content-Length: 0
Authorization: Basic dXNlci1uZnVpaTpJb01JN1dBV09U
HTTP/1.1 200 OK
Server: Asterisk
Date: Tue, 10 May 2022 16:16:02 GMT
Cache-Control: no-cache, no-store
Content-type: application/json
Content-Length: 232
{"id":"e24d7693-11f1-40cd-b513-e4c610088ee3","technology":"simple_bridge","bridge_type":"mixing","bridge_class":"stasis","creator":"Stasis","name":"","channels":[],"creationtime":"2022-05-10T21:46:02.392+0530","video_mode":"talker"}
POST /ari/bridges/e24d7693-11f1-40cd-b513-e4c610088ee3/addChannel?channel=er-01-1652199362.2652%2Csnoop-er-01-1652199332.2647 HTTP/1.1
Host: localhost:8088
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.27.1
Content-Length: 0
Authorization: Basic dXNlci1uZnVpaTpJb01JN1dBV09U
HTTP/1.1 422 Unprocessable Entity
Server: Asterisk
Date: Tue, 10 May 2022 16:16:02 GMT
Cache-Control: no-cache, no-store
Content-type: application/json
Content-Length: 47
{"message":"Channel not in Stasis application"}