[OpenSIPS-Devel] [opensips] b2bua pending request handling (#679)
DMOsipov
notifications at github.com
Tue Oct 20 13:12:02 CEST 2015
I have opensips and opensips-b2bua-module modules of version 1.11.5-2~1.gbp1f5df1 installed on Debian Wheezy.
For test purposes I use very simplified opensips.cfg implementing top hiding scenario to connect to FreeSWITCH-based IVR:
```
route {
if (is_method("INVITE")) {
b2b_init_request("top hiding");
}
}
```
- After successful call establishment UAC sends INFO and re-INVITE packets in very short period of time.
- Upon receiving INFO, opensips correctly sends it to B-leg (towards FreeSWITCH).
- Then re-INVITE packet arrives from UAC before INFO answer received.
- Opensips answers "491 Request Pending" for packet INFO and inspite of error sends re-INVITE towards FreeSWITCH.
- 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]"
- Opensips receives "200 OK" for re-INVITE and passes it to UAC
Please find call flow below
```
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
```
I see two issues here
- "491 Request Pending" should be answered for re-INVITE packet, not for INFO
- re-INVITE should NOT be passed to B-leg
So correct call flow should look like this
```
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)--------| |
| | |
```
I've tried to make patch to fix issue but I'm not sure if it's correct.
Hope you will find this helpful.
```
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);
```
---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/679
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20151020/98afc49a/attachment.htm>
More information about the Devel
mailing list