Page 1 of 1

Send call data after hangup

Posted: Wed Oct 08, 2014 10:54 am
by hecleal
Our VXML script only sends the call only when the call is completed. In other words, the caller has to go thru all prompts for the call data to be sent to our web service. How can we catch every call, whether the user goes thru all prompts? We would like to catch the caller id for every call, even if the caller hangs up immediately after call is placed and received.

Here is my code:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">

<var name="CallerID" expr="session.telephone.ani" />
<var name="CalledID" expr="session.telephone.dnis" />
<var name="Lang" expr="'EN'" />
<var name="AgencyID" />

<property name="inputmodes" value="dtmf"/>
<property name="interdigittimeout" value="3s"/>

<form id="FirstPart">
        <block>
                <if cond="CalledID==3999">
                 <assign name="AgencyID" expr="346"/>
          
                <elseif cond="CalledID==8888"/>
                 <assign name="AgencyID" expr="346"/>
                <else/>
                 <assign name="AgencyID" expr="346"/>          
                </if>
		<prompt>
			<audio src="wavfiles/eng1.mp3">
				Welcome to Visit Clock.
			</audio>
		</prompt>
	</block>
	<field name="ProviderID" type="digits">
		<prompt>
			<audio src="wavfiles/eng2.mp3">
				Please enter your employee ID using the keypad.
			</audio>
		</prompt>
		<filled>
        <if cond="ProviderID.length == 5">
           <assign name="ProvID" expr="ProviderID"/>
           <!-- You entered <value expr="ProviderID"/>. -->
           <goto nextitem="id"/>
         <else/>
           <audio src="wavfiles/engInvalid.mp3">
		   Invalid ID number. Please try again.
		   </audio>
           <clear namelist="ProviderID"/>
           <reprompt/>
         </if>
      </filled>
	</field>
	<field name="id" type="digits">
		<prompt>
			<audio src="wavfiles/eng3.mp3">
				Please enter the client number using the keypad.
			</audio>
		</prompt>
		<filled>
			<assign name="ClientID" expr="id"/>
		</filled>
		<noinput>
			<assign name="ClientID" expr="0"/>
			<goto nextitem="submit"/>
		</noinput>
	</field>
	<block name="submit">
		<submit namelist="AgencyID CallerID ProviderID ClientID Lang" next="http://www.ourwebsite.com/Call.ashx" />
	</block>
</form>
</vxml>
Thanks for any help you can provide for us.

-Hector

Re: Send call data after hangup

Posted: Wed Oct 08, 2014 2:22 pm
by support
Hi Hector,

You can handle the case where the caller hangs up prematurely using the <catch> tag.

In your case, where you want to send just the CallerID when the caller hangs up, you could include the following catch block in your form (you can include this catch block right before your closing </form> tag):

Code: Select all

<catch event="connection.disconnect.hangup">
    <submit namelist="CallerID" next="http://www.ourwebsite.com/Call.ashx" />
</catch>
This catch block will capture the event when the caller hangs up and will send the CallerID data to your webservice.

If you would like to send additional data from prompts that might not have yet been filled in at the time the hangup occurred, such as the ProvID and ClientID, you will need to make sure to define those variables to avoid a reference error by trying to submit variables that are not defined. Please let us know if you have any additional questions.

Regards,
Plum Support

Re: Send call data after hangup

Posted: Wed Oct 15, 2014 10:48 am
by hecleal
That worked great! Thanks a lot! :D