Hi All,
I am doing a two party call.
In CallOriginated callbaack i am suspending the call and playing the media.
And waiting for user to enter the option . If user press "1" then i am doing call.allow() and allowing call to the second party.
However, in MediaListner nothing is happening. I am not getting digits entered by user.
What is the issue?
Following code was working in EDP version 3.0.1 But, as i updated my EDP SDK version same code is not working.
Need help on urgent basis.
Please find below the code snippets:
[/b]
MyServlet.java
String extention1 = request.getParameter("extention1");
String extention2 = request.getParameter("extention2");
CreateCall createCall = new CreateCall(extention1,extention2);
createCall.makeCall();
PrintWriter pw = response.getWriter();
pw.write("Calls Created ");
CreateCall.java
public CreateCall(String user1, String user2) {
super();
this.user1 = user1;
this.user2 = user2;
}
public void makeCall() {
Identity identity = IdentityFactory.create("Conference Call",
"Conference Call");
String destination = "3020";
Call[] call = new Call[2];
call[0] = CallFactory.create(user1, destination, identity);
call[0].initiate();
call[1] = CallFactory.create(user2, destination, identity);
call[1].initiate();
logger.error("Calls has been created....");
}
MyCallListner.java
public void callOriginated(Call call) {
logger.error("Call Originated By : "+call.getCallingParty().getHandle());
call.suspend();
final DigitOptions digitoptions=MediaFactory.createDigitOptions().setNumberOfDigits(1).setTimeout(20000);
final com.gslab.TwoParty.MyListner mediaListener = new com.gslab.TwoParty.MyListner(call);
final MediaService mediaService = MediaFactory.createMediaService();
final PlayItem playItem=MediaFactory.createPlayItem();
playItem.setInterruptible(true);
playItem.setIterateCount(1);
try {
playItem.setSource("file://startMedia14092.wav");
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
final UUID requestId=mediaService.promptAndCollect(call.getCallingParty(), playItem, digitoptions, mediaListener);
logger.error("Media Played");
}
MyListner.java
public MyListner(Call call) {
super();
this.call = call;
}
@Override
public void digitsCollected(UUID arg0, String digit,
DigitCollectorOperationCause cause) {
// TODO Auto-generated method stub
logger.error("Inside Digit Collected : "+digit);
if("1".equalsIgnoreCase(digit)) {
call.allow();
}
}