From 3dcee6f389cd570719cb1eec5986c2da1c1c6db0 Mon Sep 17 00:00:00 2001 From: Marco Capetta Date: Wed, 10 Apr 2019 18:24:11 +0200 Subject: [PATCH] TT#56343 Fix crash calculating packet stats Backported from upstream the commits: * 9d6356a4dfe4d455958208face87616126ca49f3 * 5e763029dc207c99796adc1c3ace71cf6de59446 Change-Id: Ie9cdb67524729d2ee8d8bf9b12e3d3a2469598bd --- debian/patches/sipwise/extend_stats.patch | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/debian/patches/sipwise/extend_stats.patch b/debian/patches/sipwise/extend_stats.patch index c66facdde..bd317c074 100644 --- a/debian/patches/sipwise/extend_stats.patch +++ b/debian/patches/sipwise/extend_stats.patch @@ -57,17 +57,26 @@ Subject: [PATCH] kex: Extend kamailio rcv_replies statistics {0,0,0} }; -@@ -200,6 +231,28 @@ static int km_cb_req_stats(struct sip_ms +@@ -200,6 +231,37 @@ static int km_cb_req_stats(struct sip_ms return 1; } +static int km_cb_rpl_stats_by_method(struct sip_msg *msg, + unsigned int flags, void *param) +{ -+ int method = get_cseq(msg)->method_id; -+ int group = msg->first_line.u.reply.statuscode / 100 - 1; ++ int method = 0; ++ int group = 0; + -+ if (group >= 1 && group <= 6) { ++ if(msg==NULL) { ++ return -1; ++ } ++ if (!msg->cseq && (parse_headers(msg, HDR_CSEQ_F, 0) < 0 || !msg->cseq)) { ++ return -1; ++ } ++ method = get_cseq(msg)->method_id; ++ group = msg->first_line.u.reply.statuscode / 100 - 1; ++ ++ if (group >= 0 && group <= 5) { + switch(method) { + case METHOD_INVITE: update_stat( VAR_NAME(invite)[group], 1); break; + case METHOD_CANCEL: update_stat( VAR_NAME(cancel)[group], 1); break;