mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 09:12:25 +00:00
fix obscure bs, remove CR from dptools, add info app
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3463 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
44649c70b4
commit
d20870e121
@ -139,12 +139,43 @@ static void set_function(switch_core_session_t *session, char *data)
|
|||||||
static void log_function(switch_core_session_t *session, char *data)
|
static void log_function(switch_core_session_t *session, char *data)
|
||||||
{
|
{
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
|
char *level, *log_str;
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
|
|
||||||
if (!switch_strlen_zero(data)) {
|
if ((level = strdup(data))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s\n", data);
|
switch_event_types_t etype = SWITCH_LOG_DEBUG;
|
||||||
}
|
|
||||||
|
if ((log_str = strchr(level, ' '))) {
|
||||||
|
*log_str++ = '\0';
|
||||||
|
switch_name_event(level, &etype);
|
||||||
|
} else {
|
||||||
|
log_str = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, etype, "%s\n", log_str);
|
||||||
|
switch_safe_free(level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void info_function(switch_core_session_t *session, char *data)
|
||||||
|
{
|
||||||
|
switch_channel_t *channel;
|
||||||
|
switch_event_t *event;
|
||||||
|
char *buf;
|
||||||
|
|
||||||
|
channel = switch_core_session_get_channel(session);
|
||||||
|
assert(channel != NULL);
|
||||||
|
|
||||||
|
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_channel_event_set_data(channel, event);
|
||||||
|
switch_event_serialize(event, &buf);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "CHANNEL_DATA:\n%s\n", buf);
|
||||||
|
switch_event_destroy(&event);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void privacy_function(switch_core_session_t *session, char *data)
|
static void privacy_function(switch_core_session_t *session, char *data)
|
||||||
@ -327,13 +358,22 @@ static const switch_application_interface_t set_application_interface = {
|
|||||||
/*.next */ &ringback_application_interface
|
/*.next */ &ringback_application_interface
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const switch_application_interface_t info_application_interface = {
|
||||||
|
/*.interface_name */ "info",
|
||||||
|
/*.application_function */ info_function,
|
||||||
|
/* long_desc */ "Display Call Info",
|
||||||
|
/* short_desc */ "Display Call Info",
|
||||||
|
/* syntax */ "",
|
||||||
|
/*.next */ &set_application_interface
|
||||||
|
};
|
||||||
|
|
||||||
static const switch_application_interface_t log_application_interface = {
|
static const switch_application_interface_t log_application_interface = {
|
||||||
/*.interface_name */ "log",
|
/*.interface_name */ "log",
|
||||||
/*.application_function */ log_function,
|
/*.application_function */ log_function,
|
||||||
/* long_desc */ "Logs a channel varaible for the channel calling the application.",
|
/* long_desc */ "Logs a channel varaible for the channel calling the application.",
|
||||||
/* short_desc */ "Logs a channel varaible",
|
/* short_desc */ "Logs a channel varaible",
|
||||||
/* syntax */ "<varname>",
|
/* syntax */ "<varname>",
|
||||||
/*.next */ &set_application_interface
|
/*.next */ &info_application_interface
|
||||||
};
|
};
|
||||||
|
|
||||||
static const switch_application_interface_t answer_application_interface = {
|
static const switch_application_interface_t answer_application_interface = {
|
||||||
|
@ -1198,11 +1198,14 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel
|
|||||||
}
|
}
|
||||||
if ((nlen = sub_val ? strlen(sub_val) : 0)) {
|
if ((nlen = sub_val ? strlen(sub_val) : 0)) {
|
||||||
if (len + nlen >= olen) {
|
if (len + nlen >= olen) {
|
||||||
olen = (olen + len + nlen + block);
|
char *dp;
|
||||||
|
olen += (len + nlen + block);
|
||||||
cpos = c - data;
|
cpos = c - data;
|
||||||
data = realloc(data, olen);
|
if ((dp = realloc(data, olen))) {
|
||||||
c = data + cpos;
|
data = dp;
|
||||||
memset(c, 0, olen - cpos);
|
c = data + cpos;
|
||||||
|
memset(c, 0, olen - cpos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
len += nlen;
|
len += nlen;
|
||||||
|
@ -2673,7 +2673,8 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (switch_channel_get_state(session->channel) == CS_EXECUTE && extension->current_application) {
|
while (switch_channel_get_state(session->channel) == CS_EXECUTE && extension->current_application) {
|
||||||
char *expanded;
|
char *expanded = NULL;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Execute %s(%s)\n",
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Execute %s(%s)\n",
|
||||||
extension->current_application->application_name,
|
extension->current_application->application_name,
|
||||||
extension->current_application->application_data);
|
extension->current_application->application_data);
|
||||||
@ -2720,7 +2721,7 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
|
|||||||
application_interface->application_function(session, expanded);
|
application_interface->application_function(session, expanded);
|
||||||
|
|
||||||
if (expanded != extension->current_application->application_data) {
|
if (expanded != extension->current_application->application_data) {
|
||||||
free(expanded);
|
switch_safe_free(expanded);
|
||||||
}
|
}
|
||||||
extension->current_application = extension->current_application->next;
|
extension->current_application = extension->current_application->next;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user