Tropo is part of CiscoLearn More

Call Properties

There are many instances where information ABOUT a call is needed - for voice, the most significant of these is the callerID, but we do provide quite a few more. The following are the properties applicable to the voice channel - there is an additional property available for the text channel called initialText; check out the Message Properties section and the call API reference for more info.

calledID
The Caller ID for the session's destination. For example, if the number 4075550100 called 3865551000, the 386 number would be the calledID. For incoming calls to Tropo's US, Canadian and Puerto Rico numbers, this will be in 10 digit format, without the country code. To get the caller ID with the country code for these calls, use the e164CalledID field. For all other numbers, this will include the country code.
e164CalledID
The Caller ID of the session's destination in the telephony standard e164 format. This will include the country code, but will not include the + symbol. If the call or message is not to a telephone number (for example, to a SIP address or SMS shortcode), then the e164CalledID will be unformatted, the same as the calledID.
calledName
The CallerID Name for the session's destination. For example, if Mozart called Napoleon, Napoleon would be the calledName. This is primarily only used with SIP calls and is populated from the user portion of the SIP header.
callerID
The Caller ID for the session's origin. For example, if the number (407)555-0100 called (386)555-1000, the 407 number would be the callerID. For incoming calls to Tropo's US, Canadian and Puerto Rico numbers that come from a caller with a "1" country code (US, Canada, portions of the Caribbean), this will be in 10 digit format, without the country code. To get the caller ID with the country code for these calls, use the e164CallerID field. For all other calls, this will include the country code. For outgoing calls, this will be whatever your application sets as the caller ID.
e164CallerID
The Caller ID for the session's origin in the telephony standard e164 format. This will include the country code, but will not include the + symbol. If the call or message is from a telephone number (for example, a SIP address or SMS shortcode), then the e164CallerID will be unformatted, the same as the callerID.
callerName
The Caller ID Name for the session's origin. For example, if Mozart called Napoleon, Mozart would be the callerName. This is primarily only used with SIP calls and is populated from the user portion of the SIP header.
channel
The channel for this session. For phone calls, it's "VOICE"; for SMS, it's "TEXT".
network
The name of the network being used for this session. For voice, this can be 'PSTN" or "SIP".
isActive()
This function allows you determine whether the call is active or not. If the call is still connected, it will return true. If the call has disconnected but the session is still active, it will return false. Note that this is a method, not a property, and requesting it as a property (like currentCall.isActive instead of like currentCall.isActive()) may cause issues. Some programming languages do not return an error if you access an undefined property, leading to the appearance of failing silently if you use the incorrect form.
direction
Indicates whether the call is inbound or outbound; will be 'in' if the call is inbound, 'out' if outbound.
id
Each session can have multiple calls; this identifies a particular call.
sessionId
This identifies the session as a whole, as opposed to one of the calls within the session.
state
This identifies the state of the call, such as ANSWERED and DISCONNECTED.
answeredTime
This defines when the outbound call was picked up - its blank if the call is inbound.

Accessing these properties is just like accessing the properties on any native object - this example uses callerID and callerName to identify the caller by name and transfer to a specified number:

if (currentCall.callerID == "sip:210987654321@sip.tropo.com") {
    say("Thanks for calling " + currentCall.callerName + ", sending you to Adam.");
    transfer("+19165550100");
    }
else if (currentCall.callerID == "sip:12345678912@221.122.54.86") {
    say("Thanks for calling " + currentCall.callerName + ", sending you to Jason.");
    transfer("+14155550100");
    }
if ($currentCall.callerID == "sip:210987654321@sip.tropo.com")
    say "Thanks for calling " + $currentCall.callerName + ", sending you to Adam."
    transfer "+19165550100"
elsif ($currentCall.callerID == "sip:12345678912@221.122.54.86")
    say "Thanks for calling " + $currentCall.callerName + ", sending you to Jason."
    transfer "+14155550100"
end
<?php
if ($currentCall->callerID == "sip:210987654321@sip.tropo.com") {
    say("Thanks for calling ".$currentCall->callerName.", sending you to Adam");
    transfer("+19165550100");
    }
elseif ($currentCall->callerID == "sip:12345678912@221.122.54.86") {
    say("Thanks for calling ".$currentCall->callerName. ". sending you to Jason");
    transfer("+14155550100");
    }
?>
if (currentCall.callerID == "sip:210987654321@sip.tropo.com") :
    say("Thanks for calling " + currentCall.callerName + ", sending you to Adam")
    transfer("+19165550100")
elif (currentCall.callerID == "sip:12345678912@221.122.54.86") :
    say("Thanks for texting " + currentCall.callerName + ", sending you to Jason")
    transfer("+14155550100")
if (currentCall.callerID == "sip:210987654321@sip.tropo.com") {
    say("Thanks for calling " + currentCall.callerName + ", sending you to Adam.");
    transfer("+19165550100");
    }
else if (currentCall.callerID == "sip:12345678912@221.122.54.86") {
    say("Thanks for calling " + currentCall.callerName + ", sending you to Jason.");
    transfer("+14155550100");
    }