Here it goes, apologies for the length:
The registration process is done via TLS and therefore I "can not" post the trace. However, the resulting data is the following:
AOR::
sam@domain.comContact:: sip:83652074@M.N.O.P:34120;transport=tls Q=
Expires:: 569
Callid:: iUcVvmbsda9Yu0DGUm4exTHiZYIqwgtZ
Cseq:: 2
User-agent:: Blink 0.9.1 (Linux)
Received:: sip:M.N.O.P:39961;transport=TLS
State:: CS_DIRTY
Flags:: 0
Cflag:: 64
Socket:: tls:X.Y.Z.W:5061
Methods:: 4294967295
Ruid:: uloc-53fc870d-1097-4
Instance:: <urn:uuid:d63b1c4f-d7dc-4f4e-87f1-948123266dc0>
Reg-Id:: 0
Last-Keepalive:: 1409121941
Last-Modified:: 1409121941
The call trace is the following (Trying and Ringing messages removed for simplicity):
U A.B.C.D:5060 -> X.Y.Z.W:5060
INVITE
sip:999666222@pstn.domain.com SIP/2.0..Via: SIP/2.0/UDP A.B.C.D:5060;branch=z9hG4bK222c6640..Max-Forwards: 70..From: "111222333"
<sip:111222333@A.B.C.D>;tag=as1a7b4c7d..To: <
sip:999666222@pstn.domain.com>..Contact: <sip:111222333@A.B.C.D:5060>..Call-ID: 59f5
579c01f8039243ec830d317df994@A.B.C.D:5060..CSeq: 102 INVITE..User-Agent: IPXAdam..Date: Wed, 27 Aug 2014 06:45:54 GMT..Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH..Supported: replaces, timer..Content-Type: application/sdp..Content-Length: 311....v=0..o=root 936120945 936120945 IN IP4 A.B.C.D..s=Asterisk PBX 11.6-cert2..c=IN IP4 A.B.C.D..t=0 0..m=audio 12018 RTP/AVP 8 3 0 101..a=rtpmap:8 PCMA/8000..a=rtpmap:3 GSM/8000..a=rtpmap:0 PCMU/8000..a=rtpmap:101 telephone-event/8000..a=fmtp:101 0-16..a=silenceSupp:off - - - -..a=ptime:20..a=sendrecv..
U X.Y.Z.W:5060 -> A.B.C.D:5060
SIP/2.0 200 OK..Via: SIP/2.0/UDP A.B.C.D:5060;rport=5060;branch=z9hG4bK222c6640..Record-Route: <sip:X.Y.Z.W:5061;transport=tls;lr;r2=on;fdrrm=82.63f;nat=yes>..Record-Route: <sip:X.Y.Z.W;lr;r2=on;fdrrm=82.63f;nat=yes>..Call-ID: 59f5579c01f8039243ec830d317df994@A.B.C.D:5060..From: "111222333" <sip:111222333@A.B.C.D>;tag=as1a7b4c7d..To: <
sip:999666222@pstn.domain.com>;tag=GcH-CAWXaNVzm0W314zxJF518oM-Okco..CSeq: 102 INVITE..Server: Blink 0.9.1 (Linux)..Allow: SUBSCRIBE, NOTIFY, PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, MESSAGE, REFER..Contact: <sip:sam@M.N.O.P:39961;transport=tls;gr=urn:uuid:d63b1c4f-d7dc-4f4e-87f1-948123266dc0>..Supported: 100rel, replaces, norefersub, gruu..Content-Type: application/sdp..Content-Length: 236....v=0..o=- 3618110757 3618110758 IN IP4 M.N.O.P..s=Blink 0.9.1 (Linux)..t=0 0..m=audio 50002 RTP/AVP 8 101..c=IN IP4 M.N.O.P..a=
rtcp:50003..a=rtpmap:8 PCMA/8000..a=rtpmap:101 telephone-event/8000..a=fmtp:101 0-15..a=sendrecv..
U A.B.C.D:5060 -> X.Y.Z.W:5060
ACK sip:sam@M.N.O.P:39961;transport=tls;gr=urn:uuid:d63b1c4f-d7dc-4f4e-87f1-948123266dc0 SIP/2.0..Via: SIP/2.0/UDP A.B.C.D:5060;branch=z9hG4bK22a00025..Route: <sip:X.Y.Z.W;lr;r2=on;fdrrm=82.63f;nat=yes>,<sip:X.Y.Z.W:5061;transport=tls;lr;r2=on;fdrrm=82.63f;nat=yes>..Max-Forwards: 70..
From: "111222333" <sip:111222333@A.B.C.D>;tag=as1a7b4c7d..To: <
sip:999666222@pstn.domain.com>;tag=GcH-CAWXaNVzm0W314zxJF518oM-Okco..Contact: <sip:111222333@A.B.C.D:5060>..Call-ID: 59f5579c01f8039243ec830d317df994@A.B.C.D:5060..CSeq: 102 ACK..User-Agent: IPXAdam..Content-Length:0....
What I was refering to is that in the logs the lookup process is using sip:sam@M.N.O.P, which is not found because what exists in the registrar database is
. In the Contact header of the 200 OK the local IP is used instead of the FQDN form. I might have been misleaded by the logs or the gruu lookup process, but in the following lines of the code (you were right about the lines and verion):
123 LM_DBG("looking up pub gruu [%.*s]\n", inst.len, inst.s);
158 LM_DBG("'%.*s' Not found in usrloc\n", aor.len, ZSW(aor.s));