Update mod_sofia.c

Patch for too long and incorrectly closed reason text.
This commit is contained in:
gilles0606 2022-09-24 19:01:12 +02:00
parent 98d2e6212c
commit babebf76ab
1 changed files with 10 additions and 0 deletions

View File

@ -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_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) { if (switch_channel_test_flag(channel, CF_INTERCEPT) || cause == SWITCH_CAUSE_PICKED_OFF || cause == SWITCH_CAUSE_LOSE_RACE) {