]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
skinny - add simple expansion of text strings by id in the logging msgs
authorNathan Neulinger <nneul@neulinger.org>
Sun, 23 Jun 2013 21:11:54 +0000 (16:11 -0500)
committerNathan Neulinger <nneul@neulinger.org>
Sun, 23 Jun 2013 21:11:54 +0000 (16:11 -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 5071476e18dc651a25c4df7bcf35357d08b5a298..82e59420ae3f25f2440aac08d88321ac06f5bd29 100644 (file)
@@ -102,6 +102,44 @@ static char active_lines_sql[] =
 "   call_state       INTEGER\n"
 ");\n";
 
+/*****************************************************************************/
+/* TEXT FUNCTIONS */
+/*****************************************************************************/
+char *skinny_expand_textid(const char *str)
+{
+       char *tmp;
+       int i;
+
+       /* Look for \200, if found, next character indicates string id */
+       char match = (char) 128;
+       
+       tmp = switch_mprintf("");
+
+       if (zstr(str)) {
+               return tmp;
+       }
+
+       for (i=0; i<strlen(str); i++)
+       {
+               char *old = tmp;
+
+               if ( str[i] == match ) {
+                       if ( tmp[0] ) {
+                               tmp = switch_mprintf("%s [%s] ", old, skinny_textid2str(str[i+1]));
+                       } else {
+                               tmp = switch_mprintf("[%s] ", skinny_textid2str(str[i+1]));
+                       }
+                       switch_safe_free(old);
+                       i++;
+               } else {
+                       tmp = switch_mprintf("%s%c", old, str[i]);
+                       switch_safe_free(old);
+               }
+       }
+
+       return tmp;
+}
+
 /*****************************************************************************/
 /* PROFILES FUNCTIONS */
 /*****************************************************************************/
index f3de5920177bf2e198c37c07aed004bacb280f71..e6d8583fdd4651d04d2ed285fe92c74fa07ff7ca 100644 (file)
@@ -301,9 +301,10 @@ switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
 switch_endpoint_interface_t *skinny_get_endpoint_interface();
 
 /*****************************************************************************/
-/* MODULE FUNCTIONS */
+/* TEXT FUNCTIONS */
 /*****************************************************************************/
 #define skinny_textid2raw(label) (label > 0 ? switch_mprintf("\200%c", label) : switch_mprintf(""))
+char *skinny_expand_textid(const char *str);
 
 #endif /* _MOD_SKINNY_H */
 
index b475f8e68737669f9548a9b28cc7e5c1e91e70b8..a27bf4753585f7297bd2e44c524ec67fbdc32c4b 100644 (file)
@@ -925,6 +925,8 @@ switch_status_t perform_send_display_prompt_status(listener_t *listener,
                uint32_t call_id)
 {
        skinny_message_t *message;
+       char *tmp;
+
        message = switch_core_alloc(listener->pool, 12+sizeof(message->data.display_prompt_status));
        message->type = DISPLAY_PROMPT_STATUS_MESSAGE;
        message->length = 4 + sizeof(message->data.display_prompt_status);
@@ -933,9 +935,13 @@ 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);
+
        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", 
-               timeout, display, line_instance, call_id);
+               timeout, tmp, line_instance, call_id);
+
+       switch_safe_free(tmp);
 
        return skinny_send_reply_quiet(listener, message);
 }