Module: kamailio Branch: master Commit: b3b95b5b701a7f7ebf9532a172cd31b6dca699ff URL: https://github.com/kamailio/kamailio/commit/b3b95b5b701a7f7ebf9532a172cd31b6...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2017-08-15T09:50:35+02:00
topos: use INVITE transaction record to route BYE if dlg has no B-contact
---
Modified: src/modules/topos/tps_msg.c
---
Diff: https://github.com/kamailio/kamailio/commit/b3b95b5b701a7f7ebf9532a172cd31b6... Patch: https://github.com/kamailio/kamailio/commit/b3b95b5b701a7f7ebf9532a172cd31b6...
---
diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c index 22441b5fa9..75b6d02078 100644 --- a/src/modules/topos/tps_msg.c +++ b/src/modules/topos/tps_msg.c @@ -773,12 +773,25 @@ int tps_request_received(sip_msg_t *msg, int dialog) } use_branch = 1; } else { - if(tps_storage_load_dialog(msg, &mtsd, &stsd)<0) { + if(tps_storage_load_dialog(msg, &mtsd, &stsd) < 0) { goto error; } - /* detect direction - via from-tag */ - if(tps_dlg_detect_direction(msg, &stsd, &direction) < 0) { - goto error; + if(((get_cseq(msg)->method_id) & (METHOD_BYE)) + && stsd.b_contact.len <= 0) { + /* BYE but not B-side contact, look for INVITE transaction record */ + memset(&stsd, 0, sizeof(tps_data_t)); + if(tps_storage_link_msg(msg, &mtsd, TPS_DIR_DOWNSTREAM) < 0) { + goto error; + } + if(tps_storage_load_branch(msg, &mtsd, &stsd, 1) < 0) { + goto error; + } + use_branch = 1; + } else { + /* detect direction - via from-tag */ + if(tps_dlg_detect_direction(msg, &stsd, &direction) < 0) { + goto error; + } } }