Module: kamailio Branch: master Commit: 511964bd91d0fb0099dab14a69296d21d37abffa URL: https://github.com/kamailio/kamailio/commit/511964bd91d0fb0099dab14a69296d21...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2023-11-06T14:20:53+01:00
topos: handle NOTIFY during call setup
- GH #3627
---
Modified: src/modules/topos/tps_msg.c Modified: src/modules/topos/tps_storage.c
---
Diff: https://github.com/kamailio/kamailio/commit/511964bd91d0fb0099dab14a69296d21... Patch: https://github.com/kamailio/kamailio/commit/511964bd91d0fb0099dab14a69296d21...
---
diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c index c2dd3e70b7d..740f87b067f 100644 --- a/src/modules/topos/tps_msg.c +++ b/src/modules/topos/tps_msg.c @@ -910,7 +910,9 @@ int tps_request_received(sip_msg_t *msg, int dialog) goto error; } metid = get_cseq(msg)->method_id; - if((metid & (METHOD_BYE | METHOD_INFO | METHOD_PRACK | METHOD_UPDATE)) + if((metid + & (METHOD_BYE | METHOD_INFO | METHOD_PRACK | METHOD_UPDATE + | METHOD_NOTIFY)) && stsd.b_contact.len <= 0) { /* no B-side contact, look for INVITE transaction record */ if(metid & (METHOD_BYE | METHOD_UPDATE)) { diff --git a/src/modules/topos/tps_storage.c b/src/modules/topos/tps_storage.c index 70c003c944c..63951386622 100644 --- a/src/modules/topos/tps_storage.c +++ b/src/modules/topos/tps_storage.c @@ -1130,9 +1130,7 @@ int tps_db_load_branch( db_val_t db_vals[5]; db_key_t db_cols[TPS_NR_KEYS]; db1_res_t *db_res = NULL; - str sinv = str_init("INVITE"); - str ssub = str_init("SUBSCRIBE"); - int bInviteDlg = 1; + str sMethodDlg = str_init("INVITE"); int nr_keys; int nr_cols; int n; @@ -1144,10 +1142,13 @@ int tps_db_load_branch( nr_keys = 0; nr_cols = 0;
- if((get_cseq(msg)->method_id == METHOD_SUBSCRIBE) - || ((get_cseq(msg)->method_id == METHOD_NOTIFY) - && (msg->event && msg->event->len > 0))) { - bInviteDlg = 0; + if(get_cseq(msg)->method_id == METHOD_SUBSCRIBE) { + sMethodDlg.s = "SUBSCRIBE"; + sMethodDlg.len = 9; + } else if(get_cseq(msg)->method_id == METHOD_NOTIFY) { + /* NOTIFY can be also sent during call setup - ignore dialog method */ + sMethodDlg.s = ""; + sMethodDlg.len = 0; }
if(mode == 0) { @@ -1178,12 +1179,14 @@ int tps_db_load_branch( } nr_keys++;
- db_keys[nr_keys] = &tt_col_s_method; - db_ops[nr_keys] = OP_EQ; - db_vals[nr_keys].type = DB1_STR; - db_vals[nr_keys].nul = 0; - db_vals[nr_keys].val.str_val = bInviteDlg ? sinv : ssub; - nr_keys++; + if(sMethodDlg.len > 0) { + db_keys[nr_keys] = &tt_col_s_method; + db_ops[nr_keys] = OP_EQ; + db_vals[nr_keys].type = DB1_STR; + db_vals[nr_keys].nul = 0; + db_vals[nr_keys].val.str_val = sMethodDlg; + nr_keys++; + }
if(md->a_uuid.len > 0) { if(md->a_uuid.s[0] == 'a') {