mod_skinny: handle additional escaping in log messages to reduce screen/console issues

This commit is contained in:
Nathan Neulinger 2014-06-18 10:19:42 -05:00
parent 7340b7a917
commit 4eabd3ab95
3 changed files with 12 additions and 4 deletions

View File

@ -105,7 +105,7 @@ static char active_lines_sql[] =
/*****************************************************************************/
/* TEXT FUNCTIONS */
/*****************************************************************************/
char *skinny_expand_textid(const char *str)
char *skinny_format_message(const char *str)
{
char *tmp;
switch_size_t i;
@ -131,6 +131,9 @@ char *skinny_expand_textid(const char *str)
}
switch_safe_free(old);
i++;
} else if ( !switch_isprint(str[i]) ) {
tmp = switch_mprintf("%s\\x%.2X", old, str[i]);
switch_safe_free(old);
} else {
tmp = switch_mprintf("%s%c", old, str[i]);
switch_safe_free(old);

View File

@ -333,7 +333,7 @@ switch_endpoint_interface_t *skinny_get_endpoint_interface();
/* TEXT FUNCTIONS */
/*****************************************************************************/
#define skinny_textid2raw(label) (label > 0 ? switch_mprintf("\200%c", label) : switch_mprintf(""))
char *skinny_expand_textid(const char *str);
char *skinny_format_message(const char *str);
#endif /* _MOD_SKINNY_H */

View File

@ -1018,7 +1018,7 @@ switch_status_t perform_send_display_prompt_status(listener_t *listener,
message->data.display_prompt_status.line_instance = line_instance;
message->data.display_prompt_status.call_id = call_id;
tmp = skinny_expand_textid(display);
tmp = skinny_format_message(display);
skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG,
"Send Display Prompt Status with Timeout (%d), Display (%s), Line Instance (%d), Call ID (%d)\n",
@ -1140,6 +1140,7 @@ switch_status_t perform_send_display_pri_notify(listener_t *listener,
char *notify)
{
skinny_message_t *message;
char *tmp;
skinny_create_message(message, DISPLAY_PRI_NOTIFY_MESSAGE, display_pri_notify);
@ -1147,9 +1148,13 @@ switch_status_t perform_send_display_pri_notify(listener_t *listener,
message->data.display_pri_notify.priority = priority;
strncpy(message->data.display_pri_notify.notify, notify, 32);
tmp = skinny_format_message(notify);
skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG,
"Send Display Pri Notify with Timeout (%d), Priority (%d), Message (%s)\n",
message_timeout, priority, notify);
message_timeout, priority, tmp);
switch_safe_free(tmp);
return skinny_send_reply_quiet(listener, message, SWITCH_TRUE);
}