Manas Varma | Hi All, I am having Call Manager 7.1. I am trying to send DTMF signals after the call is connected and then receive the signal ..and then depeding upon the signal recieved, I have to proceed with further tasks. But currently I am stuck as I am not able to extend the BasicMediaService class. Its showing me an error. Can you please help. I am atttaching the code snippet.
<font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font> <font size="2" color="#7f0055"><font size="2" color="#7f0055"> </font></font><font size="2" color="#7f0055"> </font>
<font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.sound.sampled.*; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.Provider; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.JtapiPeer; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.JtapiPeerFactory;
<font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.*; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.media.*; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.media.MediaTerminalConnection; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.media.events.MediaTermConnAvailableEv; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.media.events.MediaTermConnUnavailableEv; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.media.events.MediaTermConnDtmfEv; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.events.*; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.callcontrol.*; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.callcontrol.events.*; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> java.net.URL; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> import </font></font><font size="2" color="#7f0055"> </font> javax.telephony.media.capabilities.*; <font size="2" color="#7f0055"><font size="2" color="#7f0055"> class </font></font><font size="2" color="#7f0055"> </font> sendDTMFSignal extends BasicMediaService implements MediaTerminalConnection { <font size="2"> </font> public sendDTMFSignal(MediaProvider mp){<font size="2"> </font> super (mp); } <font size="2"> </font> public void callChangedEvent(CallEv[] evlist) {<font size="2"> </font> int state = 0; TerminalConnection termconn; String name; <font size="2"> </font> for (int i = 0; i < evlist.length ; i++) { CallEv ev=evlist; TerminalConnection tc = ((TermConnEv)ev).getTerminalConnection(); MediaTerminalConnection mtc = (MediaTerminalConnection)tc; <font size="2"> </font> if (evlist instanceof TermConnEv) {<font size="2"> termconn = </font> null ;<font size="2"> mtc = </font> null ;<font size="2"> name = </font> null ; <font size="2"> </font> try { TermConnEv tcev = (TermConnEv)evlist; termconn = tcev.getTerminalConnection(); Terminal term = termconn.getTerminal(); name = term.getName(); <font size="2"> } </font> catch (Exception excp) {<font size="2"> </font> // Handle exceptions. <font size="2"> System. </font> out.println( "hata1 -->> " +excp); } <font size="2"> String msg = </font> "TerminalConnection to Terminal: " + name + " is " ;<font size="2"> </font> if(evlist instanceof TermConnCreatedEv){ <font size="2"> </font> try { <font size="2"> } </font> catch (Exception excp) {<font size="2"> System. </font> out.println("url hata" +excp); } } <font size="2"> </font> if (evlist.getID()==MediaTermConnAvailableEv.ID ) {<font size="2"> System. </font> out.println(msg + "AKTİVE" );<font size="2"> System. </font> out.println("Media Available..." );<font size="2"> </font> try { <font size="2"> mtc.usePlayURL( </font> new URL("file:C:/Documents and Settings/yazici/IdeaProjects/xtapi/src/Greeting.wav" ));<font size="2"> System. </font> out.println("Playing Greetings..." ); mtc.startPlaying(); <font size="2"> System. </font> out.println("After Playing MediaState=" );<font size="2"> mtc.setDtmfDetection( </font> true );<font size="2"> } </font> catch (Exception excp) {<font size="2"> System. </font> out.println("media hata1-> " +excp); System.exit(0); } <font size="2"> } </font> // <font size="2"> </font> else if (evlist.getID() == TermConnRingingEv.ID ) {<font size="2"> System. </font> out.println(msg + "RINGING" );<font size="2"> </font> try {<font size="2"> </font> final TerminalConnection _tc = termconn;<font size="2"> Runnable r = </font> new Runnable() {<font size="2"> </font> public void run() {<font size="2"> </font> try { _tc.answer(); <font size="2"> } </font> catch (Exception excp){<font size="2"> </font> // Handle answer exceptions <font size="2"> System. </font> out.println( "hata2" ); } }; }; <font size="2"> Thread T = </font> new Thread(r); T.start(); <font size="2"> } </font> catch (Exception excp) {<font size="2"> </font> // Handle Exceptions; <font size="2"> System. </font> out.println( "hata3" ); } } <font size="2"> </font> else if (ev instanceof MediaTermConnUnavailableEv) { <font size="2"> </font> /* Turn off DTMF-detection */
<font size="2"> </font> try {<font size="2"> mtc.setDtmfDetection( </font> false );<font size="2"> } </font> catch (Exception excp) {<font size="2"> </font> // Handle exceptions
} } <font size="2"> </font> else if (ev instanceof MediaTermConnDtmfEv) {<font size="2"> </font> /* Print out the DTMF digits */ <font size="2"> </font> char digit = ((MediaTermConnDtmfEv)ev).getDtmfDigit();<font size="2"> System. </font> out.println("detected DTMF: " + digit);<font size="2"> </font> try {<font size="2"> </font> // Echo out the same digit we detected <font size="2"> </font> //mtc.generateDtmf(digit + ""); <font size="2"> } </font> catch (Exception e){<font size="2"> System. </font> out.println("Exception generateDtmf: " + e.toString()); } } <font size="2"> </font> else if (evlist.getID() == CallCtlTermConnDroppedEv.ID ) {<font size="2"> System. </font> out.println(msg + "DROPPED" ); } } } } <font size="2"> </font> @Override <font size="2"> </font> public void generateDtmf(String arg0) throws MethodNotSupportedException, ResourceUnavailableException, InvalidStateException { <font size="2"> </font> // TODO Auto-generated method stub
} <font size="2"> </font> @Override <font size="2"> </font> public int getMediaAvailability() {<font size="2"> </font> // TODO Auto-generated method stub <font size="2"> </font> return 0; } <font size="2"> </font> @Override <font size="2"> </font> public int getMediaState() {<font size="2"> </font> // TODO Auto-generated method stub <font size="2"> </font> return 0; } <font size="2"> </font> @Override <font size="2"> </font> public void setDtmfDetection(boolean arg0)<font size="2"> </font> throws MethodNotSupportedException, ResourceUnavailableException, InvalidStateException { <font size="2"> </font> // TODO Auto-generated method stub
} <font size="2"> </font> @Override <font size="2"> </font> public void startPlaying() throws MethodNotSupportedException, ResourceUnavailableException, InvalidStateException { <font size="2"> </font> // TODO Auto-generated method stub
} <font size="2"> </font> @Override <font size="2"> </font> public void startRecording() throws MethodNotSupportedException, ResourceUnavailableException, InvalidStateException { <font size="2"> </font> // TODO Auto-generated method stub
} <font size="2"> </font> @Override <font size="2"> </font> public void stopPlaying() {<font size="2"> </font> // TODO Auto-generated method stub
} <font size="2"> </font> @Override <font size="2"> </font> public void stopRecording() {<font size="2"> </font> // TODO Auto-generated method stub
} <font size="2"> </font> @Override <font size="2"> </font> public void useDefaultMicrophone() throws PrivilegeViolationException, ResourceUnavailableException, MethodNotSupportedException { <font size="2"> </font> // TODO Auto-generated method stub
} <font size="2"> </font> @Override <font size="2"> </font> public void useDefaultSpeaker() throws PrivilegeViolationException, ResourceUnavailableException, MethodNotSupportedException { <font size="2"> </font> // TODO Auto-generated method stub
} <font size="2"> </font> @Override <font size="2"> </font> public void usePlayURL(URL arg0) throws PrivilegeViolationException, ResourceUnavailableException, MethodNotSupportedException { <font size="2"> </font> // TODO Auto-generated method stub
} <font size="2"> </font> @Override <font size="2"> </font> public void useRecordURL(URL arg0) throws PrivilegeViolationException, ResourceUnavailableException, MethodNotSupportedException { <font size="2"> </font> // TODO Auto-generated method stub
} <font size="2"> </font> @Override <font size="2"> </font> public void answer() throws PrivilegeViolationException, ResourceUnavailableException, MethodNotSupportedException, InvalidStateException { <font size="2"> </font> // TODO Auto-generated method stub
} <font size="2"> </font> @Override <font size="2"> </font> public TerminalConnectionCapabilities getCapabilities() {<font size="2"> </font> // TODO Auto-generated method stub <font size="2"> </font> return null ; } <font size="2"> </font> @Override <font size="2"> </font> public Connection getConnection() {<font size="2"> </font> // TODO Auto-generated method stub <font size="2"> </font> return null ; } <font size="2"> </font> @Override <font size="2"> </font> public int getState() {<font size="2"> </font> // TODO Auto-generated method stub <font size="2"> </font> return 0; } <font size="2"> </font> @Override <font size="2"> </font> public Terminal getTerminal() {<font size="2"> </font> // TODO Auto-generated method stub <font size="2"> </font> return null ; } <font size="2"> </font> @Override <font size="2"> </font> public TerminalConnectionCapabilities getTerminalConnectionCapabilities(<font size="2"> Terminal arg0, Address arg1) </font> throws InvalidArgumentException, PlatformException { <font size="2"> </font> // TODO Auto-generated method stub <font size="2"> </font> return null ; |