📄 theapplication.java
字号:
package samples.gccs.createcall;
import samples.fw.*;
import org.csapi.*;
//import org.csapi.ui.*;
import org.csapi.cc.gccs.*;
/**
* This application creates generic call and bridges two parties 4860034 and 4860037.
*/
public class TheApplication
{
static Object lock = new Object();
static TpAddress targetAddress = new TpAddress(
TpAddressPlan.P_ADDRESS_PLAN_E164,
"4860034",""
TpAddressPresentation.P_ADDRESS_PRESENTATION_UNDEFINED,
TpAddressScreening.P_ADDRESS_SCREENING_USER_NOT_VERIFIED,
"A");
static TpAddress origAddress = new TpAddress(
TpAddressPlan.P_ADDRESS_PLAN_E164,
"4860037","",
TpAddressPresentation.P_ADDRESS_PRESENTATION_UNDEFINED,
TpAddressScreening.P_ADDRESS_SCREENING_USER_NOT_VERIFIED,
"A");
static IpCall ipCall;
static IpCallControlManager ipCallCtlMgr;
static IpAppCallControlManager ipAppCallCtlMgr;
static int callSessionID;
public static void main(String[] argv) throws Exception
{
AppFWImpl.initiate("localhost", "12345", "FwInitial");
AppFWImpl.getAuthenticated("GCCSApplication1");
IpInterface mgrIfc = AppFWImpl.getService("P_GENERIC_CALL_CONTROL");
ipCallCtlMgr = org.csapi.cc.gccs.IpCallControlManagerHelper.narrow(
mgrIfc);
ipAppCallCtlMgr = IpAppCallControlManagerHelper.narrow(
AppFWImpl.poa.servant_to_reference(
new AppCallControlManagerImpl()));
TpCallIdentifier retCall = ipCallCtlMgr.createCall(ipAppCallCtlMgr);
ipCall = retCall.CallReference;
callSessionID = retCall.CallSessionID;
TpCallReportRequest[] callRptReqs = new TpCallReportRequest[1];
TpCallAdditionalReportCriteria addCr = new TpCallAdditionalReportCriteria();
addCr.Dummy((short) 0);
callRptReqs[0]=new TpCallReportRequest(
org.csapi.cc.TpCallMonitorMode.P_CALL_MONITOR_MODE_NOTIFY,
TpCallReportType.P_CALL_REPORT_ANSWER, addCr);
int legId = ipCall.routeReq(callSessionID, callRptReqs,
targetAddress, origAddress,targetAddress, targetAddress,
new TpCallAppInfo[0]);
System.out.println("Done route to 4960034, and waiting for answer");
synchronized(lock) {
try {
lock.wait();
}
catch(Exception e) {}
System.out.println("TheApplication finished");
}
}
public static public void callEnded(int SessionID, org.csapi.cc.gccs.TpCallEndedReport report)
{
synchronized(lock) {
try {
lock.notify();
}
catch(Exception e) {}
}
}
public static void routeRes(int SessionID, int legID,
org.csapi.cc.gccs.TpCallReport eventReport)
{
try
{
if (eventReport.CallReportType.value() != TpCallReportType._P_CALL_REPORT_ANSWER) {
System.out.println("RouteRes is not Answer, to quit");
synchronized(lock) {
try {
lock.notify();
}
catch(Exception e) {}
}
return;
}
System.out.println("Start to route to 4860037");
ipCall.routeReq(callSessionID, new TpCallReportRequest[0],
origAddress,targetAddress,
origAddress, origAddress, new TpCallAppInfo[0]);
ipCall.deassignCall(callSessionID);
}
catch(Exception e) {
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -