From babebf76abbde76250645af32bb6bf780ffde95d Mon Sep 17 00:00:00 2001 From: gilles0606 <38776814+gilles0606@users.noreply.github.com> Date: Sat, 24 Sep 2022 19:01:12 +0200 Subject: [PATCH] Update mod_sofia.c Patch for too long and incorrectly closed reason text. --- src/mod/endpoints/mod_sofia/mod_sofia.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 97f735189d..de9cbea572 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -509,6 +509,16 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) switch_snprintf(reason, sizeof(reason), "SIP;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause)); } } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "reason .[%s].\n", reason); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "reason lg (%zu). cause %d \n", strlen(reason), cause); + + if(strlen(reason) > 126 && strstr(reason, "text=\"") != NULL && reason[126] != '"') { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "avant reason .[%s].\n", reason); + reason[126] = '"'; + reason[127] = 0; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "apres reason .[%s].\n", reason); + } } if (switch_channel_test_flag(channel, CF_INTERCEPT) || cause == SWITCH_CAUSE_PICKED_OFF || cause == SWITCH_CAUSE_LOSE_RACE) {