📄 theapplication.java.bak
字号:
package samples.mpccs.alarmcall;
import samples.fw.*;
import org.csapi.*;
import org.csapi.ui.*;
import org.csapi.cc.*;
import org.csapi.cc.mpccs.*;
/**
* This application crates a multiparty call to 4860034 and
* play a voice message after it is answered.
*/
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 IpMuiltpartyCall ipMPCall;
static IpMuiltpartyCallControlManager ipMPCallCtlMgr;
static IpAppMuiltpartyCallControlManager ipAppMPCallCtlMgr;
static int callSessionID;
static IpCallLeg ipCallLeg;
static int legID;
static IpAppCallLeg ipAppCallLeg;
static IpUICall ipUICall;
static IpUIManager ipUIMgr;
static IpAppUICall ipAppUICall;
static IpAppUIManager ipAppUIMgr;
static int uiCallSessionID;
public static void main(String[] argv) throws Exception
{
AppFWImpl.initiate("localhost", "12345", "FwInitial");
AppFWImpl.getAuthenticated("MPCCSApplication1");
IpInterface mgrIfc = AppFWImpl.getService("P_MULTIPARTY_CALL_CONTROL");
ipMPCallCtlMgr = org.csapi.cc.mpccs.IpMuiltpartyCallControlManagerHelper.narrow(
mgrIfc);
ipAppMPCallCtlMgr = IpAppMuiltpartyCallControlManagerHelper.narrow(
AppFWImpl.poa.servant_to_reference(
new AppMPCallControlManagerImpl()));
IpInterface uiMgrIfc = AppFWImpl.getService("P_USER_INTERACTION");
ipUIMgr = org.csapi.ui.IpUIManagerHelper.narrow(
uiMgrIfc);
TpMultiPartyCallIdentifier retCall =
ipMPCallCtlMgr.createCall(ipAppMPCallCtlMgr);
ipMPCall = retCall.CallReference;
callSessionID = retCall.CallSessionID;
org.csapi.cc.TpCallEventRequest[] eventReqs =
new org.csapi.cc.TpCallEventRequest[0];
org.csapi.cc.TpAdditionalCallEventCriteria addyCretieria =
new org.csapi.cc.TpAdditionalCallEventCriteria();
addyCretieria.Dummy((short) 0);
eventReqs[0] = new org.csapi.cc.TpCallEventRequest(
org.csapi.cc.TpCallEventType.P_CALL_EVENT_ANSWER ,
addyCretieria,
org.csapi.cc.TpCallMonitorMode.from_int(0));
org.csapi.cc.TpCallAppInfo[] appInfo = new org.csapi.cc.TpCallAppInfo[0];
ipAppCallLeg = IpAppCallLegHelper.narrow(
AppFWImpl.poa.servant_to_reference(new AppCallLegImpl());
System.out.println("Start to create call leg for 4860034");
org.csapi.cc.mpccs.TpCallLegIdentifier newLeg =
ipMPCall.createCallLeg(callSessionID, ipAppCallLeg);
legID = newLeg.CallLegSessionID;
ipCallLeg = newLeg.CallLegReference;
System.out.println("done to create call leg for 4860034, to eventReportReq");
ipCallLeg1.eventReportReq(legID,eventReqs);
System.out.println("done to eventReportReq, to route");
ipCallLeg.route(legID,targetAddress1,undefinedAddress,appInfo,
new org.csapi.cc.TpCallLegConnectionProperties(
org.csapi.cc.TpCallLegAttachMechanism.P_CALLLEG_ATTACH_IMPLICITLY));
System.out.println("done to route 4860034, and wating for eventReportRes");
synchronized(lock) {
try {
lock.wait();
}
catch(Exception e) {}
System.out.println("TheApplication finished");
}
}
static public void callEnded(int SessionID, org.csapi.cc.gccs.TpCallEndedReport report)
{
try {
ipMPCall.release(callSessionID,org.csapi.cc.TpReleaseCause.from_int(0));
}
catch(Exception e){}
synchronized(lock) {
try {
lock.notify();
}
catch(Exception e) {}
}
}
public static void eventReportRes(int callLegSessionID,
org.csapi.cc.TpCallEventInfo eventInfo)
{
try {
if (eventInfo.CallEventType.value()!=TpCallEventType._P_CALL_EVENT_ANSWER) {
if (callLegSessionID==legID1)
System.out.println("4860034 is not answer:"+eventInfo.CallEventType.value());
else
System.out.println("4860037 is not answer:"+eventInfo.CallEventType.value());
}
System.out.println("Start to createUICall");
org.csapi.ui.TpUITargetObject uiTargetObject = new org.csapi.ui.TpUITargetObject();
org.csapi.cc.mpccs.TpMultiPartyCallIdentifier call =
new org.csapi.cc.mpccs.TpMultiPartyCallIdentifier(
ipMPCall, callSessionID);
uiTargetObject.MultiPartyCall(call);
org.csapi.ui.TpUICallIdentifier retUICall = ipUIMgr.createUICall(
ipAppUICall,uiTargetObject);
ipUICall = retUICall.UICallRef;
uiCallSessionID = retUICall.UserInteractionSessionID;
TpUIInfo info = new TpUIInfo();
info.InfoAddress("Alarm service, wake up");
TpUIVariableInfo[] variableInfo = new TpUIVariableInfo[0];
ipUICall.sendInfoReq(uiCallSessionID, info,
"ZH",variableInfo,
0, // no repeating
0); // no response needed
System.out.println("message sent out, waiting it play out");
}
catch(Exception e){
e.printStackTrace();
}
}
public static void sendInfoErr(int uiSessionID, int assignmentID,
org.csapi.ui.TpUIError error)
{
System.out.println("SendInfoReq got error:"+ error.value()+", to quit");
try {
ipUICall.release(uiSessionID);
ipCall.release(callSessionID, org.csapi.cc.TpReleaseCause.from_int(0));
}
catch(Exception e){
e.printStackTrace();
}
synchronized(lock) {
try {
lock.notify();
}
catch(Exception e) {}
}
}
public void sendInfoResUICallProcess(Session session, org.csapi.ui.TpUIReport response)
{
try
{
System.out.println("SendInfoReq got UI res:"+response.value());
System.out.println("To Quit Alarm Call App");
// No matter what is the response, to clean up call
//
ipUICall.release(uiSessionID);
ipCall.release(callSessionID, org.csapi.cc.TpReleaseCause.from_int(0));
synchronized(lock) {
try {
lock.notify();
}
catch(Exception e) {}
}
}
catch(Exception e) {
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -