Here are two sipdroid sip registration logs for the same Android phone
connecting to the same server, sniffed over wifi using Wireshark; one using an
adsl connection and 'ordinary' nat, which works; and the other using a Virgin
Media 'Super Hub' (vmdg480, software version "V2.37.01"), where the
registration reply is ignored by the phone; it simply retries the same
registration request again and again. In the working case it sends a followup
register request containing authorization data.
You'll see that the Call-ID field has been re-written by the SuperHub: the id
when it left the phone was:
Call-ID: 780196184658@$(PHONE)
where $(PHONE) is the ip address of the phone in dotted decimal; but the
response contains:
Call-ID: 780196184658@$(PUBLIC)
where $(PUBLIC) is the public facing interface of the SuperHub. In the working
example the reply contains the same Call-ID as the request.
I note a comment at
http://stackoverflow.com/questions/10610194/call-id-and-branch-tags-in-sip-proto
col
"There's no requirement for Call-ID to be in the for unique token + "@" + a
host name. You'll find a lot of SIP stacks use a GUID or similar for it.
Putting an IP address in the Call-ID value is actually a bad idea. I've seen
SIP ALG's that mangle every private IP address they find in a SIP packet and
that will screw up the Call-ID header if they happen to contain a private IP
address"
This is what appears to be happening in the attached logs. In the interest of
robustness it would make sense for the sipdroid Call-ID field format to be
changed so that it doesn't contain a literal IP address - map 0-9 to a-j or
change the dots to dashes, or not use the ip at all.
----
In the wireshark dump below, $(PHONE) is the ip address of the phone on the
private side of the local router; $(PUBLIC) is the public address of the local
router; and $(SERVER) is the public address of the SIP server.
Failing case (Super Hub):
Internet Protocol Version 4, Src: $(PHONE) ($(PHONE)), Dst: $(SERVER)
($(SERVER))
User Datagram Protocol, Src Port: 35033 (35033), Dst Port: sip (5060)
Source port: 35033 (35033)
Destination port: sip (5060)
Length: 432
Checksum: 0x37e1 [validation disabled]
Session Initiation Protocol
Request-Line: REGISTER sip:$(SRVNAME) SIP/2.0
Method: REGISTER
Request-URI: sip:$(SRVNAME)
[Resent Packet: False]
Message Header
Via: SIP/2.0/UDP $(PHONE):35033;rport;branch=z9hG4bK41913
Transport: UDP
Sent-by Address: $(PHONE)
Sent-by port: 35033
RPort: rport
Branch: z9hG4bK41913
Max-Forwards: 70
To: <sip:4272@$(SRVNAME)>
SIP to address: sip:4272@$(SRVNAME)
SIP to address User Part: 4272
SIP to address Host Part: $(SRVNAME)
From: <sip:4272@$(SRVNAME)>;tag=z9hG4bK55002276
SIP from address: sip:4272@$(SRVNAME)
SIP from address User Part: 4272
SIP from address Host Part: $(SRVNAME)
SIP tag: z9hG4bK55002276
Call-ID: 780196184658@$(PHONE)
CSeq: 1 REGISTER
Sequence Number: 1
Method: REGISTER
Contact: <sip:4272@$(PHONE):35033;transport=udp>
Contact-URI: sip:4272@$(PHONE):35033;transport=udp
Contactt-URI User Part: 4272
Contact-URI Host Part: $(PHONE)
Contact-URI Host Port: 35033
Contact parameter: transport=udp>
Expires: 3600
User-Agent: Sipdroid/2.9 beta/HTC Desire
Content-Length: 0
Internet Protocol Version 4, Src: $(SERVER) ($(SERVER)), Dst: $(PHONE)
($(PHONE))
User Datagram Protocol, Src Port: sip (5060), Dst Port: 35033 (35033)
Source port: sip (5060)
Destination port: 35033 (35033)
Length: 530
Checksum: 0x56c7 [validation disabled]
Session Initiation Protocol
Status-Line: SIP/2.0 401 Unauthorized
Status-Code: 401
[Resent Packet: False]
Message Header
Via: SIP/2.0/UDP $(PUBLIC):35033;branch=z9hG4bK41913;received=$(PUBLIC);rport=35033
Transport: UDP
Sent-by Address: $(PUBLIC)
Sent-by port: 35033
Branch: z9hG4bK41913
Received: $(PUBLIC)
RPort: 35033
From: <sip:4272@$(SRVNAME)>;tag=z9hG4bK55002276
SIP from address: sip:4272@$(SRVNAME)
SIP from address User Part: 4272
SIP from address Host Part: $(SRVNAME)
SIP tag: z9hG4bK55002276
To: <sip:4272@$(SRVNAME)>;tag=as40b180a2
SIP to address: sip:4272@$(SRVNAME)
SIP to address User Part: 4272
SIP to address Host Part: $(SRVNAME)
SIP tag: as40b180a2
Call-ID: 780196184658@$(PUBLIC)
CSeq: 1 REGISTER
Sequence Number: 1
Method: REGISTER
User-Agent: $(AGENT)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="7af64c99"
Authentication Scheme: Digest
algorithm=MD5
realm="asterisk"
nonce="7af64c99"
Content-Length: 0
Working case (same phone and server):
Internet Protocol Version 4, Src: $(PHONE) ($(PHONE)), Dst: $(SERVER)
($(SERVER))
User Datagram Protocol, Src Port: 38231 (38231), Dst Port: sip (5060)
Source port: 38231 (38231)
Destination port: sip (5060)
Length: 438
Checksum: 0xa251 [validation disabled]
Session Initiation Protocol
Request-Line: REGISTER sip:$(SRVNAME) SIP/2.0
Method: REGISTER
Request-URI: sip:$(SRVNAME)
[Resent Packet: False]
Message Header
Via: SIP/2.0/UDP $(PHONE):38231;rport;branch=z9hG4bK78754
Transport: UDP
Sent-by Address: $(PHONE)
Sent-by port: 38231
RPort: rport
Branch: z9hG4bK78754
Max-Forwards: 70
To: <sip:4272@$(SRVNAME)>
SIP to address: sip:4272@$(SRVNAME)
SIP to address User Part: 4272
SIP to address Host Part: $(SRVNAME)
From: <sip:4272@$(SRVNAME)>;tag=z9hG4bK63395224
SIP from address: sip:4272@$(SRVNAME)
SIP from address User Part: 4272
SIP from address Host Part: $(SRVNAME)
SIP tag: z9hG4bK63395224
Call-ID: 129162509255@$(PHONE)
CSeq: 1 REGISTER
Sequence Number: 1
Method: REGISTER
Contact: <sip:4272@$(PHONE):38231;transport=udp>
Contact-URI: sip:4272@$(PHONE):38231;transport=udp
Contactt-URI User Part: 4272
Contact-URI Host Part: $(PHONE)
Contact-URI Host Port: 38231
Contact parameter: transport=udp>
Expires: 3600
User-Agent: Sipdroid/2.9 beta/HTC Desire
Content-Length: 0
Internet Protocol Version 4, Src: $(SERVER) ($(SERVER)), Dst: $(PHONE)
($(PHONE))
User Datagram Protocol, Src Port: sip (5060), Dst Port: 38231 (38231)
Source port: sip (5060)
Destination port: 38231 (38231)
Length: 532
Checksum: 0x867d [validation disabled]
Session Initiation Protocol
Status-Line: SIP/2.0 401 Unauthorized
Status-Code: 401
[Resent Packet: False]
[Request Frame: 193]
[Response Time (ms): 39]
Message Header
Via: SIP/2.0/UDP $(PHONE):38231;branch=z9hG4bK78754;received=$(PUBLIC);rport=30993
Transport: UDP
Sent-by Address: $(PHONE)
Sent-by port: 38231
Branch: z9hG4bK78754
Received: $(PUBLIC)
RPort: 30993
From: <sip:4272@$(SRVNAME)>;tag=z9hG4bK63395224
SIP from address: sip:4272@$(SRVNAME)
SIP from address User Part: 4272
SIP from address Host Part: $(SRVNAME)
SIP tag: z9hG4bK63395224
To: <sip:4272@$(SRVNAME)>;tag=as7ad78559
SIP to address: sip:4272@$(SRVNAME)
SIP to address User Part: 4272
SIP to address Host Part: $(SRVNAME)
SIP tag: as7ad78559
Call-ID: 129162509255@$(PHONE)
CSeq: 1 REGISTER
Sequence Number: 1
Method: REGISTER
User-Agent: $(AGENT)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="55a09595"
Authentication Scheme: Digest
algorithm=MD5
realm="asterisk"
nonce="55a09595"
Content-Length: 0
Original issue reported on code.google.com by will...@gmail.com on 3 Feb 2013 at 2:37
Original issue reported on code.google.com by
will...@gmail.com
on 3 Feb 2013 at 2:37