cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1530
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: Patrik Englund on 18-06-2012 03:44:16 AM
Hi
 
Im trying to figure out how to continue a vxml application script i a user hangs up. Specific im using the Record and Email element
that only works if i let the recording to time out on the gateway while on Record element, then i will receive the email with the voicemessage. This is not working if i hang up before the timeout kicks in. The voicemail .wav file is created locally on the cvp call server but i never get the email wit the file attached. Im using CVP 8.5. I have tried using both true and false on "Keep recording on hangup" but no difference. Does anyone have a suggestion?
It´s also hard to understand exactly how to use hotevent and/or action element to perhaps help out with this.
 
I looked at a similar thread on this forum but that was for standalone and version 7 of Cvp so i dont know how different that is versus CVP 8.5 and comprehensive.

Subject: RE: How to catch user hangup event in comprehensive mode
Replied by: Patrik Englund on 21-06-2012 12:20:18 AM
ANyone have an idea on how to achieve this? Have someone already solved this and have a custom java class to share if so? Im in really bad need for this solution.

Subject: RE: How to catch user hangup event in comprehensive mode
Replied by: Janine Graves on 21-06-2012 10:10:35 AM
Caller Hangup:  This has been answered many times on the Forum already. Go to Google and search: developer.cisco.com caller hangup - here's one such place where it was discussed: http://developer.cisco.com/web/cvp/forums/-/message_boards/view_message/5437146
 
You have to create an End of Call java class and check for how the call ended:
 
    public void onEndCall(CallEndAPI data) throws AudiumException
    {
        if (data.getHowCallEnded().equals("hangup"))
        { blah blah blah
        }
   }

Subject: RE: How to catch user hangup event in comprehensive mode
Replied by: Patrik Englund on 26-06-2012 04:47:57 AM
Caller Hangup:  This has been answered many times on the Forum already. Go to Google and search: developer.cisco.com caller hangup - here's one such place where it was discussed: http://developer.cisco.com/web/cvp/forums/-/message_boards/view_message/5437146
 
You have to create an End of Call java class and check for how the call ended:
 
    public void onEndCall(CallEndAPI data) throws AudiumException
    {
        if (data.getHowCallEnded().equals("hangup"))
        { blah blah blah
        }
   }

 
Hi Janine
 
Many thanks for your reply and yes i know that there are a numerous number of these in the forum but it´s hard to get a clear view of what´s really needed to accomplish this. I took your code from your other thread and compiled it. I hope it went ok as the javac did not complain about anything and i got the .class file. Although im having issues that when putting the .class file in c:\cvp\vxmlserver\applications\voicemail\java\applications\classes the vxml server complains during start up. The error in the error_log states :
 
Root Cause: java.lang.NoClassDefFoundError: AudiumException (wrong name: com/audium/server/AudiumException)
 
This is what i compiled :
 

//These classes are used by on call end classes
 
import com.audium.core.vfc.VException;
import com.audium.core.vfc.VPreference;
import com.audium.core.vfc.form.VBlock;
import com.audium.core.vfc.form.VForm;
import com.audium.core.vfc.util.VAction;
import com.audium.core.vfc.util.VMain;
import com.audium.server.AudiumException;
import com.audium.server.proxy.EndCallInterface;
import com.audium.server.session.CallEndAPI;
 
/**
* If caller hung up, send data 
* from the Session variables return0, return1, return2, return3
* to ICM into ECC variables FromExtVxml[0], [1], [2], [3]
*/
 
public class EndClassSubRet implements EndCallInterface
{
/**
* All On End Call classes must implement this method. Use the passed
* CallEndAPI class to get useful information. Making changes here will
* do nothing as the call has already ended.
*/
 
public void onEndCall(CallEndAPI data) throws AudiumException
{
if (data.getHowCallEnded().equals("hangup"))
{
try {
 
//get data to return to ICM from these Session variables:
//and return 'hangup' in the caller_input ECC variable of ICM
//return0, return1, return2, return3
String return0 = (String) data.getSessionData("return0");
String return1 = (String) data.getSessionData("return1");
String return2 = (String) data.getSessionData("return2");
String return3 = (String) data.getSessionData("return3");
 
VPreference pref = data.getPreference();
VMain vxml = VMain.getNew(pref);
VForm form = VForm.getNew(pref);
VBlock block = VBlock.getNew(pref);
 
VAction var = VAction.getNew(pref, VAction.VARIABLE, "caller_input", "hangup", VForm.WITH_QUOTES); 
block.add(var);
VAction returnTag = null;
if(return0 != null){
VAction var0=VAction.getNew(pref, VAction.VARIABLE, "FromExtVXML0", return0, VForm.WITH_QUOTES); 
block.add(var0);
if(return1 != null){
VAction var1=VAction.getNew(pref, VAction.VARIABLE, "FromExtVXML1", return1, VForm.WITH_QUOTES);
block.add(var1);
if(return2 != null){
VAction var2=VAction.getNew(pref, VAction.VARIABLE, "FromExtVXML2", return2, VForm.WITH_QUOTES);
block.add(var2);
if(return3 != null){
VAction var3=VAction.getNew(pref, VAction.VARIABLE, "FromExtVXML3", return3, VForm.WITH_QUOTES);
block.add(var3); 
returnTag = VAction.getNew(pref, VAction.RETURN, "caller_input FromExtVXML0 FromExtVXML1 FromExtVXML2 FromExtVXML3");
} else{
returnTag = VAction.getNew(pref, VAction.RETURN, "caller_input FromExtVXML0 FromExtVXML1 FromExtVXML2");

}else {
returnTag = VAction.getNew(pref, VAction.RETURN, "caller_input FromExtVXML0 FromExtVXML1");

}else {
returnTag = VAction.getNew(pref, VAction.RETURN, "caller_input FromExtVXML0");

}else {
returnTag = VAction.getNew(pref, VAction.RETURN, "caller_input");
}
 
block.add(returnTag);
 
form.add(block);
vxml.add(form);
 
data.setCustomVxmlResponse(vxml);
 
} catch (VException ex) { 
ex.printStackTrace();
}
}
}


Subject: RE: How to catch user hangup event in comprehensive mode
Replied by: Janine Graves on 26-06-2012 09:23:24 PM
Try putting the compiled java class into VxmlServer/common/classes and restart the VxmlServer service.
 

Subject: RE: How to catch user hangup event in comprehensive mode
Replied by: Janine Graves on 26-06-2012 09:29:12 PM
I've been told that the end of call java class executes in a separate thread and therefore you have to be careful that if it's accessing a custom-defined java class, then the class has to be at the VxmlServer/common level, not at the VxmlServer/applications/appname/application/java level.
 

Subject: RE: How to catch user hangup event in comprehensive mode
Replied by: Patrik Englund on 27-06-2012 01:36:46 AM
Ok, now i got rid of the error, perfect! I can see data passed back to icm if using Paul´s example in earlier thread but i suppose there will be a problem using this as if the call dont take the success or failure node in the run ext script node then it will be hard to do anything more.

Should there not be anyone having similar issue as i have? Using recording element and then email element to gether? It works fine if using dtmf or letting the timeout in the recording element to expire, then the email is sent since the vxml app will continue. Problem gets when users hangs up after recording the message and call ends in recording element and email is not sent. Worked fine in IVR to do this with an exception step.

Subject: RE: How to catch user hangup event in comprehensive mode
Replied by: Bill Westby on 02-07-2012 02:02:10 PM
Patrik,

Janine pinged me about this as I use sendmail all over my applications mostly for error notifications when my apps have an issue.

At first I tried using the hotevents for the various disconnect types such as connection.disconnect.hangup and telephone.disconnect.hangup however I found that isn't always reliable either.  You could give those a try and see if they work for you but since the app technically is done if someone hangs up, catching the hotevent is never guaranteed to always work.

The endcall class always fires, Janine will hammer this point into your brain in training but it still took me awhile to believe it LOL, never had an issue and is the only guaranteed method to finish any after call work you need.

Since everything is still available as far as element and sesion data in the endcall class, I just make sure I have everything I need when the call ends and I use javax sendmail API to send the message and it works great. I placed a snippet of code I use to send the message manually outside of JNDI.

import javax.mail.*;
import javax.mail.internet.*;
Properties props = new Properties();
props.put("mail.smtp.host", "<youremailserver.address.com>");  // replace <youremailserver.address.com> with your company email server.
Session s = Session.getInstance(props, null);
InternetAddress from = new InternetAddress("<yourreplyaddress@yourcompany.com");  // Enter any reply address which will appear as the sender.
InternetAddress to = new InternetAddress(callEndAPI.getSessionData("EmailDL").toString());  // Session data I create in Studio to store my email distribution list
MimeMessage message = new MimeMessage(s);
message.setFrom(from);
message.addRecipient(Message.RecipientType.TO, to);
message.setSubject("<Put your message subject line here>");
message.setText("<Put your message body here>");
message.setFile("<physicalpath\filename>");  // File you want to attach
Transport.send(message);  // off it goes!!!


Bill Westby
Medtronic

Subject: RE: How to catch user hangup event in comprehensive mode
Replied by: Janine Graves on 04-07-2012 09:26:46 AM
Patrik,
 
First, do you know if your End of Call java class is executing? You might include an addToLog(("***Entered End of Call Java","") statement so you know whether it's executing. In the Studio app, you need to configure Project Properties/CallStudio/EndPointSettings. Fill in the End of Call full java class name (including package, but no file extension).
 
Second, with figuring out where to store different java classes (like javax, jaxb, etc) I think it's a matter of trial and error.
Try these directories (1 at  a time until you find one that works).
Restart VxmlServer each time you move the files around:

VXMLServer\common\lib


VXMLServer\Tomcat\common\endorsed


VXMLServer\Tomcat\common\lib
 
Also, do you know that you have the libraries to send mail?  I've never done my own custom email in java, but I do know that to use the Studio Email element, one needs to install mail.jar and activation.jar (download from SUN) into VxmlServer\Tomcat\common\lib - I will attach these two jar files here. Then restart the Cisco VxmlServer service.
 

Subject: RE: How to catch user hangup event in comprehensive mode
Replied by: Patrik Englund on 04-07-2012 07:25:40 AM
Hi Bill and Janine. I must first of all thank you for all help so far with this, it´s really impressive knowledge you have about cvp and vcml / java.

I have got some help creating a class that contains the custome onEndCall together with the javax part you provided Bill but it seemd that the javax
is never triggered, it ends with sedning data back to icm, that´s all.

The jar files that javax needs, do they need to be in a specific folder on the vxml server or should they be where they are?
Nevertheless i think the javax part should have been triggered anyhow, or?

Subject: RE: How to catch user hangup event in comprehensive mode
Replied by: Patrik Englund on 05-07-2012 01:46:14 AM
Hi Janine

It was a coding problem in the java file. sendMail was set after the exception was thrown so it could not continue.
Now it´s corrected and it works perfectly!. Now i have something to work with and fall back on.

Many thanks once again for all your support Bill and Janine!

Janine:  I will try to join the training in Denmark in October, i suppose you are the trainer.

Br Patrik Englund
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links