question

bryan-bojorque avatar image
bryan-bojorque asked ·

500 Error while getting the call status 'Consult RC Support' error message

PHP SDK

Expected HTTP Error: Server error: 'GET https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/ringout/4073' resulted in a '500 Internal Server Error' response: { "message" : "Internal Server Error. Consult RC Support.", "eventId" : "91ca556c-ecbc-11e6-b9d8-005056bb594d" } (from backend) at URL https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/ringout/4073

topic-default
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

benjamin-dean avatar image
benjamin-dean answered ·
Hello Bryan,

Are you still experiencing this issue please sir?

Have you created a developer support case?

Is the extension you're using configured with either a digital line or direct number, and are you using that number (or one of the extension's phone numbers) as the from.phoneNumber in the RingOut?
Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

bryan-bojorque avatar image
bryan-bojorque answered ·
Hi Sir!

We did sent an email to devsupport@ringcentral.com.

We switched to telephonyStatus in webhook but its not very detailed and we cannot find out if the status is inProgress which is in the RingOut group.
Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

bryan-bojorque avatar image
bryan-bojorque answered ·
We are connecting a call using From 'Sandbox Phone Number' to 'Live Phone Number' in ring central.

Sample code is..

public function ringOut($toNumber) {       
     if ($this->platform->loggedIn()) {
            $phoneNumbers = $this->getPhoneNumbers(); //We are getting the from number in the sandbox acccount
            if (count($phoneNumbers)) {
                foreach ($phoneNumbers as $phoneNumber) {
                    if (in_array('SmsSender', $phoneNumber->features)) {
                        $smsNumber = $phoneNumber->phoneNumber;
                        break;
                    }
                }
            }

            try {
                $response = $this->platform->post('/account/~/extension/~/ringout', array(
                    'from' => array('phoneNumber' => $smsNumber),
                    'to' => array('phoneNumber' => $toNumber)
                ))->json();
                
            } catch (ApiException $e) {
                $this->exceptionHandler($e);
            }
            
            return $response;
        }
    }


$call = $ringcentral->ringOut('XXXXXXX'); //This is the live number
$callStatus = $ringcentral->getCallStatus($call->id);




Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

bryan-bojorque avatar image
bryan-bojorque answered ·
So in the updating part we are using setTimeout and calling a php script. $callStatus = $ringcentral->getCallStatus($id) querying status every 5 seconds via ajax.
Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

bryan-bojorque avatar image
bryan-bojorque answered ·
This is the code for getCallStatus.

public function getCallStatus($callId){        if($this->platform->loggedIn()){
            try{
                $response = $this->platform->get("/account/~/extension/~/ringout/{$callId}");
            }catch(ApiException $e){
                $this->exceptionHandler($e);
            }
            
            return $response;
        }
    }
8 comments Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

I would not call the "RingOut" route, but instead would add eventFilters to monitor the Extension's Detailed Telephony Status in your WebHooks as follows (perhaps there was a typo in the information provided to you):

/restapi/v1.0/account/{ {ACCOUNT_ID}}/extension/{ {EXTENSION_ID}}/presence?detailedTelephonyState=true

As long as the extensions you are monitoring have enabled visibility of Presence, and the subscription is actively registered successfully, you should receive WebHook events which look like this:

{"uuid":"{ {SOME_UUID}}","event":"/restapi/v1.0/account/{ {ACCOUNT_ID}}/extension/{ {EXTENSION_ID}}/presence?detailedTelephonyState=true","timestamp":"2017-02-07T16:54:59.027Z","subscriptionId":"{ {SUBSCRIPTION_ID}}",

"body":{
"extensionId":{ {EXTENSION_ID}},
"telephonyStatus":"NoCall",
"activeCalls":[
    {"id":"{ {ACTIVE_CALL_ITEM_ID}}","direction":"Outbound","from":"{ {FROM_PHONE_NUMBER}}","to":"{ {TO_PHONE_NUMBER}}","telephonyStatus":"NoCall","sessionId":"{ {SESSION_ID}}","terminationType":"final"}
],
"sequence", { {SEQUENCE_ID}},
"presenceStatus":"Available",
"userStatus":"Available",
"dndStatus":"TakeAllCalls",
"allowSeeMyPresence":true,
"ringOnMonitoredCall":false,
"pickUpCallsOnHold":false}

}

The Active Calls property is returned when you use the the "detailedTelephonyState=true" query parameter, and it has current active call information state (which is more accurate than a GET to RingOut API).

0 Likes 0 · ·
You see the problem with this is that, We cannot figure out if the Call is InProgress.

This is our webhook post, we found out that we can only get 'NoCall' | 'CallConnected' | 'Ringing' | 'OnHold' | 'ParkedCall''CallConnected', 'Ringing','On Hold', '

Also do you have any idea if we can get the details of a call using the webhook post? Using an id maybe, I'm reading the api reference and there is no relation from the callId and active call id in the webhook post
0 Likes 0 · ·
{
    "uuid": "2334273847131430065-5940644466241513615",     "event": "/restapi/v1.0/account/154624004/extension/154624004/presence?detailedTelephonyState=true",     "timestamp": "2017-02-07T18:29:54.585Z",     "subscriptionId": "3c57876e-4d78-4711-96b0-af7cf310ac2c",     "body": {         "extensionId": 154624004,         "telephonyStatus": "Ringing",         "activeCalls": [             {                 "id": "",                 "direction": "Outbound",                 "from": "XXXXXXXXX",                 "to": "XXXXXXXX",                 "telephonyStatus": "Ringing",                 "sessionId": "15515058004"             }         ],         "sequence": 276138,         "presenceStatus": "Available",         "userStatus": "Available",         "dndStatus": "TakeAllCalls",         "allowSeeMyPresence": true,         "ringOnMonitoredCall": false,         "pickUpCallsOnHold": false     } }
0 Likes 0 · ·
'NoCall'                 = Not on a call or call has ended (need to check the "terminationType")
'CallConnected'    = On a call, and connected
'Ringing'                = Dialing **some** leg of the call
'OnHold'                = On a call, but caller is holding
'ParkedCall'           = A call has been parked here

To get the details of a call from information in the Webhook event data, you would need to cache the "sessionId", "extensionId", "timestamp", and associated activeCalls[{ {specificActiveCallObject}}]. Then reverse lookup that information in the Call Log. We understand this isn't the easiest thing currently, and are actively working on a new feature to simplify this process of reverse lookups from event data -> call logs.
0 Likes 0 · ·
Well nevermind I figured out the relation it is the session id and call id!

Thanks for the very big help sir! Til I encountered a problem again!
1 Like 1 · ·
Show more comments
vb avatar image
vb answered ·
Please refer to the detailed explanation on mapping the sessionID and call-log and polling for call status for ring out calls here:   https://devcommunity.ringcentral.com/ringcentraldev/topics/need-extensionnumber-returned-in-active-c...
Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.