skinny - add simple expansion of text strings by id in the logging msgs
This commit is contained in:
parent
38ccc48980
commit
2060654809
|
@ -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 */
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue