Back to SipClickToDialExample2, or SipClickToDialExample2 Info
| At line 1 added 2 lines. |
| [{ALLOW comment All }] |
| [{ALLOW rename Authenticated }] |
| At line 22 added 1 line. |
| # When one of them hangs up, the other one is also disconnected |
| At line 29 changed 1 line. |
| The first servlet is a SIP Servlet that handles softphone registration. When Alice or Bob launches their softphone, it registers the softphone address with a SIP proxy. |
| The first servlet is a SIP Servlet that handles softphone registration. When Alice or Bob launches their softphone, it registers the softphone address with a SIP proxy. We will record the softphone contact information using Java Persistence API. It will be used later to call Alice or Bob. |
| At line 31 changed 1 line. |
| Our registrar servlet will record the softphone contact information using Java Persistence, so that it can be used later to call Alice or Bob. |
| Below is pseudocode for clicktodial.sip.RegistrarServlet. The full code can be found in the [download bundle|ClickToDial.zip]. |
| At line 33 removed 2 lines. |
| Below is some pseudocode for clicktodial.sip.RegistrarServlet. The full code can be found in the [download bundle|ClickToDial.zip]. |
| At line 144 changed 1 line. |
| The Call SIP servlet handles the OK response to the INVITE sent by the PlaceCall servlet above. Once an OK is received from Alice, this servlet sends an INVITE to Bob, specifying Alice's media preferences. When an OK is received from Bob, it sends an ACK to both parties. |
| The Call SIP servlet handles the OK response to the INVITE sent by the PlaceCall servlet above. Once an OK is received from Alice, this servlet sends an INVITE to Bob, specifying Alice's media preferences. When an OK is received from Bob, it sends an ACK to both parties. It also handle the BYE and call tear down. |
| At line 169 changed 1 line. |
| // to ring the second party, or the OK is from the second |
| // to ring the second pa |
| 2000 |
| rty, or the OK is from the second |
| At line 200 removed 1 line. |
| secondPartyAck.setContent(resp.getContent(), "application/sdp"); |
| At line 213 changed 1 line. |
| The example is distributed as a NetBeans project. You can deploy it directly from [NetBeans 5.5.1|http://www.netbeans.org/community/releases/55/1/] to a [SailFin|http://sailfin.dev.java.net] container. |
| Please follow the following steps to install and start the server |
| At line 215 changed 1 line. |
| Before you start, you will need to download and build SailFin using [these instructions|https://sailfin.dev.java.net/Build_Instructions_for_SailFin.html]. You will also need to use the Server Manager in NetBeans to add SailFin as a server. |
| # [Download and install SailFin.|https://sailfin.dev.java.net/downloads/downloads.html]. |
| # The example is distributed as a NetBeans project. You can build and deploy it directly from [NetBeans|http://www.netbeans.org/] to a [SailFin|http://sailfin.dev.java.net] container. You can also use the [SIP Application Development Module for NetBeans |http://blogs.sun.com/vkraemer/entry/sip_servlet_development_support_and] to develop new SIP Application projects. |
| # Start SailFin (SF_HOME/bin/asadmin start-domain) |
| # Start JavaDB (SF_HOME/bin/asadmin start-database) |
| At line 217 changed 3 lines. |
| To install: |
| # Unzip the download bundle |
| # Open the project in NetBeans 5.5.1 |
| Follow the steps below to the application |
| # Unzip the [download bundle | ClickToDial.zip] |
| # Open the project in NetBeans |
| At line 222 removed 1 line. |
| # Alternatively, you can select "Build" from the NetBeans menu. This will generate "dist/ClickToDial.war", which can be deployed manually. |
| At line 229 added 4 lines. |
| Alternatively, you can skip NetBeans and use the <b>ant</b> scripts. There is a <b>build.xml</b> in the top level directory that will automatically build it and generate a deployable archive in <b>dist/ClickToDial.war</b>. You can deploy using <b>asadmin deploy dist/ClickToDIal.war</b>. |
| Before you deploy, create a JDBC resource called jdbc/sample. You can do that by logging into the Admin console (http://localhost:4848) and clicking on the little triangle to expand <b>Resources</b>. Click on <b>JDBC</b>. Click on <JDBC Resources</b>. You will see a list of already existing JDBC resources. If you do not see <b>jdbc/sample</b>,you can create it by clicking on <b>New</b> button. Use <b>jdbc/sample</b> for name and choose the pre-defined <b>DerbyPool</b> for the database connection pool. Click <b>OK</b>. |
| At line 226 changed 1 line. |
| You can test this example using any SIP-based software phone. Instructions are provided for two freely available softphones: [x-lite|http://www.counterpath.com/index.php?menu=Products&smenu=xlite] and [Ekiga|http://www.gnomemeeting.org]. |
| You can test this example using any SIP-based software phone. Instructions are provided for freely available X-Lite softphones: [x-lite|http://www.counterpath.com/index.php?menu=Products&smenu=xlite] |
| At line 236 changed 1 line. |
| Start of by logging in as Bob. Select 'Bob' in the drop-down menu and click Login. This should bring up Bob's home page, with no softphone registered: |
| Start off by logging in as Bob. Select 'Bob' in the drop-down menu and click Login. This should bring up Bob's home page, with no softphone registered: |
| At line 241 changed 1 line. |
| ! 3. Setup the Ekiga Softphone |
| ! 3. Setup Bob's Softphone |
| At line 243 changed 1 line. |
| Ekiga is a freely available softphone for Linux and Windows. To set up Bob's softphone in Ekiga, I used the settings below, where 129.148.173.187 is the IP address of my SailFin server. |
| X-Lite is a freely available softphone for many platforms. To set up Bob's softphone, I used the settings below, where 129.148.173.187 is the IP address of my SailFin server. It is running on port 5060. |
| At line 245 changed 1 line. |
| [{Image src='ekiga.png' width='' height='' align='center' }] |
| [{Image src='BobProp.png' width='' height='' align='center' }] |
| At line 247 changed 1 line. |
| With Ekiga setup, enabled the account to perform the registration. You should see a message like the following in the SailFin log: |
| With X-Lite setup, enable the account to perform the registration to SailFin server which is acting as a registrar. You should see a message like the following in the SailFin log: |
| At line 263 added 1 line. |
| X-Lite also will show a message: <b>You are logged in as Bob</b>. Once X-Lite successfully registers, you can reload Bob's Login web page to get more information about his registration: |
| At line 255 removed 2 lines. |
| Once Ekiga is launched, you can reload Bob's page to get more information about his registration: |
| At line 263 changed 1 line. |
| ! 5. Setup the x-lite Softphone |
| ! 5. Setup the x-lite Softphone. Same as above, but configured for Alice. |
| At line 265 removed 4 lines. |
| X-Lite is a free, cross-platform softphone from Counterpath. I used the following setup to have my x-lite softphone log in as Alice: |
| [{Image src='xten.png' width='' height='' align='center' }] |
| At line 271 changed 1 line. |
| [{Image src='Alice.png' width='' height='' align='center' }] |
| [{Image src='BothLoggedIn.png' width='' height='' align='center' }] |
| At line 275 changed 1 line. |
| Now we are all set up to have Alice place a call to Bob. When Alice clicks on the "Call" link next to Bob's name, her softphone should ring. When she picks up, Bob's sofphone should ring. When he answers, the call is connected. |
| Now we are all set up to have Alice place a call to Bob (or Bob to Alice). When Alice clicks on the "Call" link next to Bob's name, her softphone should ring. When she picks up, Bob's sofphone should ring. When he answers, the call is connected. Either can disconnect first and the other is automatically disconnected by CallServlet. |
| At line 281 added 2 lines. |
| Make sure, you do the web login first. If the SIP Soft Phone connects to SailFin before the web login, Registration will fail. The sample can be modified to remove this limitation, if you wish. |