Develop an application.

Before you begin

Restart the application server.

About this task

Step 6 towards the goal: Accessing telephony services with web services clients

Procedure

Develop an application to call the web services interface.
Use the following CEA web service APIs to access telephony services with web service clients:
  • W3CEndpointReference openSession(CommWsRequest)
  • void makeCall(CommWsRequest)
  • void endCall()
  • void closeSession()

Example

The following example shows how each of the APIs is used. For example, the return value from openSession is very important. It is an endpoint reference that must be used in all other APIs called related to the session monitoring that phone.
import com.ibm.ws.commsc.webservice.client.*;
...
public class Sample {

   private ControllerService controllerService = null;
   private Controller controllerPort = null;
   private W3CEndpointReference EPR = null;
   private Controller controllerPortWithEPR = null;

   // Constructor 
   public Sample() {
      // Access the web services client
      controllerService = ControllerService();
      if (controllerService!= null) {
         // Access the port on which main APIs are called
         controllerPort = controllerService.getControllerPort();
      }
      ...
   }
 
   // Open a session to monitor/control a phone
   public void openSession(String addressOfRecord, String notifyCallback) {
      // Build a request object
      CommWsRequest wsRequest = new CommWsRequest();
      wsRequest.setAddressOfRecord(addressOfRecord);
      wsRequest.setNotifyCallback(notifyCallback);
      EPR = controllerPort.openSession(wsRequest);
      controllerPortWithEPR = EPR.getPort(Controller.class, new AddressFeature(true));
   }

   // Make a call
   public void makeCall(String calleeAddressOfRecord) {
      // Build a request object
      CommWsRequest wsRequest = new CommWsRequest();
      wsRequest.setPeerAddressOfrecord(calleeAddressOfRecord);
      // Make the call, using the EPR returned in openSession()
      controllerPortWithEPR.makeCall(wsRequest);
   }

   // End an active call
   public void endCall() {
      // End the call, using the EPR returned in openSession()
      controllerPortWithEPR.endCall(wsRequest);
   }
   
   // Close the session monitoring the phone
   public void closeSession() {
      // Close the session, using the EPR returned in openSession()
      controllerPortWithEPR.closeSession();
   }

   ...
}
Attention: For another example, see the CEA sample application that comes with the CEA feature.

What to do next

Install and start the new application.
Task topic    

Terms and conditions for information centers | Feedback

Last updated: April 17, 2014 10:32 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-express-iseries&topic=tcea_manage_calls_webservice_step6
File name: tcea_manage_calls_webservice_step6.html