Java SIP确认对话框为空

Java SIP确认对话框为空,java,sip,jain-sip,Java,Sip,Jain Sip,我正在使用JAIN SIP在java中创建一个SIP客户端 我已成功注册并发送INVITE,但在将ACK发送回服务器时,我收到一个错误,该错误表示: Cannot Create ACK - no remote Target 我检查了Dialog的值,它是空的 在processResponse()中,我得到的值也是null this.dialog = responseEvent.getClientTransaction().getDialog(); 我将其传递给ack(responseEven

我正在使用JAIN SIP在java中创建一个SIP客户端

我已成功注册并发送INVITE,但在将ACK发送回服务器时,我收到一个错误,该错误表示:

Cannot Create ACK - no remote Target
我检查了Dialog的值,它是空的

在processResponse()中,我得到的值也是null

this.dialog = responseEvent.getClientTransaction().getDialog();
我将其传递给ack(responseEvent.getResponse(),对话框)

也在Register()和Call()中

dialog的值在此也为null

我也试过了

dialog = sipProvider.getNewDialog(inviteID);
但它给出了如下错误:

AUTOMATIC_DIALOG_SUPPORT is on
我是否必须初始化对话框或进行更多调用才能设置其值

如何实现ACK

REGISTER sip:SipIP SIP/2.0
Call-ID: b83eb80b195f6802c283c5927fb6415a@localHost
CSeq: 1 REGISTER
From: <sip:username@SipIP>;tag=1626086046
To: <sip:username@SipIP>
Via: SIP/2.0/UDP localHost:52216;rport;branch=z9hG4bK-363935-33f876b2e3720a123b62c68fc23cfa68
Max-Forwards: 70
Contact: <sip:username@localHost:52216;transport=UDP>
Content-Length: 0

SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP localHost:52216;branch=z9hG4bK-363935-33f876b2e3720a123b62c68fc23cfa68;received=localHost;rport=52216
From: <sip:username@SipIP>;tag=1626086046
To: <sip:username@SipIP>;tag=as3c3695d2
Call-ID: b83eb80b195f6802c283c5927fb6415a@localHost
CSeq: 1 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="65dfb3ad"
Content-Length: 0


REGISTER sip:SipIP SIP/2.0
Call-ID: b83eb80b195f6802c283c5927fb6415a@localHost
CSeq: 2 REGISTER
From: <sip:username@SipIP>;tag=1626086046
To: <sip:username@SipIP>
Via: SIP/2.0/UDP localHost:52216;rport;branch=z9hG4bK-363935-150b07c1e9409d05aafaa7652859024a
Max-Forwards: 70
Contact: <sip:username@localHost:52216;transport=UDP>
Authorization: Digest username="username",realm="xyz.com",nonce="65dfb3ad",uri="sip:SipIP",algorithm=MD5,response="b34005eb8ded9180fb5f5667f1ee842d"
Content-Length: 0


---------------------------Registered200--------------------

SIP/2.0 200 OK
Via: SIP/2.0/UDP localHost:52216;branch=z9hG4bK-363935-    150b07c1e9409d05aafaa7652859024a;received=localHost;rport=52216
From: <sip:username@SipIP>;tag=1626086046
To: <sip:username@SipIP>;tag=as3c3695d2
Call-ID: b83eb80b195f6802c283c5927fb6415a@localHost
CSeq: 2 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Expires: 240
Contact: <sip:username@localHost:52216;transport=UDP>;expires=240
Date: Wed, 22 Apr 2015 23:52:44 GMT
Content-Length: 0


Dialog created: gov.nist.javax.sip.stack.SIPDialog@d15ad713
Dialog: gov.nist.javax.sip.stack.SIPDialog@d15ad713

INVITE sip:SipIP SIP/2.0
Call-ID: b83eb80b195f6802c283c5927fb6415a@localHost
CSeq: 3 INVITE
From: <sip:username@SipIP>;tag=1626086046
To: <sip:160@SipIP>
Via: SIP/2.0/UDP localHost:52216;rport;branch=z9hG4bK-363935-3d3a34f99499b96c6c1f709065ed4c85
Max-Forwards: 70
Content-Type: application/sdp
Contact: <sip:username@localHost:52216;transport=UDP>
Content-Length: 300

v=0
o=fraunhofer 392867480 292042336 IN IP4 localHost
s=-
c=IN IP4 localHost
t=0 0
m=audio 8000 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
------------------Invite 401--------------------

SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP localHost:52216;branch=z9hG4bK-363935-        3d3a34f99499b96c6c1f709065ed4c85;received=localHost;rport=52216
From: <sip:username@SipIP>;tag=1626086046
To: <sip:160@SipIP>;tag=as3c3695d2
Call-ID: b83eb80b195f6802c283c5927fb6415a@localHost
CSeq: 3 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="4c1d89c8"
Content-Length: 0


-------------------------Dialog:gov.nist.javax.sip.stack.SIPDialog@d15ad713
Dialog get Remote Target: null
javax.sip.SipException: Cannot create ACK - no remote Target!
at gov.nist.javax.sip.stack.SIPDialog.createAck(SIPDialog.java:3021)
at test.ack(test.java:507)
at test.processResponse(test.java:214)
at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:296)
at gov.nist.javax.sip.EventScanner.run(EventScanner.java:519)
at java.lang.Thread.run(Thread.java:745)
无法创建ACK的日志-无远程目标

enter REGISTER sip:localIP SIP/2.0
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 1 REGISTER
From: <sip:username@localIP>;tag=1825098223
To: <sip:username@localIP>
Via: SIP/2.0/UDP 10.99.136.136:52216;rport;branch=z9hG4bK-363735-0dd0a58b853bb23070f706fc3b058461
Max-Forwards: 70
Contact: <sip:username@10.99.136.136:52216;transport=UDP>
Content-Length: 0


-----------StatusCode:401----------------------------
-----------currentREsponse:Unauthorized----------------------------
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-    363735-0dd0a58b853bb23070f706fc3b058461;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:username@localIP>;tag=as78941717
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 1 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="49a39764"
Content-Length: 0


REGISTER sip:localIP SIP/2.0
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 2 REGISTER
From: <sip:username@localIP>;tag=1825098223
To: <sip:username@localIP>
Via: SIP/2.0/UDP 10.99.136.136:52216;rport;branch=z9hG4bK-363735-0a214e6d4a1bc50c0faf1657cf109e31
Max-Forwards: 70
Contact: <sip:username@10.99.136.136:52216;transport=UDP>
Authorization: Digest username="username",realm="xyz.com",nonce="49a39764",uri="sip:localIP",algorithm=MD5,response="1af91bd8169339ec8c77decfab59fd21"
Content-Length: 0


-----------StatusCode:200----------------------------
-----------currentREsponse:OK----------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-    363735-0a214e6d4a1bc50c0faf1657cf109e31;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:username@localIP>;tag=as78941717
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 2 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Expires: 240
Contact: <sip:username@10.99.136.136:52216;transport=UDP>;expires=240
Date: Fri, 24 Apr 2015 16:58:50 GMT
Content-Length: 0


---------------------------Registered: 200--------------------

SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-0a214e6d4a1bc50c0faf1657cf109e31;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:username@localIP>;tag=as78941717
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 2 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Expires: 240
Contact: <sip:username@10.99.136.136:52216;transport=UDP>;expires=240
Date: Fri, 24 Apr 2015 16:58:50 GMT
Content-Length: 0


DEBUG: Response: SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-    363735-0a214e6d4a1bc50c0faf1657cf109e31;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:username@localIP>;tag=as78941717
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 2 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Expires: 240
Contact: <sip:username@10.99.136.136:52216;transport=UDP>;expires=240
Date: Fri, 24 Apr 2015 16:58:50 GMT
Content-Length: 0


Dialog: createdgov.nist.javax.sip.stack.SIPDialog@393895ed
INVITE sip:160@localIP SIP/2.0
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 3 INVITE
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>
Via: SIP/2.0/UDP 10.99.136.136:52216;rport;branch=z9hG4bK-363735-312eacb8db309d6c6794e2eb7adf8b92
Max-Forwards: 70
Content-Type: application/sdp
Contact: <sip:username@10.99.136.136:52216;transport=UDP>
Authorization: Digest username="username",realm="xyz.com",nonce="49a39764",uri="sip:localIP",algorithm=MD5,response="1af91bd8169339ec8c77decfab59fd21"
Content-Length: 211

v=0
o=user1 795808818 480847547 IN IP4 localIP
s=-
c=IN IP4 localIP
t=0 0
m=audio 8000 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv


Request OPTIONSreceived at stackwith server transaction idnull
-----------StatusCode:401----------------------------
-----------currentREsponse:Unauthorized----------------------------
------------------Invite 401--------------------

SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-    363735-312eacb8db309d6c6794e2eb7adf8b92;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as4f6f7f78
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 3 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="7e048345"
Content-Length: 0


DEBUG: Response: SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-312eacb8db309d6c6794e2eb7adf8b92;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as4f6f7f78
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 3 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="7e048345"
Content-Length: 0


Dialog: createdgov.nist.javax.sip.stack.SIPDialog@393895ed
INVITE sip:160@localIP SIP/2.0
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 4 INVITE
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>
Via: SIP/2.0/UDP 10.99.136.136:52216;rport;branch=z9hG4bK-363735-dae4419c9405bb40dda573fe9c276518
Max-Forwards: 70
Content-Type: application/sdp
Contact: <sip:username@10.99.136.136:52216;transport=UDP>
Authorization: Digest username="username",realm="xyz.com",nonce="49a39764",uri="sip:localIP",algorithm=MD5,response="1af91bd8169339ec8c77decfab59fd21"
Content-Length: 211

v=0
o=user1 795808818 480847547 IN IP4 localIP
s=-
c=IN IP4 localIP
t=0 0
m=audio 8000 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
-----------StatusCode:401----------------------------
-----------currentREsponse:Unauthorized----------------------------
------------------Invite 401--------------------

SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-1a2fd8de5c389de950ecbb1a3d9a7d3e;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as22472833
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 4 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="599cd63b"
Content-Length: 0


DEBUG: Response: SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-1a2fd8de5c389de950ecbb1a3d9a7d3e;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as22472833
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 4 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="599cd63b"
Content-Length: 0


Dialog: createdgov.nist.javax.sip.stack.SIPDialog@393895ed
INVITE sip:160@localIP SIP/2.0
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>
Via: SIP/2.0/UDP 10.99.136.136:52216;rport;branch=z9hG4bK-363735-633d808b788771fa1e211672ddc3e903
Max-Forwards: 70
Content-Type: application/sdp
Contact: <sip:username@10.99.136.136:52216;transport=UDP>
Authorization: Digest username="username",realm="xyz.com",nonce="49a39764",uri="sip:localIP",algorithm=MD5,response="1af91bd8169339ec8c77decfab59fd21"
Content-Length: 211

v=0
o=user1 795808818 480847547 IN IP4 localIP
s=-
c=IN IP4 localIP
t=0 0
m=audio 8000 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
-----------StatusCode:401----------------------------
-----------currentREsponse:Unauthorized----------------------------
-----------StatusCode:100----------------------------
-----------currentREsponse:Trying----------------------------
------------------- Status Code: 100--------------------------
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-a872936256c40065a4b147d4981cc74a;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Contact: <sip:160@localIP:5060>
Content-Length: 0


-----------StatusCode:401----------------------------
-----------currentREsponse:Unauthorized----------------------------


Request OPTIONSreceived at stackwith server transaction idnull
-----------StatusCode:180----------------------------
-----------currentREsponse:Ringing----------------------------

SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-a872936256c40065a4b147d4981cc74a;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as78f593d4
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Contact: <sip:160@localIP:5060>
Content-Length: 0

-


Request OPTIONSreceived at stackwith server transaction idnull


Request OPTIONSreceived at stackwith server transaction idnull


Request OPTIONSreceived at stackwith server transaction idnull
-----------StatusCode:200----------------------------
-----------currentREsponse:OK----------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-a872936256c40065a4b147d4981cc74a;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as78f593d4
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Contact: <sip:160@localIP:5060>
Content-Type: application/sdp
Content-Length: 256

v=0
o=root 698934329 698934329 IN IP4 localIP
s=Asterisk PBX 10.5.1
c=IN IP4 localIP
t=0 0
m=audio 23142 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

javax.sip.SipException: Cannot create ACK - no remote Target!
    at gov.nist.javax.sip.stack.SIPDialog.createAck(SIPDialog.java:3021)
    at test.processResponse(test.java:323)
    at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:296)
    at gov.nist.javax.sip.EventScanner.run(EventScanner.java:519)
    at java.lang.Thread.run(Thread.java:745)
-----------StatusCode:200----------------------------
-----------currentREsponse:OK----------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-a872936256c40065a4b147d4981cc74a;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as78f593d4
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Contact: <sip:160@localIP:5060>
Content-Type: application/sdp
Content-Length: 256

v=0
o=root 698934329 698934329 IN IP4 localIP
s=Asterisk PBX 10.5.1
c=IN IP4 localIP
t=0 0
m=audio 23142 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

javax.sip.SipException: Cannot create ACK - no remote Target!
    at gov.nist.javax.sip.stack.SIPDialog.createAck(SIPDialog.java:3021)
    at test.processResponse(test.java:323)
    at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:296)
    at gov.nist.javax.sip.EventScanner.run(EventScanner.java:519)
    at java.lang.Thread.run(Thread.java:745)
-----------StatusCode:200----------------------------
-----------currentREsponse:OK----------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-a872936256c40065a4b147d4981cc74a;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as78f593d4
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Contact: <sip:160@localIP:5060>
Content-Type: application/sdp
Content-Length: 256

v=0
o=root 698934329 698934329 IN IP4 localIP
s=Asterisk PBX 10.5.1
c=IN IP4 localIP
t=0 0
m=audio 23142 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

javax.sip.SipException: Cannot create ACK - no remote Target!
    at gov.nist.javax.sip.stack.SIPDialog.createAck(SIPDialog.java:3021)
    at test.processResponse(test.java:323)
    at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:296)
    at gov.nist.javax.sip.EventScanner.run(EventScanner.java:519)
    at java.lang.Thread.run(Thread.java:745)


Request OPTIONSreceived at stackwith server transaction idnull
-----------StatusCode:200----------------------------
-----------currentREsponse:OK----------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-a872936256c40065a4b147d4981cc74a;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as78f593d4
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Contact: <sip:160@localIP:5060>
Content-Type: application/sdp
Content-Length: 256

v=0
o=root 698934329 698934329 IN IP4 localIP
s=Asterisk PBX 10.5.1
c=IN IP4 localIP
t=0 0
m=audio 23142 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

javax.sip.SipException: Cannot create ACK - no remote Target!
    at gov.nist.javax.sip.stack.SIPDialog.createAck(SIPDialog.java:3021)
    at test.processResponse(test.java:323)
    at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:296)
    at gov.nist.javax.sip.EventScanner.run(EventScanner.java:519)
    at java.lang.Thread.run(Thread.java:745)




Request OPTIONSreceived at stackwith server transaction idnull


Request BYEreceived at stackwith server transaction idnull
----------------Received a BYE-----------------------
 null TID


Request BYEreceived at stackwith server transaction idnull
----------------Received a BYE-----------------------
 null TID


Request BYEreceived at stackwith server transaction idnull
----------------Received a BYE-----------------------
     null TID
输入注册sip:localIP sip/2.0
呼叫ID:5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq:1寄存器
发件人:;标签=1825098223
致:
Via:SIP/2.0/UDP 10.99.136.136:52216;rport;分支机构=z9hG4bK-363735-0dd0a58b853bb23070f706fc3b058461
最大前锋:70
联系人:
内容长度:0
-----------状态代码:401----------------------------
-----------当前响应:未经授权----------------------------
SIP/2.0 401未经授权
Via:SIP/2.0/UDP 10.99.136.136:52216;分支机构=z9hG4bK-363735-0dd0a58b853bb23070f706fc3b058461;已接收=10.99.136.136;rport=52216
发件人:;标签=1825098223
致:;标签=as78941717
呼叫ID:5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq:1寄存器
服务器:星号PBX 10.5.1
允许:邀请、确认、取消、选项、再见、参考、订阅、通知、信息、发布
支持:替换、定时器
WWW-Authenticate:Digest algorithm=MD5,realm=“xyz.com”,nonce=“49a39764”
内容长度:0
注册sip:localIP sip/2.0
呼叫ID:5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq:2寄存器
发件人:;标签=1825098223
致:
Via:SIP/2.0/UDP 10.99.136.136:52216;rport;分支机构=z9hG4bK-363735-0a214e6d4a1bc50c0faf1657cf109e31
最大前锋:70
联系人:
授权:Digest username=“username”,realm=“xyz.com”,nonce=“49a39764”,uri=“sip:localIP”,algorithm=MD5,response=“1af91bd8169339ec8c77decfab59fd21”
内容长度:0
-----------状态代码:200----------------------------
-----------回答:好的----------------------------
SIP/2.0 200正常
Via:SIP/2.0/UDP 10.99.136.136:52216;分支机构=z9hG4bK-363735-0a214e6d4a1bc50c0faf1657cf109e31;已接收=10.99.136.136;rport=52216
发件人:;标签=1825098223
致:;标签=as78941717
呼叫ID:5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq:2寄存器
服务器:星号PBX 10.5.1
允许:邀请、确认、取消、选项、再见、参考、订阅、通知、信息、发布
支持:替换、定时器
有效期:240
联系人:;expires=240
日期:2015年4月24日星期五16:58:50 GMT
内容长度:0
---------------------------注册人数:200--------------------
SIP/2.0 200正常
Via:SIP/2.0/UDP 10.99.136.136:52216;分支=z9hG4bK-363735-0a214e6d4a1bc50c0faf1657cf109e31;已接收=10.99.136.136;rport=52216
发件人:;标签=1825098223
致:;标签=as78941717
呼叫ID:5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq:2寄存器
服务器:星号PBX 10.5.1
允许:邀请、确认、取消、选项、再见、参考、订阅、通知、信息、发布
支持:替换、定时器
有效期:240
联系人:;expires=240
日期:2015年4月24日星期五16:58:50 GMT
内容长度:0
调试:响应:SIP/2.0 200正常
Via:SIP/2.0/UDP 10.99.136.136:52216;分支机构=z9hG4bK-363735-0a214e6d4a1bc50c0faf1657cf109e31;已接收=10.99.136.136;rport=52216
发件人:;标签=1825098223
致:;标签=as78941717
呼叫ID:5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq:2寄存器
服务器:星号PBX 10.5.1
允许:邀请、确认、取消、选项、再见、参考、订阅、通知、信息、发布
支持:替换、定时器
有效期:240
联系人:;expires=240
日期:2015年4月24日星期五16:58:50 GMT
内容长度:0
对话框:createdgov.nist.javax.sip.stack。SIPDialog@393895ed
邀请sip:160@localIPSIP/2.0
呼叫ID:5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq:3邀请
发件人:;标签=1825098223
致:
Via:SIP/2.0/UDP 10.99.136.136:52216;rport;分支=z9hG4bK-363735-312eacb8db309d6c6794e2eb7adf8b92
最大前锋:70
内容类型:应用程序/sdp
联系人:
授权:Digest username=“username”,realm=“xyz.com”,nonce=“49a39764”,uri=“sip:localIP”,algorithm=MD5,response=“1af91bd8169339ec8c77decfab59fd21”
内容长度:211
v=0
o=IP4本地化中的用户1 795808818 480847547
=-
c=在IP4中,P
t=0
m=音频8000 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101电话事件/8000
a=sendrecv
请求选项在stackwith服务器事务idnull处接收
-----------状态代码:401----------------------------
-----------当前响应:未经授权----------------------------
------------------邀请401--------------------
SIP/2.0 401未经授权
Via:SIP/2.0/UDP 10.99.136.136:52216;分支=z9hG4bK-363735-312eacb8db309d6c6794e2eb7adf8b92;已接收=10.99.136.136;rport=52216
发件人:;标签=1825098223
致:;标签=AS4F6F778
呼叫ID:5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq:3邀请
服务器:星号PBX 10.5.1
允许:邀请、确认、取消、选项、再见、参考、订阅、通知、信息、发布
支持:替换、定时器
WWW-Authenticate:Digest algorithm=MD5,realm=“xyz.com”,nonce=“7e048345”
内容长度:0
调试:响应:SIP/2.0 401未经授权
Via:SIP/2.0/UDP 10.99.136.136:52216;分支=z9hG4bK-363735-312eacb8db309d6c6794e2eb7adf8b92;已接收=10.99.136.136;rport=52216
发件人:;标签=1825098223
致:;标签=AS4F6F778
呼叫ID:5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq:3邀请
服务器:星号PBX 10.5.1
允许:邀请、确认、取消、选项、再见、参考、订阅、通知、信息、发布
支持:替换、定时器
WWW-Authenticate:Digest algorithm=MD5,realm=“xyz.com”,nonce=“7e048345”
内容长度:0
对话框:createdgov.nist.javax.sip.stack。SIPDialog@393895ed
邀请sip:160@localIPSIP/2.0
呼叫ID:5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq:4邀请
发件人:;标签=1825098223
致:
Via:SIP/2.0/UDP 10.99.136.136:52216;rport;分支=z9hG4bK-363735-dae4419c9405bb40dda573fe9c276518
最大前锋:70
内容类型:应用程序/sdp
联系人:
授权:Digest username=“username”,realm=“xyz.com”,nonce=“49a39764”,uri=“sip:localIP”,算法=
REGISTER sip:SipIP SIP/2.0
Call-ID: b83eb80b195f6802c283c5927fb6415a@localHost
CSeq: 1 REGISTER
From: <sip:username@SipIP>;tag=1626086046
To: <sip:username@SipIP>
Via: SIP/2.0/UDP localHost:52216;rport;branch=z9hG4bK-363935-33f876b2e3720a123b62c68fc23cfa68
Max-Forwards: 70
Contact: <sip:username@localHost:52216;transport=UDP>
Content-Length: 0

SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP localHost:52216;branch=z9hG4bK-363935-33f876b2e3720a123b62c68fc23cfa68;received=localHost;rport=52216
From: <sip:username@SipIP>;tag=1626086046
To: <sip:username@SipIP>;tag=as3c3695d2
Call-ID: b83eb80b195f6802c283c5927fb6415a@localHost
CSeq: 1 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="65dfb3ad"
Content-Length: 0


REGISTER sip:SipIP SIP/2.0
Call-ID: b83eb80b195f6802c283c5927fb6415a@localHost
CSeq: 2 REGISTER
From: <sip:username@SipIP>;tag=1626086046
To: <sip:username@SipIP>
Via: SIP/2.0/UDP localHost:52216;rport;branch=z9hG4bK-363935-150b07c1e9409d05aafaa7652859024a
Max-Forwards: 70
Contact: <sip:username@localHost:52216;transport=UDP>
Authorization: Digest username="username",realm="xyz.com",nonce="65dfb3ad",uri="sip:SipIP",algorithm=MD5,response="b34005eb8ded9180fb5f5667f1ee842d"
Content-Length: 0


---------------------------Registered200--------------------

SIP/2.0 200 OK
Via: SIP/2.0/UDP localHost:52216;branch=z9hG4bK-363935-    150b07c1e9409d05aafaa7652859024a;received=localHost;rport=52216
From: <sip:username@SipIP>;tag=1626086046
To: <sip:username@SipIP>;tag=as3c3695d2
Call-ID: b83eb80b195f6802c283c5927fb6415a@localHost
CSeq: 2 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Expires: 240
Contact: <sip:username@localHost:52216;transport=UDP>;expires=240
Date: Wed, 22 Apr 2015 23:52:44 GMT
Content-Length: 0


Dialog created: gov.nist.javax.sip.stack.SIPDialog@d15ad713
Dialog: gov.nist.javax.sip.stack.SIPDialog@d15ad713

INVITE sip:SipIP SIP/2.0
Call-ID: b83eb80b195f6802c283c5927fb6415a@localHost
CSeq: 3 INVITE
From: <sip:username@SipIP>;tag=1626086046
To: <sip:160@SipIP>
Via: SIP/2.0/UDP localHost:52216;rport;branch=z9hG4bK-363935-3d3a34f99499b96c6c1f709065ed4c85
Max-Forwards: 70
Content-Type: application/sdp
Contact: <sip:username@localHost:52216;transport=UDP>
Content-Length: 300

v=0
o=fraunhofer 392867480 292042336 IN IP4 localHost
s=-
c=IN IP4 localHost
t=0 0
m=audio 8000 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
------------------Invite 401--------------------

SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP localHost:52216;branch=z9hG4bK-363935-        3d3a34f99499b96c6c1f709065ed4c85;received=localHost;rport=52216
From: <sip:username@SipIP>;tag=1626086046
To: <sip:160@SipIP>;tag=as3c3695d2
Call-ID: b83eb80b195f6802c283c5927fb6415a@localHost
CSeq: 3 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="4c1d89c8"
Content-Length: 0


-------------------------Dialog:gov.nist.javax.sip.stack.SIPDialog@d15ad713
Dialog get Remote Target: null
javax.sip.SipException: Cannot create ACK - no remote Target!
at gov.nist.javax.sip.stack.SIPDialog.createAck(SIPDialog.java:3021)
at test.ack(test.java:507)
at test.processResponse(test.java:214)
at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:296)
at gov.nist.javax.sip.EventScanner.run(EventScanner.java:519)
at java.lang.Thread.run(Thread.java:745)
REGISTER sip:SIPIP SIP/2.0
Call-ID: 01bb8e9788fc251f8d44f2c709542fa5@LOCALIP
CSeq: 1 REGISTER
From: <sip:username@SIPIP>;tag=2125326583
To: <sip:username@SIPIP>
Via: SIP/2.0/UDP LOCALIP:52216;rport;branch=z9hG4bK-3833-142aff6ad1e359c2b618eba23fa04453
Max-Forwards: 70
Contact: <sip:username@LOCALIP:52216;transport=UDP>
Content-Length: 0

SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP LOCALIP:52216;branch=z9hG4bK-3833-142aff6ad1e359c2b618eba23fa04453;received=LOCALIP;rport=52216
From: <sip:username@SIPIP>;tag=2125326583
To: <sip:username@SIPIP>;tag=as2e8e5e8d
Call-ID: 01bb8e9788fc251f8d44f2c709542fa5@LOCALIP
CSeq: 1 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="6223df47"
Content-Length: 0


REGISTER sip:SIPIP SIP/2.0
Call-ID: 01bb8e9788fc251f8d44f2c709542fa5@LOCALIP
CSeq: 2 REGISTER
From: <sip:username@SIPIP>;tag=2125326583
To: <sip:username@SIPIP>
Via: SIP/2.0/UDP LOCALIP:52216;rport;branch=z9hG4bK-3833-36d48a4c062bbb9e83db9a12f36414b3
Max-Forwards: 70
Contact: <sip:username@LOCALIP:52216;transport=UDP>
Authorization: Digest username="username",realm="xyz.com",nonce="6223df47",uri="sip:SIPIP",algorithm=MD5,response="d4ac55bbc8dacb87f66cf9f4041af03c"
Content-Length: 0


---------------------------Registered200--------------------

SIP/2.0 200 OK
Via: SIP/2.0/UDP LOCALIP:52216;branch=z9hG4bK-3833-36d48a4c062bbb9e83db9a12f36414b3;received=LOCALIP;rport=52216
From: <sip:username@SIPIP>;tag=2125326583
To: <sip:username@SIPIP>;tag=as2e8e5e8d
Call-ID: 01bb8e9788fc251f8d44f2c709542fa5@LOCALIP
CSeq: 2 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Expires: 240
Contact: <sip:username@LOCALIP:52216;transport=UDP>;expires=240
Date: Thu, 23 Apr 2015 08:38:28 GMT
Content-Length: 0


Dialog: createdgov.nist.javax.sip.stack.SIPDialog@977c31a5
INVITE sip:SIPIP SIP/2.0
Call-ID: a86cc90138ad50d9716664b7925cb205@LOCALIP
CSeq: 3 INVITE
From: <sip:username@SIPIP>;tag=2125326583
To: <sip:160@SIPIP>
Via: SIP/2.0/UDP LOCALIP:52216;rport;branch=z9hG4bK-            3833-0db5ef4b4e463aee4fa22c3379915d5e
Max-Forwards: 70
Content-Type: application/sdp
Contact: <sip:username@LOCALIP:52216;transport=UDP>
Content-Length: 300

v=0
o=fraunhofer 392867480 292042336 IN IP4 LOCALIP
s=-
c=IN IP4 LOCALIP
t=0 0
m=audio 8000 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
------------------Invite 401--------------------

SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP LOCALIP:52216;branch=z9hG4bK-   3833-0db5ef4b4e463aee4fa22c3379915d5e;received=LOCALIP;rport=52216
From: <sip:username@SIPIP>;tag=2125326583
To: <sip:160@SIPIP>;tag=as54bd3315
Call-ID: a86cc90138ad50d9716664b7925cb205@LOCALIP
CSeq: 3 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="1e960014"
Content-Length: 0
enterpublic void call(Response response) {
    try {
        cseq++;
        String callee = "160";
        current_process = cseq + "INVITE";
        ArrayList viaHeaders = new ArrayList();
        ViaHeader viaHeader = headerFactory.createViaHeader(localIP,
                rport, "udp", null);
        viaHeader.setRPort();
        viaHeaders.add(viaHeader);
        // The "Max-Forwards" header.
        MaxForwardsHeader maxForwardsHeader = headerFactory.createMaxForwardsHeader(70);
        // The "Call-Id" header.
        CallIdHeader callIdHeader = this.sipProvider.getNewCallId();;
        // The "CSeq" header.
        CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(cseq, "INVITE");

        Address fromAddress = addressFactory.createAddress("sip:"
                + username + '@' + server);

        Address toAddress = addressFactory.createAddress("sip:"+callee+'@'+sipIP);

        FromHeader fromHeader = headerFactory.createFromHeader(
                fromAddress, String.valueOf(this.tag));
        // The "To" header.
        ToHeader toHeader = headerFactory.createToHeader(toAddress,
                null);

        ContentLengthHeader contentLength = headerFactory.createContentLengthHeader(211);
        ContentTypeHeader contentType = headerFactory.createContentTypeHeader("application", "sdp");

        String sdpData = "v=0\n" + 
                "o=user1 795808818 480847547 IN IP4 10.99.70.106\n" + 
                "s=-\n" + 
                "c=IN IP4 10.99.70.106\n" + 
                "t=0 0\n" + 
                "m=audio 8000 RTP/AVP 0 8 101\n" + 
                "a=rtpmap:0 PCMU/8000\n" + 
                "a=rtpmap:8 PCMA/8000\n" + 
                "a=rtpmap:101 telephone-event/8000\n" + 
                "a=sendrecv";
         byte[] contents = sdpData.getBytes();
         this.contactHeader = this.headerFactory
         .createContactHeader(contactAddress);

         URI requestURI = addressFactory.createURI("sip:"
                +callee+ '@'+ server); 

        request = this.messageFactory.createRequest(requestURI, Request.INVITE, 
                callIdHeader,cSeqHeader, fromHeader, toHeader, viaHeaders, maxForwardsHeader, contentType, contents);

        request.addHeader(contactHeader);
        request.addHeader(contentLength);
        test listener =this;
        if (response != null) {
            boolean retry = true;
            System.out.println("DEBUG: Response: "+response);
        }
        listener.inviteTid = sipProvider.getNewClientTransaction(request);


        if(dialog!= null && logger.isDebugEnabled()){
            logger.debug("Obtain dialog from ClientTransaction: automatic dialog support on");
//              System.out.println("Obtain dialog from ClientTransaction: automatic dialog support on");
        }
        if(dialog == null){
            //Automatic Dialog support turned off

            dialog = sipProvider.getNewDialog(inviteTid);

        }
        System.out.println("Dialog: created" + dialog);
        // send the request out.
        listener.inviteTid.sendRequest();

        this.dialog = this.inviteTid.getDialog();
 //         System.out.println("Dialog:" + dialog);

        // Send the request statelessly through the SIP provider.
        // this.sipProvider.sendRequest(request);
        System.out.println(request.toString());
        // Display the message in the text area.
        logger.debug("Request sent:\n" + "\n\n");
    } catch (Exception e) {
        // If an error occurred, display the error.
        e.printStackTrace();
        logger.debug("Request sent failed: " + e.getMessage() + "\n");
    }
}
enter REGISTER sip:localIP SIP/2.0
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 1 REGISTER
From: <sip:username@localIP>;tag=1825098223
To: <sip:username@localIP>
Via: SIP/2.0/UDP 10.99.136.136:52216;rport;branch=z9hG4bK-363735-0dd0a58b853bb23070f706fc3b058461
Max-Forwards: 70
Contact: <sip:username@10.99.136.136:52216;transport=UDP>
Content-Length: 0


-----------StatusCode:401----------------------------
-----------currentREsponse:Unauthorized----------------------------
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-    363735-0dd0a58b853bb23070f706fc3b058461;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:username@localIP>;tag=as78941717
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 1 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="49a39764"
Content-Length: 0


REGISTER sip:localIP SIP/2.0
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 2 REGISTER
From: <sip:username@localIP>;tag=1825098223
To: <sip:username@localIP>
Via: SIP/2.0/UDP 10.99.136.136:52216;rport;branch=z9hG4bK-363735-0a214e6d4a1bc50c0faf1657cf109e31
Max-Forwards: 70
Contact: <sip:username@10.99.136.136:52216;transport=UDP>
Authorization: Digest username="username",realm="xyz.com",nonce="49a39764",uri="sip:localIP",algorithm=MD5,response="1af91bd8169339ec8c77decfab59fd21"
Content-Length: 0


-----------StatusCode:200----------------------------
-----------currentREsponse:OK----------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-    363735-0a214e6d4a1bc50c0faf1657cf109e31;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:username@localIP>;tag=as78941717
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 2 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Expires: 240
Contact: <sip:username@10.99.136.136:52216;transport=UDP>;expires=240
Date: Fri, 24 Apr 2015 16:58:50 GMT
Content-Length: 0


---------------------------Registered: 200--------------------

SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-0a214e6d4a1bc50c0faf1657cf109e31;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:username@localIP>;tag=as78941717
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 2 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Expires: 240
Contact: <sip:username@10.99.136.136:52216;transport=UDP>;expires=240
Date: Fri, 24 Apr 2015 16:58:50 GMT
Content-Length: 0


DEBUG: Response: SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-    363735-0a214e6d4a1bc50c0faf1657cf109e31;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:username@localIP>;tag=as78941717
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 2 REGISTER
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Expires: 240
Contact: <sip:username@10.99.136.136:52216;transport=UDP>;expires=240
Date: Fri, 24 Apr 2015 16:58:50 GMT
Content-Length: 0


Dialog: createdgov.nist.javax.sip.stack.SIPDialog@393895ed
INVITE sip:160@localIP SIP/2.0
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 3 INVITE
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>
Via: SIP/2.0/UDP 10.99.136.136:52216;rport;branch=z9hG4bK-363735-312eacb8db309d6c6794e2eb7adf8b92
Max-Forwards: 70
Content-Type: application/sdp
Contact: <sip:username@10.99.136.136:52216;transport=UDP>
Authorization: Digest username="username",realm="xyz.com",nonce="49a39764",uri="sip:localIP",algorithm=MD5,response="1af91bd8169339ec8c77decfab59fd21"
Content-Length: 211

v=0
o=user1 795808818 480847547 IN IP4 localIP
s=-
c=IN IP4 localIP
t=0 0
m=audio 8000 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv


Request OPTIONSreceived at stackwith server transaction idnull
-----------StatusCode:401----------------------------
-----------currentREsponse:Unauthorized----------------------------
------------------Invite 401--------------------

SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-    363735-312eacb8db309d6c6794e2eb7adf8b92;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as4f6f7f78
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 3 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="7e048345"
Content-Length: 0


DEBUG: Response: SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-312eacb8db309d6c6794e2eb7adf8b92;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as4f6f7f78
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 3 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="7e048345"
Content-Length: 0


Dialog: createdgov.nist.javax.sip.stack.SIPDialog@393895ed
INVITE sip:160@localIP SIP/2.0
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 4 INVITE
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>
Via: SIP/2.0/UDP 10.99.136.136:52216;rport;branch=z9hG4bK-363735-dae4419c9405bb40dda573fe9c276518
Max-Forwards: 70
Content-Type: application/sdp
Contact: <sip:username@10.99.136.136:52216;transport=UDP>
Authorization: Digest username="username",realm="xyz.com",nonce="49a39764",uri="sip:localIP",algorithm=MD5,response="1af91bd8169339ec8c77decfab59fd21"
Content-Length: 211

v=0
o=user1 795808818 480847547 IN IP4 localIP
s=-
c=IN IP4 localIP
t=0 0
m=audio 8000 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
-----------StatusCode:401----------------------------
-----------currentREsponse:Unauthorized----------------------------
------------------Invite 401--------------------

SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-1a2fd8de5c389de950ecbb1a3d9a7d3e;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as22472833
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 4 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="599cd63b"
Content-Length: 0


DEBUG: Response: SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-1a2fd8de5c389de950ecbb1a3d9a7d3e;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as22472833
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 4 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
WWW-Authenticate: Digest algorithm=MD5,realm="xyz.com",nonce="599cd63b"
Content-Length: 0


Dialog: createdgov.nist.javax.sip.stack.SIPDialog@393895ed
INVITE sip:160@localIP SIP/2.0
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>
Via: SIP/2.0/UDP 10.99.136.136:52216;rport;branch=z9hG4bK-363735-633d808b788771fa1e211672ddc3e903
Max-Forwards: 70
Content-Type: application/sdp
Contact: <sip:username@10.99.136.136:52216;transport=UDP>
Authorization: Digest username="username",realm="xyz.com",nonce="49a39764",uri="sip:localIP",algorithm=MD5,response="1af91bd8169339ec8c77decfab59fd21"
Content-Length: 211

v=0
o=user1 795808818 480847547 IN IP4 localIP
s=-
c=IN IP4 localIP
t=0 0
m=audio 8000 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
-----------StatusCode:401----------------------------
-----------currentREsponse:Unauthorized----------------------------
-----------StatusCode:100----------------------------
-----------currentREsponse:Trying----------------------------
------------------- Status Code: 100--------------------------
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-a872936256c40065a4b147d4981cc74a;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Contact: <sip:160@localIP:5060>
Content-Length: 0


-----------StatusCode:401----------------------------
-----------currentREsponse:Unauthorized----------------------------


Request OPTIONSreceived at stackwith server transaction idnull
-----------StatusCode:180----------------------------
-----------currentREsponse:Ringing----------------------------

SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-a872936256c40065a4b147d4981cc74a;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as78f593d4
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Contact: <sip:160@localIP:5060>
Content-Length: 0

-


Request OPTIONSreceived at stackwith server transaction idnull


Request OPTIONSreceived at stackwith server transaction idnull


Request OPTIONSreceived at stackwith server transaction idnull
-----------StatusCode:200----------------------------
-----------currentREsponse:OK----------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-a872936256c40065a4b147d4981cc74a;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as78f593d4
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Contact: <sip:160@localIP:5060>
Content-Type: application/sdp
Content-Length: 256

v=0
o=root 698934329 698934329 IN IP4 localIP
s=Asterisk PBX 10.5.1
c=IN IP4 localIP
t=0 0
m=audio 23142 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

javax.sip.SipException: Cannot create ACK - no remote Target!
    at gov.nist.javax.sip.stack.SIPDialog.createAck(SIPDialog.java:3021)
    at test.processResponse(test.java:323)
    at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:296)
    at gov.nist.javax.sip.EventScanner.run(EventScanner.java:519)
    at java.lang.Thread.run(Thread.java:745)
-----------StatusCode:200----------------------------
-----------currentREsponse:OK----------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-a872936256c40065a4b147d4981cc74a;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as78f593d4
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Contact: <sip:160@localIP:5060>
Content-Type: application/sdp
Content-Length: 256

v=0
o=root 698934329 698934329 IN IP4 localIP
s=Asterisk PBX 10.5.1
c=IN IP4 localIP
t=0 0
m=audio 23142 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

javax.sip.SipException: Cannot create ACK - no remote Target!
    at gov.nist.javax.sip.stack.SIPDialog.createAck(SIPDialog.java:3021)
    at test.processResponse(test.java:323)
    at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:296)
    at gov.nist.javax.sip.EventScanner.run(EventScanner.java:519)
    at java.lang.Thread.run(Thread.java:745)
-----------StatusCode:200----------------------------
-----------currentREsponse:OK----------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-a872936256c40065a4b147d4981cc74a;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as78f593d4
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Contact: <sip:160@localIP:5060>
Content-Type: application/sdp
Content-Length: 256

v=0
o=root 698934329 698934329 IN IP4 localIP
s=Asterisk PBX 10.5.1
c=IN IP4 localIP
t=0 0
m=audio 23142 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

javax.sip.SipException: Cannot create ACK - no remote Target!
    at gov.nist.javax.sip.stack.SIPDialog.createAck(SIPDialog.java:3021)
    at test.processResponse(test.java:323)
    at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:296)
    at gov.nist.javax.sip.EventScanner.run(EventScanner.java:519)
    at java.lang.Thread.run(Thread.java:745)


Request OPTIONSreceived at stackwith server transaction idnull
-----------StatusCode:200----------------------------
-----------currentREsponse:OK----------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.99.136.136:52216;branch=z9hG4bK-363735-a872936256c40065a4b147d4981cc74a;received=10.99.136.136;rport=52216
From: <sip:username@localIP>;tag=1825098223
To: <sip:160@localIP>;tag=as78f593d4
Call-ID: 5fd6c07f15259d4aaeabdfb9e306cd12@10.99.136.136
CSeq: 5 INVITE
Server: Asterisk PBX 10.5.1
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer
Contact: <sip:160@localIP:5060>
Content-Type: application/sdp
Content-Length: 256

v=0
o=root 698934329 698934329 IN IP4 localIP
s=Asterisk PBX 10.5.1
c=IN IP4 localIP
t=0 0
m=audio 23142 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

javax.sip.SipException: Cannot create ACK - no remote Target!
    at gov.nist.javax.sip.stack.SIPDialog.createAck(SIPDialog.java:3021)
    at test.processResponse(test.java:323)
    at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:296)
    at gov.nist.javax.sip.EventScanner.run(EventScanner.java:519)
    at java.lang.Thread.run(Thread.java:745)




Request OPTIONSreceived at stackwith server transaction idnull


Request BYEreceived at stackwith server transaction idnull
----------------Received a BYE-----------------------
 null TID


Request BYEreceived at stackwith server transaction idnull
----------------Received a BYE-----------------------
 null TID


Request BYEreceived at stackwith server transaction idnull
----------------Received a BYE-----------------------
     null TID
   private String callingURI;
   private String calledURI;
   private String username;
   private String password;
   private Address fromNameAddress;
   private ContactHeader contactHeader;
// Save the created ACK request, to respond to retransmitted 2xx
private Request ackRequest;

private long cseq=1L;
public void processResponse(ResponseEvent responseReceivedEvent) {
    System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);

    System.out.println("Response received : Status Code = "
            + response.getStatusCode() + " " + cseq);

    try {
        if(cseq.getMethod().equals(Request.REGISTER)) {
            processRegisterResponse(responseReceivedEvent);
        }
        else if(cseq.getMethod().equals(Request.INVITE)) {
            processInviteResponse(responseReceivedEvent);
        }
        else if(cseq.getMethod().equals(Request.BYE)) {
            processByeResponse(responseReceivedEvent);
        }
        else {
            System.out.println("Response to unexpected request");
        }
    } catch(Exception e)  {
        e.printStackTrace();
    }
}
private void processRegisterResponse(ResponseEvent responseReceivedEvent) throws TransactionUnavailableException, ParseException, InvalidArgumentException, SipException, NoSuchAlgorithmException {
    Response response = (Response) responseReceivedEvent.getResponse();

    if(response.getStatusCode() == Response.UNAUTHORIZED) {
        sendRegister(response);
    }
    else if (response.getStatusCode() == Response.OK) {
        contactHeader=(ContactHeader)response.getHeader(ContactHeader.NAME);
        sendInvite();
    }               
}
private void sendInvite() throws ParseException, InvalidArgumentException, TransactionUnavailableException, SipException {

    // create To Header
    URI toAddress = addressFactory.createURI(calledURI);
    Address toNameAddress = addressFactory.createAddress(toAddress);
    ToHeader toHeader = headerFactory.createToHeader(toNameAddress,null);

    FromHeader fromHeader = headerFactory.createFromHeader(fromNameAddress, "12345");
    // Create ViaHeaders
    ArrayList<ViaHeader> viaHeaders = getViaHeaders();

    // Create a new CallId header
    CallIdHeader callIdHeader = sipProvider.getNewCallId();

    // Create a new Cseq header
    CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(cseq,Request.INVITE);
    cseq++;

    // Create a new MaxForwardsHeader
    MaxForwardsHeader maxForwards = headerFactory.createMaxForwardsHeader(70);

    // Create the request.
    Request request = messageFactory.createRequest(toAddress,
            Request.INVITE, callIdHeader, cSeqHeader, fromHeader,
            toHeader, viaHeaders, maxForwards);

    request.addHeader(contactHeader);

    // at this point you should add the rest of the headers, content, etc.

    // Create the client transaction.
    ClientTransaction currentTid = sipProvider.getNewClientTransaction(request);
    // send the request out.
    currentTid.sendRequest();
}
private void processInviteResponse(ResponseEvent responseReceivedEvent) throws SipException, InvalidArgumentException {
    Response response = (Response) responseReceivedEvent.getResponse();
    ClientTransaction tid = responseReceivedEvent.getClientTransaction();
    CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);     
    Dialog dialog = responseReceivedEvent.getDialog();

    if (tid == null) {
        // RFC3261: MUST respond to every 2xx
        if (ackRequest!=null && dialog!=null) {
            System.out.println("re-sending ACK");
            dialog.sendAck(ackRequest);
        }
        return;
    }

    if (response.getStatusCode() == Response.OK) {
        System.out.println("Dialog after 200 OK  " + dialog);
        System.out.println("Dialog State after 200 OK  " + dialog.getState());
        ackRequest = dialog.createAck(cseq.getSeqNumber() );
        System.out.println("Sending ACK");
        dialog.sendAck(ackRequest);
    }
}