question

andy-haas5702 avatar image
andy-haas5702 asked andy-haas5702 answered

Update User Queue Agent Presence

I am trying to update the dndStatus for end users if they are not in the Q. So far I have this

$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "https://platform.ringcentral.com/restapi/v1.0/account/" . $RCaccountId . "/extension/" . $callerID . "/presence");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $FINALHEADERS);
curl_setopt($curl_handle, CURLOPT_PUT, true);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, '{"dndStatus": "TakeAllCalls"}');
$buffer = curl_exec($curl_handle);


The response I get is 
Fatal error: Maximum execution time of 30 seconds exceeded

Any help will be much appreciated. 

Thank You
Andy

General Topic
1 |1500 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.

andy-haas5702 avatar image
andy-haas5702 answered
Update I am now getting a 415, Unsupported attachment media type. I changed the Put statement and put it in the header. X-HTTP-Method-Override: PUT

the data that I am passing is 
$REQUEST_BODY = '{"dndStatus": "TakeAllCalls"}';
1 |1500 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.

andy-haas5702 avatar image
andy-haas5702 answered
So I updated my erroring and I don't have EditPresence

The question I have is how do I get this. I looked at creating a new app but only Edit Messages were there.

{ "errorCode" : "InsufficientPermissions", "message" : "In order to call this API endpoint, application needs to have [EditPresence] permission", "errors" : [ { "errorCode" : "CMN-401", "message" : "In order to call this API endpoint, application needs to have [EditPresence] permission", "permissionName" : "EditPresence" } ], "permissionName" : "EditPresence" }


Thank You
Andy
1 |1500 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.

ak avatar image
ak answered

Andy,


You would need to add the 'EditPresence' permission on your application in order to exercise this API endpoint.


Email the developer support team or submit a support ticket with your appKey and the necessary details and we would add the permission on your application at the earliest.

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

andy-haas5702 avatar image
andy-haas5702 answered
AK,
I have emailed you the appKey. Please let me know if you need anything else.

Thank You
Andy
1 |1500 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.

andy-haas5702 avatar image
andy-haas5702 answered
Still Getting an 415 Unsupported Media Type. Here is the written code


$REQUEST_BODY = '{"dndStatus":"TakeAllCalls"}';

curl_setopt_array($curl, array(
                CURLOPT_URL => " https://platform.ringcentral.com/restapi/v1.0/account/"; . $RCaccountId . "/extension/" . $callerID . "/presence",
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_MAXREDIRS => 10,
                CURLOPT_TIMEOUT => 30,
CURLOPT_SSL_VERIFYPEER => false,
                CURLOPT_CUSTOMREQUEST => "PUT",
                CURLOPT_POSTFIELDS => '{"dndStatus":"TakeAllCalls"}',
                CURLOPT_HTTPHEADER => [$REQUEST_HEADER_authorization, "Accept: application/json"]
            ));


I do now have EditPresence enabled on this project. 

Thank You
Andy

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

ak avatar image
ak answered
We have added the permission on your application. Did it work?

Oh thats easy, I guess you are missing the "Content-Type: application/json" header. Could you try with the header please. 
1 |1500 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.

andy-haas5702 avatar image
andy-haas5702 answered
AK,
Thank You for that.

Now missing another permission
{ "errorCode" : "CMN-408", "message" : "[EditPresenceStatus] permission required", "errors" : [ { "errorCode" : "CMN-408", "message" : "[EditPresenceStatus] permission required", "permissionName" : "EditPresenceStatus" } ], "permissionName" : "EditPresenceStatus" }{ "errorCode" : "CMN-408", "message" : "[EditPresenceStatus] permission required", "errors" : [ { "errorCode" : "CMN-408", "message" : "[EditPresenceStatus] permission required", "permissionName" : "EditPresenceStatus" } ], "permissionName" : "EditPresenceStatus" }

Thank You for Everything.
Andy

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

ak avatar image
ak answered
Andy,

Please keep in mind that you cannot Update the Presence on an Extension if you are not logged in as that extension unless you are a Super Admin.

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

andy-haas5702 avatar image
andy-haas5702 answered
I am doing this through the API. I am reading this doc to do exactly what we want to do. 

If an end user is not in the Q we want to be able to programmatically edit their status.

Update User Queue Agent Presence

To enable or disable an user extension's queue agent presence, update the extension's presence  dndStatus property.

http://ringcentral-api-docs.readthedocs.io/en/latest/call_queue/

Thank You
Andy
1 |1500 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.

anton-nikitin avatar image
anton-nikitin answered
Andy, only administrator can update presence status of other users (regular users can only update their own statuses). So you has to be authenticated as an admin user with corresponding permissions to call this API.
1 |1500 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.

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