Skip to content

Commit 97cbd24

Browse files
committed
SCA: Fix issues with parsing Call-Info in SHM msg
(cherry picked from commit e44b9268c7cdcd31aa2515849f476c6ffa4e4c41)
1 parent ea3c1f4 commit 97cbd24

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

modules/presence_callinfo/presence_callinfo.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ mi_response_t *sca_mi_set_log_level(const mi_params_t *params,
10031003

10041004
static void sca_tm_sendpublish(struct cell *t, int type, struct tmcb_params *_params)
10051005
{
1006-
struct sip_msg *req = _params->req; //, *rpl = _params->rpl;
1006+
struct sip_msg *rpl = _params->rpl; //, *req = _params->req;
10071007
struct sca_cb_params *param;
10081008
struct sca_party *entity;
10091009
struct dlg_cell *dlg;
@@ -1056,8 +1056,8 @@ static void sca_tm_sendpublish(struct cell *t, int type, struct tmcb_params *_pa
10561056

10571057
if (n) {
10581058
/* best-effort search for ";appearance-index" in Call-INFO hdr */
1059-
if (parse_call_info_header(req) == 0)
1060-
idx = get_appearance_index(req);
1059+
if (parse_call_info_header(rpl) == 0)
1060+
idx = get_appearance_index(rpl);
10611061

10621062
sca_sendpublish(dlg, branch, &entity->uri, peer, idx, -1);
10631063
}

modules/presence_callinfo/sca_dialog.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,23 @@ void sca_dialog_sendpublish(struct dlg_cell *dlg, int type,
107107
if (!msg || msg == FAKED_REPLY) {
108108
LM_SCA("null/fake SIP message provided, assuming index 1 (%p)\n", msg);
109109
idx = 1;
110-
} else if (parse_call_info_header(msg) != 0) {
111-
LM_SCA("message has no Call-Info hf, assuming index 1\n");
112-
idx = 1;
113110
} else {
114-
idx = get_appearance_index(msg);
115-
if (idx == 0) {
116-
LM_SCA("message has Call-Info but index not found, assuming 1\n");
111+
struct sip_msg pkg_msg;
112+
113+
memset(&pkg_msg, 0, sizeof pkg_msg);
114+
parse_msg(msg->buf, msg->len, &pkg_msg);
115+
116+
if (parse_call_info_header(&pkg_msg) != 0) {
117+
LM_SCA("message has no Call-Info hf, assuming index 1\n");
117118
idx = 1;
119+
} else {
120+
idx = get_appearance_index(msg);
121+
if (idx == 0) {
122+
LM_SCA("message has Call-Info but index not found, assuming 1\n");
123+
idx = 1;
124+
}
125+
126+
free_call_info(pkg_msg.call_info->parsed);
118127
}
119128
}
120129

0 commit comments

Comments
 (0)