I am new to mobicents , I am currently working on a project which uses
mobicents sip-servlet on Jboss server.
I use SIP inspector as my user agent . everything works fine when i
deploy and run the code on the server, when i send invite call from
sip inspector and try to trace from wire shark , I getting an error
stating ''400 BAD Request''
This is my code from my editor
package org.example.servlet.sip;
import java.io.IOException;
import java.text.ParseException;
import javax.servlet.*;
import javax.servlet.sip.*;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.sip.SipServlet;
import javax.servlet.sip.SipServletRequest;
import javax.servlet.sip.SipErrorListener;
import javax.servlet.sip.SipServletRequest;
import javax.servlet.sip.SipServletResponse;
import javax.servlet.sip.Proxy;
public class ServletZigbee extends SipServlet{
protected void doInvite(SipServletRequest request)
throws ServletException, IOException
{
if(request.isInitial())
{
Proxy proxy = request.getProxy();
proxy.setRecordRoute(true);
proxy.setSupervised(true);
proxy.proxyTo(request.getRequestURI());
}
System.out.println("ServletZigbee: Got request:\n" +request);
}
public void doMessage(SipServletRequest request)
throws ServletException, IOException
{
SipServletResponse res = request.createResponse(200);
res.send();
}
public void init(ServletConfig config) throws ServletException {
super.init(config);
System.out.println("Servlet SIP / Zigbee deployed!");
}
}
Now i have to write a code using the method doMessage()
so that I can send message request to my sip inspector.
Can anyone guide me with this . It would be a great help !
Thanks
Indra
Hello Jean ,
This is the following error that I get . I am using SIP inspector as my SIP user agent and I am using invite and Message SIP messages, When i run my server and trace in wireshark, i get the following error in my server console
Indhira
To = ( "To" / "t" ) HCOLON ( name-addr
/ addr-spec ) *( SEMI to-param )
Looks like the semicolon should only be present if followed by a parameter.
these are my following wireshark traces.
This trace is for, which i tried to send a Message request from the
servlet to the SIP INSPECTOR, It worked well.
Frame 1 (413 bytes on wire, 413 bytes captured)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst:
00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol, Src: 192.168.0.114 (192.168.0.114), Dst: 127.0.0.1
(127.0.0.1)
User Datagram Protocol, Src Port: sip-tls (5061), Dst Port: onscreen
(5080)
Session Initiation Protocol
Request-Line: MESSAGE sip:10...@127.0.0.1:5080;transport=udp SIP/2.0
Method: MESSAGE
Request-URI: sip:10...@127.0.0.1:5080;transport=udp
[Resent Packet: False]
Message Header
Via: SIP/2.0/UDP 192.168.0.114:5061;branch=z9hG4bK200
Transport: UDP
Sent-by Address: 192.168.0.114
Sent-by port: 5061
Branch: z9hG4bK200
From: <sip:1...@192.168.0.114:5061>;tag=24417923471779367133
SIP from address: sip:1...@192.168.0.114:5061
SIP tag: 24417923471779367133
To: <sip:10...@127.0.0.1:5080>
SIP to address: sip:10...@127.0.0.1:5080
SIP to address User Part: 1000
SIP to address Host Part: 127.0.0.1
SIP to address Host Port: 5080
Call-ID: 1...@192.168.0.114
CSeq: 2 MESSAGE
Sequence Number: 2
Method: MESSAGE
Max-Forwards: 70
Contact: <sip:1...@192.168.0.114:5061;transport=UDP>
Contact Binding: <sip:1...@192.168.0.114:5061;transport=UDP>
User-Agent: SIPInspector_v_1.34
Content-Length: 0
The second trace is, when i Tried to send a MESSAGE request from SIP
inspector to Sip servlet & it failed, shwoing 404 Bad request ERROR
Frame 1 (413 bytes on wire, 413 bytes captured)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst:
00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol, Src: 192.168.0.114 (192.168.0.114), Dst: 127.0.0.1
(127.0.0.1)
User Datagram Protocol, Src Port: sip-tls (5061), Dst Port: onscreen
(5080)
Session Initiation Protocol
Request-Line: MESSAGE sip:10...@127.0.0.1:5080;transport=udp SIP/
2.0
Method: MESSAGE
Request-URI: sip:10...@127.0.0.1:5080;transport=udp
[Resent Packet: False]
Message Header
Via: SIP/2.0/UDP 192.168.0.114:5061;branch=z9hG4bK200
Transport: UDP
Sent-by Address: 192.168.0.114
Sent-by port: 5061
Branch: z9hG4bK200
From: <sip:1...@192.168.0.114:5061>;tag=24417923471779367133
SIP from address: sip:1...@192.168.0.114:5061
SIP tag: 24417923471779367133
To: <sip:10...@127.0.0.1:5080>
SIP to address: sip:10...@127.0.0.1:5080
SIP to address User Part: 1000
SIP to address Host Part: 127.0.0.1
SIP to address Host Port: 5080
Call-ID: 1...@192.168.0.114
CSeq: 2 MESSAGE
Sequence Number: 2
Method: MESSAGE
Max-Forwards: 70
Contact: <sip:1...@192.168.0.114:5061;transport=UDP>
Contact Binding: <sip:
1...@192.168.0.114:5061;transport=UDP>
User-Agent: SIPInspector_v_1.34
Content-Length: 0
No. Time Source Destination
Protocol Info
2 1.223063 127.0.0.1 192.168.0.114
SIP Status: 404 Not found
Frame 2 (277 bytes on wire, 277 bytes captured)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst:
00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol, Src: 127.0.0.1 (127.0.0.1), Dst: 192.168.0.114
(192.168.0.114)
User Datagram Protocol, Src Port: onscreen (5080), Dst Port: sip-tls
(5061)
Session Initiation Protocol
Status-Line: SIP/2.0 404 Not found
Status-Code: 404
[Resent Packet: False]
[Request Frame: 1]
[Response Time (ms): 1223]
Message Header
To: <sip:10...@127.0.0.1:5080>
SIP to address: sip:10...@127.0.0.1:5080
SIP to address User Part: 1000
SIP to address Host Part: 127.0.0.1
SIP to address Host Port: 5080
Via: SIP/2.0/UDP 192.168.0.114:5061;branch=z9hG4bK200
Transport: UDP
Sent-by Address: 192.168.0.114
Sent-by port: 5061
Branch: z9hG4bK200
CSeq: 2 MESSAGE
Sequence Number: 2
Method: MESSAGE
Call-ID: 1...@192.168.0.114
From: <sip:1...@192.168.0.114:5061>;tag=24417923471779367133
SIP from address: sip:1...@192.168.0.114:5061
SIP tag: 24417923471779367133
Content-Length: 0
Thanks
-Indhira