<p>I have opensips and opensips-b2bua-module modules of version 1.11.5-2~1.gbp1f5df1 installed on Debian Wheezy.</p>
<p>For test purposes I use very simplified opensips.cfg implementing top hiding scenario to connect to FreeSWITCH-based IVR:</p>
<pre><code>route {
if (is_method("INVITE")) {
b2b_init_request("top hiding");
}
}
</code></pre>
<ul>
<li>After successful call establishment UAC sends INFO and re-INVITE packets in very short period of time. </li>
<li>Upon receiving INFO, opensips correctly sends it to B-leg (towards FreeSWITCH).</li>
<li>Then re-INVITE packet arrives from UAC before INFO answer received.</li>
<li>Opensips answers "491 Request Pending" for packet INFO and inspite of error sends re-INVITE towards FreeSWITCH.</li>
<li>Opensips receives "200 OK" for INFO from FreeSWITCH and got error "ERROR:b2b_entities:b2b_send_reply: Mismatch between the method in tm[16] and the method to send reply to[1]"</li>
<li>Opensips receives "200 OK" for re-INVITE and passes it to UAC</li>
</ul>
<p>Please find call flow below</p>
<pre><code>UAC Opensips FreeSWITCH
|----------INVITE(1)------->| |
|<-------100 Trying(1)------| |
| |-----INVITE(1)--->|
| |<--100 Trying(1)--|
| |<----200 OK(1)----|
|<---------200 OK(1)--------| |
|------------ACK(1)-------->| |
| |------ACK(1)----->|
================Call established=================
|-----------INFO(2)-------->| |
|----------INVITE(3)------->| |
| |------INFO(2)---->|
|<--491 Request Pending(2)--| |
|<-------100 Trying(3)------| |
| |-----INVITE(3)--->|
| |<--100 Trying(3)--|
| |<----200 OK(2)----|
| | |
ERROR:b2b_entities:b2b_send_reply:
Mismatch between the method in tm[16]
and the method to send reply to[1]
| |<----200 OK(3)----|
|<---------200 OK(3)--------| |
| | |
Never receive answer
for INFO
</code></pre>
<p>I see two issues here </p>
<ul>
<li>"491 Request Pending" should be answered for re-INVITE packet, not for INFO</li>
<li>re-INVITE should NOT be passed to B-leg</li>
</ul>
<p>So correct call flow should look like this</p>
<pre><code>UAC Opensips FreeSWITCH
|----------INVITE(1)------->| |
|<-------100 Trying(1)------| |
| |-----INVITE(1)--->|
| |<--100 Trying(1)--|
| |<----200 OK(1)----|
|<---------200 OK(1)--------| |
|------------ACK(1)-------->| |
| |------ACK(1)----->|
================Call established=================
|-----------INFO(2)-------->| |
|----------INVITE(3)------->| |
| |------INFO(2)---->|
|<--491 Request Pending(3)--| |
| |<----200 OK(2)----|
|<---------200 OK(2)--------| |
| | |
</code></pre>
<p>I've tried to make patch to fix issue but I'm not sure if it's correct.<br>
Hope you will find this helpful.</p>
<pre><code>diff --git a/modules/b2b_entities/dlg.c b/modules/b2b_entities/dlg.c
index e656d8b..6798d3d 100644
--- a/modules/b2b_entities/dlg.c
+++ b/modules/b2b_entities/dlg.c
@@ -863,15 +863,17 @@ logic_notify:
LM_DBG("Received another request when the previous "
"one was in process\n");
str text = str_init("Request Pending");
- if(tmb.t_reply_with_body(dlg->uas_tran, 491,
+ if(tmb.t_reply_with_body(tm_tran, 491,
&text, 0, 0, &to_tag) < 0)
{
LM_ERR("failed to send reply with tm\n");
}
LM_DBG("Sent reply [491] and unreffed the cell %p\n",
- dlg->uas_tran);
+ tm_tran);
}
- tmb.unref_cell(dlg->uas_tran);
+ tmb.unref_cell(tm_tran);
+ lock_release(&table[hash_index].lock);
+ return SCB_DROP_MSG;
}
dlg->uas_tran = tm_tran;
LM_DBG("Saved uas_tran=[%p] for dlg[%p]\n", tm_tran, dlg);
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/679">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOciUkWiV7SG4mgEr_2Bg_ouDk0H_B3ks5o9hkCgaJpZM4GSD7e.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/OpenSIPS/opensips/issues/679"></link>
<meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>