Sample UAS Applications

The following samples illustrate how to use the .NET UAS application framework to create simple UAS applications that handle inbound and outbound calls, play and record wav files, play and detect DTMF digits, perform call connection , transfer and conferencing.

C# and VB versions of all samples are provided. A subset of samples are also provided in F# and C++.

Please note that in the interests of clarity these samples are short on the kind of error handling and diagnostic aspects that would typically be required in a live environment.

  • Where to Find Them
They are included in the .NET UAS download package and located in the <UAS installation folder>\Samples\UASApplications folder under a folder for each .NET language.
Pre-built versions of all of these samples are provided in the bin subfolder.

  • How to Build Them
Each sample contains a project file (e.g. .csproj or .vbproj) that builds the application dll from Visual Studio.

  • How to Install and Configure Them
Use the UAS Management Console to install a built application.
Use either the Inbound Services and Outbound Services page on cloud.aculab.comyour Rapide web site to configure a service that will invoke an application.

The service configuration settings (applicationParameters, outboundParameters and extraChannels) are shown in [brackets]s below each application.

  • How to Run Them
An inbound sample can be run by making a telephone call to the service you have configured to call it.

An outbound sample can be run by pressing the 'test' icon for the service you have configured to call it on the Outbound Services page or by using the service_start web service via the InvokeOutboundService web service client sample.

  • Media Files
Some of these samples play or record media files. These files reside on the cloud and may be manually uploaded or downloaded via the Files / Media page of cloud.aculab.comyour Rapide web site.

  • Local Database
The database and voicemail4 samples access a local SQLEXPRESS database 'test'. See Tutorial - Database for instructions on preparing this database.

Note: Rapide does not currently support Transfer.

The Samples:

AddToConference ConnectToConference

An inbound application that prompts the user to enter a 4-digit pin that represents a conference to which they are then transferred connected.
[1 extra channel]

Database2

An inbound application that opens a local database of pincodes and associated ages, answers the call and prompts the caller to enter a four digit pin code. It then queries the database for the age associated with the entered pin code and says it to the caller.
[none]

Database3

Extends the Database2 sample to provide the caller with the option of modifying the age within the database.
[none]

Database4

Extends the Database3 sample to provide the caller with the option of adding a new entry if the pin code is not within the database.
[none]

InboundConnect

An inbound application that answers the inbound call and plays some music (passed in) to it while making an outbound call to a destination address (passed in). When this is answered it detects whether a live speaker answers and if it is, connects it to the inbound call. It then waits for either of the calls to be hung up.

The Caller Id (callFrom) that is to be used when calling out should also be supplied in the applicationsParameters field. For outgoing SIP calls this can be empty, but for outgoing PSTN calls see the Outbound Calls documentation for your platform.

[applicationParameters = destination;Caller Id;hold_music_file]
[1 extra channel]
e.g.
applicationParameters = "sip:bob@bobscompany.com;;/wavs/holdmusic.wav"
or
applicationParameters = "441908876543;441908273800;/wavs/holdmusic.wav"


An inbound application that simply plays a wav file (filename passed in) to the caller then hangs up.
[applicationParameters = the wav filename]

InboundPlayWav

An inbound application that simply plays a wav file (filename passed in) to the caller then hangs up.
[applicationParameters = the wav filename]

InboundReceiveFax

An inbound application that answers a call and receives a fax from that call. The received fax is saved to a TIFF file name constructed from the user part of the callFrom field and the current date.
Fax receiving can be enabled for a particular service by editing the service entry from the Inbound Services page.
[Enable Fax Receive = enabled in the service invoking this application]

InboundWithSpeech

An inbound application that prompts the caller to say some text then reads the recognised text back to the caller and hangs up.

InboundWithTTS

An inbound application that simply says some text (passed in) to the caller then hangs up.
[applicationParameters = the text to say]

OutboundConnect

An outbound application that makes calls to two destination addresses (passed in). It prompts the first call to record a message and plays this to the second call before tromboning the two calls together. It then waits for the calls to be hung up.
[outboundParameters = two destination addresses for the outgoing call, semicolon delimited]
[1 extra channel]
e.g.
outboundParameters = "sip:bob@bobscompany.com;sip:brian@brianscompany.com"
applicationParameters = ""
or
outboundParameters = "441908081876;441908678180"
applicationParameters = "441908876543"

OutboundReminder

An outbound application that makes a call to a destination address (passed in) from a source address (passed in) and says a text string (also passed in) and optionally plays a wav file (also passed in, but can be omitted) to that call.
[outboundParameters = destination address;source address;text to say;wav filename]
e.g.
outboundParameters = "sip:bob@bobscompany.com;;Time for your meeting"
or
outboundParameters = "441908081876;441908876543;Time for your meeting;alarm.wav"

OutboundSendFax

An outbound application that makes a call to a destination address (passed in) from a source address (passed in) and sends a fax to that call. The fax is constructed from a single header page and 1 or more content pages. The header page is obtained from a TIFF file specified in the service's application parameters. The content pages are obtained from a TIFF file specified in the outboundParameters. A page number is inserted into each page before sending.
Fax sending can be enabled for a particular service by editing the service entry from the Outbound Services (or Inbound Services) page.
[Enable Fax Send = enabled in the service invoking this application]
[outboundParameters = destination address;source address;file name of fax]
[applicationParameters = file name (.tif) of header page] (optional)
e.g.
outboundParameters = "sip:bob@bobscompany.com;;ContractFax.tif"
or
outboundParameters = "441908081876;441908876543;ContractFax.tif"

PinInput

An inbound application that answers the call, prompts for the caller to enter a 4 digit pin code. It waits for 30 seconds for 4 digits to be entered and replays them to the caller.
[none]

QuickStart

A simple inbound application that is provided as the default Developer Service Target Entry. It rings the call for 4 seconds, answers the call, then reads out the decoded pincode and username from the called address before hanging up.
[none]

TransferMenu

An inbound application that prompts the user to select an Inbound Service target to be transferred to. A prompt (to be read out) and the service (to be transferred to) need to be listed at service registration.
[applicationParameters/app_args = semicolon delimited list of prompt,servicename
e.g.
"join a conference, AddToConferenceService;
listen to media file, InboundPlayMusicService"]
[1 extra channel]

UASConnectionTest

A simplified inbound application that rings the call for 2 seconds, answers the call, then reads out some text including the machine name on which the UAS is running and the application parameters sent to the application, before hanging up.
[optional: applicationParameters = text to say]

Voicemail1

An inbound application that answers the call, prompts the caller to record a message (and to press any key to stop recording), plays a beep to indicate it is recording and then waits for a max of 60 seconds.
The recorded filename is samples/voicemail1/recordedMessageFromcallFrom.wav. It checks that a recorded message file exists.
[none]

Voicemail2

An inbound application that answers the call, loops round prompting the caller to record a message and playing it back to them until they are satisfied with it.
The recorded filename is samples/voicemail2/recordedMessageFromcallFrom.wav.
[none]

Voicemail3

An inbound application that answers the call, says "Welcome to the voicemail server for name." name is obtained from applicationParameters. It is compared with the user part of the callFrom property of the inbound call.

If callFrom equals name
- Say "Press 1 to hear all messages, press 2 to delete all messages".
- 1. Play all existing messages
- 2. Delete all existing messages
else
- Do recording as in voicemail 2.

All options return to the above menu.
The app only completes when the call is hung up.
The recorded filename is samples/voicemail3/name/msgcounter.wav.
The counter is a variable, initialised to 1, which increments each time a message is successfully saved.
[applicationParameters = name of voicemailbox (e.g. calling number)]

Voicemail4

Extends the voicemail3 sample so that option 1 additionally allows each message to be deleted after it is played. Also it adds a third option to record a welcome message to be played after the call is answered.

To avoid any eventual consistency issues with media file storage the list of recorded message files is saved in a local SQLEXPRESS database.
[applicationParameters = name of voicemailbox (e.g. calling number)]