<p>Further investigation shows that the database loses b_contact when the called side sends the session timer reINVITE.</p>
<p>At beginning of the call:</p>
<pre><code>*************************** 1. row ***************************
        id: 762
   rectime: 2017-03-08 09:29:13
  s_method: INVITE
    s_cseq: 2
  a_callid: DaDWA2PfEHrzY2yHo-7UmQ..
    a_uuid: atpsh-58bf061d-69c4-4
    b_uuid: btpsh-58bf061d-69c4-4
 a_contact: sip:xxxxxxxxx@10.50.50.50:32709;transport=UDP
 b_contact: sip:2500991234@10.20.0.224:5060
as_contact: <sip:atpsh-58bf061d-69c4-4@10.10.0.180>
bs_contact: <sip:btpsh-58bf061d-69c4-4@10.10.0.180>
     a_tag: 976c020a
     b_tag: as22aeaf5f
      a_rr:
      b_rr: <sip:10.10.0.177:5065;lr=on>
      s_rr: <sip:10.10.0.180;lr;ftag=976c020a;dv=aae.5ab1>
    iflags: 2
     a_uri:
     b_uri:
     r_uri:
 a_srcaddr:
 b_srcaddr:
  a_socket:
  b_socket:
</code></pre>
<p>If the call is ended at this point, the BYE is sent correctly.</p>
<p>However, when the called side's session timer expires and it sends a reINVITE, the database changes to this:</p>
<pre><code>*************************** 1. row ***************************
        id: 762
   rectime: 2017-03-08 09:29:13
  s_method: INVITE
    s_cseq: 2
  a_callid: DaDWA2PfEHrzY2yHo-7UmQ..
    a_uuid: atpsh-58bf061d-69c4-4
    b_uuid: btpsh-58bf061d-69c4-4
 a_contact: sip:xxxxxxxxx@10.50.50.50:32709;transport=UDP
 b_contact:                                                      <--- this is now blank
as_contact: <sip:atpsh-58bf061d-69c4-4@10.10.0.180>
bs_contact: <sip:btpsh-58bf061d-69c4-4@10.10.0.180>
     a_tag: 976c020a
     b_tag: as22aeaf5f
      a_rr:
      b_rr: <sip:10.10.0.177:5065;lr=on>
      s_rr: <sip:10.10.0.180;lr;ftag=976c020a;dv=aae.5ab1>
    iflags: 2
     a_uri:
     b_uri:
     r_uri:
 a_srcaddr:
 b_srcaddr:
  a_socket:
  b_socket:
</code></pre>
<p>If the call is ended by the caller after this, it sends <code>BYE sip:10.10.0.177:5065;lr=on SIP/2.0</code> instead of <code>BYE sip:2500991234@10.20.0.224:5060 SIP/2.0</code> as expected.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1005#issuecomment-285115616">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZSCVtfDW16nJokfCZ7mrVplrxmuOks5rjusFgaJpZM4MG_mh">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZTkiK5nrlBy5_a83nkd7ZJ_vs69Jks5rjusFgaJpZM4MG_mh.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/1005#issuecomment-285115616"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@dryvoip in #1005: Further investigation shows that the database loses b_contact when the called side sends the session timer reINVITE.\r\n\r\nAt beginning of the call:\r\n\r\n```\r\n*************************** 1. row ***************************\r\n        id: 762\r\n   rectime: 2017-03-08 09:29:13\r\n  s_method: INVITE\r\n    s_cseq: 2\r\n  a_callid: DaDWA2PfEHrzY2yHo-7UmQ..\r\n    a_uuid: atpsh-58bf061d-69c4-4\r\n    b_uuid: btpsh-58bf061d-69c4-4\r\n a_contact: sip:xxxxxxxxx@10.50.50.50:32709;transport=UDP\r\n b_contact: sip:2500991234@10.20.0.224:5060\r\nas_contact: \u003csip:atpsh-58bf061d-69c4-4@10.10.0.180\u003e\r\nbs_contact: \u003csip:btpsh-58bf061d-69c4-4@10.10.0.180\u003e\r\n     a_tag: 976c020a\r\n     b_tag: as22aeaf5f\r\n      a_rr:\r\n      b_rr: \u003csip:10.10.0.177:5065;lr=on\u003e\r\n      s_rr: \u003csip:10.10.0.180;lr;ftag=976c020a;dv=aae.5ab1\u003e\r\n    iflags: 2\r\n     a_uri:\r\n     b_uri:\r\n     r_uri:\r\n a_srcaddr:\r\n b_srcaddr:\r\n  a_socket:\r\n  b_socket:\r\n```\r\n\r\nIf the call is ended at this point, the BYE is sent correctly.\r\n\r\nHowever, when the called side's session timer expires and it sends a reINVITE, the database changes to this:\r\n\r\n```\r\n*************************** 1. row ***************************\r\n        id: 762\r\n   rectime: 2017-03-08 09:29:13\r\n  s_method: INVITE\r\n    s_cseq: 2\r\n  a_callid: DaDWA2PfEHrzY2yHo-7UmQ..\r\n    a_uuid: atpsh-58bf061d-69c4-4\r\n    b_uuid: btpsh-58bf061d-69c4-4\r\n a_contact: sip:xxxxxxxxx@10.50.50.50:32709;transport=UDP\r\n b_contact:                                                      \u003c--- this is now blank\r\nas_contact: \u003csip:atpsh-58bf061d-69c4-4@10.10.0.180\u003e\r\nbs_contact: \u003csip:btpsh-58bf061d-69c4-4@10.10.0.180\u003e\r\n     a_tag: 976c020a\r\n     b_tag: as22aeaf5f\r\n      a_rr:\r\n      b_rr: \u003csip:10.10.0.177:5065;lr=on\u003e\r\n      s_rr: \u003csip:10.10.0.180;lr;ftag=976c020a;dv=aae.5ab1\u003e\r\n    iflags: 2\r\n     a_uri:\r\n     b_uri:\r\n     r_uri:\r\n a_srcaddr:\r\n b_srcaddr:\r\n  a_socket:\r\n  b_socket:\r\n```\r\n\r\nIf the call is ended by the caller after this, it sends `BYE sip:10.10.0.177:5065;lr=on SIP/2.0` instead of `BYE sip:2500991234@10.20.0.224:5060 SIP/2.0` as expected.\r\n"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1005#issuecomment-285115616"}}}</script>