Dial Plan

From sipsorcery

Jump to: navigation, search

SIP Sorcery dialplans can be written as either Ruby scripts or as line-by-line plans somewhat similar to Asterisk dialplans.

The Ruby script dialplan is used is executed linearly. Upon a SIP 200 response, it stop executing.

The extension dialplan is no longer under development and only supports Dial and Respond.


Contents

Function List

You can brush up on your Ruby Syntax.

All functions are written as sys.function_name - don't forget the sys!

Standard SIP and Outgoing Calls

  • Dial (string dialString)
  • GoogleVoiceCall (string emailAddress, string password, string forwardingNumber, string destinationNumber, string fromUserToMatch, int phoneType, int callbackTimeout) Places an outbound call via the Google Voice service.
  • Respond (int SIPResponseCode, string information) Provides a SIP response to the UA. >=200 will terminate the SIP Sorcery script execution.
  • Callback (string leg1, string leg2) Dials 2 legs and connects them together.

Other Communication

  • WebGet (string url) Sends a HTTP GET request and returns the result to the dialplan.
  • 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.
  • GTalk (string fromuser, string frompassword, string touser, string message) Sends GTalk message from fromuser@gmail.com to touser@gmail.com. Note that you must get fromuser and touser to know each other by sending an invitation to GTalk chat (from GMail webpage, for example)

Misc Functions

  • GetCurrentCallCount() Returns the number of calls currently in progress for the calling user. Unfortunately, with multiple in-users, this may be checking the wrong username.
  • CallsInProgress() Returns an array with the list of all calls - both legs - that are currently in progress on your account.
  • DoesSIPAccountExist (string username) Returns true if the specified SIP Account exists on the system, false otherwise.
  • IsAvailable() Returns true if the account has a current UA registered to sip sorcery. Unfortunately, with multiple in-users, this may be checking the wrong username.
  • sys.trace= (false|true) - whether or not a full trace should be emailed to the address stored on the dial plan. It may be changed partway through the script, e.g. if something failed.

Database Functions

SIP Header Functions

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

Code Vault

Google Voice Calling

Most of the awesome Dial Plans optimized for Google Voice have been written by Mike Telis.

Misc

Personal tools