TeleStax.orgCommunity Documentation

Chapter 4. Restful APIs

4.1. Accounts
4.1.1. Supported Operations
4.1.2. Account List Resource
4.2. AvailablePhoneNumbers
4.2.1. Supported Operations
4.3. Gateways
4.3.1. Supported Operations
4.3.2. Examples
4.4. Clients
4.4.1. Supported Operations
4.4.2. Client List Resource
4.5. IncomingPhoneNumbers
4.5.1. Supported Operations
4.5.2. IncomingPhoneNumber List Resource
4.6. Calls
4.6.1. Supported Operations
4.6.2. Call List Resource
4.6.3. Supported Operations
4.6.4. REST API: Modifying Live Calls
4.6.5. List Filter
4.6.6. Paging Information
4.7. SMS Messages
4.7.1. Supported Operations
4.7.2. SMS Message List Resource
4.8. Recordings
4.8.1. Supported Operations
4.8.2. Recording List Resource
4.9. Transcriptions
4.9.1. Supported Operations
4.9.2. Transcription List Resource
4.10. Notifications
4.10.1. Supported Operations
4.10.2. Notification List Resource
4.11. OutboundProxy
4.11.1. Supported Operations
4.12. OutboundProxy
4.12.1. Supported Operations
4.13. UssdPush
4.13.1. Supported Operations

The RestComm Restufl APIs are very similar to Twilio's and allow you to query meta-data about your account, phone numbers, calls, text messages, and recordings. Through the Restful API you can also start outbound calls and send text messages.

Resource Encoding. When an HTTP client makes a request to RestComm for a resource the HTTP client has the option to pick which encoding is used for the response. Currently, RestComm supports XML and JSON encoding. The default encoding is XML but to receive the resource in JSON just append .json to the end of the resource name.

User Authentication. Before accepting any Restful API call, Restcomm will authenticate the request source using either a valid Account SID or an Email Account combined with an Authentication Token. See below for the default Administrator account.



{AccountSID}:{AuthToken}
ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166 

		

or



{AccountEmail}:{AuthToken}
administrator@company.com:77f8c12cc7b8f8423e5c38b035249166

		

Accounts and sub-accounts are useful for things like segmenting phone numbers and usage data for your users and controlling access to data.

Account Resource URI. /2012-04-24/Accounts/{AccountSid}


HTTP GET. Returns the representation of an Account resource, including the properties above.

Account Resource URI. /2012-04-24/Accounts/{EmailAddress}

HTTP POST/PUT. Modifies an Account resource and returns the representation, including the properties above. Below you will find a list of optional parameters.


Get information about the default account. 


curl -X GET  http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf


			

Change default account password(AuthToken). 


curl -X PUT http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf -d "Password=NewPassword"


			

Command line versus Browser

The above command uses the Account SID and the one below uses the Email Account. Note the administrator%40company.com is used instead of administrator@company.com . This is because using curl on the bash terminal doesn't parse the @ correctlyl. If you were to running on a browser, you can safely use the @ as the web browser will correctly handle it.


curl -X GET  http://administrator%40company.com:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf

			

The above commands will print an output similar to the one below:



<RestcommResponse>
  <Account>
    <Sid>ACae6e420f425248d6a26948c17a9e2acf</Sid>
    <FriendlyName>Default Administrator Account</FriendlyName>
    <Status>active</Status>
    <Type>Full</Type>
    <DateCreated>2012-04-24T00:00:00.000-06:00</DateCreated>
    <DateUpdated>2012-04-24T00:00:00.000-06:00</DateUpdated>
    <AuthToken>77f8c12cc7b8f8423e5c38b035249166</AuthToken>
    <Uri>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf</Uri>
    <SubresourceUris>
      <AvailablePhoneNumbers>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/AvailablePhoneNumbers</AvailablePhoneNumbers>
      <Calls>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls</Calls>
      <Conferences>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Conferences</Conferences>
      <IncomingPhoneNumbers>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/IncomingPhoneNumbers</IncomingPhoneNumbers>
      <Notifications>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Notifications</Notifications>
      <OutgoingCallerIds>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/OutgoingCallerIds</OutgoingCallerIds>
      <Recordings>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Recordings</Recordings>
      <Sandbox>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Sandbox</Sandbox>
      <SMSMessages>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/SMS/Messages</SMSMessages>
      <Transcriptions>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Transcriptions</Transcriptions>
    </SubresourceUris>
  </Account>


			

Account List Resource URI. /2012-04-24/Accounts

HTTP GET. Returns the list representation of all the Sub-Account resources for this Account, including the properties above.

HTTP POST. Creates a new Sub-Account and returns the representation of the Sub-Account resource, including the properties above. Below you will find a list of required and optional parameters.


Here is an example of how to createa a sub-account. The sub-account will inherit the same permissions has the Administrator's account.



curl -X POST http://administrator%40company.com:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ -d "FriendlyName=MySubAccount" -d "EmailAddress=test@telestax.com" -d "Password=restcomm"
 


				

About Sub-accounts

Note that the SID, Email and the AuthToken (see output below) of the sub-account can now be used instead of the Administrator's account


<RestcommResponse>
  <Account>
    <Sid>AC3b8f0dd2e5026abde018446cbb3b185d</Sid>
    <FriendlyName>MySubAccount</FriendlyName>
    <Status>active</Status>
    <Type>Full</Type>
    <DateCreated>2013-10-16T09:22:28.708-06:00</DateCreated>
    <DateUpdated>2013-10-16T09:22:28.712-06:00</DateUpdated>
    <AuthToken>53134d7a9914e2b47c8435ebdb50ded3</AuthToken>
    <Uri>/restcomm/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d</Uri>
    <SubresourceUris>
      <AvailablePhoneNumbers>/restcomm/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/AvailablePhoneNumbers</AvailablePhoneNumbers>
      <Calls>/restcomm/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/Calls</Calls>
      <Conferences>/restcomm/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/Conferences</Conferences>
      <IncomingPhoneNumbers>/restcomm/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/IncomingPhoneNumbers</IncomingPhoneNumbers>
      <Notifications>/restcomm/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/Notifications</Notifications>
      <OutgoingCallerIds>/restcomm/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/OutgoingCallerIds</OutgoingCallerIds>
      <Recordings>/restcomm/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/Recordings</Recordings>
      <Sandbox>/restcomm/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/Sandbox</Sandbox>
      <SMSMessages>/restcomm/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/SMS/Messages</SMSMessages>
      <Transcriptions>/restcomm/2012-04-24/Accounts/AC3b8f0dd2e5026abde018446cbb3b185d/Transcriptions</Transcriptions>
    </SubresourceUris>
  </Account>


				

The AvailablePhoneNumbers subresources let you search for incoming local and toll-free phone numbers that are available for you to purchase from a TeleStax partner.

AvailablePhoneNumbers List Resource URI. /2012-04-24/Accounts/{AccountSid}/AvailablePhoneNumbers/US/Local

Searching For Numbers. When using RestComm the way to search for new phone numbers is by searching the AvailablePhoneNumbers list resource and providing the desired area code as a filter.


HTTP GET. Returns the representation of an AvailablePhoneNumber resource, including the properties above.


Here is an example, the AreaCode is any valid United States Code



curl -G http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@<Elastic_IP>:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/AvailablePhoneNumbers/US/Local -d "AreaCode=305"


			

The Gateways subresources let you create sip accounts that Restcomm will use to register itself to the Gateway and receive incoming traffic.

Gatewat List Resource URI. /2012-04-24/Accounts/{AccountSid}/Management/Gateways

Register Restcomm instance to a SIP Gateway. You might need to register Restcomm instnace to a SIP Gateway and receive incoming traffic from that gateway. For that you need to use Gateway REST endpoint


An Client instance resource represents a user agent registered with RestComm.

Client Resource URI. /2012-04-24/Accounts/{AccountSid}/Clients/{ClientSid}

Using SIP User Agents. When using RestComm to handle SIP user agent you have to create a new Client resource, this resource acts as an account for your user agent and also dictates how calls made by the user agent should be handled.

Table 4.7. Resource Properties

PropertyDescription
SidA string that uniquely identifies this client.
DateCreatedThe date that this client was created.
DateUpdatedThe date that this clientr was last updated.
FriendlyNameA friendly name for this client.
AccountSidThe unique id of the Account that owns this phone number.
ApiVersionCalls to this phone number will create a new RCML session with this API version.
LoginThe name that is used inside the <Client> noun. This is also used by the user agent as the user name used for registration and outbound dialing.
PasswordThe password used by the user agent during registration and outbound dialing.
StatusThe client status the possible values are 0 for disabled and 1 for enabled.
VoiceUrlThe URL RestComm will request when this client makes an outbound call.
VoiceMethodThe HTTP method RestComm will use when requesting the above Url. Either GET or POST.
VoiceFallbackUrlThe URL that RestComm will request if execution of VoiceUrl fails for any reason.
VoiceFallbackMethodThe HTTP method RestComm will use when requesting the VoiceFallbackUrl. Either GET or POST.
VoiceApplicationSidIf this entry contains an Sid to a voice application then RestComm will ignore these voice URLs and use the voice URLs specified by the voice application.
StatusCallbackThe URL that RestComm will request to pass status parameters (such as the call state) to your application.
StatusCallbackMethodThe HTTP method RestComm will use to make requests to the StatusCallback URL. Either GET or POST.
UriThe URI for this Client, relative to http://localhost:port/restcomm.

Client List Resource URI. /2012-04-24/Accounts/{AccountSid}/Clients

HTTP GET. Returns the list representation of all the Client resources for this Account, including the properties above.

HTTP POST. Creates a new Client and returns the representation of the resource, including the properties above. Below you will find a list of required and optional parameters.


Create a Client. The client name will be Alice as shown below



 curl -X POST  http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Clients.json -d "Login=alice" -d "Password=test" 

				

The output of the command will be similar to the one below



{
  "sid": "CL4e10e3b56a614414bcc1eeca5d96effe",
  "date_created": "2013-10-16T08:51:32.460-06:00",
  "date_updated": "2013-10-16T08:51:32.460-06:00",
  "account_sid": "ACae6e420f425248d6a26948c17a9e2acf",
  "api_version": "2012-04-24",
  "friendly_name": "alice",
  "login": "alice",
  "password": "test",
  "status": "1",
  "voice_method": "POST",
  "voice_fallback_method": "POST",
  "uri": "/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Clients/CL4e10e3b56a614414bcc1eeca5d96effe.json"


				

Delete a Client. You must use the Client SID


curl -X DELETE http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Clients/CL4e10e3b56a614414bcc1eeca5d96effe

				

Change Client's Password. You must use the Client SID as shown below:


curl -X PUT http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Clients/CL4e10e3b56a614414bcc1eeca5d96effe -d "Password=NewPassword"

				

Get List of available Clients. The command below shows all Clients created using the default Admin Account


curl -X GET http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Clients/

				

An IncomingPhoneNumber instance resource represents a RestComm phone number.

IncomingPhoneNumber Resource URI. /2012-04-24/Accounts/{AccountSid}/IncomingPhoneNumbers/{IncomingPhoneNumberSid}

Binding a Phone Number to an Application. When using RestComm the way to bind a phone number to an application is be creating a new IncomingPhoneNumber resource and providing the VoiceUrl to your application.

Table 4.10. Resource Properties

PropertyDescription
SidA string that uniquely identifies this incoming phone number.
DateCreatedThe date that this incoming phone number was created.
DateUpdatedThe date that this incoming phone number was last updated.
FriendlyNameA formatted version of this phone number.
AccountSidThe unique id of the Account that owns this phone number.
PhoneNumberThe incoming phone number in E.164 format ex. +2223334444
ApiVersionCalls to this phone number will create a new RCML session with this API version.
VoiceCallerIdLookupLook up the caller's caller-ID name. Either true or false.
VoiceUrlThe URL RestComm will request when this phone number receives a call.
VoiceMethodThe HTTP method RestComm will use when requesting the above Url. Either GET or POST.
VoiceFallbackUrlThe URL that RestComm will request if execution of VoiceUrl fails for any reason.
VoiceFallbackMethodThe HTTP method RestComm will use when requesting the VoiceFallbackUrl. Either GET or POST.
StatusCallbackThe URL that RestComm will request to pass status parameters (such as the call state) to your application.
StatusCallbackMethodThe HTTP method RestComm will use to make requests to the StatusCallback URL. Either GET or POST.
SmsUrlThe URL that RestComm will request when receiving an incoming SMS message to this number. This may not be supported. Please consult with your DID provider.
SmsMethodThe HTTP method RestComm will use when making requests to the SmsUrl. Either GET or POST.
SmsFallbackUrlThe URL that RestComm will request if SmsUrl fail for any reason. Please see SmsUrl as this feature may not be supported.
SmsFallbackMethodThe HTTP method RestComm will use when making requests to SmsFallbackUrl. Either GET or POST.
UriThe URI for this incoming phone number, relative to http://localhost:port/restcomm.

HTTP GET. Returns the representation of an IncomingPhoneNumber resource, including the properties above.

HTTP POST/PUT. Modifies an IncomingPhoneNumber resource and returns the representation, including the properties above. Below you will find a list of optional parameters.


HTTP DELETE. Releases an IncomingPhoneNumber from the user's Account.

IncomingPhoneNumber List Resource URI. /2012-04-24/Accounts/{AccountSid}/IncomingPhoneNumbers

HTTP GET. Returns the list representation of all the IncomingPhoneNumber resources for this Account, including the properties above.

HTTP POST. Creates a new IncomingPhoneNumber and returns the representation of the resource, including the properties above. Below you will find a list of required and optional parameters.


Attach a phone number to an application. This one uses the default application


curl -X POST  http://administrator%40company.com:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/IncomingPhoneNumbers.json -d "PhoneNumber=1234" -d "VoiceUrl=http://127.0.0.1:8080/restcomm/demos/hello-play.xml"

				

Result of the above command

{
  "sid": "PNdd7a0a0248244615978bd5781598e5eb",
  "account_sid": "ACae6e420f425248d6a26948c17a9e2acf",
  "friendly_name": "234",
  "phone_number": "+1234",
  "voice_url": "http://127.0.0.1:8080/restcomm/demos/hello-play.xml",
  "voice_method": "POST",
  "voice_fallback_method": "POST",
  "status_callback_method": "POST",
  "voice_caller_id_lookup": false,
  "date_created": "2013-10-04T17:42:02.500-06:00",
  "date_updated": "2013-10-04T17:42:02.500-06:00",
  "sms_method": "POST",
  "sms_fallback_method": "POST",
  "api_version": "2012-04-24",
  "uri": "/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/IncomingPhoneNumbers/PNdd7a0a0248244615978bd5781598e5eb.json"


				

Delete a phone number. You have to get the SID of the phone and use curl to delete as follows


curl -X DELETE http://administrator%40company.com:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/IncomingPhoneNumbers/PNdd7a0a0248244615978bd5781598e5eb

				

List of phone numbers. Gets all numbers created using IncomingPhoneNumbers.json


curl -X GET  http://administrator%40company.com:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/IncomingPhoneNumbers.json

				

A Call represents a connection between a phone or user agent and RestComm. This may be inbound or outbound. The Calls list resource represents the set of phone calls originated and terminated from an account.

Call Resource URI. /2012-04-24/Accounts/{AccountSid}/Calls/{CallSid}

Table 4.13. Resource Properties

PropertyDescription
SidA string that uniquely identifies this call.
ParentCallSidA string that uniquely identifies the call that created this leg.
DateCreatedThe date that this call was created.
DateUpdatedThe date that this call was last updated.
AccountSidThe unique id of the Account that created this call.
ToThe phone number or identifier that will be the recipient of this call.
FromThe phone number or identifier that originated this call.
PhoneNumberSidIf the call was inbound, this is the Sid of the IncomingPhoneNumber that received the call.
StatusA string representing the status of the call. Possible values are queued, ringing, in-progress, completed, failed, busy and no-answer.
StartTimeThe start time of the call. Empty if the call has not yet been started.
EndTimeThe end time of the call. Empty if the call has not ended..
DurationThe length of the call in seconds.
PriceThe charge for this call, in the currency associated with the account. Populated after the call is completed.
DirectionA string describing the direction of the call. Possible values are inbound, outbound-api, and outbound-dial
AnsweredByIf this call was initiated with answering machine detection, either human or machine. Empty otherwise.
ApiVersionDisplays the current API version
ForwardFromIf this call was an incoming call forwarded from another number, the forwarding phone number (depends on carrier supporting forwarding). Empty otherwise.
CallerNameIf this call was an incoming call, the caller's name. Empty otherwise.
UriThe URI for this account, relative to http://localhost:port/restcomm.

HTTP GET. Returns the list representation of all the Call resources for this Account, including the properties above.

HTTP POST. Makes a new Call and returns the representation of the Call resource, including the properties above. Below you will find a list of required and optional parameters.


Making a call to a SIP account. 

Restcomm will make a call to any SIP account that is reachable. It the example below, the SIP account is listening on port 5060. When you make the call, the SIP phone on which Alice is registered will ring and the hello-play.xml file will be played.


curl -X POST http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls.json -d "From=+16175551212" -d "To=sip:alice@127.0.0.1:5060" -d "Url=http://127.0.0.1:8080/restcomm/demos/hello-play.xml"


			

Making a call to a Restcomm client. 

You must first create a RestComm client. In the example below, the Restcomm client created is called Alice. When you make the call, the SIP phone on which Alice is registered will ring and the hello-play.xml file will be played.


curl -X POST http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls.json -d "From=+16175551212" -d "To=client:alice" -d "Url=http://127.0.0.1:8080/restcomm/demos/hello-play.xml"


			

Get a list of all available calls. This will return all the available calls linked to the account SID

Working on a production server

Using filter is a good practice on a server with thousands or millions of calls


curl -X GET  http://administrator%40company.com:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls


			

If the system hasn't received any calls, you will see the the output below


<RestcommResponse>
  <Calls page="0" numpages="0" pagesize="50" total="0" start="0" end="0" uri="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls" firstpageuri="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?Page=0&amp;PageSize=50" previouspageuri="null" nextpageuri="null" lastpageuri=="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?Page=0&amp;PageSize=50"/>


			

Realtime call modification allows you to interrupt an in-progress call and terminate it or have it begin processing RCML from a new URL. This is useful for any application where you want to asynchronously change the behavior of a running call. For example: hold music, call queues, transferring calls, forcing hangup, etc.

POST Parameters. 

The following parameters are available for you to POST when modifying a phone call:


Call in-Progress

Note that any call which is currently ringing within a Dial verb is in-progress from the point of view of Restcomm, and thus you must use 'Status=completed' to cancel it.

Optional Parameters.  You may POST the following parameters:



 Modifying a Live Call 

In order to accomplish this, you need to create a client called alice
Start a SIP phone and register alice
From the terminal run the following curl command
Make sure alice is using the port 5061
The "From=" could be any number of your choice
The Url is the default sample example provided with Restcomm

curl -X POST http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls.json -d "From=+16175551212" -d "To=sip:alice@127.0.0.1:5061" -d "Url=http://127.0.0.1:8080/restcomm/demos/hello-play.xml"

You will see an output similar to the one below:

{
  "sid": "CAfa51b104354440b09213d04752f50271",
  "date_created": "2013-11-01T03:41:14.488-06:00",
  "date_updated": "2013-11-01T03:41:14.488-06:00",
  "account_sid": "ACae6e420f425248d6a26948c17a9e2acf",
  "to": "alice",
  "from": "+16175551212",
  "status": "queued",
  "start_time": "2013-11-01T03:41:14.488-06:00",
  "price": "0.0",
  "direction": "outbound-api",
  "api_version": "2012-04-24",
  "uri": "/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls/CAfa51b104354440b09213d04752f50271.json",
  "subresource_uris": {
    "notifications": "/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls/CAfa51b104354440b09213d04752f50271/Notifications",
    "recordings": "/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls/CAfa51b104354440b09213d04752f50271/Recordings"
  }


Notice the "sid": "CAfa51b104354440b09213d04752f50271",
This Call ID is what you must use to interact with the current call.
You can now redirect the current call to another application as shown below
Notice that the Call ID is referenced
The call will now be redirected to the Url specified(hello-world.xml)


curl -X POST http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls/CAfa51b104354440b09213d04752f50271 -d "Url=http://127.0.0.1:8080/restcomm/demos/hello-world.xml"

The output showing the same Call ID

<RestcommResponse>
  <Call>
    <Sid>CAfa51b104354440b09213d04752f50271</Sid>
    <DateCreated>2013-11-01T03:41:14.488-06:00</DateCreated>
    <DateUpdated>2013-11-01T03:41:14.488-06:00</DateUpdated>
    <ParentCallSid/>
    <AccountSid>ACae6e420f425248d6a26948c17a9e2acf</AccountSid>
    <To>alice</To>
    <From>+16175551212</From>
    <PhoneNumberSid/>
       ..... TRUNCATED


You can still redirect the current call back to the previous application


curl -X POST http://ACae6e420f425248d6f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls/CAfa51b104354440b09213d04752f50271 -d "Url=http://127.0.0.1:8080/restcomm/demos/hello-play.xml"

The output showing the same Call ID

<RestcommResponse>
  <Call>
    <Sid>CAfa51b104354440b09213d04752f50271</Sid>
    <DateCreated>2013-11-01T03:41:14.488-06:00</DateCreated>
    <DateUpdated>2013-11-01T03:41:14.488-06:00</DateUpdated>
    <ParentCallSid/>
    <AccountSid>ACae6e420f425248d6a26948c17a9e2acf</AccountSid>
    <To>alice</To>
    <From>+16175551212</From>
    <PhoneNumberSid/>
   ..... TRUNCATED


You can end the call using the Status=completed command as shown below

curl -X POST http://ACae6e420f425248d6f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls/CAfa51b104354440b09213d04752f50271 -d "Status=completed"

The output showing the same Call ID

<RestcommResponse>
  <Call>
    <Sid>CAfa51b104354440b09213d04752f50271</Sid>
    <DateCreated>2013-11-01T03:41:14.488-06:00</DateCreated>
    <DateUpdated>2013-11-01T03:41:14.488-06:00</DateUpdated>
    <ParentCallSid/>
    <AccountSid>ACae6e420f425248d6a26948c17a9e2acf</AccountSid>
    <To>alice</To>
    <From>+16175551212</From>
    <PhoneNumberSid/>
   ..... TRUNCATED


				

HTTP GET. The following GET query string parameters allow you to limit the list returned. Note, parameters are case-sensitive:


Filter using the From parameter. The example below will only return Calls made from client Alice


 curl -X GET  http://administrator%40company.com:77f8c12cc7166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?From=alice

			

The result will be similar to the one below


<RestcommResponse>
  <Calls page="0" numpages="0" pagesize="50" total="0" start="0" end="1" uri="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls" firstpageuri="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?Page=0&amp;PageSize=50" previouspageuri="null" nextpageuri="null" lastpageuri=="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?Page=0&amp;PageSize=50">
    <Call>
      <Sid>CAc0fb839632cf444f9066876d5de741e0</Sid>
      <DateCreated>2013-10-18T04:51:47.643-06:00</DateCreated>
      <DateUpdated>2013-10-18T04:51:49.174-06:00</DateUpdated>
      <ParentCallSid/>
      <AccountSid>ACae6e420f425248d6a26948c17a9e2acf</AccountSid>
      <To>1234</To>
      <From>alice</From>
      <PhoneNumberSid/>
      <Status>completed</Status>
      <StartTime>2013-10-18T04:51:47.671-06:00</StartTime>
      <EndTime>2013-10-18T04:51:49.174-06:00</EndTime>
      <Duration>1</Duration>
      <Price>0.00</Price>
      <Direction>inbound</Direction>
      <AnsweredBy/>
      <ApiVersion>2012-04-24</ApiVersion>
      <ForwardedFrom/>
      <CallerName/>
      <Uri>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls/CAc0fb839632cf444f9066876d5de741e0</Uri>
      <SubresourceUris>
        <Notifications>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls/CAc0fb839632cf444f9066876d5de741e0/Notifications</Notifications>
        <Recordings>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls/CAc0fb839632cf444f9066876d5de741e0/Recordings</Recordings>
      </SubresourceUris>
    </Call>
  </Calls>


			

HTTP GET. The following GET query string parameters allow you to limit the list returned. Note, parameters are case-sensitive:


Example. The command below will return a single item from the list of calls using the PageSize parameter


curl -X GET  http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?PageSize=1


			

The result of the PageSize parameter


<RestcommResponse>
  <Calls page="0" numpages="7" pagesize="1" total="7" start="0" end="0" uri="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls" firstpageuri="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?Page=0&amp;PageSize=1" previouspageuri="null" nextpageuri="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?Page=1&amp;PageSize=1&amp;AfterSid=CA4049cf008d6b4277b92ab863fd4ec7c8" lastpageuri=="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?Page=7&amp;PageSize=1">
    <Call>
      <Sid>CA4049cf008d6b4277b92ab863fd4ec7c8</Sid>
      <DateCreated>2013-10-18T04:49:45.942-06:00</DateCreated>
      <DateUpdated>2013-10-18T04:49:46.272-06:00</DateUpdated>
      <ParentCallSid/>
      <AccountSid>ACae6e420f425248d6a26948c17a9e2acf</AccountSid>
      <To>1235</To>
      <From>bob</From>
      <PhoneNumberSid/>
      <Status>completed</Status>
      <StartTime>2013-10-18T04:49:45.994-06:00</StartTime>
      <EndTime>2013-10-18T04:49:46.272-06:00</EndTime>
      <Duration>0</Duration>
      <Price>0.00</Price>
      <Direction>inbound</Direction>
      <AnsweredBy/>
      <ApiVersion>2012-04-24</ApiVersion>
      <ForwardedFrom/>
      <CallerName/>
      <Uri>/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls/CA4049cf008d6b4277b92ab863fd4ec7c8</Uri>
      <SubresourceUris>
        <Notifications>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls/CA4049cf008d6b4277b92ab863fd4ec7c8/Notifications</Notifications>
        <Recordings>/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls/CA4049cf008d6b4277b92ab863fd4ec7c8/Recordings</Recordings>
      </SubresourceUris>
    </Call>
  </Calls>



			

Additional Paging Information. The API returns URIs to the next, previous, first and last pages of the returned list as shown in the table below:


An SMS Message resource represents an inbound or outbound SMS message.

SMS Message Resource URI. /2012-04-24/Accounts/{AccountSid}/SMS/Messages/{SMSMessageSid}


SMS Message List Resource URI. /2012-04-24/Accounts/{AccountSid}/SMS/Messages

HTTP GET. Returns the list representation of all the Call resources for this Account, including the properties above.

HTTP POST. Sends a new SMS Message and returns the representation of the SMS Message resource, including the properties above. Below you will find a list of required and optional parameters.


Using custom headers

These additional headers will be part of the SIP MESSAGE that Restcomm will create and dispatch to the SMS Aggregator.

Send SMS Messages. 

Note the encoding used %2B13216549878 instead of the +13216549878 The + sign is encoded to to send SMS from the command line.

"From" DID number

The "From" number should be the DID SMS enabled number from VoIP Innovations.

From the bash terminal, you can run the command below:


curl -X POST http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/SMS/Messages -d "To=%2B13216549878" -d "From=%2B19876543212" -d "Body=This is a test from RestComm"


				

To send the same SMS but this time also provide some additional headers:


curl -X POST http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/SMS/Messages -d "To=%2B13216549878" -d "From=%2B19876543212" -d "Body=This is a test from RestComm" -d "X-MyCustomHeader-1=Value1" -d "X-MyCustomHeader-2=Value2" 


				

Get list of SMS Messages. 

This will display list of message sent

From the bash terminal, you can run the command below:


curl -X GET http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/SMS/Messages  


				

Recordings are generated when you use the <Record> verb. Those recordings are hosted with RestComm for you to retrieve. The Recordings list resource represents the set of an account's recordings.

Recording Resource URI. /2012-04-24/Accounts/{AccountSid}/Recordings/{RecordingSid}

To download the audio file just append .wav after the RecordingSid.


Recording List Resource URI. /2012-04-24/Accounts/{AccountSid}/Recordings

HTTP GET. Returns the list representation of all the Recording resources for this Account, including the properties above.

Get List of Recordings. 

The list of recorded wav files can be found in the directory $RESTCOMM_HOME/standalone/deployments/restcomm.war/recordings/

From the bash terminal, you can run the command below:


curl -X GET  http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Recordings


				

A Transcription resource represents a transcription of a recording. A transcription is a text version of a recording produced using automatic speech recognition.

Transcription Resource URI. /2012-04-24/Accounts/{AccountSid}/Transcriptions/{TranscriptionSid}


A Notification resource represents a single log entry made by RestComm while handling your calls or your use of the Restful APIs. It is very useful for debugging purposes. The Notifications list resource represents the set of notifications generated for an account.

Notification Resource URI. /2012-04-24/Accounts/{AccountSid}/Notifications/{NotificationSid}

Table 4.24. Resource Properties

PropertyDescription
SidA string that uniquely identifies this transcription.
DateCreatedThe date that this transcription was created.
DateUpdatedThe date that this transcription was last updated.
AccountSidThe unique id of the Account that created this transcription.
CallSidCallSid is the unique id of the call during which the notification was generated. Empty if the notification was generated by the Restful APIs without regard to a specific phone call.
ApiVersionThe RestComm API version in use when this notification was generated. May be empty for events that don't have a specific API version.
LogAn integer log level corresponding to the type of notification: 0 is ERROR, 1 is WARNING.
ErrorCodeA unique error code for the error condition. You can lookup errors, in our Error Dictionary.
MoreInfoA URL for more information about the error condition. The URL is a page in our Error Dictionary.
MessageTextThe text for the notification.
MessageDateThe date the notification was actually generated
RequestUrlThe URL of the resource that caused the notification to be generated.
RequestMethodThe HTTP method in use for the request that caused the notification to be generated.
RequestVariablesThe HTTP GET or POST variables that RestComm generated and sent to your server. Also, if the notification was generated by the Restful APIs, this field will include any HTTP POST or PUT variables you sent.
ResponseHeadersThe HTTP headers returned by your server.
ResponseBodyThe HTTP body returned by your server.
UriThe URI for this account, relative to http://localhost:port/restcomm.

Using Outbound proxy endpoint you can get the details of Primary and Backup outbound proxy, get the current active outbound proxy and also switch outbound proxy.

OutboundProxy Resource URI. /2012-04-24//Accounts/{accountSid}/OutboundProxy

Using Outbound proxy endpoint you can get the details of Primary and Backup outbound proxy, get the current active outbound proxy and also switch outbound proxy.

OutboundProxy Resource URI. /2012-04-24//Accounts/{accountSid}/OutboundProxy

A UssdPush resource represents a message sent from Restcomm to a USSD gateway.

UssdPush Resource URI. /2012-04-24/Accounts/{AccountSid}/UssdPush

Example of UssdPush. 


		

		The USSD gateway to which Restcomm must send the UssdMessage must be configured in the restcomm.xml file. IP address and port must be configured. Username/password for the USSD are optional.

		<!-- TelScale USSD Gateway -->
		<ussd-gateway>
		<ussd-gateway-uri>IP_USSD_GW:PORT_NUMBER</ussd-gateway-uri>
		<ussd-gateway-user></ussd-gateway-user>
		<ussd-gateway-password></ussd-gateway-password>
		</ussd-gateway>




		See below a curl example for the USSD Push:

		curl -X POST -H "application/json" http://ACae6e420f425248d6a26948c17a9e2acf:YOUR_PWD@RESTCOMM_IP_ADDRESS:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a-d "From=Restcomm" -d "To=123" -d "Url=http://RESTCOMM_IP_ADDRESS:8080/restcomm-rvd/services/apps/YOUR_USSD_APP/controller"