question

Nate Breeden avatar image
Nate Breeden asked Nate Breeden edited

CallRecordingExtensionResource Issue

BulkAccountCallRecordingsResource bulkAccountCallRecordingsResource = new BulkAccountCallRecordingsResource
{
    addedExtensions = new CallRecordingExtensionResource
    {
        id = "123456789",
        callDirection = 'Inbound'
    }
};


Using the above(I've removed my extensionID and made it 123456789), I'm getting an error for the first single quote in "callDirection": CS1012: Too many characters in character literal. When changing them to double quotes I get: Cannot implicitly convert type 'RingCentral.CallRecordingExtensionResource' to 'RingCentral.CallRecordingExtensionResource[]'

1634845245615.png


A while ago I made a Python script that does what I'm attempting to do with my C# program, the issue was pretty similar and had to do with the structure of the param, it needed to have "[ ]" brackets before "id" and after "callDirection".


Is the structure in my code accurate, or do I need to change it?


Here is what I had to do with Python to get it to work a long time ago(notice the "[ ]" brackets), but when trying this fix in C# it tells me it's invalid.

body = {
    'addedExtensions': [
        {
        'id': <ENTER VALUE>,
        'callDirection': 'Outbound'
        }
    ]
}

On the API documentation it states to use this in Python: https://developers.ringcentral.com/api-reference/Call-Recording-Settings/updateCallRecordingExtensionList

body = {
    'addedExtensions': {
        'id': '<ENTER VALUE>',
        'callDirection': 'Outbound'
    }
}


Not having any luck on where Phong pointed me to for the other issue earlier: https://github.com/ringcentral/RingCentral.Net/blob/master/samples.md


Also, when looking at the SDK, it looks like 'Inbound' is correct, that I'm using a string for callDirection under CallRecordingExtensionResource:

namespace RingCentral
{
    public class CallRecordingExtensionResource
    {
        public CallRecordingExtensionResource();

        public string id { get; set; }
        public string uri { get; set; }
        public string extensionNumber { get; set; }
        public string type { get; set; }
        public string callDirection { get; set; }
    }
}


Any help is appreciated!

rest apisdk
1634845245615.png (19.8 KiB)
1 |3000

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

1 Answer

Phong Vu avatar image
Phong Vu answered Nate Breeden edited

Can you try thing like this

BulkAccountCallRecordingsResource bcCallRecordingRes = new BulkAccountCallRecordingsResource();
var ext1 = new CallRecordingExtensionResource();
ext1.id = "12343566";
ext1.callDirection = "Inbound";

var ext2 = new CallRecordingExtensionResource();
ext2.id = "343243434";
ext2.callDirection = "Inbound";

bcCallRecordingRes.addedExtensions = new CallRecordingExtensionResource[] { ext1, ext2 };
var res = await rcsdk.Restapi().Account().CallRecording().BulkAssign().Post(bcCallRecordingRes);
1 comment
1 |3000

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

Nate Breeden avatar image Nate Breeden commented ·

You're awesome, thanks for the help Phong.


I do have another issue with getting detailed answering rules, is there another call to make for detailed instead of simple? In Python I would just add '"view" : "Detailed"' in my params and the output would let me parse through all of the detailed output. However, when adding the detailed param in C# the SDK doesn't have the detailed keys so it throws errors when trying to parse through them.


1634909604614.png


This is what I'm using


ListAnsweringRulesParameters listAnsweringRulesParameters = new ListAnsweringRulesParameters
{
    view = "Detailed",
    enabledOnly = true,
};

var handleIDs = await rc.Restapi().Account("~").Extension(ext.id.ToString()).AnsweringRule().List(listAnsweringRulesParameters);

var fwdId = handleIDs.records[0].forwarding.rules[0].forwardingNumbers[0].id;
var fwdType = handleIDs.records[0].forwarding.rules[0].forwardingNumbers[0].type;


The SDK doesn't have a "forwarding" key (in fwdId and fwdType) after "records[0]" so it throws me an error, even though I'm requesting a detailed list

Trying to use the ID/Type to set the users default answering rule, if there's a more simplistic way of doing it please let me know

0 Likes 0 ·
1634909604614.png (34.2 KiB)

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