SIP Sorcery Help - Dial Plans

Back to Contents

For additional help or questions a community forum is available here.

Dial Plan Applications

The SIP Sorcery dialplans can be written as either Ruby scripts or as line-by-line plans somewhat similar to Asterisk dialplans. It is recommended that the Ruby script dialplan is used as the line-by-line plan is no longer under development and does not provide access to any dialplan applications except for Dial and Respond.

Ruby Dial Plan Applications (incomplete)

Dial(string dialString)
Initiates a call to one or more SIP end points and when the first call is answered will bridge it with the SIP user agent that initiated the application. The Dial command takes a dial string as a parameter and it controls the order, delay and other types of beahviours for the forwarded call requests. The syntax of the dial string is best demonstrated by an example:

sys.Dial("123@provider1&456@provider2[dt=5]|789@provider3")

The call sequence of this command will be:

If at any point one of the forwards answered all other forwards are cancelled and the dialplan execution terminates. The additional options that can be used on each call leg are:

sys.Dial("123@provider1[rm=a,cd=3600]&456@provider2[dt=5,rm=a,cd=600]")

DBWrite(string key, string value)
Writes a keyed value to the database.

DBRead(string key)
Reads a keyed value from database.

DBDelete(string key)
Deletes a keyed value from database.

WebGet(string url)
Sends a HTTP GET request and returns the result to the dialplan.

GetCurrentCallCount()
Returns the number of calls currently in progress for the calling user.

DoesSIPAccountExist(string username)
Returns true if the specified SIP Account exists on the system, false otherwise.

SetCustomSIPHeader(string header, string value)
Sets a custom SIP header that will be added to all subsequent calls.

RemoveCustomSIPHeader(string header)
Removes the custom SIP header from the list.

ClearCustomSIPHeaders()
Clears all custom SIP headers from the list.

PrintCustomSIPHeaders()
Prints custom SIP headers to the monitoring console.

SetFromHeader(string fromName, string fromUser, string fromHost)
Sets the From SIP header that will be added to all subsequent calls.

ClearFromHeader()
Resets the From SIP header.

SetCustomContent(string contentType, string content)
Sets the Content-Type SIP header and the body that will be used for all subsequent call requests.

ClearCustomBody()
Resets the custom Content-Type SIP header and the body.

Email(string to, string subject, string body)
Sends an email. This application requires authorisation which an be gained by sending a request to admin@sipsorcery.com.

GoogleVoiceCall(string emailAddress, string password, string forwardingNumber, string destinationNumber, string fromUserToMatch, int phoneType, int callbackTimeout)
Places an outbound call via the Google Voice service. The application works by initiating a callback with the a HTTP request with Google Voice. The incoming call leg of the callback is then matched to the call leg that initiated the sipsorcery dial plan execution.

- The emailAddress and password are the credentials used to login to the Google Voice portal.
- The forwardingNumber is the number to request the Google Voice callback on. Whatever this number is it needs to get the call to sipsorcery.
- The destinationNumber is the number that will be passed to the callback as the outgoing leg and is the external number that will be called.
- The fromUserToMatch is used to match the incoming callback to the SIP call that initiated the dial plan execution. By specifying this field sipsorcery will look at the From URI user, in a SIP From header of From: "Joe Bloggs" <sip:12345678@somehost.com> the From URI user is 12345678, to match the calls. The fromUserToMatch can be left blank in which case the match will assume Gizmo is the incoming call provider and will perform the match by looking for an X-GoogleVoice: true header and a SIP To URI user equal to the forwardingNumber. - The phone type used by GoogleVoice. If not specified defaults to (Mobile=2):
1 - Home
2 - Mobile
3 - Work
7 - Gizmo
- The callback timeout in seconds which is the amount of time the sipsorcery dialplan will wait for the GoogleVoice callback before giving up and continuing with the next dialplan command. The timeout must be between 5 and 60s and if not specified a default value of 30s is used.