Module: kamailio Branch: master Commit: aca92cf40a94bbb7ca66930b76067653b5528385 URL: https://github.com/kamailio/kamailio/commit/aca92cf40a94bbb7ca66930b76067653...
Author: Victor Seva linuxmaniac@torreviejawireless.org Committer: GitHub noreply@github.com Date: 2016-09-21T09:02:59+02:00
Merge pull request #790 from linuxmaniac/vseva/fix_sca
sca: fix core when HDR_CSEQ not parsed
---
Modified: modules/sca/sca.c Modified: modules/sca/sca_call_info.c
---
Diff: https://github.com/kamailio/kamailio/commit/aca92cf40a94bbb7ca66930b76067653... Patch: https://github.com/kamailio/kamailio/commit/aca92cf40a94bbb7ca66930b76067653...
---
diff --git a/modules/sca/sca.c b/modules/sca/sca.c index 62a6db9..30eabc9 100644 --- a/modules/sca/sca.c +++ b/modules/sca/sca.c @@ -70,6 +70,10 @@ static int sca_mod_init(void); static int sca_child_init(int); static void sca_mod_destroy(void); static int sca_set_config(sca_mod *); +static int sca_call_info_update_0_f(sip_msg_t* msg); +static int sca_call_info_update_1_f(sip_msg_t* msg, char*); +static int sca_call_info_update_2_f(sip_msg_t* msg, char* , char*); +static int sca_call_info_update_3_f(sip_msg_t* msg, char* , char*, char *); int fixup_ciu(void **, int); int fixup_free_ciu(void **param, int param_no);
@@ -79,13 +83,13 @@ int fixup_free_ciu(void **param, int param_no); static cmd_export_t cmds[] = { {"sca_handle_subscribe", (cmd_function)sca_handle_subscribe, 0, NULL, 0, REQUEST_ROUTE}, - {"sca_call_info_update", (cmd_function)sca_call_info_update, 0, NULL, 0, + {"sca_call_info_update", (cmd_function)sca_call_info_update_0_f, 0, NULL, 0, REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE}, - {"sca_call_info_update", (cmd_function)sca_call_info_update, 1, + {"sca_call_info_update", (cmd_function)sca_call_info_update_1_f, 1, fixup_ciu, fixup_free_ciu, REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE}, - {"sca_call_info_update", (cmd_function)sca_call_info_update, 2, + {"sca_call_info_update", (cmd_function)sca_call_info_update_2_f, 2, fixup_ciu, fixup_free_ciu, REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE}, - {"sca_call_info_update", (cmd_function)sca_call_info_update, 3, + {"sca_call_info_update", (cmd_function)sca_call_info_update_3_f, 3, fixup_ciu, fixup_free_ciu, REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE}, { 0, 0, 0, 0, 0, 0 } }; @@ -408,6 +412,21 @@ void sca_mod_destroy(void) sca_db_disconnect(); }
+static int sca_call_info_update_0_f(sip_msg_t* msg) { + return sca_call_info_update(msg, NULL, NULL, NULL); +} +static int sca_call_info_update_1_f(sip_msg_t* msg, char* p1) { + return sca_call_info_update(msg, p1, NULL, NULL); +} +static int sca_call_info_update_2_f(sip_msg_t* msg, char* p1, char* p2) { + return sca_call_info_update(msg, p1, p2, NULL); +} +static int sca_call_info_update_3_f(sip_msg_t* msg, + char* p1, char* p2, char * p3) +{ + return sca_call_info_update(msg, p1, p2, p3); +} + int fixup_ciu(void **param, int param_no) { switch (param_no) { diff --git a/modules/sca/sca_call_info.c b/modules/sca/sca_call_info.c index 8f8ca7e..d5586cb 100644 --- a/modules/sca/sca_call_info.c +++ b/modules/sca/sca_call_info.c @@ -1842,6 +1842,12 @@ int sca_call_info_update(sip_msg_t *msg, char *p1, char *p2, char *p3) } } if (i >= n_dispatch) { + if(msg->cseq==NULL && ((parse_headers(msg, HDR_CSEQ_F, 0)==-1) || + (msg->cseq==NULL))) + { + LM_ERR("no CSEQ header\n"); + return (1); + } LM_DBG("BUG: sca module does not support Call-Info headers " "in %.*s requests\n", STR_FMT(&get_cseq(msg)->method)); return (1);