question

Alex Grodzicki avatar image
Alex Grodzicki asked Phong Vu answered

C# Loop through call record legs

We have a working API that is getting all of the company call log data and inserting it into a databse. We have discovered some data is missing from the records and I have found the missing data within the legs of the call record.

I'm looking for a way to get my C# code to loop through the legs of a call record to find the first To Name.

I have set my view = "Detailed" and can Console.WriteLine(response.legs[0].to.name); but that only shows me the to name in the first leg, sometimes this can be null. I can figure out how to get my app to loop through the legs until if finds a value in to.name.


Any help is apprecaited.

call logs
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

As per the API reference, the name in the 'to' and 'from' object can be omitted completely in some scenario.

to

object


{
phoneNumber

string

Phone number of a party. Usually it is a plain number including country and area code like 18661234567. But sometimes it could be returned from database with some formatting applied, for example (866)123-4567. This property is filled in all cases where parties communicate by means of global phone numbers, for example when calling to direct numbers or sending/receiving SMS

extensionNumber

string

Extension short number (usually 3 or 4 digits). This property is filled when parties communicate by means of short internal numbers, for example when calling to other extension or sending/receiving Company Pager message

extensionId

string

Internal identifier of an extension

location

string

Contains party location (city, state) if one can be determined from phoneNumber. This property is filled only when phoneNumber is not empty and server can calculate location information from it (for example, this information is unavailable for US toll-free numbers)

name

string

Symbolic name associated with a party. If the phone does not belong to the known extension, only the location is returned, the name is not determined then

device

object

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