Skip to content

Type 4 - the incoming call

Workflow example using OnCallEvent

A client can initiate the incoming call event by incoming SIP call. In this case, OnCallEvent REST method is called. This method contains incoming call information.

 

The diagram shows that /OnCallEvent query goes to backend server, then client handles this event on step 4 after backend server response.

Example:

POST /rest/my_api/OnCallEvent HTTP/1.1
Accept: application/json
Content-Type: application/json;charset=UTF-8
User-Agent: Java/1.8.0_111
Host: 192.168.1.101
Connection: keep-alive
Content-Length: 3614

{
    "nodeId" : "ah20GKYnbYKxjJmdh1zDs6cllWkn0Q0t@46.101.108.90",
    "appKey" : "defaultApp",
    "sessionId" : "/8.8.8.8:56046/46.101.108.90:8443",
    "callId" : "pbx-8BD6EE910B71BE609010-3434@h79n40.etc.tario.ru",
    "incoming" : true,
    "status" : "PENDING",
    "caller" : "PPP009",
    "callee" : "PPP005",
    "hasAudio" : true,
    "hasVideo" : false, 
    "mediaProvider" : "WebRTC",
    "isMsrp" : false,
    "holdForTransfer" : false
}
HTTP/1.1 200 OK
Date: Tue, 28 Feb 2017 17:35:44 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Content-Length: 3656
Connection: close
Content-Type: application/json

{
    "nodeId" : "ah20GKYnbYKxjJmdh1zDs6cllWkn0Q0t@46.101.108.90",
    "appKey" : "defaultApp",
    "sessionId" : "/8.8.8.8:56046/46.101.108.90:8443",
    "callId" : "pbx-8BD6EE910B71BE609010-3434@h79n40.etc.tario.ru",
    "incoming" : true,
    "status" : "PENDING",
    "caller" : "PPP009",
    "callee" : "PPP005",
    "hasAudio" : true,
    "hasVideo" : false, 
    "mediaProvider" : "WebRTC",
    "isMsrp" : false,
    "holdForTransfer" : false
}

Error handling

If backend server returns error then SESSION_STATUS.WARN goes to client and error status returns to caller (SIP side in this case)

 

Example:

POST /rest/my_api/OnCallEvent HTTP/1.1
Accept: application/json
Content-Type: application/json;charset=UTF-8
User-Agent: Java/1.8.0_111
Host: 192.168.1.101
Connection: keep-alive
Content-Length: 3639

{
    "nodeId" : "ah20GKYnbYKxjJmdh1zDs6cllWkn0Q0t@46.101.108.90",
    "appKey" : "defaultApp",
    "sessionId" : "/8.8.8.8:56046/46.101.108.90:8443",
    "callId" : "pbx-8BD6EE910B71BE609010-3434@h79n40.etc.tario.ru",
    "incoming" : true,
    "status" : "PENDING",
    "caller" : "PPP009",
    "callee" : "PPP005",
    "hasAudio" : true,
    "hasVideo" : false, 
    "mediaProvider" : "WebRTC",
    "isMsrp" : false,
    "holdForTransfer" : false
}
HTTP/1.1 403 Forbidden
Date: Tue, 28 Feb 2017 13:44:39 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8