JBoss.orgCommunity Documentation
With the advent of MSS 2.x, the Mobicents team made available asynchronous processing of requests feature in the world of SipServlets and demonstrated this feature with a new version of the traditional Click2Call example.
Now its time to get Click2Call one step further and demonstrate the CTF features with it.
In this new version of the Click2Call, the CDI programming model makes the application significant simpler by using beans as services. Redundant is the use of the ServletContext to store attributes such as registered users or calls. This is now being served by the CallStatusContainer and the SipRegistar modules. Several functions of the application are being delegated to beans also. Methods that need to fire an event are using the CDI event producer/observer model instead of a queue that was placed in the ServletContext and the SimpleSipServlet class is using the SipRegistar module to register users.
If you check out the Click2Call example you will notice the following major changes:
SimpleSipServlet is nothing more than a simple class. No more extend SipServlet and @Override
doRequest(SipServletRequest req) and such. All the methods of the class that needs to get notified for a SIP request or response have @Observe @SipEvent
and that enough to handle SIP messages.
Everywhere in the project, when there is a need for the SipFactory we don’t take it using JNDI anymore. A simple @Inject
SipFactory sipFactory will do the job since CTF makes available SipFactory for injection.
Several of the application’s functionality have been moved to stand alone modules. One of them is the SipRegistar module that will take care of SIP Registration requests. SimpleSipServlet injects SipRegistar module and delegates registration requests to it. Please note that these modules could reside in an external archive jar file placed in the classpath of the application, thus the beginning of reusable SIP modules.
You will also notice that SipSession or SipApplicationSession in the SimpleSipServlet wont be retrieved by the request or the response. If you include the following in the application @Inject
SipSession sipSession and @Inject
SipApplicationSession sipAppSession CTF will make sure you will get the SipSession and SipApplicationSession from the request or the response accordingly, depending on the SIP event you observe.
The drawing below will give you the general idea of the application’s interactions with the serveral modules and the CTF.
MSS 2.x comes with Click2CallAsync predeployed, make sure you undeploy this application and apply the correct dar configuration before you deploy the new version of Click2Call.
In the examples of the framework you will find a version of Click2Call with CTF, suitable for servlet 2.5 containers such as Tomcat 6.0.29 and JBoss AS5.