|
||||||||||||||||||||||||||||||||
3PCC FunctionThe 3PCC (Third Party Call Control) function is a component that implements applications such as Click-to-Dial. SIP Servlet Engine supports call flows conforming to the Internet Draft draft-ietf-sipping-3pcc-06.txt defined by IETF SIPPING. Specifically, it supports Type 1 and Type 2 call flows specified in the draft. Some SIP terminals support only Type 1, or do not support both types. Refer to the specification of your SIP terminal to select an available call flow. Figure 1 shows a process flow of the Call Flow Type 1.
This component also implements functions such as receiving state change of call control in progress as an event and canceling the process. The 3PCC function consists of the following classes: The following sections describe APIs provided by each class. CallControlServlet Classpackage com.oki.sip.equips.signal; public class CallControlServlet extends B2BUAServlet implements CallControlConstants, SipConstants { public CallingProgressHandler makeCall(SipRequestParams params) thorws ServletParseException, SignalingException; public CallingProgressHandler makeCall(int flowType, int timeout, int timeout2, CallingEntity caller, CallingEntity callee, CallingProgressListener listener) Locale locale) thorws ServletParseException, SignalingException; } CallControlServlet is a servlet class that implements the 3PCC function. This class inherits B2BUAServlet. So this servlet functions as B2BUA after establishing a call. You can set the following two initialization parameters in this SIP servlet.
This servlet exposes two methods used to establish a call between two terminals: The first makeCall method is used to start the HTTP servlet using SipRequestDispatcher. Internally, information stored in params (SipRequestParams class) is extracted to invoke the second makeCall method. Attributes that can be set in params are:
The second makeCall method specifies all the arguments and invokes processes. If you call this method from an HTTP servlet, write the following code: ServletContext context = session.getServletContext(); CallControlServlet servlet = (CallControlServlet) context.getServlet("3pcc"); CallingProgressHandler handler = servlet.makeCall(4, 120, 25, caller, callee, listener, Locale.getDefault()); Note that the ServletContext.getServlet is a deprecated method. Use the makeCall method instead as shown earlier. The description of the arguments and returned values of this method is as follows:
CallingEntity Classpackage com.oki.sip.equips.signal; public class CallingEntity { private final SipURI uri; private final String display; protected Address contact; public CallingEntity(SipURI uri, String display, Address contact); public CallingEntity(SipURI uri, String display); public SipURI getSipURI(); public String getDisplay(); public Address getContact(); public void setContact(Address contact); } The CallingEntity is a container class that stores information on the party (caller or receiver) that establishes the call with 3PCC. It has three instance variables:
The CallingEntity class provides only getter methods for uri and display since these variables are declared as final. For contact, both the setter and getter methods are provided. The getDisplay method returns display if a meaningful value is set in the display variable, otherwise returns the user part in uri. CallingProgressListener Interfacepackage com.oki.sip.equips.signal; public interface CallingProgressListener extends EventListener { void statusChanged(CallingProgress progress); } CallingProgressListener is an interface used for CallControleServlet to notify the caller of the state of ongoing call control. This event notification is issued whenever the step is changed in Figure 1 (Call Flow Type 1). When the event receipt is required, application developers create a class that implements this interface and pass it to CallControlServlet as the argument of makeCall. CallingProgress Classpackage com.oki.sip.equips.signal; public class CallingProgress extends EventObject implements Serializable { public SipURI getCallerURI(); public SipURI getCalleeURI(); public int getPercent(); public boolean isInitiated(); public boolean isDone(); public int getStatusCode(); public String getReasonPhrase(); public String getMessage(); public long getCallLength(); public static final int TERM_NOT_YET; public static final int TERM_HOOK; public static final int TERM_CANCEL; public static final int TERM_TIMEOUT; public static final int TERM_ERROR; public int getTerminatingCode(); } CallingProgress is a class that stores the progress of the call, which is used as the argument of CallingProgressListener. It stores various state information as shown below: getCallerURI and getCalleeURI are methods that get the SIP URI of the party that establishes the call. This information is not changed from the time the first request is delivered to CallControlServlet. getPercent is a method that returns the percentage that represents the current progress. This method returns 100 (%) upon the establishment of the call, not on the disconnection of it. Use the isDone method to detect that the call is disconnected. isInitiated is a method that determines whether the call is established. It returns true if the call is established, otherwise (such as on failure) returns false. isOnline is a method that determines whether the call is online. It returns true if online, otherwise returns false. Note that the call is not controlled strictly in SIP, unlike traditional telephony systems. This method returns the state that CallControlServlet recognizes it as online. Therefore, there is no guarantee that it is really online. For example, if either of the SIP terminals terminates a realtime session without issuing BYE due to a network failure, CallControlServlet recognizes that the session is still online. isDone is a method that determines whether the call is disconnected. It returns true if the call is successfully completed or the call process is aborted. getStatusCode and getReasonPhrase returns the status code and description string of the last received SIP response. For example, if the SIP response is "180 RINGING", "180" represents the status code and "RINGING" represents the description string. If an event is triggered based on sending an SIP request, the status code of the SIP response received before then is set. getMessage is a method that retrieves the description string set by CallControlServlet. Examples of these strings are:
getCallLength returns the call period in msec. This method returns a meaningful value if the call is established and completed. Otherwise (when the call is not established, the call is busy, and an error or cancel occurred), a negative value is returned. getTerminatingCode is a method that returns the cause of the 3PCC process completion. This method returns one of the following values:
CallingProgressHandler Interfacepackage com.oki.sip.equips.signal; public interface CallingProgressHandler { CallingProgress getStatus(); void cancel() throws IllegalStateException; void terminate() throws IllegalStateException; } The CallingProgressHandler interface is used to control the call process initiated by makeCall from outside. SIP Servlet Engine 3.0 can disconnect or cancel the call. This object can be retrieved as a return value of the CallControlServlet.makeCall. getStatus is a method that gets the current state of the 3PCC process. This method returns the CallingProgress object, which is the same class to CallingProgressListener . cancel is a method that interrupts the current state of the 3PCC process. This method is only available until the call is established. When you disconnect a call already established, use the terminate() method. If you call this method after the process is terminated due to an error response, IllegalStateException is thrown. terminate is a method that disconnects the call established by 3PCC. This method is available only for the call that has been already established. Use cancel() to cancel the call that has not been established yet. If this method is invoked when the call has not been established, IllegalStateException is thrown. Last Modified:Mon May 17 11:36:11 AM JST 2004 |
||||||||||||||||||||||||||||||||
|