Creating a Click to Call Application w/Speech Server (2007)

The term "Click to Call" is thrown around a bit to mean slightly different things. In this post I'm going to show you how to create a web based interface, in which end users can type their name and phone number and have your Speech Server (2007) application call them.

This sounds more diffcult than it actually is. Speech Server (2007) uses MSMQ to place outbound calls, meaning that my website only has to write messages to MSMQ to trigger an Outbound Call in Speech Server. When I write items to MSMQ I just need to pass it parameters such as phone number to call, the person's name, etc..

Step 1
Create a Private Transactional Queue in MSMQ and give it a name.

Step 2
Create an ASP.NET Website with input fields for both Name and Phone Number, along with a Submit Button.

Step 3
Add the MSMQ to the Code Behind for the Submit button, using the name of the Queue you created in Step 1. Add a reference to System.Messaging

protected void btnCallNow_Click(object sender, EventArgs e)
{

string outboundInfo = string.Format("OutboundPhoneNumber={0}&Name={1}", this.tbNumber.Text, this.tbName.Text);

MessageQueue queue = new MessageQueue(@".\private$\OutboundCallMe");
Message message = new Message(outboundInfo);

MessageQueueTransaction transaction = new MessageQueueTransaction();

transaction.Begin();
queue.Send(message, transaction);
transaction.Commit();

}

Step 4
Create a Speech Server application which will read the values from the query string, and use them to place an outbound call.

You could have a Code Activity prior to the Make Call Activity which will set the value based on the Queue object, as well as set the statement prompt which will speak the person's name.

private void setOutbound_ExecuteCode(object sender, EventArgs e)
{

this.makeCall.CalledParty = QueryString["OutboundPhoneNumber"];
this.makeCall.CallingParty = "5554861";

this.sayWelcome.MainPrompt.SetText("Hello {0}", QueryString["Name"]);

}

Step 5
In the Speech Server Administrator Console, Set the Outbound Queue property to the name of Queue created in Step 1.

Very little Code to create a simple "Click to Call" web based application...