TeleStax.orgCommunity Documentation

RestComm User Guide

The Guide to the RestComm

Abstract

RestComm is a carrier-grade open source platform that provides developers the tools to integrate fax, voice, and SMS functionality in to their own applications with ease. RestComm is designed to have 100% compatibility with Twilio's APIs allowing easy porting between platforms. Furthermore, the RestComm platform is built on top of the industry leading Mobicents Sip Servlet Container and Mobicents Media Server providing the robustness and performance these platforms are already known to deliver.


Preface
1. Document Conventions
1.1. Typographic Conventions
1.2. Pull-quote Conventions
1.3. Notes and Warnings
1. Introduction to RestComm
1.1. How it Works
2. Getting Started and General Configuration
2.1. Quick Start Guide
2.2. Login into Restcomm and Changing the Default Password
2.3. Testing the Demo Applications
2.3.1. Demo 1 - Testing the Play Verb
2.3.2. Detailed Configuration
2.3.3. Runtime Settings
2.3.4. VoIP Innovations Restful API Access
2.3.5. Dao Manager
2.3.6. Media Server Manager
2.3.7. SMS Aggregator
2.3.8. Fax Service
2.3.9. Speech Recognizer
2.3.10. Speech Synthesizer
3. RestComm Markup Language
3.1. RestComm Request
3.2. Your Response
3.3. Say
3.4. Play
3.5. Gather
3.6. Record
3.7. Fax
3.8. Sms
3.9. Dial
3.9.1. Number
3.9.2. Client
3.9.3. Conference
3.9.4. Sip
3.10. Hangup
3.11. Redirect
3.12. Reject
3.13. Pause
3.14. UssdCollect
3.14.1. UssdMessage
3.14.2. Language
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
5. Restcomm Admin User Interface
5.1. Login Interface
5.2. Passwords, Sub Accounts Settings
5.3. Dashboard
5.4. Restcomm Numbers
5.4.1. Register Number
5.4.2. Edit Update Number
5.5. SIP Clients
5.6. Outgoing CallerId
5.7. Logs
5.7.1. Logs - Calls
5.7.2. Logs - Messages
5.7.3. Logs - Recordings
5.7.4. Logs - Transcriptions
5.7.5. Logs - Notifications
6. Restcomm Visual Designer
6.1. Getting Started
6.2. Voice Projects
6.3. USSD Projects
6.4. SMS Projects
6.5. Demo Application
7. Advanced RestComm Examples
7.1. Activating Text-to-Speech (TTS)
7.1.1. Say Verb
7.1.2. Record Verb
7.1.3. Dial Verb and Client
7.1.4. Dial Verb and Uri
7.1.5. Dial Verb and Conference
7.1.6. Gather Verb

This manual uses several conventions to highlight certain words and phrases and draw attention to specific pieces of information.

In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts set. The Liberation Fonts set is also used in HTML editions if the set is installed on your system. If not, alternative but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later includes the Liberation Fonts set by default.

Four typographic conventions are used to call attention to specific words and phrases. These conventions, and the circumstances they apply to, are as follows.

Mono-spaced Bold

Used to highlight system input, including shell commands, file names and paths. Also used to highlight key caps and key-combinations. For example:

The above includes a file name, a shell command and a key cap, all presented in Mono-spaced Bold and all distinguishable thanks to context.

Key-combinations can be distinguished from key caps by the hyphen connecting each part of a key-combination. For example:

The first sentence highlights the particular key cap to press. The second highlights two sets of three key caps, each set pressed simultaneously.

If source code is discussed, class names, methods, functions, variable names and returned values mentioned within a paragraph will be presented as above, in Mono-spaced Bold . For example:

Proportional Bold

This denotes words or phrases encountered on a system, including application names; dialogue box text; labelled buttons; check-box and radio button labels; menu titles and sub-menu titles. For example:

The above text includes application names; system-wide menu names and items; application-specific menu names; and buttons and text found within a GUI interface, all presented in Proportional Bold and all distinguishable by context.

Note the > shorthand used to indicate traversal through a menu and its sub-menus. This is to avoid the difficult-to-follow 'Select Mouse from the Preferences sub-menu in the System menu of the main menu bar' approach.

Mono-spaced Bold Italic or Proportional Bold Italic

Whether Mono-spaced Bold or Proportional Bold, the addition of Italics indicates replaceable or variable text. Italics denotes text you do not input literally or displayed text that changes depending on circumstance. For example:

Note the words in bold italics above — username, domain.name, file-system, package, version and release. Each word is a placeholder, either for text you enter when issuing a command or for text displayed by the system.

Aside from standard usage for presenting the title of a work, italics denotes the first use of a new and important term. For example:

RestComm is a turnkey Cloud Communications platform based on Open Source building blocks from the team behind Mobicents. Restcomm offers a clean room implementation of the Twilio.com APIs and much more.

Restcomm can be integrated with VoIP and legacy SS7 network providers either in the cloud or via on-premise Resource Adaptors.

Keep in mind that before you continue you should configure your ASR, Fax, SMS, and TTS plugins in order to have everything function as you would expect it to.

RestComm is a robust, powerful platform that will facilitate building comprehensive real-time communication solutions. The steps below will help you get started with ease.

Running RestComm on JBoss

JBoss Security

Running a secure application is dependent on multiple factors. Restcomm runs on JBoss which implies that system security implemention can be handled at JBoss level. Please see the link below on how you can make your server environment more secure. https://community.jboss.org/wiki/SecureJboss?_sscc=t

  • Download TelScale-Restcomm-JBoss-AS7-XX.XX.GA.zip

  • Using a terminal of your choice, extract the content of TelScale-Restcomm-XX.XX.GA.zip to a local directory on your computer. The root directoy into which you extract the content of the .zip file will be referred to as $RESTCOMM_HOME.

  • Go to $RESTCOMM_HOME/telscale-media/telscale-media-server/bin

  • change the permission of the run.sh as follows

  • sudo chmod +x ./run.sh

  • then start the TelScale Media Server as follows

  • sudo ./run.sh

  • If all is correctly started you will see the following at the end of the bash terminal window

    [MainDeployer] [[[[[[[[[ Mobicents Media Server: release.version=3.0.0.FINAL Started ]]]]]]]]]
    

  • Open another terminal and proceed as follows:

  • Go to $RESTCOMM_HOME/bin

  • change the permissions of all the .sh files in the bin directory as follows

  • sudo chmod +x ./*.sh

  • Start RestComm by running the following command

  • sudo ./standalone.sh -c standalone-sip.xml

  • If RestComm is correctly started you will see the following at the end of the terminal

    INFO  [Version] TelScale Sip Servlets 6.1.3.GA-TelScale (build: Git Hash=r8947f2732ee64c76566ed6c0b236204c048538e1 date=201306131639) Started.
    17:30:05,854 INFO  [Version] 
    ==============================================================================
    ==                                                                          ==
    ==                      Thank you for running TelScale                      ==
    ==    Carrier Grade Communications Platform by the creators of Mobicents    ==
    ==                    Copyright 2011-2013 Telestax, Inc.                    ==
    ==                         http://www.telestax.com/                         ==
    ==                                                                          ==
    ==============================================================================
    
    

Running RestComm on Tomcat

  • Download TelScale-Restcomm-Tomcat-XX.XX.GA.zip

  • Using a terminal of your choice, extract the content of TelScale-Restcomm-Tomcat-XX.XX.GA.zip to a local directory on your computer. The root directoy into which you extract the content of the .zip file will be referred to as $RESTCOMM_HOME.

  • Go to $RESTCOMM_HOME/telscale-media/telscale-media-server/bin

  • change the permission of the run.sh as follows

  • sudo chmod +x ./run.sh

  • then start the TelScale Media Server as follows

  • sudo ./run.sh

  • If all is correctly started you will see the following at the end of the bash terminal window

    [MainDeployer] [[[[[[[[[ Mobicents Media Server: release.version=3.0.0.FINAL Started ]]]]]]]]]
    

  • Open another terminal and proceed as follows:

  • Go to $RESTCOMM_HOME/bin

  • change the permissions of all the .sh files in the bin directory as follows

  • sudo chmod +x ./*.sh

  • The content of the bin directory should be similar to the list below

    bootstrap.jar                 digest.sh             tomcat-juli.jar
    catalina.bat                  setclasspath.bat      tomcat-native.tar.gz
    catalina.sh                   setclasspath.sh       tool-wrapper.bat
    catalina-tasks.xml            shutdown.bat          tool-wrapper.sh
    commons-daemon.jar            shutdown.sh           version.bat
    commons-daemon-native.tar.gz  startup.bat           version.sh
    cpappend.bat                  startup.sh
    digest.bat                    telestax-license.xml
    
    

    Start RestComm by running the following command

  • sudo ./catalina.sh run

  • If RestComm is correctly started on Tomcat, you will see an output similar to the one below

    Started.
    2013-08-15 19:02:46,903 INFO  [Version] (main) 
    ==============================================================================
    ==                                                                          ==
    ==                      Thank you for running TelScale                      ==
    ==    Carrier Grade Communications Platform by the creators of Mobicents    ==
    ==                    Copyright 2011-2013 Telestax, Inc.                    ==
    ==                         http://www.telestax.com/                         ==
    ==                                                                          ==
    ==============================================================================
    Aug 15, 2013 7:02:50 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 14090 ms
    
    
    

Restcomm comes prepackaged with multiple example applications designed to help you quickly get started. For more demos and configuration details please visit www.telestax.com/doc

Start a SIP phone (see below) and dial 1234@127.0.0.1:5080. You will hear a welcome message.

RestComm is a robust, powerful platform that will facilitate building comprehensive real-time communication solutions. The steps below will help you get started with ease.

Running RestComm on JBoss

JBoss Security

Running a secure application is dependent on multiple factors. Restcomm runs on JBoss which implies that system security implemention can be handled at JBoss level. Please see the link below on how you can make your server environment more secure. https://community.jboss.org/wiki/SecureJboss?_sscc=t

  • Download TelScale-Restcomm-JBoss-AS7-XX.XX.GA.zip

  • Using a terminal of your choice, extract the content of TelScale-Restcomm-XX.XX.GA.zip to a local directory on your computer. The root directoy into which you extract the content of the .zip file will be referred to as $RESTCOMM_HOME.

  • Go to $RESTCOMM_HOME/telscale-media/telscale-media-server/bin

  • change the permission of the run.sh as follows

  • sudo chmod +x ./run.sh

  • then start the TelScale Media Server as follows

  • sudo ./run.sh

  • If all is correctly started you will see the following at the end of the bash terminal window

    						[MainDeployer] [[[[[[[[[ Mobicents Media Server: release.version=3.0.0.FINAL
    						Started ]]]]]]]]]
    					

  • Open another terminal and proceed as follows:

  • Go to $RESTCOMM_HOME/bin

  • change the permissions of all the .sh files in the bin directory as follows

  • sudo chmod +x ./*.sh

  • Start RestComm by running the following command

  • sudo ./standalone.sh -c standalone-sip.xml

  • If RestComm is correctly started you will see the following at the end of the terminal

    					INFO [Version] TelScale Sip Servlets 6.1.3.GA-TelScale (build: Git
    					Hash=r8947f2732ee64c76566ed6c0b236204c048538e1 date=201306131639)
    					Started.
    					17:30:05,854 INFO [Version]
    					==============================================================================
    					== ==
    					== Thank you for running TelScale ==
    					== Carrier Grade Communications Platform by the creators of Mobicents
    					==
    					== Copyright 2011-2013 Telestax, Inc. ==
    					== http://www.telestax.com/ ==
    					== ==
    					==============================================================================
    
    				

Running RestComm on Tomcat

  • Download TelScale-Restcomm-Tomcat-XX.XX.GA.zip

  • Using a terminal of your choice, extract the content of TelScale-Restcomm-Tomcat-XX.XX.GA.zip to a local directory on your computer. The root directoy into which you extract the content of the .zip file will be referred to as $RESTCOMM_HOME.

  • Go to $RESTCOMM_HOME/telscale-media/telscale-media-server/bin

  • change the permission of the run.sh as follows

  • sudo chmod +x ./run.sh

  • then start the TelScale Media Server as follows

  • sudo ./run.sh

  • If all is correctly started you will see the following at the end of the bash terminal window

    						[MainDeployer] [[[[[[[[[ Mobicents Media Server: release.version=3.0.0.FINAL
    						Started ]]]]]]]]]
    					

  • Open another terminal and proceed as follows:

  • Go to $RESTCOMM_HOME/bin

  • change the permissions of all the .sh files in the bin directory as follows

  • sudo chmod +x ./*.sh

  • The content of the bin directory should be similar to the list below

    					bootstrap.jar digest.sh tomcat-juli.jar
    					catalina.bat setclasspath.bat tomcat-native.tar.gz
    					catalina.sh setclasspath.sh tool-wrapper.bat
    					catalina-tasks.xml shutdown.bat tool-wrapper.sh
    					commons-daemon.jar shutdown.sh version.bat
    					commons-daemon-native.tar.gz startup.bat version.sh
    					cpappend.bat startup.sh
    					digest.bat telestax-license.xml
    
    				

    Start RestComm by running the following command

  • sudo ./catalina.sh run

  • If RestComm is correctly started on Tomcat, you will see an output similar to the one below

    					Started.
    					2013-08-15 19:02:46,903 INFO [Version] (main)
    					==============================================================================
    					== ==
    					== Thank you for running TelScale ==
    					== Carrier Grade Communications Platform by the creators of Mobicents
    					==
    					== Copyright 2011-2013 Telestax, Inc. ==
    					== http://www.telestax.com/ ==
    					== ==
    					==============================================================================
    					Aug 15, 2013 7:02:50 PM org.apache.catalina.startup.Catalina start
    					INFO: Server startup in 14090 ms
    
    
    				

Restcomm comes prepackaged with multiple example applications designed to help you quickly get started.

You must first activate Text-to-Speech before you can proceed.

You must get an API key from http://www.voicerss.org in order to proceed with this section. You can register for a free account and an API key will be emailed to you. Once you have the API key, open the $RESTCOMM_HOME/standalone/deployments/restcomm.war/WEB-INF/conf/restcomm.xml file and find the speech-synthesizer VoiceRSS section. Add your API key as shown below and restart RestComm


<speech-synthesizer
		class="org.mobicents.servlet.restcomm.tts.VoiceRSSSpeechSynthesizer">
		<service-root>http://api.voicerss.org</service-root>
		<apikey>2901c0aXXXXXXXXXXXXXX</apikey>

			

Start a SIP phone dial 1235@127.0.0.1:5080 . You will hear a welcome message in multiple languages.


The application bound to the number 1235 can be found at
 $RESTCOMM_HOME/standalone/deployments/restcomm.war/demos/hello-world.xml.

			

The runtime-settings are used by TelScale RestComm at runtime to customize it's behavior. A list of the runtime settings and a description is provided below.

Table 2.1. Runtime Settings

ElementDescription
api-versionThe version of the TelScale RestComm API that we will be executing by default.
prompts-uriThe location where the audio prompts are located.
cache-pathThe local path the cache folder.
cache-uriThe HTTP URI to the cache folder.
recordings-pathThe local path to the folder containing the recordings.
recordings-uriThe HTTP URI to the folder containing the recordings.
error-dictionary-uriThe HTTP URI to the TelScale RestComm error dictionary.
external-ip The IP to use for out-bound SIP REGISTER requests. This is useful when you want to report a different IP than the one TelScale RestComm picked by default.
use-to If set to true TelScale RestComm will use the To header to determine the destination. If set to false TelScale RestComm will use the Request URI to determine the destination.
outbound-proxy-user The user name used to authenticate with the outbound proxy. (Optional)
outbound-proxy-password The password used to authenticated with the outbound proxy. (Optional)
outbound-proxy-uri The SIP URI to the outbound proxy. Note: Do not prepend 'sip:' to the proxy uri. If necessary the port can be included, for example alice@localhost:5080
fallback-outbound-proxy-user The user name used to authenticate with the fallback outbound proxy. (Optional)
fallback-outbound-proxy-password The password used to authenticated with the fallback outbound proxy. (Optional)
fallback-outbound-proxy-uri The SIP URI to the fallback outbound proxy. Note: Do not prepend 'sip:' to the proxy uri. If necessary the port can be included, for example alice@localhost:5080
allow-fallback Set this to true so Restcomm will fallback to the backup proxy in case of failed calls
max-failed-calls Maximum number of failed call before switching from primary to fallback outbound proxy
allow-fallback-to-primary Allow fallback from Backup to Primary proxy in case fail called at backup proxy.

TelScale Restcomm Resource Security. The security model is based on role based access control. TelScale RestComm defines a set of permissions that can be defined for each role. There are two predefined roles Administrator and Developer. The Developer role can be configured or removed all together depending on your needs but the Administrator role can not be changed. The Administrator role can not be modified or removed and it has access to every resource.

First we will define the list of permissions and what they mean.


These permissions apply to every resource exposed by the Restful APIs. Once a role is defined it can be specified for new Account resources that are created.

Note

If no role is specified when creating a new Account resource then the new Account will inherit the security role of the account that created it. If this role is the Administrator role the system may become compromised.

Wildcard Permission. The asterisk '*' is a wildcard that means grant all permissions and can be used in place of typing out all the permissions.

To see how this all comes together please check out the restcomm.xml configuration file.

The RestComm Markup Language (RCML) is composed of a set of XML tags that can be used to instruct RestComm on how to handle an on-going phone call. RestComm applications are built by combining these XML verbs and nouns in a way that is sensible for a given set of application requirements. In this chapter we will discuss what a request from RestComm to your application looks like as well as what the response from your application should look like. Then, we will dive in to how each verb and noun in the XML instruction set is used.

The <Say> verb is used to synthesize text to speech and play it to the remote party. The voices supported depends on the TTS Service provider plug-in. Below are the voices for our default TTS service provider plug-in which uses Acapela Voice and VoiceRSS (default) as a Service.


voice. The 'voice' attribute allows you to select the gender of the voice used to synthesize the text to speech for playback.

language. The 'language' attribute allows you pick a specific language for speech synthesis. RestComm currently supports languages 'bf' (Belgium-French), 'bp' (Brazilian-Portugues), 'en' (English), 'en-gb' (British-English), 'cf' (Canadian-French), 'cs' (Czech), 'dan' (Dannish), 'fi' (Finnish), 'es' (Spanish), 'fr' (French), 'de' (German), 'el' (Greek), 'it' (Italian), 'nl' (Netherlands-Dutch), 'no' (Norwegian), 'pl' (Polish), 'pt' (Portuguese), 'ru' (Russian), 'ar' (Saudi-Arabia Arabic), 'ca' (Spain Catalan), 'sv' (Swedish), and 'tr' (Turkish).

loop. The 'loop' attribute specifies how many times you'd like the text repeated. Specifying '0' will cause the the <Say> verb to loop until the call is hung up.

Nesting. The <Say> verb can not have any other verbs or nouns nested. Only text.

Examples. For an example of how to use the <Say> verb see below.

		<Response>
			<Say>Hello World</Say>
		</Response>
		

The example below shows how you can set the language, voice and loop parameters of the Say Verb.

	
		<Response>
		<Say voice="woman" language="fr" loop="3">Bienvenue à RestComm un projet parrainé par TeleStax</Say>
		</Response>

	
	

Usefull Information

  • When translating text to speech, the Say verb will make assumptions about how to pronounce numbers, dates, times, amounts of money and other abbreviations.

  • When saying numbers, '12345' will be spoken as "twelve thousand three hundred forty-five." Whereas '1 2 3 4 5' will be spoken as "one two three four five."

The <Gather> verb "gathers" digits that a caller enters into his or her telephone keypad. When the caller is done entering digits, RestComm submits that digits to the provided 'action' URL in an HTTP GET or POST request. If no input is received before timeout, <Gather> falls through to the next verb in the RestComm document. You may optionally nest <Say>, <Play>, and <Pause> verbs within a <Gather> verb while waiting for input. This allows you to read menu options to the caller while letting her enter a menu selection at any time. After the first digit is received the audio will stop playing.


action. The 'action' attribute takes an absolute or relative URL as a value. When the caller has finished entering digits RestComm will make a GET or POST request to this URL including the parameters below. If no 'action' is provided, RestComm will by default make a POST request to the current document's URL.


method. The 'method' attribute takes the value 'GET' or 'POST'. This tells RestComm whether to request the 'action' URL via HTTP GET or POST.

timeout. The 'timeout' attribute sets the limit in seconds that RestComm will wait for the caller to press another digit before moving on and making a request to the 'action' URL. For example, if 'timeout' is '10', RestComm will wait ten seconds for the caller to press another key before submitting the previously entered digits to the 'action' URL. RestComm waits until completing the execution of all nested verbs before beginning the timeout period.

finishOnKey. The 'finishOnKey' attribute lets you choose one value that submits the received data when entered. For example, if you set 'finishOnKey' to '#' and the user enters '1234#', RestComm will immediately stop waiting for more input when the '#' is received and will submit "Digits=1234" to the 'action' URL. Note that the 'finishOnKey' value is not sent. The allowed values are the digits 0-9, '#' , '*' and the empty string (set 'finishOnKey' to ''). If the empty string is used, <Gather> captures all input and no key will end the <Gather> when pressed. In this case RestComm will submit the entered digits to the 'action' URL only after the timeout has been reached. The value can only be a single character.

numDigits. The 'numDigits' attribute lets you set the number of digits you are expecting, and submits the data to the 'action' URL once the caller enters that number of digits.

Nesting. You can nest the following verbs within <Gather>: <Say>, <Play>, <Pause>

Examples. For an example of how to use the <Gather> verb see below.

			<Response>
				<Gather action="handle-user-input.php" numDigits="1">
					<Say>Welcome to TPS.</Say>
					<Say>For store hours, press 1.</Say>
					<Say>To speak to an agent, press 2.</Say>
					<Say>To check your package status, press 3.</Say>
				</Gather>
				<!-- If customer doesn't input anything, prompt and try again. -->
				<Say>Sorry, I didn't get your response.</Say>
				<Redirect>handle-incoming-call.xml</Redirect>
			</Response>
		

The <Record> verb records the caller's voice and returns to you the URL of a file containing the audio recording.


action. The 'action' attribute takes an absolute or relative URL as a value. When recording is finished RestComm will make a GET or POST request to this URL including the parameters below. If no 'action' is provided, <Record> will default to requesting the current document's URL. After making this request, RestComm will continue the current call using the RCML received in your response. Any RCML verbs occuring after a <Record> are unreachable. There is one exception: if RestComm receives an empty recording, it will not make a request to the 'action' URL. The current call flow will continue with the next verb in the current RCML document.


method. The 'method' attribute takes the value 'GET' or 'POST'. This tells RestComm whether to request the URL via HTTP GET or POST.

timeout. The 'timeout' attribute tells RestComm to end the recording after a number of seconds of silence has passed.

finishOnKey. The 'finishOnKey' attribute lets you choose a set of digits that end the recording when entered. For example, if you set 'finishOnKey' to '#' and the caller presses '#', RestComm will immediately stop recording and submit 'RecordingUrl', 'RecordingDuration', and the '#' as parameters in a request to the 'action' URL. The allowed values are the digits 0-9, '#' and '*'. Unlike <Gather>, you may specify more than one character as a 'finishOnKey' value.

maxLength. The 'maxLength' attribute lets you set the maximum length for the recording in seconds.

transcribe. The 'transcribe' attribute tells RestComm that you would like a text representation of the audio of the recording.

transcribeCallback. The 'transcribeCallback' attribute is used in conjunction with the 'transcribe' attribute. It allows you to specify a URL to which RestComm will make an asynchronous POST request when the transcription is complete. This is not a request for RCML and the response will not change call flow, but the request will contain the standard RCML request parameters as well as 'TranscriptionStatus', 'TranscriptionText', 'TranscriptionUrl' and 'RecordingUrl'. If 'transcribeCallback' is specified, then there is no need to specify 'transcribe=true'. It is implied. If you specify 'transcribe=true' without a 'transcribeCallback', the completed transcription will be stored for you to retrieve later (see the REST API Transcriptions section), but RestComm will not asynchronously notify your application.


playBeep. The 'playBeep' attribute allows you to toggle between playing a sound before the start of a recording.

Nesting. The <Record> verb can not have any other verbs or nouns nested.

Examples. For an example of how to use the <Record> verb see below.

		<Response>
			<Record maxLength="30"/>
		</Response>
		

The <Fax> verb sends a fax to some a fax machine.


to. The 'to' attribute takes a valid E.164 phone number as a value. RestComm will send a fax to this number. When sending a fax during an incoming call, 'to' defaults to the caller. When sending an fax during an outgoing call, 'to' defaults to the called party. The value of 'to' must be a valid phone number.

from. The 'from' attribute takes a valid E.164 phone number as an argument. When sending a fax during an incoming call, 'from' defaults to the calling party. When sending a fax during an outgoing call, 'from' defaults to the called party. The value of 'from' must be a valid phone number.

action. The 'action' attribute takes a URL as an argument. After processing the <Fax> verb, RestComm will make a GET or POST request to this URL with the form parameters 'FaxStatus' and 'FaxSid'. Using an 'action' URL, your application can receive synchronous notification that the message was successfully enqueued. If you provide an 'action' URL, RestComm will use the RCML received in your response to the 'action' URL request to continue the current call. Any RCML verbs occuring after a <Fax> which specifies an 'action' attribute are unreachable. If no 'action' is provided, <Fax> will finish and RestComm will move on to the next RCML verb in the document. If there is no next verb, RestComm will end the phone call.


method. The 'method' attribute takes the value 'GET' or 'POST'. This tells RestComm whether to request the 'action' URL via HTTP GET or POST. This attribute is modeled after the HTML form 'method' attribute.

statusCallback. The 'statusCallback' attribute takes a URL as an argument. When the fax is actually sent, or if sending fails, RestComm will make an asynchronous POST request to this URL with the parameters 'FaxStatus' and 'FaxSid'. Note, 'statusCallback' always uses HTTP POST to request the given url.


Nesting. The <Fax> verb can not have any other verbs or nouns nested.

Examples. For an example of how to use the <Fax> verb see below.

		<Response>
			<Fax>This is a test fax.</Fax>
		</Response>
		

The <Sms> verb sends an SMS message to a phone number during a phone call.


to. The 'to' attribute takes a valid E.164 phone number as a value. RestComm will send an SMS message to this number. When sending an SMS during an incoming call, 'to' defaults to the caller. When sending an SMS during an outgoing call, 'to' defaults to the called party. The value of 'to' must be a valid phone number.

from. The 'from' attribute takes a valid E.164 phone number as an argument. When sending an SMS during an incoming call, 'from' defaults to the calling party. When sending an SMS during an outgoing call, 'from' defaults to the called party.

action. The 'action' attribute takes a URL as an argument. After processing the <Sms> verb, RestComm will make a GET or POST request to this URL with the form parameters 'SmsStatus' and 'SmsSid'. Using an 'action' URL, your application can receive synchronous notification that the message was successfully enqueued. If you provide an 'action' URL, RestComm will use the RCML received in your response to the 'action' URL request to continue the current call. Any RCML verbs occuring after an <Sms> which specifies an 'action' attribute are unreachable. If no 'action' is provided, <Sms> will finish and RestComm will move on to the next RCML verb in the document. If there is no next verb, RestComm will end the phone call.

method. The 'method' attribute takes the value 'GET' or 'POST'. This tells RestComm whether to request the 'action' URL via HTTP GET or POST. This attribute is modeled after the HTML form 'method' attribute.

statusCallback. The 'statusCallback' attribute takes a URL as an argument. When the SMS message is actually sent, or if sending fails, RestComm will make an asynchronous POST request to this URL with the parameters 'SmsStatus' and 'SmsSid'. Note, 'statusCallback' always uses HTTP POST to request the given url.


Nesting. The <Sms> verb can not have any other verbs or nouns nested.

Examples. For an example of how to use the <Sms> verb see below.

		<Response>
			<Sms>Hello World!</Sms>
		</Response>
		

Sms Custom headers

Restcomm will check for any custom headers and make use of them.

In case of an incoming SMS (incoming SIP MESSAGE) Restcomm will scan the message for any headers starting with X- and if any found will be send to the application server with the request (part of the query string in the case of HTTP GET or part of the message body in the case of HTTP POST)

The application server can also provide some custom http headers (again starting with X-) along with the RCML response, that Restcomm will store and use them when creating the outgoing SMS message (in the case of RCML response is Sms).

The <Dial> verb connects the current caller to another phone. If the called party picks up, the two parties are connected and can communicate until one hangs up. If the called party does not pick up, if a busy signal is received, or if the number doesn't exist, the dial verb will finish.


action. The 'action' attribute takes a URL as an argument. When the dialed call ends, RestComm will make a GET or POST request to this URL including the parameters below. If you provide an 'action' URL, RestComm will continue the current call after the dialed party has hung up, using the RCML received in your response to the 'action' URL request. Any RCML verbs occuring after a <Dial> which specifies an 'action' attribute are unreachable. If no 'action' is provided, <Dial> will finish and RestComm will move on to the next RCML verb in the document. If there is no next verb, RestComm will end the phone call.



method. The 'method' attribute takes the value 'GET' or 'POST'. This tells RestComm whether to request the 'action' URL via HTTP GET or POST. This attribute is modeled after the HTML form 'method' attribute.

timeout. The 'timeout' attribute sets the limit in seconds that <Dial> waits for the called party to answer the call.

timelimit. The 'timeLimit' attribute sets the maximum duration of the <Dial> in seconds.

callerId. The 'callerId' attribute lets you specify the caller ID that will appear to the called party when RestComm calls. By default, when you put a <Dial> in your RCML response to RestComm's inbound call request, the caller ID that the dialed party sees is the inbound caller's caller ID. If you are dialing to a <Client>, you can set a client identifier as the callerId attribute. For instance, if you've set up a client for incoming calls and you are dialing to it, you could set the callerId attribute to client:thomas.

record. The 'record' attribute lets you specify whether the call will be recorded or not. By default, the call is not recorded. If you set the attribute to 'true' Restcomm will start recording when the two calls are bridged

Record attribute for Dial Conference

The current release of Restcomm doesn't support recording for Dial Conference. This feature will be available in the next release

Nesting. You can nest the following nouns within <Dial>: <Number>, <Client>, <Conference>

Examples. For examples of how to use the <Dial> verb see below.

		<Response>
			<Dial>1-444-555-666</Dial>
		</Response>
		
		<Response>
			<Dial record="true">1-444-555-666</Dial>
		</Response>
		
		<Response>
			<Dial callerId="1555666777" record="true">1-444-555-666</Dial>
		</Response>
		

The <Conference> noun allows you to connect to a named conference room and talk with the other callers who have also connected to that room. The name of the room is up to you and is namespaced to your account.


muted. The 'muted' attribute lets you specify whether a participant can speak in the conference. If this attribute is set to 'true', the participant will only be able to listen to people in the conference.

beep. The 'beep' attribute lets you specify whether a notification beep is played to the conference when a participant joins or leaves the conference.

startConferenceOnEnter. This attribute tells a conference to start when this participant joins the conference, if it is not already started. If this is false and the participant joins a conference that has not started, they are muted and hear background music until a participant joins where startConferenceOnEnter is true. This is useful for implementing moderated conferences.

endConferenceOnExit. If a participant has this attribute set to 'true', then when that participant leaves, the conference ends and all other participants drop out. This is useful for implementing moderated conferences that bridge two calls and allow either call leg to continue executing RCML if the other hangs up.

waitUrl. The 'waitUrl' attribute lets you specify a URL for music that plays before the conference has started. The URL may be a WAV or a RCML document that uses <Play> or <Say> for content. This defaults to a selection of Creative Commons licensed background music, but you can replace it with your own music and messages. If the 'waitUrl' responds with RCML, RestComm will only process <Play>, <Say>, and <Redirect> verbs. If you do not wish anything to play while waiting for the conference to start, specify the empty string (set 'waitUrl' to '').

waitMethod. This attribute indicates which HTTP method to use when requesting 'waitUrl'. It defaults to 'POST'. Be sure to use 'GET' if you are directly requesting static audio files such as WAV files so that RestComm properly caches the files.

maxParticipants. This attribute indicates the maximum number of participants you want to allow within a named conference room. The default maximum number of participants is 40. The value must be a positive integer less than or equal to 100.

Examples. For an example of how to use the <Conference> noun see below.

			<Response>
				<Dial>
					<Conference>1234</Conference>
				</Dial>
			</Response>
			

The <Sip> noun specifies a SIP URI to dial. You can use multiple <Sip> nouns within a <Dial> verb to simultaneously attempt a connection with many user agents at once. The first user agent to accept the incoming connection is connected to the call and the other connection attempts are canceled.

The Dial verb's Sip noun lets you set up VoIP sessions by using SIP -- Session Initiation Protocol. With this feature, you can send a call to any SIP endpoint. Set up your RCML to use the Sip noun within the Dial verb.

Currently, only one Sip noun may be specified per Dial, and the INVITE message may be sent to only one SIP endpoint. Also, you cannot add any other nouns (eg Number, Client) in the same Dial as the SIP. If you want to use another noun, set up a callback on the Dial to use alternate methods.

Examples. For an example of how to use the <Sip> noun see below.

			<Response>
				<Dial>
					<Sip>sip:alice@127.0.0.1:5080</Sip>
				</Dial>
			</Response>
			

Authentication . 

Send username and password attributes for authentication to your SIP infrastructure as attributes on the Sip noun.


Authentication Example . 



<?xml version="1.0" encoding="UTF-8"?>
<Response>
	<Dial>
		<Sip username="alice" password="secret">sip:alice@example.com</Sip>
	</Dial>
</Response>


Custom headers. 

Send custom headers by appending them to the SIP URI -- just as you'd pass headers in a URI over HTTP. For example:



<?xml version="1.0" encoding="UTF-8"?>
<Response>
	<Dial>
		<Sip>
		sip:alice@example.com?mycustomheader=tata&myotherheader=toto
		</Sip>
	</Dial>
</Response>


Character Limit

While the SIP URI itself must be under 255 chars, the headers must be under 1024 characters.

Transport. 

Set a parameter on your SIP URI to specify what transport protocol you want to use. Currently, this is limited to TCP and UDP. By default, Restcomm sends your SIP INVITE over UDP. Change this by using the transport parameter:



<?xml version="1.0" encoding="UTF-8"?>
<Response>
	<Dial>
		<Sip>
		sip:alice@example.com;transport=tcp
		</Sip>
	</Dial>
</Response>


Attributes. 


The url attribute allows you to specify a url for a RCML document that runs on the called party's end, after they answer, but before the two parties are connected. You can use this RCML to privately Play or Say information to the called party, or provide a chance to decline the phone call using Gather and Hangup. The current caller continues to hear ringing while the RCML document executes on the other end. RCML documents executed in this manner cannot contain the Dial verb.

method. 

The method attribute allows you to specify which HTTP method Restcomm should use when requesting the URL specified in the url attribute. The default is POST.

Call Screening HTTP parameters. 

When a call is answered, Restcomm passes the following parameters with its request to your screening URL (in addition to the standard RCML Voice request parameters):


Dial Action HTTP parameters. 

Use the action callback parameters to modify your application based on the results of the SIP dial attempt:


Dial with Multiple Examples. 

A more complex Dial, specifying custom settings as attributes on Dial, including call screening and setting the protocol to TCP.



<?xml version="1.0" encoding="UTF-8"?>
<Response>
	<Dial
		record="true"
		timeout="10"
		hangupOnStar="true"
		callerId="bob"
		method="POST"
		action="/handle_post_dial">
	<Sip
		method="POST"
		url="/handle_screening_on_answer">
		sip:alice@example.com?customheader=foo
	</Sip>
	</Dial>
</Response>


The UssdCollect verb is a USSD integration with Restcomm resource. When fully configured with a USSD gateway, Restcomm will send all UssdMessage to the configured gateway

Example. For an example of how to use the USSDCollect verb see below.

	
	<Response>
		<UssdCollect action="http://my.controller.net">
			<UssdMessage> 1 for first option</UssdMessage>
			<UssdMessage> 2 for first option</UssdMessage>
			<UssdMessage> 3 for first option</UssdMessage>
		</UssdCollect>
	</Response>
	
		

The UssdMessage verb contains the message that Restcomm will send to the USSD gateway

Nesting. The UssdMessage can be nested inside of the USSDCollect verb.

Examples. For an example of how to use the USSDCollect verb see below.

	
	<Response>
		<UssdMessage>Test USSD Message</UssdMessage></UssdCollect>
	</Response>
	
		

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 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.

The admin user interface is a great way to perform repetive Restcomm task in a orderly manner. Care has been taken to make the user experience intuitive for those new to the platform. In this chapter, you will learn how to use some of the features available to create Clients, Phone Numbers, Check Call Logs, Get Speech-to-Text Transcription and many more

Please also visit the official Telestax documentation page for more usage tutorials:http://www.telestax.com/docs

This will show the default demo applications that come with Restcomm. When you start creating applications and attaching numbers, they will also be displayed on this page.


Restcomm Visual Designer is a practical feature that lets you create applications easily using a GUI based interface.

Please also visit the official Telestax documentation page for more usage tutorials:http://www.telestax.com/docs

In order to access the designer, open your web browser and go to this url http://127.0.0.1:8080/restcomm-rvd. This page lets you select which type of project you will like to create. There are three options, Voice, USSD and SMS.

In this section, you will learn how to build a sample application.

Create a new project called Demo. The result will be similar to the screenshot below.

Press the save button and click on the Startup Url to make sure the project is correctly saved. The result will be similar to the screenshot below.

Next you need to go to the Restcomm Admin User Interface http://127.0.0.1:8080/restcomm-management/ . Login and press the menu "Numbers", then press the button, "Register Number". You will see a window similar to the screenshot below.

Leave Account SID as default. Enter a "Phone Number" you want to use. In the demo we shall be using 9999.

Under "Voice" -> Voice Request URL, click on the List icon to reveal the Demo application you created using the Restcomm Visual Designer. See screenshot below.

Press "Register" to save your work and return to the list of available phone numbers.

You have just created a new phone number "9999" and have linked it to your Demo application. See below.

You can then start a SIP phone to test your Demo application. Note that you must have enabled Text-to-speech for this application to work. See the Getting started chapter to learn how to configure VoiceRSS.

In this chapter, you will learn how to use more advanced features of Restcomm verbs to create communications applications

You must get an API key from http://www.voicerss.org in order to proceed with this section. You can register for a free account and an API key will be emailed to you. Once you have the API key, open the $RESTCOMM_HOME/standalone/deployments/restcomm.war/WEB-INF/conf/restcomm.xml file and find the speech-synthesizer VoiceRSS section. Add your API key as shown below and restart RestComm


<speech-synthesizer
		class="org.mobicents.servlet.restcomm.tts.VoiceRSSSpeechSynthesizer">
		<service-root>http://api.voicerss.org</service-root>
		<apikey>2901c0aXXXXXXXXXXXXXX</apikey>

Once you have done that, you are ready to use Text-to-Speech feature of RestComm.

Create a file called test.xml in the $RESTCOMM_HOME/standalone/deployments/restcomm.war/demos/ directory and copy the content of the application below into the test.xml file and save it


<?xml version="1.0" encoding="UTF-8"?>
<Response>
        <Say>Welcome to RestComm, you have successfully tested the Say Verb</Say>
</Response>

From a command terminal run the Curl command below to bind the 5555 phone number to the test.xml file.


curl -X POST  http://ACae6e420f425248d6a26948c17a9e2acf:77f8c12cc7b8f8423e5c38b035249166@127.0.0.1:8080/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/IncomingPhoneNumbers.json -d "PhoneNumber=5555" -d "VoiceUrl=http://127.0.0.1:8080/restcomm/demos/test.xml"


If the command is successful, you will see an output similar to the following:


{
  "sid": "PN0834628c131e4b66bc862ae0b21b7cfa",
  "account_sid": "ACae6e420f425248d6a26948c17a9e2acf",
  "friendly_name": "5555",
  "phone_number": "+15555",
  "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-08-15T17:45:21.409-06:00",
  "date_updated": "2013-08-15T17:45:21.409-06:00",
  "sms_method": "POST",
  "sms_fallback_method": "POST",
  "api_version": "2012-04-24",
  "uri": "/restcomm/2012-04-24/Accounts/ACae6e420f425248d6a26948c17a9e2acf/IncomingPhoneNumbers/PN0834628c131e4b66bc862ae0b21b7cfa.json"

Next, you have to configure your SIP phone and make a call to the test.xml dialing number 5555

Start the SIP phone Ekiga (see below) and dial 5555@127.0.0.1:5080. You will hear the content of the Say Verb in the test.xml file.

This verb is used to get user input and instruct RestComm to perform a specific task. This example is a little bit more elaborate and it will require the creation of a php file. You also must host the php file on a web server like Apache. Copy the Gather application below into the test.xml and save the file.


<?xml version="1.0" encoding="UTF-8"?>
<Response>
	 <Gather action="http://127.0.0.1/test-user-input.php" numDigits="1">
		 <Say>Welcome to Telestax RestCom.</Say>
		 <Say>For opening hours, press 1.</Say>
		 <Say>to talk to Alice, press 2.</Say>
	 </Gather>
 <!-- If customer doesn't input anything, prompt and try again. -->
	 <Say>Sorry, I didn't get your response.</Say>
	 <Redirect>http://127.0.0.1:8080/restcomm/demos/test.xml</Redirect>
 </Response>

Create a php file in the Apache /var/www/html directory. 

You can use any web server of your choice, in this example, we shall be using Apache on a Linux computer

Start the httpd server as follows sudo service httpd start

Create a new file called test-user-input.php in the /var/www/html directory

Copy the php application below into the test-user-input.php and save


<?php
    header('Content-type: text/xml');
    echo '<?xml version="1.0" encoding="UTF-8"?>';
 
    echo '<Response>';
 
    $user_input = (int) ($_POST['Digits']);
 
    if ($user_input == 1)
        
    {
         echo '<Say>Our Opening hours are 24 hours 7 Days a week </Say>';
        echo '<Say>Telestax appreciates your business</Say>';
        echo '<Say>You may Hang up or wait to be redirected to the main menu</Say>';
        echo '<Redirect>http://127.0.0.1:8080/restcomm/demos/test.xml</Redirect>';
   
    }  elseif($user_input == 2) {
 
        echo '<Say>You are being forwarded to Alice</Say>';
        echo '<Dial callerid="+1234568789">';
        echo '<Client>alice</Client>';
	echo '</Dial>';

     } 
    echo '</Response>';
?>

This example welcomes the user and offers two options. If the user presses 1, he hears the openining hours message. If the user presses 2, he will be redirected to user Alice.

To test the application using the Gather verb, dial any number from user Bob and follow the application instruction.