Community Documentation

Working with VoIP Drupal scripts

Last updated May 26, 2011. Created by leoburd on March 2, 2011.
Log in to edit this page.

“VoIP scripts” (a.k.a. "dialplan scripts") enable the creation of the voice menus and interactivity that are so characteristic of Internet telephony.

In technical terms, they are objects of the class VoipScript and contain, among other things, a sequence of commands and a set of variables that, together, define the behavior and the current state of VoIP Drupal calls.

The main methods of the VoipScript class include:

Input and output methods

  • addBeep(), to play a beep sound
  • addSetLanguage(), to set the default text-to-speech language of the script
  • addSetVoice(), to set the default text-to-speech voice of the script
  • addGetInput(), to read input from the telephone keypad
  • addRecord(), to record audio input from the user
  • addRunIvrMenu(), to execute an interactive voice menu
  • addSay(), to play audio and use text-to-speech to read text to the user

Variable-related commands

  • addSet(), to set specific variables with the result of calls to PHP and Drupal functions

Script control commands

  • addGosub(), to load a different script and store the existing one in a stack
  • addReturn(), to return to the last script stored in the stack
  • addGoto(), to skip to a different command inside the current script
  • addGotoIf(), to skip to a different command inside the script only if the specified condition is TRUE.
  • addLabel(), to define the destination of goto and gotoIf commands

Call control commands

  • addHangup(), to hangup the call
  • addReject(), to reject an incoming call before its answered
  • addDial(), to divert an ongoing call to a different destination
  • addJoinConference(), to organize conference calls
  • addSendSms(), to send text messages from inside the call

Error handling commands

  • addLog(), to log messages from inside the script execution
  • isError(), to check if a script error occurred
  • getErrorMessage(), to retrieve the error description

Note: To learn about the specific parameters and outputs associated with the commands above, please check their definition in the voipscript.inc file of the voipdrupal project.

Site Building Guide

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.