I am trying to diale out and leave a message for my users but I get the MediaTermConnAvailableEv event very soon before the other sides phone even ring.
I appreciate any help with it.
Here is the code:
It start playing the file before the other party's phone even rings.
class MessageSenderCallObserver implements MediaCallObserver {
public void callChangedEvent(CallEv[] eventList) {
for (int i = 0; i < eventList.length; i++) {
CallEv ev = eventList[i];
TerminalConnection tc = ((TermConnEv) ev).getTerminalConnection();
MediaTerminalConnection mtc = (MediaTerminalConnection) tc;
case MediaTermConnStateEv.ID:
System.out.println("MediaTermConnStateEv");
System.out.println("2 "+mtc.getMediaState());
try {
/* Want to find out when playing is done */
int state = mtc.getMediaState();
state = state & MediaTerminalConnection.PLAYING;
if (state == 0) {
// hangup();
// exit();
}
} catch (Exception excp) {
System.out.println("Exception startRecording: " +
excp.toString());
}
break;
}
}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to diale out and leave a message for my users but I get the MediaTermConnAvailableEv event very soon before the other sides phone even ring.
I appreciate any help with it.
Here is the code:
It start playing the file before the other party's phone even rings.
class MessageSenderCallObserver implements MediaCallObserver {
public void callChangedEvent(CallEv[] eventList) {
for (int i = 0; i < eventList.length; i++) {
CallEv ev = eventList[i];
TerminalConnection tc = ((TermConnEv) ev).getTerminalConnection();
MediaTerminalConnection mtc = (MediaTerminalConnection) tc;
switch (ev.getID()) {
case TermConnCreatedEv.ID:
try {
String sExt = ".au";
if(useMSTAPI == true)
sExt = ".wav";
mtc.usePlayURL(new URL("file:./Greeting" + sExt));
} catch (Exception excp) {
System.out.println("Exception TermConnCreatedEv: " +
excp.toString());
}
break;
case MediaTermConnAvailableEv.ID:
try {
mtc.startPlaying();
} catch (Exception excp) {
System.out.println("Exception startPlaying: " +
excp.toString());
}
break;
case MediaTermConnStateEv.ID:
System.out.println("MediaTermConnStateEv");
System.out.println("2 "+mtc.getMediaState());
try {
/* Want to find out when playing is done */
int state = mtc.getMediaState();
state = state & MediaTerminalConnection.PLAYING;
if (state == 0) {
// hangup();
// exit();
}
} catch (Exception excp) {
System.out.println("Exception startRecording: " +
excp.toString());
}
break;
}
}
}
Ok, I found my answere in previous questions.
So forget about it ;)
Hello,
Could you tell me what java JDK version since I'm trying to compile, but got compilation error.