Question

C# Loop through call record legs

  • 21 March 2023
  • 1 reply
  • 228 views

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.


1 reply

Userlevel 1

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

Reply