Welcome to GotSpeech.NET Sign in | Join | Help

Handling Disconnects

Someone asked me this question today:
How do I detect a hangup in MSS 2004 R2?

So, I thought I would post my answer:

To register a jscript function to be called on hangup:

 

In each .aspx page that you want to monitor for a hang up place the following in the <body> tag:

 

<body xmlns:speech="http://schemas.microsoft.com/speech/WebControls"

onload="BodyOnLoad()">

 

 

Then create the BodyOnLoad function in your BLOCKED SCRIPT

 

function BodyOnLoad() {

RunSpeech.OnUserDisconnected = HandleDisconnect;

}

 

 

Add this function to your Jscript too.  It will be called whenever a hangup is detected:

 

function HandleDisconnect(theQA) {

    // Set a flag so that we know we've disconnected

    RunSpeech.CurrentCall().Set("CallState", "Disconnected");

    SemanticItem.SetText("-1", true);

    SpeechCommon.Submit();

}

 

HandleDisconnect Comments:

The SemanticItem is used to post back and perform some sort of server side code.  You would have to register a SemanticItem_Changed event with a server side function.


 

I copied most of this information off this thread on GotSpeech.Net forums.


Technorati Tags:


Published Friday, July 28, 2006 11:33 AM by brandontyler
Filed under:

Comments

# re: Handling Disconnects

This can get confusing for new users.

Note -

If you have a DisconnectCall control in your application that initiates the disconnect, then the OnClientDisconnected event is activated. However, if the user initiates the disconnect before the DisconnectCall control gets activated, then the RunSpeech.OnUserDisconnected event is activated.
Friday, July 28, 2006 11:42 AM by marshallharrison

# re: Handling Disconnects

You are correct sir.  This is for those hangup's that are initiated by the caller.
Friday, July 28, 2006 11:48 AM by brandontyler

# re: Handling Disconnects

I know I'm correct ;-)

I just didn't want anyone confused by why their Disconnect is working funny.

Call me when you get a chance.
Friday, July 28, 2006 12:04 PM by marshallharrison

# re: Handling Disconnects

Brandon, BTW...it works!
Friday, August 04, 2006 11:58 AM by PaulPower

# re: Handling Disconnects

Paul, that is sooo funny.  You weren't supposed to notice this! lol
Monday, August 07, 2006 2:43 PM by brandontyler

# re: Handling Disconnects

Hi,

I am not able to disconnect the call. I am using TR1000 analog board with 4 channels.

I pasted my javascript code here..

function BodyOnLoad() {

RunSpeech.OnUserDisconnected = HandleDisconnect;

}

function HandleDisconnect(theQA) {

// Set a flag so that we know we've disconnected

RunSpeech.CurrentCall().Set("CallState", "Disconnected");

siDisconnect.SetText("-1", true);

SpeechCommon.Submit();

}

In the above code, i have some doubt.. what is that "theQA" in the parameter? I used some QA controls and Listselectors.

i created the "siDisconnect" sematic item, and its not mapped with any control.

why i have to set to -1 for this semantic item?

Then i set autopostback=true for Answer call and disconnect call controls...

But still nothing was working.

I am working around for the last 45 days. still i am helpless. can u guide me, where i made mistake?

-Sen

Friday, May 25, 2007 9:35 AM by zylogsen

# re: Handling Disconnects

I forgot to say onething.

I am connecting my MSS in PBX

Friday, May 25, 2007 9:36 AM by zylogsen
Anonymous comments are disabled