⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 theapplication.java.bak

📁 中兴公司在parlayx开发方面的培训文档
💻 BAK
字号:
package samples.gccs.alarmcall;


import samples.fw.*;
import org.csapi.*;
import org.csapi.ui.*;
import org.csapi.cc.gccs.*;

/**
 * This application crates a 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 IpCall ipCall;
	static IpCallControlManager ipCallCtlMgr;
	static IpAppCallControlManager ipAppCallCtlMgr;
	static int callSessionID;

	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("GCCSApplication1");
		
		IpInterface mgrIfc = AppFWImpl.getService("P_GENERIC_CALL_CONTROL");
		
		ipCallCtlMgr = org.csapi.cc.gccs.IpCallControlManagerHelper.narrow(
                                  mgrIfc);
                                  
		IpInterface uiMgrIfc = AppFWImpl.getService("P_USER_INTERACTION");
		ipUIMgr = org.csapi.ui.IpUIManagerHelper.narrow(
                                  uiMgrIfc);

        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 createUICall");
          		  
			org.csapi.ui.TpUITargetObject uiTargetObject = new org.csapi.ui.TpUITargetObject();
			org.csapi.cc.gccs.TpCallIdentifier call = new org.csapi.cc.gccs.TpCallIdentifier(ipCall, callSessionID);
			uiTargetObject.Call(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 + -