News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
CallRecordingExtensionResource Issue
Tags: rest api, sdk, .net sdk, ringcentral.net sdk, sdk issue
Oct 21, 2021 at 12:55pm   •   1 replies  •  0 likes
Nate Breeden
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!

1 Answer
answered on Oct 21, 2021 at 3:07pm  

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

 0
on Oct 22, 2021 at 6:31am   •  0 likes

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



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us