question

bryan-bojorque avatar image
bryan-bojorque asked vyshakhbabji Deactivated answered

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

sdk
1 |3000

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?
1 |3000

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 send an email to the developer support team.

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.

1 |3000

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);




1 |3000

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.
1 |3000

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 benjamin-dean commented
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
1 |3000

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 commented ·
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 ·
benjamin-dean avatar image benjamin-dean commented ·
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 ·
bryan-bojorque avatar image bryan-bojorque commented ·
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 ·
bryan-bojorque avatar image bryan-bojorque commented ·
{
    "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 ·
benjamin-dean avatar image benjamin-dean commented ·
'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 ·
Show more comments
vyshakhbabji avatar image
vyshakhbabji Deactivated 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...
1 |3000

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

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys