VoiceIntroduction to CCXML, Part V

Introduction to CCXML, Part V

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

In this final introduction to the CCXML language, we will develop
a simple multi-party conferencing system in Perl.

In case you missed them, you can find previous parts in this series here:


Creating a multi-party conference call with CCXML requires a
dynamic script that is able to handle multiple callers. The first
caller is the one that creates the conference call. Subsequent
callers join in to the existing conference call. The script must
keep track of who the first caller is, and what conference call the
other parties should be connected to. For this example, what I do is
ask each caller for a conference number that must be unique for the
conference, though all parties must use the same unique conference

When the first party initiates the call, it creates an empty flag
file that corresponds to the conference number. When other parties
enter this same number, the system checks for the file. If it
exists, then the system knows that the conference is already in
session and that the caller should join the existing call as opposed
to creating a new conference call. 

This is a very simplistic method of tracking conference calls. In
a real application, you would probably use a database to keep track
of the calls. My intent was to expend as little effort as possible
to script up a Perl program that allow multiple callers to dial into
a conference call.


You can view the full source of this script here.
The main body of the script is listed below:

if (param('conference_code')) {
   my $conferenceCode = param('conference_code');

   # if conference already exists, 
   #join the conference
   if (-e "$conferenceDirectory/$conferenceCode") {
   # if first caller, create conference
   } else {

# get conference code
} else {

The logic of the code above reads as follows:

If the conference_code field was passed to the script
(meaning the user entered the 10 digit conference code) and a file
exists whose name is the same as the conference code (meaning that
someone has already created the conference call) then join the
conference; otherwise, create a new conference. If the field wasn’t
passed (meaning this is the first time the script was executed by
the caller) then we ask them for the conference number that they
would like to join (which submits the number back to the script via
the conference_code variable).

So the first caller will execute the following subroutines:

  • getConferenceCode
  • createConference

Subsequent callers would execute the following subroutines:

  • getConferenceCode
  • joinConference


The getConference subroutine in the Perl script contains
CCXML content which answers the call and plays the get_conference_code.vxml
VoiceXML dialog. This dialog prompts the caller for their conference
number, which is then returned to the CCXML program and assigned to
the conference_code variable. The value of this variable is
appended to the URL of the next attribute of the goto
element for the dialog.exit event handler:


In effect, this executes the Perl script a second time, passing
in the conference_code variable.


The createConference subroutine is executed after the
caller has provided their conference number. The script checks for
the existance of a file in the directory defined by the $conferenceDirectory
variable whose filename is the same as the conference number. If the
file doesn’t exist, we assume that this is the first caller and that
the conference needs to be created. 

One of the first things this subroutine does is in fact create
the conference token file in the $conferenceDirectory

Next, the name of the conference is set within the <createconference>
element by combining the string conference_ with the unique
conference number:

  name="conference_$conferenceCode" />

Once the conference has been successfully created, the caller
will hear a prompt indicating that they are the first caller in the

<dialogstart callid="in_callerid" 


The joinConference subroutine is executed after the caller
has provided their conference number and the main body of the script
detects that the token file for the conference number exists,
meaning that the conference call has already been initiated:

<join sessionid1="in_callerid" 
      sessionid2="conference_$conferenceCode" />

The session1 and session2 attributes of the <join>
element specify the two call legs to join, the first one being the
id of the caller joining the conference call, and the second one
being the unique conference call id.

Once the <join> is successful, a prompt indicating that the
caller has joined the conference call is played:



Things that should be added to this script in the future are
better error handling routines that would end the conference call
gracefully. Another drawback of the script is that you can never
re-use the conference numbers (unless you delete the token files).
Nonetheless, you can use this script as a template to develop more
complex conferencing solutions. If you study the script, you will
also get a better idea of the conferencing concept where the first
caller creates the conference and subsequent callers join the
conference. Joining callers to the conference involves patching the
caller’s unique caller id into the unique conference id.

About Jonathan Eisenzopf

Jonathan is a member of the Ferrum Group, LLC  which specializes in Voice Web consulting and
training. Feel free to send an
email to eisen@ferrumgroup.com
regarding questions or comments about this or any article.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories