Dial Plan
From sipsorcery
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)
- GoogleVoiceSMS (username, password, number, message)
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
- 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.
- StartTransaction()
- CommitTransaction()
- RollbackTransaction()
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.
- id 2623 Flexible table-controlled dialplan, Version 2
- id 1634 Flexible table-controlled dialplan, optimized for US, GV
- id 1678 Alternate Google Voice Accounts
- Complex Dial Plan with CNAM lookup on code.google.com
- Simple Dial Plan with CNAM lookup and VM on code.google.com
- Phone-Controlled Google Voice Outbound Dial Plan by doohickey
- How-to: multi-forward incoming GV calls to Sipsorcery
Misc
- Fully featured Dial plan My "One for All" Ruby plan ** Updated 08-Oct-08
- ENUM
- CNAM - Caller ID lookup
- Speed Dial
- Time-sensitive inward dialing
- Call Hunting
- Simulring
- Number Formatter See forum.
- Voicemail
- Inbound SipBroker CNAM rewrite for compatibility [1]