Following a detailed explanation of the guts of the integration effort, we introduce the
Grails ClickToDial plugin (grails-c2d)
which eliminates the manual effort in building the c2dgrailsapp and demonstrates building the same capability by simply installing the plugin.
The application will be developed using the latest versions for Groovy (1.6), Grails (1.1) and deployedon Sailfin (1.0)The various strategies to integrate SIP Servlets with Web applications include:1.Java EE Web App with Java SIP Servlets [existing Sailfin ClickToDial app]2.Grails Web App with Java SIP Servlets [covered below]3.Grails Plugin to configure Java SIP Servlets [covered below]4.Grails Web App with SIP Groovlets (SIP Servlets in Groovy) [future work]
Additional features for this web app like authentication, using other web services is similar to the procedure followed with existing web applications and we will focus on the Servlet integration. In his tutorial, "E4SS/Grails/Sailfin tutorial", Gregory Bond demonstrates the integration of E4SS with Grails.The goal of this tutorial is to demonstrate the integration of regular SIP Servlets with Grails. For this project, code from the Sailfin ClickToDial project was modified to replace the JPA support with GrailsORM (GORM) layer.
The integration of SIP Servlets in the Grails web application is similar in parts to the integration with(HTTP) Servlets. Therefore, we will first list out the steps to get regular Servlets to work with a Grailsweb application and then move onto the SIP Servlet specific bits.In the following sections, we show the Grails/HttpServlet integration, then Grails/SipServlet integrationand the Grails/ClickToDial plugin.
Building the skeleton Grails app
The following steps show the development of a simple Grails application containing a single model'Person' class and applying static scaffolding (use dynamic scaffolding is also possible and works fine)to generate a CRUD web interface for it.1.$ grails create-app grails-c2dapp2.$ cd grails-c2dapp3.$ grails install-plugin hibernate4.$ grails create-domain-class PersonEdit Person class to add name(String) and telephone(String)5.$ grails generate-all Person6.$ grails run-appTest the application at "http://localhost:8080/grails-c2dapp/"In order to enable quick testing of the application, default accounts for 'alice' and 'bob' can be created in[grails-app/conf/BootStrap.groovy]
Note: Due to a bug in grails 1.1, we need to install the hibernate plugin to allow us to generate the scaffolded views.