1) Which API should we use to listen softcodes to know the getCalledAddress() and getCallingAddress() call details.
2) Which API is used to get incoming call details from a PBX ? Scenario is a user from his personal mobile will call to a number 108 which is PBX.This PBX will forward that call to some Avaya Agent.This Avaya Agent is not able to capture the incoming call details from PBX.However if directly call is made to this Avaya Agent then it correctly returns the getCalledAddress() and getCallingAddress(). Below is the code we implemented to achieve it :
Terminal terminal = myprovider.getTerminal(agentNumber);
terminal.addCallListener(new IncomingCallListener(postURL, agentNumber));
public class IncomingCallListener implements CallControlTerminalConnectionListener {
String agentNumber;
public static final Map<String, String> InfoMap = new HashMap<String, String>();
int flag = 0;
public static void appendStrToFile(String fileName,String str) {
try {
// Open given file in append mode.
BufferedWriter out = new BufferedWriter(
new FileWriter(fileName, true));
out.write(str);
out.close();
} catch (IOException e) {
System.out.println("exception occoured" + e);
}
}
public IncomingCallListener(String postURL, String agentNumber) {
if (flag == 0) {
flag = 1;
// Let us create a sample file with some text
String fileName = "d:\\writeoutput.txt";
try {
BufferedWriter out = new BufferedWriter(
new FileWriter(fileName));
out.write("HStarting to write now \n");
out.close();
} catch (IOException e) {
System.out.println("Exception Occurred" + e);
}
}
InfoMap.put(agentNumber, postURL);
this.agentNumber = agentNumber;
}
@Override
public void terminalConnectionActive(TerminalConnectionEvent event) {
}
@Override
public void terminalConnectionCreated(TerminalConnectionEvent event) {
}
@Override
public void terminalConnectionDropped(TerminalConnectionEvent event) {
// System.exit(0);
}
@Override
public void terminalConnectionPassive(TerminalConnectionEvent event) {
}
@Override
public void terminalConnectionUnknown(TerminalConnectionEvent event) {
}
@Override
public void connectionAlerting(ConnectionEvent event) {
}
@Override
public void connectionConnected(ConnectionEvent event) {
}
@Override
public void connectionCreated(ConnectionEvent event) {
}
public void connectionDisconnected(ConnectionEvent event) {
}
public void connectionFailed(ConnectionEvent event) {
}
public void connectionInProgress(ConnectionEvent event) {
}
public void connectionUnknown(ConnectionEvent event) {
}
public void callActive(CallEvent event) {
}
public void callInvalid(CallEvent event) {
}
public void callEventTransmissionEnded(CallEvent event) {
}
public void singleCallMetaProgressStarted(MetaEvent event) {
}
public void singleCallMetaProgressEnded(MetaEvent event) {
}
public void singleCallMetaSnapshotStarted(MetaEvent event) {
}
public void singleCallMetaSnapshotEnded(MetaEvent event) {
}
public void multiCallMetaMergeStarted(MetaEvent event) {
}
public void multiCallMetaMergeEnded(MetaEvent event) {
}
public void multiCallMetaTransferStarted(MetaEvent event) {
}
public void multiCallMetaTransferEnded(MetaEvent event) {
}
public void connectionAlerting(CallControlConnectionEvent event) {
}
public void connectionDialing(CallControlConnectionEvent event) {
}
public void connectionDisconnected(CallControlConnectionEvent event) {
}
public void connectionEstablished(CallControlConnectionEvent event) {
}
public void connectionFailed(CallControlConnectionEvent event) {
}
public void connectionInitiated(CallControlConnectionEvent event) {
}
public void connectionNetworkAlerting(CallControlConnectionEvent event) {
}
public void connectionNetworkReached(CallControlConnectionEvent event) {
}
public void connectionOffered(CallControlConnectionEvent event) {
}
public void connectionQueued(CallControlConnectionEvent event) {
}
public void connectionUnknown(CallControlConnectionEvent event) {
}
public void terminalConnectionBridged(CallControlTerminalConnectionEvent event) {
}
public void terminalConnectionDropped(CallControlTerminalConnectionEvent event) {
appendStrToFile("writeoutput", "In terminalConnectionDropped Incomingcalllistener... ");
appendStrToFile("writeoutput", "callingFromPhoneNumber... "+event.getCallingAddress().getName());
appendStrToFile("writeoutput", "callingToPhoneNumber... "+event.getCalledAddress().getName());
String callingFromPhoneNumber = null;
String callingToPhoneNumber = null;
if (event.getCallingAddress() != null) {
callingFromPhoneNumber = event.getCallingAddress().getName();
}
if (event.getCalledAddress() != null) {
callingToPhoneNumber = event.getCalledAddress().getName();
}
if (callingFromPhoneNumber != null && callingFromPhoneNumber != null) {
String url = InfoMap.get(callingToPhoneNumber).toString();
if (!(url.trim().equals("BLANKURL"))) {
// PostDataUtil.uploadData(url, callingFromPhoneNumber, agentNumber, callingToPhoneNumber, "Connection is Dropped", 104);
}
}
}
public void terminalConnectionHeld(CallControlTerminalConnectionEvent event) {
appendStrToFile("writeoutput", "In terminalConnectionHeld Incomingcalllistener... ");
appendStrToFile("writeoutput", "callingFromPhoneNumber... "+event.getCallingAddress().getName());
appendStrToFile("writeoutput", "callingToPhoneNumber... "+event.getCalledAddress().getName());
String callingFromPhoneNumber = null;
String callingToPhoneNumber = null;
if (event.getCallingAddress() != null) {
callingFromPhoneNumber = event.getCallingAddress().getName();
}
if (event.getCalledAddress() != null) {
callingToPhoneNumber = event.getCalledAddress().getName();
}
String url = InfoMap.get(callingToPhoneNumber).toString();
if (!(url.trim().equals("BLANKURL"))) {
// PostDataUtil.uploadData(url, callingFromPhoneNumber, agentNumber, callingToPhoneNumber, "Connection is on Hold", 103);
}
}
public void terminalConnectionInUse(CallControlTerminalConnectionEvent event) {
appendStrToFile("writeoutput", "In terminalConnectionInUse Incomingcalllistener... ");
appendStrToFile("writeoutput", "callingFromPhoneNumber... "+event.getCallingAddress().getName());
appendStrToFile("writeoutput", "callingToPhoneNumber... "+event.getCalledAddress().getName());
}
public void terminalConnectionRinging(CallControlTerminalConnectionEvent event) {
appendStrToFile("writeoutput", "In terminalConnectionRinging Incomingcalllistener... ");
appendStrToFile("writeoutput", "callingFromPhoneNumber... "+event.getCallingAddress().getName());
appendStrToFile("writeoutput", "callingToPhoneNumber... "+event.getCalledAddress().getName());
String callingFromPhoneNumber = null;
String callingToPhoneNumber = null;
if (event.getCallingAddress() != null) {
callingFromPhoneNumber = event.getCallingAddress().getName();
}
if (event.getCalledAddress() != null) {
callingToPhoneNumber = event.getCalledAddress().getName();
}
String url = InfoMap.get(callingToPhoneNumber).toString();
if (!(url.trim().equals("BLANKURL"))) {
//PostDataUtil.uploadData(url, callingFromPhoneNumber, agentNumber, callingToPhoneNumber, "Connection is Ringing", 101);
}
}
public void terminalConnectionTalking(CallControlTerminalConnectionEvent event) {
appendStrToFile("writeoutput", "In terminalConnectionTalking Incomingcalllistener... ");
appendStrToFile("writeoutput", "callingFromPhoneNumber... "+event.getCallingAddress().getName());
appendStrToFile("writeoutput", "callingToPhoneNumber... "+event.getCalledAddress().getName());
String callingFromPhoneNumber = null;
String callingToPhoneNumber = null;
if (event.getCallingAddress() != null) {
callingFromPhoneNumber = event.getCallingAddress().getName();
}
if (event.getCalledAddress() != null) {
callingToPhoneNumber = event.getCalledAddress().getName();
}
String url = InfoMap.get(callingToPhoneNumber).toString();
if (!(url.trim().equals("BLANKURL"))) {
//PostDataUtil.uploadData(url, callingFromPhoneNumber, agentNumber, callingToPhoneNumber, "Connection is Talking", 102);
}
}
public void terminalConnectionUnknown(CallControlTerminalConnectionEvent event) {
}
@Override
public void terminalConnectionRinging(TerminalConnectionEvent tce) {
}
}
3) What are the parameters required for a DMCC provider object to create ?
4) How to resolve the SSLHandshake exception comes when creating the provider object of Avaya DMCC ?
5) Which API has to be used for knowing that an Avaya Agent has made a conference call or forwarded or transfered a call ? Scenario is we are listening a Terminal object of an Avaya agent and we need to add a correct listener to capture the events related to whether a conference call is made / transferred / forwarded.
Also the getCallControlCause() always returns 100 and never gives the proper value whether conference is made or call is transferred.Please suggest how to overcome this problem.
6) Are sample programs for all above scenarios available ?
7) Any video/tutorial can be shared explaining the details on to how to use the Avaya API's with their significance ?
|