2014/11/12

Test Simple SIP application with Mobicents and Eclipse

看了幾篇,主要介绍如何使用Mobicents、Tomcat和eclipse創建Sip Servlet應用的方式。參考Developping a Simple SIP application with Mobicents and Eclipse的步驟,很快就能將測試環境安裝好。

目前手邊的程式在jboss下執行是沒問題的,但如果能在這樣的eclipse&tomcat的環境下開發測試,應該會省下一些麻煩的步驟,因此花了些時間測試一下。

我使用的測試環境是
作業系統:Window7 32位元
Eclipse Java EE IDE for Web Developers:Luna Service Release 1 (4.4.1) (download url http://www.eclipse.org/downloads/ )
Mobicents Sip Servlets:mss-3.0.564-apache-tomcat-7.0.50.zip ( download url https://github.com/Mobicents/sip-servlets/releases )

環境安裝請參考Developping a Simple SIP application with Mobicents and Eclipse ,這裡不再贅述。

Creating a new simple project in Eclipse

  • Click File / New / Dynamic Web Project
We will generate a simple SIP application without any Web support (only basic JSP).
  • In the dialog
  1. enter "SimpleServlet" as project name.
  2. select 2.4 as module version (2.5 version does not allow simple SIP app)
  3. Select "Converged SIP / Web" as configuration
如果順利安裝完Mobicents plugin 以上步驟是沒有問題的。

以下這個步驟非常重要,否則server是跑不起來的...
  • Open the file Servers / Mobicents at localhost-config / server.xml
  • At the end of the file, locate the Context definition :
<context docbase="SimpleServlet" path="/SimpleServlet" reloadable="true" source="org.eclipse.jst.j2ee.server:SimpleServlet"></host>

  • Remove the Context tag. KEEP </host> the tag only !!
Guru's help needed : if you do not remove the context definition from server.xml, Sip servlets are not started at launch time.......

在SimpleSipServlet.java 加入測試 code 後就就可以deploy,但檢查的步驟證明我的範例程式出了問題。

  • Deploy your application : in the servers pane, right clic on your server, then deploy.
  • Now start the server. On the servers pane, right click on your server, then choose Deploy, and Start
  • Check the log file ("console" view). Check that you do not have any error (no excpetion).
  • You should see the log ****** the simple sip servlet has been started *********
  • Now, the server should be listening on the UDP port 5080 (can be checked by the netstat -an command). It should contain the following line. (if you want grep, I recommand you install MINGW to get grep and tail).

UDP 127.0.0.1:5080 *:*    ----> 找不到 冏

---------------
紅字的部份就是檢查失敗的地方,查找了sip servlet相關文章,仍然搞不清楚問題是出在哪?
解決方法待續...



沒有留言:

張貼留言