📄 theapplication.java
字号:
package samples.gccs.routecall;
import samples.fw.*;
import org.csapi.*;
//import org.csapi.ui.*;
import org.csapi.cc.gccs.*;
/**
* This application routes call of destination 8001234567
* from network to 4860034.
*/
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 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()));
org.csapi.cc.gccs.TpCallEventCriteria eventCriteria =
new org.csapi.cc.gccs.TpCallEventCriteria (
new org.csapi.TpAddressRange(
org.csapi.TpAddressPlan.P_ADDRESS_PLAN_E164,
"8001234567*", "0","0"), // called number
new org.csapi.TpAddressRange(
org.csapi.TpAddressPlan.P_ADDRESS_PLAN_E164,
"*", "0", "0"), // any number by caller
org.csapi.cc.gccs.P_EVENT_GCCS_ADDRESS_COLLECTED_EVENT.value,
org.csapi.cc.gccs.TpCallNotificationType.P_TERMINATING, // incoming
org.csapi.cc.TpCallMonitorMode.from_int(
org.csapi.cc.TpCallMonitorMode._P_CALL_MONITOR_MODE_INTERRUPT // interrupt
)
);
int assignmentId = ipCallCtlMgr.enableCallNotification(
ipAppCallCtlMgr,eventCriteria);
System.out.println("!!!!!! Ready to accept 8001234567 call !!!!!!!");
synchronized(lock) {
try {
lock.wait();
}
catch(Exception e) {}
System.out.println("TheApplication finished");
}
}
public void callEventNotify(org.csapi.cc.gccs.TpCallIdentifier callReference,
org.csapi.cc.gccs.TpCallEventInfo eventInfo, int assignmentID)
{
ipCall = callReference.CallReference;
callSessionID = callReference.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]);
ipCall.deassignCall(callSessionID);
}
public static public void callEnded(int SessionID, org.csapi.cc.gccs.TpCallEndedReport report)
{
synchronized(lock) {
try {
lock.notify();
}
catch(Exception e) {}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -