<html><head>
<meta content="text/html; charset=windows-1252" 
http-equiv="Content-Type">
</head><body bgcolor="#FFFFFF" text="#000000">I have been playing around
 some more, and if I force the Contact header of the peer reply in my 
kamailio.cfg.customtt.tt2 (near the end in onreply_route():<br>
    remove_hf("Contact");<br>
    append_hf("Contact: <a class="moz-txt-link-rfc2396E" href="sip:127.0.0.1:5080"><sip:127.0.0.1:5080></a>;expires=200\r\n");<br>
), then it works (at least for this particular scenario, and it is 
ignored when handling the 401 unauthorized):<br>
<br>
U 2014/08/24 16:21:10.488831 72.251.241.166:5060 -> 178.X.Y.Z:5060<br>
SIP/2.0 200 OK'<br>
Via: SIP/2.0/UDP 
178.X.Y.Z;branch=z9hG4bK09ac.08655b889dff04f59a713f0f644d643d.0;rport=5060'<br>
Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bK2jcbeaSi;rport=5080'<br>
From: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=478F2D6E-53F9F40C000A5CB8-335A3700'<br>
To: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=b27e1a1d33761e85846fc98f5f3a7e58.434f'<br>
CSeq: 55 REGISTER'<br>
Call-ID: 32D4C33B-53F9F40C000A5D59-336A4700'<br>
Contact: 
<a class="moz-txt-link-rfc2396E" href="sip:ngcp-lb@178.X.Y.Z:5060;ngcpct=7369703a3132372e302e302e313a35303830"><sip:ngcp-lb@178.X.Y.Z:5060;ngcpct=7369703a3132372e302e302e313a35303830></a>;expires=3600'<br>
Content-Length: 0'<br>
'<br>
<br>
<br>
U 2014/08/24 16:21:10.489967 127.0.0.1:5060 -> 127.0.0.1:5080<br>
SIP/2.0 200 OK'<br>
Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bK2jcbeaSi;rport=5080'<br>
From: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=478F2D6E-53F9F40C000A5CB8-335A3700'<br>
To: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=b27e1a1d33761e85846fc98f5f3a7e58.434f'<br>
CSeq: 55 REGISTER'<br>
Call-ID: 32D4C33B-53F9F40C000A5D59-336A4700'<br>
Content-Length: 0'<br>
P-NGCP-Src-Ip: 72.251.241.166'<br>
P-NGCP-Src-Port: 5060'<br>
P-NGCP-Src-Proto: udp'<br>
P-NGCP-Src-Af: 4'<br>
Contact: <a class="moz-txt-link-rfc2396E" href="sip:127.0.0.1:5080"><sip:127.0.0.1:5080></a>;expires=200'<br>
'<br>
<br>
That is, then I see the SEMS registering the reply and counting down 
from 200sec (see attached SEMS log).<br>
At 50% of the expires value it will reregister, as per the following 
method I guess:<br>
<br>
bool AmSIPRegistration::timeToReregister(time_t now_sec) {<br>
    return (((unsigned long)reg_begin+ reg_expires/2) < (unsigned 
long)now_sec);    <br>
}<br>
<br>
<br>
I'm still trying to get the hang of all the logic in the kamailio.cfg 
routing and I have no idea of all the SIP scenarios involved, but in 
general I would expect that for incoming messages to the loadbalancer 
that have ngcpct set, kamailio should unmask the contact. Or is that too
 simplistic?<br>
<br>
<br>
Regards,<br>
Arjan<br>
<br>
<br>
<blockquote style="border: 0px none;" 
cite="mid:53F9EC2B.2090406@hakwerk.com" type="cite">
  <div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div 
style="display:table;width:100%;border-top:1px solid 
#EDEEF0;padding-top:5px">       <div 
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
 photoaddress="arjan@hakwerk.com" photoname="Arjan Hakkesteegt" 
src="cid:part1.07050605.01050301@hakwerk.com" name="postbox-contact.jpg"
 height="25px" width="25px"></div>   <div 
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
        <a moz-do-not-send="true" href="mailto:arjan@hakwerk.com" 
style="color:#737F92 
!important;padding-right:6px;font-weight:bold;text-decoration:none 
!important;">Arjan Hakkesteegt</a></div>   <div 
style="display:table-cell;white-space:nowrap;vertical-align:middle;">   
  <font color="#9FA2A5"><span style="padding-left:6px">Sunday, August 
24, 2014 15:44</span></font></div></div></div>
  <div style="color:#888888;margin-left:24px;margin-right:24px;" 
__pbrmquotes="true" class="__pbConvBody">
<meta http-equiv="Content-Type" content="text/html; 
charset=windows-1252">
I attached the output from
 "ngrep-sip didlogic" for a minute or so, showing the 10 sec interval. I
 also included the sems.log for that same period.<br>
<br>
I did a grep on expire in all logfiles in /var/log/ngcp/ but there never
 is an expires: 0 in the logs, only 3600. Any other idea how to find 
such an unREGISTER?<br>
<br>
Arjan<br>

<div>_______________________________________________<br>Spce-user 
mailing list<br><a class="moz-txt-link-abbreviated" href="mailto:Spce-user@lists.sipwise.com">Spce-user@lists.sipwise.com</a><br><a class="moz-txt-link-freetext" href="https://lists.sipwise.com/listinfo/spce-user">https://lists.sipwise.com/listinfo/spce-user</a><br></div></div>
  <div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div 
style="display:table;width:100%;border-top:1px solid 
#EDEEF0;padding-top:5px">       <div 
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
 photoaddress="dgrotti@sipwise.com" photoname="Daniel Grotti" 
src="cid:part2.00070700.01000005@hakwerk.com" name="postbox-contact.jpg"
 height="25px" width="25px"></div>   <div 
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
        <a moz-do-not-send="true" href="mailto:dgrotti@sipwise.com" 
style="color:#737F92 
!important;padding-right:6px;font-weight:bold;text-decoration:none 
!important;">Daniel Grotti</a></div>   <div 
style="display:table-cell;white-space:nowrap;vertical-align:middle;">   
  <font color="#9FA2A5"><span style="padding-left:6px">Sunday, August 
24, 2014 14:26</span></font></div></div></div>
  <div style="color:#888888;margin-left:24px;margin-right:24px;" 
__pbrmquotes="true" class="__pbConvBody">
  
    <meta http-equiv="Content-Type" content="text/html; 
charset=windows-1252">
  
    <div class="moz-cite-prefix">Hi,<br>
      sorry in the trace below I just see the registration process at
      09:39:43.<br>
      Where do you see the second REGISTER after 10sec ? It should
      Re-REGISTER again after 3600 sec.<br>
      <br>
      Also I don't see the unREGISTER message (with Expires: 0).<br>
      Can you provide such messages ?<br>
      <br>
      Daniel<br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      On 08/24/2014 11:05 AM, Arjan Hakkesteegt wrote:<br>
    </div>
    
    <br>
  </div>
  <div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div 
style="display:table;width:100%;border-top:1px solid 
#EDEEF0;padding-top:5px">       <div 
style="display:table-cell;vertical-align:middle;padding-right:6px;"><img
 photoaddress="arjan@hakwerk.com" photoname="Arjan Hakkesteegt" 
src="cid:part1.07050605.01050301@hakwerk.com" name="postbox-contact.jpg"
 height="25px" width="25px"></div>   <div 
style="display:table-cell;white-space:nowrap;vertical-align:middle;width:100%">
        <a moz-do-not-send="true" href="mailto:arjan@hakwerk.com" 
style="color:#737F92 
!important;padding-right:6px;font-weight:bold;text-decoration:none 
!important;">Arjan Hakkesteegt</a></div>   <div 
style="display:table-cell;white-space:nowrap;vertical-align:middle;">   
  <font color="#9FA2A5"><span style="padding-left:6px">Sunday, August 
24, 2014 11:05</span></font></div></div></div>
  <div style="color:#888888;margin-left:24px;margin-right:24px;" 
__pbrmquotes="true" class="__pbConvBody">Hi all,
<br>
<br>I have a fresh install of mr3.4.1 (actually I messed up upgrading 
from 
3.3.1 on a mysql error and didn't have a proper backup; my bad. 
Completey wiped the VM and started from scratch).
<br>SEMS is successfully registering with my SIP trunk provider, I can 
call 
to and be called from the PSTN.
<br>However, looking at the sems logs ("debug: 'yes'" in config.yml, 
attached), it is re-registering every 10 seconds because of a "no 
matching Contact - deregistered" error.
<br>
<br>Below is the output of ngrep-sip for one attempt. I'm no expert but 
it 
looks like the unmasking of the contact fails in kamailio-lb.
<br>178.X.Y.Z = public IP address
<br>12345 = didlogic user id
<br>
<br>I'd appreciate any help.
<br>
<br>Thanks,
<br>Arjan
<br>
<br>
<br>
<br>U 2014/08/24 09:39:43.210372 127.0.0.1:5080 -> 127.0.0.1:5060
<br>REGISTER <a class="moz-txt-link-freetext" href="sip:sip.nl.didlogic.net">sip:sip.nl.didlogic.net</a> SIP/2.0'
<br>Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bKIG5LNa8x;rport'
<br>From: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=227C9105-53F996BF00032EEE-6060F700'
<br>To: <a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>'
<br>CSeq: 50 REGISTER'
<br>Call-ID: 015670DF-53F996BF00033117-60710700'
<br>Route: <a class="moz-txt-link-rfc2396E" href="sip:127.0.0.1:5060;lr"><sip:127.0.0.1:5060;lr></a>'
<br>Max-Forwards: 70'
<br>Expires: 3600'
<br>User-Agent: Sipwise NGCP Application Server 3.X'
<br>Contact: <a class="moz-txt-link-rfc2396E" href="sip:178.X.Y.Z:5060;transport=udp"><sip:178.X.Y.Z:5060;transport=udp></a>'
<br>Content-Length: 0'
<br>'
<br>
<br>
<br>U 2014/08/24 09:39:43.211469 178.X.Y.Z:5060 -> 
72.251.241.166:5060
<br>REGISTER <a class="moz-txt-link-freetext" href="sip:sip.nl.didlogic.net">sip:sip.nl.didlogic.net</a> SIP/2.0'
<br>Via: SIP/2.0/UDP 
178.X.Y.Z;branch=z9hG4bKc603.4d33604a362202e4562c26f0f8afb615.0'
<br>Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bKIG5LNa8x;rport=5080'
<br>From: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=227C9105-53F996BF00032EEE-6060F700'
<br>To: <a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>'
<br>CSeq: 50 REGISTER'
<br>Call-ID: 015670DF-53F996BF00033117-60710700'
<br>Max-Forwards: 69'
<br>Expires: 3600'
<br>User-Agent: Sipwise NGCP Application Server 3.X'
<br>Contact: <a class="moz-txt-link-rfc2396E" href="sip:178.X.Y.Z:5060;transport=udp"><sip:178.X.Y.Z:5060;transport=udp></a>'
<br>Content-Length: 0'
<br>'
<br>
<br>
<br>U 2014/08/24 09:39:43.258182 72.251.241.166:5060 -> 
178.X.Y.Z:5060
<br>SIP/2.0 401 Unauthorized'
<br>Via: SIP/2.0/UDP 
178.X.Y.Z;branch=z9hG4bKc603.4d33604a362202e4562c26f0f8afb615.0;rport=5060'
<br>Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bKIG5LNa8x;rport=5080'
<br>From: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=227C9105-53F996BF00032EEE-6060F700'
<br>To: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=b27e1a1d33761e85846fc98f5f3a7e58.fae6'
<br>CSeq: 50 REGISTER'
<br>Call-ID: 015670DF-53F996BF00033117-60710700'
<br>WWW-Authenticate: Digest realm="sip.nl.didlogic.net", 
nonce="U/mX61P5lr9U1NSl+99whZC51Z20733QKpDIeoA=", qop="auth"'
<br>Content-Length: 0'
<br>'
<br>
<br>
<br>U 2014/08/24 09:39:43.258552 127.0.0.1:5060 -> 127.0.0.1:5080
<br>SIP/2.0 401 Unauthorized'
<br>Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bKIG5LNa8x;rport=5080'
<br>From: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=227C9105-53F996BF00032EEE-6060F700'
<br>To: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=b27e1a1d33761e85846fc98f5f3a7e58.fae6'
<br>CSeq: 50 REGISTER'
<br>Call-ID: 015670DF-53F996BF00033117-60710700'
<br>WWW-Authenticate: Digest realm="sip.nl.didlogic.net", 
nonce="U/mX61P5lr9U1NSl+99whZC51Z20733QKpDIeoA=", qop="auth"'
<br>Content-Length: 0'
<br>P-NGCP-Src-Ip: 72.251.241.166'
<br>P-NGCP-Src-Port: 5060'
<br>P-NGCP-Src-Proto: udp'
<br>P-NGCP-Src-Af: 4'
<br>'
<br>
<br>
<br>U 2014/08/24 09:39:43.260249 127.0.0.1:5080 -> 127.0.0.1:5060
<br>REGISTER <a class="moz-txt-link-freetext" href="sip:sip.nl.didlogic.net">sip:sip.nl.didlogic.net</a> SIP/2.0'
<br>Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bKRaVVYaD1;rport'
<br>From: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=227C9105-53F996BF00032EEE-6060F700'
<br>To: <a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>'
<br>CSeq: 51 REGISTER'
<br>Call-ID: 015670DF-53F996BF00033117-60710700'
<br>Route: <a class="moz-txt-link-rfc2396E" href="sip:127.0.0.1:5060;lr"><sip:127.0.0.1:5060;lr></a>'
<br>Max-Forwards: 70'
<br>Expires: 3600'
<br>Authorization: Digest username="12345", realm="sip.nl.didlogic.net",
 
nonce="U/mX61P5lr9U1NSl+99whZC51Z20733QKpDIeoA=", 
uri=<a class="moz-txt-link-rfc2396E" href="sip:sip.nl.didlogic.net">"sip:sip.nl.didlogic.net"</a>, qop=auth, cnonce="570de1e7", nc=00000001,
 
response="2b54500d9b70647866d0190affd850a0", algorithm=MD5'
<br>Contact: <a class="moz-txt-link-rfc2396E" href="sip:127.0.0.1:5080;transport=udp"><sip:127.0.0.1:5080;transport=udp></a>'
<br>Contact: <a class="moz-txt-link-rfc2396E" href="sip:178.X.Y.Z:5060;transport=udp"><sip:178.X.Y.Z:5060;transport=udp></a>'
<br>Content-Length: 0'
<br>'
<br>
<br>
<br>U 2014/08/24 09:39:43.260751 178.X.Y.Z:5060 -> 
72.251.241.166:5060
<br>REGISTER <a class="moz-txt-link-freetext" href="sip:sip.nl.didlogic.net">sip:sip.nl.didlogic.net</a> SIP/2.0'
<br>Via: SIP/2.0/UDP 
178.X.Y.Z;branch=z9hG4bKd603.3582e31aa520aa31282983c13533f2b7.0'
<br>Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bKRaVVYaD1;rport=5080'
<br>From: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=227C9105-53F996BF00032EEE-6060F700'
<br>To: <a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>'
<br>CSeq: 51 REGISTER'
<br>Call-ID: 015670DF-53F996BF00033117-60710700'
<br>Max-Forwards: 69'
<br>Expires: 3600'
<br>Authorization: Digest username="12345", realm="sip.nl.didlogic.net",
 
nonce="U/mX61P5lr9U1NSl+99whZC51Z20733QKpDIeoA=", 
uri=<a class="moz-txt-link-rfc2396E" href="sip:sip.nl.didlogic.net">"sip:sip.nl.didlogic.net"</a>, qop=auth, cnonce="570de1e7", nc=00000001,
 
response="2b54500d9b70647866d0190affd850a0", algorithm=MD5'
<br>Content-Length: 0'
<br>Contact: 
<a class="moz-txt-link-rfc2396E" href="sip:ngcp-lb@178.X.Y.Z:5060;ngcpct=7369703a3132372e302e302e313a35303830"><sip:ngcp-lb@178.X.Y.Z:5060;ngcpct=7369703a3132372e302e302e313a35303830></a>'
<br>'
<br>
<br>
<br>U 2014/08/24 09:39:43.288129 72.251.241.166:5060 -> 
178.X.Y.Z:5060
<br>SIP/2.0 200 OK'
<br>Via: SIP/2.0/UDP 
178.X.Y.Z;branch=z9hG4bKd603.3582e31aa520aa31282983c13533f2b7.0;rport=5060'
<br>Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bKRaVVYaD1;rport=5080'
<br>From: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=227C9105-53F996BF00032EEE-6060F700'
<br>To: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=b27e1a1d33761e85846fc98f5f3a7e58.95fd'
<br>CSeq: 51 REGISTER'
<br>Call-ID: 015670DF-53F996BF00033117-60710700'
<br>Contact: 
<a class="moz-txt-link-rfc2396E" href="sip:ngcp-lb@178.X.Y.Z:5060;ngcpct=7369703a3132372e302e302e313a35303830"><sip:ngcp-lb@178.X.Y.Z:5060;ngcpct=7369703a3132372e302e302e313a35303830></a>;expires=3600'
<br>Content-Length: 0'
<br>'
<br>
<br>
<br>U 2014/08/24 09:39:43.288567 127.0.0.1:5060 -> 127.0.0.1:5080
<br>SIP/2.0 200 OK'
<br>Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bKRaVVYaD1;rport=5080'
<br>From: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=227C9105-53F996BF00032EEE-6060F700'
<br>To: 
<a class="moz-txt-link-rfc2396E" href="sip:12345@sip.nl.didlogic.net"><sip:12345@sip.nl.didlogic.net></a>;tag=b27e1a1d33761e85846fc98f5f3a7e58.95fd'
<br>CSeq: 51 REGISTER'
<br>Call-ID: 015670DF-53F996BF00033117-60710700'
<br>Contact: 
<a class="moz-txt-link-rfc2396E" href="sip:ngcp-lb@178.X.Y.Z:5060;ngcpct=7369703a3132372e302e302e313a35303830"><sip:ngcp-lb@178.X.Y.Z:5060;ngcpct=7369703a3132372e302e302e313a35303830></a>;expires=3600'
<br>Content-Length: 0'
<br>P-NGCP-Src-Ip: 72.251.241.166'
<br>P-NGCP-Src-Port: 5060'
<br>P-NGCP-Src-Proto: udp'
<br>P-NGCP-Src-Af: 4'
<br>'
<br>
<br><div>_______________________________________________<br>Spce-user 
mailing list<br><a class="moz-txt-link-abbreviated" href="mailto:Spce-user@lists.sipwise.com">Spce-user@lists.sipwise.com</a><br><a class="moz-txt-link-freetext" href="https://lists.sipwise.com/listinfo/spce-user">https://lists.sipwise.com/listinfo/spce-user</a><br></div></div>
</blockquote>
</body></html>