TeleStax.orgCommunity Documentation
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}
Table 4.1. Resource Properties
| Property | Description |
|---|---|
| Sid | A string that uniquely identifies this account. |
| DateCreated | The date that this account was created. |
| DateUpdated | The date that this account was last updated. |
| FriendlyName | A description of this account, up to 64 characters long. By default the FriendlyName is your email address. |
| Status | The status of this account. Possible values are active, suspended, and closed. |
| AuthToken | The authorization token for this account. This should not be shared. |
| Uri | The URI for this account, relative to http://localhost:port/restcomm. |
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.
Table 4.2. Request Parameters
| Parameter | Description |
|---|---|
| FriendlyName | A description of this account, up to 64 characters long. |
| Status | The status of this account. Possible values are active, suspended, and closed. |
| Password | A password that will be used to generate the AuthToken for the new Account resource. |
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"
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.
Table 4.3. Request Parameters
| Parameter | Description |
|---|---|
| EmailAddress(Required) | The email address to use for this account. |
| FriendlyName | A description of this account, up to 64 characters long. Default, is your email address. |
| Status | The status of this account. Default is active, possible values are active, suspended, and closed. |
| Password(Required) | A password that will be used to generate the AuthToken for the new Account resource. |
| Role(Required) | The security role that this Account resource will use. If no role is provided then the role of the account resource creating this will be inherited to the new Account resource and may compromise the system. |
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"
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.
Table 4.4. Resource Properties
| Property | Description |
|---|---|
| FriendlyName | A friendly version of the phone number. |
| PhoneNumber | The phone number, in E.164 format. |
| Lata | The LATA for this phone number. |
| RateCenter | The rate center for this phone number. |
| Latitude | The latitude coordinate for this phone number. |
| Longitude | The longitude coordinate for this phone number. |
| Region | The two-letter state or province abbreviation for this phone number. |
| PostalCode | The zip code for this phone number. |
| IsoCountry | The ISO country code for this phone number.. |
HTTP GET. Returns the representation of an AvailablePhoneNumber resource, including the properties above.
You need to be using RestComm for VoIP Innovations in order to be able to use this feature. See here for more details RestComm AMI for VoIP Innovation
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
Table 4.6. Resource Properties
| Property | Description |
|---|---|
| FriendlyName | A friendly version of the gateway. |
| UserName | The username that will be used to register to this gateway |
| Password | The password that will be used to register to this gateway |
| Proxy | The proxy address of the gateway |
| Register | Boolean flag to register or not the gateway |
| TTL | Time to live for the Register |
HTTP GET. Returns the representation of a Gateway resource, including the properties above. Resource URI: /2010-04-01/Accounts/{AccountSid}/Management/Gateways/{GatewaySid}
HTTP POST. Creates a new Gateway resource and returns the representation of the resource, including the properties above. Resource URI: /2010-04-01/Accounts/{AccountSid}/Management/Gateways
HTTP POST/PUT. Update a Gateway resource and returns the representation of the resource, including the properties above. Resource URI: /2010-04-01/Accounts/{AccountSid}/Management/Gateways/{GatewaySid}
HTTP DELETE. Deletes a Gateway resource. Resource URI: /2010-04-01/Accounts/{AccountSid}/Management/Gateways/{GatewaySid}
Create a new Gateway.
curl -X POST http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@<RESTCOMM_IP>:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Management/Gateways -d "FriendlyName=mygateway" -d "UserName=username" -d "Password=password" -d "Proxy=my.gateway.com" -d "Register=true" -d "TTL=3600"
Get a list of available Gateways.
curl -G http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@<RESTCOMM_IP>:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Management/Gateways
Update an existing Gateway.
curl -X POST http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@<RESTCOMM_IP>:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Management/Gateways/GW106bc6f34bd24790a435eaeccc1aed72 -d "FriendlyName=MyGatewayNewName" -d "UserName=newUserName"
Delete an existing Gateway.
curl -X DELETE http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@<RESTCOMM_IP>:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Management/Gateways/GW1cffb069192a45f2b5f5af2e76489550
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.
Restcomm has a new implied behavior when VoiceUrl is not provided for a Client account. Restcomm will proxy calls from such Clients to the destination Client (only if registered) or to the destination Application DID.
Only registered Clients are allowed to use the B2BUA/P2P/Proxy functionalities of Restcomm. Proxying and P2P calls are only allowed between registered(authenticated) Clients.
Table 4.7. Resource Properties
| Property | Description |
|---|---|
| Sid | A string that uniquely identifies this client. |
| DateCreated | The date that this client was created. |
| DateUpdated | The date that this clientr was last updated. |
| FriendlyName | A friendly name for this client. |
| AccountSid | The unique id of the Account that owns this phone number. |
| ApiVersion | Calls to this phone number will create a new RCML session with this API version. |
| Login | The 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. |
| Password | The password used by the user agent during registration and outbound dialing. |
| Status | The client status the possible values are 0 for disabled and 1 for enabled. |
| VoiceUrl | The URL RestComm will request when this client makes an outbound call. |
| VoiceMethod | The HTTP method RestComm will use when requesting the above Url. Either GET or POST. |
| VoiceFallbackUrl | The URL that RestComm will request if execution of VoiceUrl fails for any reason. |
| VoiceFallbackMethod | The HTTP method RestComm will use when requesting the VoiceFallbackUrl. Either GET or POST. |
| VoiceApplicationSid | If 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. |
| StatusCallback | The URL that RestComm will request to pass status parameters (such as the call state) to your application. |
| StatusCallbackMethod | The HTTP method RestComm will use to make requests to the StatusCallback URL. Either GET or POST. |
| Uri | The URI for this Client, relative to http://localhost:port/restcomm. |
HTTP GET. Returns the representation of an Client resource, including the properties above.
HTTP POST/PUT. Modifies a Client resource and returns the representation, including the properties above. Below you will find a list of optional parameters.
Table 4.8. Request Parameters
| Parameter | Description |
|---|---|
| FriendlyName | A formatted version of this phone number. |
| Password | The password used by the user agent during registration and outbound dialing. |
| Status | The client status the possible values are 0 for disabled and 1 for enabled. |
| VoiceUrl | The URL RestComm will request when this phone number receives a call. |
| VoiceMethod | The HTTP method RestComm will use when requesting the above Url. Either GET or POST. |
| VoiceFallbackUrl | The URL that RestComm will request if execution of VoiceUrl fails for any reason. |
| VoiceFallbackMethod | The HTTP method RestComm will use when requesting the VoiceFallbackUrl. Either GET or POST. |
| VoiceApplicationSid | If 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. |
| StatusCallback | The URL that RestComm will request to pass status parameters (such as the call state) to your application. |
| StatusCallbackMethod | The HTTP method RestComm will use to make requests to the StatusCallback URL. Either GET or POST. |
HTTP DELETE. Deletes a Client from the user's Account.
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.
Table 4.9. Request Parameters
| Parameter | Description |
|---|---|
| FriendlyName | A formatted version of this phone number. |
| Login | The 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. |
| Password | The password used by the user agent during registration and outbound dialing. |
| Status | The client status the possible values are 0 for disabled and 1 for enabled. |
| VoiceUrl | The URL RestComm will request when this phone number receives a call. |
| VoiceMethod | The HTTP method RestComm will use when requesting the above Url. Either GET or POST. |
| VoiceFallbackUrl | The URL that RestComm will request if execution of VoiceUrl fails for any reason. |
| VoiceFallbackMethod | The HTTP method RestComm will use when requesting the VoiceFallbackUrl. Either GET or POST. |
| VoiceApplicationSid | If 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. |
| StatusCallback | The URL that RestComm will request to pass status parameters (such as the call state) to your application. |
| StatusCallbackMethod | The HTTP method RestComm will use to make requests to the StatusCallback URL. Either GET or POST. |
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
| Property | Description |
|---|---|
| Sid | A string that uniquely identifies this incoming phone number. |
| DateCreated | The date that this incoming phone number was created. |
| DateUpdated | The date that this incoming phone number was last updated. |
| FriendlyName | A formatted version of this phone number. |
| AccountSid | The unique id of the Account that owns this phone number. |
| PhoneNumber | The incoming phone number in E.164 format ex. +2223334444 |
| ApiVersion | Calls to this phone number will create a new RCML session with this API version. |
| VoiceCallerIdLookup | Look up the caller's caller-ID name. Either true or false. |
| VoiceUrl | The URL RestComm will request when this phone number receives a call. |
| VoiceMethod | The HTTP method RestComm will use when requesting the above Url. Either GET or POST. |
| VoiceFallbackUrl | The URL that RestComm will request if execution of VoiceUrl fails for any reason. |
| VoiceFallbackMethod | The HTTP method RestComm will use when requesting the VoiceFallbackUrl. Either GET or POST. |
| StatusCallback | The URL that RestComm will request to pass status parameters (such as the call state) to your application. |
| StatusCallbackMethod | The HTTP method RestComm will use to make requests to the StatusCallback URL. Either GET or POST. |
| SmsUrl | The 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. |
| SmsMethod | The HTTP method RestComm will use when making requests to the SmsUrl. Either GET or POST. |
| SmsFallbackUrl | The URL that RestComm will request if SmsUrl fail for any reason. Please see SmsUrl as this feature may not be supported. |
| SmsFallbackMethod | The HTTP method RestComm will use when making requests to SmsFallbackUrl. Either GET or POST. |
| Uri | The 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.
Table 4.11. Request Parameters
| Parameter | Description |
|---|---|
| FriendlyName | A formatted version of this phone number. |
| ApiVersion | Calls to this phone number will create a new RCML session with this API version. |
| VoiceCallerIdLookup | Look up the caller's caller-ID name. Either true or false. |
| VoiceUrl | The URL RestComm will request when this phone number receives a call. |
| VoiceMethod | The HTTP method RestComm will use when requesting the above Url. Either GET or POST. |
| VoiceFallbackUrl | The URL that RestComm will request if execution of VoiceUrl fails for any reason. |
| VoiceFallbackMethod | The HTTP method RestComm will use when requesting the VoiceFallbackUrl. Either GET or POST. |
| StatusCallback | The URL that RestComm will request to pass status parameters (such as the call state) to your application. |
| StatusCallbackMethod | The HTTP method RestComm will use to make requests to the StatusCallback URL. Either GET or POST. |
| SmsUrl | The 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. |
| SmsMethod | The HTTP method RestComm will use when making requests to the SmsUrl. Either GET or POST. |
| SmsFallbackUrl | The URL that RestComm will request if SmsUrl fail for any reason. Please see SmsUrl as this feature may not be supported. |
| SmsFallbackMethod | The HTTP method RestComm will use when making requests to SmsFallbackUrl. Either GET or POST. |
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.
Table 4.12. Request Parameters
| Parameter | Description |
|---|---|
| PhoneNumber(Required) | The phone number you want to provision. |
| FriendlyName | A formatted version of this phone number. |
| ApiVersion | Calls to this phone number will create a new RCML session with this API version. |
| VoiceCallerIdLookup | Look up the caller's caller-ID name. Either true or false. |
| VoiceUrl | The URL RestComm will request when this phone number receives a call. |
| VoiceMethod | The HTTP method RestComm will use when requesting the above Url. Either GET or POST. |
| VoiceFallbackUrl | The URL that RestComm will request if execution of VoiceUrl fails for any reason. |
| VoiceFallbackMethod | The HTTP method RestComm will use when requesting the VoiceFallbackUrl. Either GET or POST. |
| StatusCallback | The URL that RestComm will request to pass status parameters (such as the call state) to your application. |
| StatusCallbackMethod | The HTTP method RestComm will use to make requests to the StatusCallback URL. Either GET or POST. |
| SmsUrl | The 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. |
| SmsMethod | The HTTP method RestComm will use when making requests to the SmsUrl. Either GET or POST. |
| SmsFallbackUrl | The URL that RestComm will request if SmsUrl fail for any reason. Please see SmsUrl as this feature may not be supported. |
| SmsFallbackMethod | The HTTP method RestComm will use when making requests to SmsFallbackUrl. Either GET or POST. |
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
| Property | Description |
|---|---|
| Sid | A string that uniquely identifies this call. |
| ParentCallSid | A string that uniquely identifies the call that created this leg. |
| DateCreated | The date that this call was created. |
| DateUpdated | The date that this call was last updated. |
| AccountSid | The unique id of the Account that created this call. |
| To | The phone number or identifier that will be the recipient of this call. |
| From | The phone number or identifier that originated this call. |
| PhoneNumberSid | If the call was inbound, this is the Sid of the IncomingPhoneNumber that received the call. |
| Status | A string representing the status of the call. Possible values are queued, ringing, in-progress, completed, failed, busy and no-answer. |
| StartTime | The start time of the call. Empty if the call has not yet been started. |
| EndTime | The end time of the call. Empty if the call has not ended.. |
| Duration | The length of the call in seconds. |
| Price | The charge for this call, in the currency associated with the account. Populated after the call is completed. |
| Direction | A string describing the direction of the call. Possible values are inbound, outbound-api, and outbound-dial |
| AnsweredBy | If this call was initiated with answering machine detection, either human or machine. Empty otherwise. |
| ApiVersion | Displays the current API version |
| ForwardFrom | If this call was an incoming call forwarded from another number, the forwarding phone number (depends on carrier supporting forwarding). Empty otherwise. |
| CallerName | If this call was an incoming call, the caller's name. Empty otherwise. |
| Uri | The URI for this account, relative to http://localhost:port/restcomm. |
HTTP GET. Returns the representation of a Call resource, including the properties above.
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.
Table 4.14. Request Parameters
| Parameter | Description |
|---|---|
| From(Required) | The phone number to use as the caller id. |
| To(Required) | The phone number to call. |
| Url(Required) | The fully qualified URL that should be executed when the call connects. |
| Method | The HTTP method RestComm should use when making its request to the above Url. Defaults to POST. |
| FallbackUrl | The URL that RestComm will request if execution of Url fails for any reason. |
| FallbackMethod | The HTTP method that RestComm should use to request the FallbackUrl. Must be either GET or POST. Defaults to POST. |
| StatusCallback | A URL that RestComm will request when the call ends to notify your app. |
| StatusCallbackMethod | The HTTP method RestComm should use when requesting the above StatusCallback. Defaults to POST. |
| Timeout | The number of seconds that RestComm should allow the phone to ring before assuming there is no answer. The default is 60 seconds. |
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"
The above example shows how to make a call to a SIP number. If you want to make a call to a DID number, you must can connect Restcomm to a DID provisioning service provider. The quickest way is to use RestComm AMI for Voice Innovation
Get a list of all available calls. This will return all the available calls linked to the account SID
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&PageSize=50" previouspageuri="null" nextpageuri="null" lastpageuri=="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?Page=0&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.
Client List Resource URI.
To redirect or terminate a live call, you make an HTTP POST request to an in-progress Call instance resource URI:
/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}
POST Parameters.
The following parameters are available for you to POST when modifying a phone call:
Table 4.15. Request Parameters
| Parameter | Description |
|---|---|
| Url | A valid URL that returns TwiML. Twilio will immediately redirect the call to the new TwiML. |
| Method | The HTTP method Twilio should use when requesting the above URL. Defaults to POST. |
| Status | Either canceled or completed. Specifying canceled will attempt to hangup calls that are queued or ringing but not affect calls already in progress. Specifying completed will attempt to hang up a call even if it's already 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:
Table 4.16. Request Parameters
| Parameter | Description |
|---|---|
| FallbackUrl | A URL that Twilio will request if an error occurs requesting or executing the TwiML at Url. |
| FallbackMethod | The HTTP method that Twilio should use to request the FallbackUrl. Must be either GET or POST. Defaults to POST. |
| StatusCallback | A URL that Twilio will request when the call ends to notify your app. |
| StatusCallbackMethod | The HTTP method Twilio should use when requesting the above URL. Defaults to POST. |
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:
Table 4.17. Request Parameters
| Parameter | Description |
|---|---|
| To | Only show calls to this phone number or Client identifier. |
| From | Only show calls from this phone number or Client identifier. |
| Status | Only show calls currently in this status. May be queued, ringing, in-progress, canceled, completed, failed, busy, or no-answer. |
| StartTime | Only show calls that started on this date, given as YYYY-MM-DD. Also supports inequalities, such as StartTime=YYYY-MM-DD for calls that started at or before midnight on a date, and StartTime=YYYY-MM-DD for calls that started at or after midnight on a date. |
| ParentCallSid | Only show calls spawned by the call with this Sid. |
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&PageSize=50" previouspageuri="null" nextpageuri="null" lastpageuri=="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?Page=0&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:
Table 4.18. Request Parameters
| Parameter | Description |
|---|---|
| Page | The current page number. Zero-indexed, so the first page is 0. |
| NumPages | The total number of pages. |
| PageSize | How many items are in each page |
| Total | The total number of items in the list. |
| Start | The position in the overall list of the first item in this page. |
| End | The position in the overall list of the last item in this page. |
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&PageSize=1" previouspageuri="null" nextpageuri="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?Page=1&PageSize=1&AfterSid=CA4049cf008d6b4277b92ab863fd4ec7c8" lastpageuri=="/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/Calls?Page=7&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:
Table 4.19. Request Parameters
| Parameter | Description |
|---|---|
| Uri | The URI of the current page. |
| Firstpageuri | The URI for the first page of this list. |
| Nextpageuri | The URI for the next page of this list. |
| Previouspageuri | The URI for the previous page of this list. |
| Lastpageuri | The URI for the last page of this list. |
An SMS Message resource represents an inbound or outbound SMS message.
SMS Message Resource URI. /2012-04-24/Accounts/{AccountSid}/SMS/Messages/{SMSMessageSid}
Table 4.20. Resource Properties
| Property | Description |
|---|---|
| Sid | A string that uniquely identifies this SMS Message. |
| DateCreated | The date that this SMS Message was created. |
| DateUpdated | The date that this SMS Message was last updated. |
| DateSent | The date that the SMS was sent or received by RestComm. |
| AccountSid | The unique id of the Account that sent or received this SMS message. |
| From | The phone number or short code that initiated the message. |
| To | The phone number or short code that received the message. |
| Body | The text body of the SMS message. Up to 160 characters long. |
| Status | The status of this SMS message. Possible values are queued, sending, sent, failed, and received. |
| Direction | The direction of this SMS message. Possible values are incoming, outbound-api, outbound-call. |
| ApiVersion | The API version RestComm used to handle the SMS message. |
| Uri | The URI for this account, relative to http://localhost:port/restcomm. |
HTTP GET. Returns the representation of an SMS Message resource, including the properties above.
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.
Table 4.21. Request Parameters
| Parameter | Description |
|---|---|
| From(Required) | A phone number that is enabled for SMS. |
| To(Required) | The destination phone number in E.164 format. |
| Body(Required) | The text of the message you want to send, limited to 160 characters. |
| Custom headers X- (optional) | Optionally you can provide as many custom headers as you wish. The custom headers must start with X-, for example "X-MyCustom-Header=My custom header value" |
These additional headers will be part of the SIP MESSAGE that Restcomm will create and dispatch to the SMS Aggregator.
You need to configure Restcomm to send SMS messages and DID phone
calls to a Service Provider for provisioning. In the
restcomm.xml
file, the outbound-proxy-uri and the SMS outbound-endpoint must
point to the Service Provider IP address. You may also decide to
use
Restcomm AMI.
Send SMS Messages.
Note the encoding used
%2B13216549878
instead of the
+13216549878
The + sign is encoded to to send SMS from the command line.
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.
Table 4.22. Resource Properties
| Property | Description |
|---|---|
| Sid | A string that uniquely identifies this recording. |
| DateCreated | The date that this recording was created. |
| DateUpdated | The date that this recording was last updated. |
| AccountSid | The unique id of the Account that created this recording. |
| CallSid | The unique id of the call during which the recording was made. |
| Duration | The length of the recording, in seconds. |
| ApiVersion | The API version in use during the recording. |
| Uri | The URI for this account, relative to http://localhost:port/restcomm. |
HTTP GET. Returns the representation of a Recording resource, including the properties above.
HTTP DELETE. Removes the recording from the account.
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.
Go to the Advanced Chapter under Section 7.1.2, “Record Verb” section to learn how to record a message.
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}
Table 4.23. Resource Properties
| Property | Description |
|---|---|
| Sid | A string that uniquely identifies this transcription. |
| DateCreated | The date that this transcription was created. |
| DateUpdated | The date that this transcription was last updated. |
| AccountSid | The unique id of the Account that created this transcription. |
| Status | A string representing the status of the transcription. Possible values are in-progress, completed, and failed. |
| RecordingSid | The unique id of the Recording this Transcription was made of. |
| Duration | The duration of the transcribed audio, in seconds. |
| TranscriptionText | The text content of the transcription. |
| Uri | The URI for this account, relative to http://localhost:port/restcomm. |
HTTP GET. Returns the representation of a Transcription resource, including the properties above.
HTTP DELETE. Removes the Transcription from the account.
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
| Property | Description |
|---|---|
| Sid | A string that uniquely identifies this transcription. |
| DateCreated | The date that this transcription was created. |
| DateUpdated | The date that this transcription was last updated. |
| AccountSid | The unique id of the Account that created this transcription. |
| CallSid | CallSid 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. |
| ApiVersion | The RestComm API version in use when this notification was generated. May be empty for events that don't have a specific API version. |
| Log | An integer log level corresponding to the type of notification: 0 is ERROR, 1 is WARNING. |
| ErrorCode | A unique error code for the error condition. You can lookup errors, in our Error Dictionary. |
| MoreInfo | A URL for more information about the error condition. The URL is a page in our Error Dictionary. |
| MessageText | The text for the notification. |
| MessageDate | The date the notification was actually generated |
| RequestUrl | The URL of the resource that caused the notification to be generated. |
| RequestMethod | The HTTP method in use for the request that caused the notification to be generated. |
| RequestVariables | The 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. |
| ResponseHeaders | The HTTP headers returned by your server. |
| ResponseBody | The HTTP body returned by your server. |
| Uri | The URI for this account, relative to http://localhost:port/restcomm. |
HTTP GET. Returns the representation of a Notification resource, including the properties above.
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
HTTP GET. Returns the list of outbound proxies.
HTTP GET. /2012-04-24//Accounts/{accountSid}/OutboundProxy/switchProxySwitch the outbound proxy and returns the proxy in use
HTTP GET. /2012-04-24//Accounts/{accountSid}/OutboundProxy/getActiveProxyReturns the currently active outbound proxy
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
HTTP GET. Returns the list of outbound proxies.
HTTP GET. /2012-04-24//Accounts/{accountSid}/OutboundProxy/switchProxySwitch the outbound proxy and returns the proxy in use
HTTP GET. /2012-04-24//Accounts/{accountSid}/OutboundProxy/getActiveProxyReturns the currently active outbound proxy
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"