]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_skinny: handle additional escaping in log messages to reduce screen/console issues
authorNathan Neulinger <nneul@neulinger.org>
Wed, 18 Jun 2014 15:19:42 +0000 (10:19 -0500)
committerNathan Neulinger <nneul@neulinger.org>
Wed, 18 Jun 2014 15:19:42 +0000 (10:19 -0500)
src/mod/endpoints/mod_skinny/mod_skinny.c
src/mod/endpoints/mod_skinny/mod_skinny.h
src/mod/endpoints/mod_skinny/skinny_protocol.c

index 6cd46fc49ac0cb1cba6b8c1b5c9eb84bdaec1c01..bc35c9b70a61478649b3ed980f44afa06972319f 100644 (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);
index 60616020cf3839ca44108ce9ba8757a6cf4454d3..91598f56bbfdf5eff26dca6e99b0f9384c46fdf2 100644 (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 */
 
index d33d3369f21a77c89ad4938d9ed6df3428322f06..9a032599a61854dad27d20a207592e8d427f6608 100644 (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);
 }