add "log" application to print log messages From Mike Murdock.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3451 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2006-11-24 15:43:46 +00:00
parent 74dee5f6ec
commit 63aae494ac
2 changed files with 424 additions and 401 deletions

View File

@ -30,6 +30,8 @@ that much better:
Ken Rice of Asteria Solutions Group, INC <ken AT asteriasgi.com> - xmlcdr, sofia improvements, load testing. Ken Rice of Asteria Solutions Group, INC <ken AT asteriasgi.com> - xmlcdr, sofia improvements, load testing.
Neal Horman <neal at wanlink dot com> - conference improvements, switch_ivr menu additions and other tweaks. Neal Horman <neal at wanlink dot com> - conference improvements, switch_ivr menu additions and other tweaks.
Johny Kadarisman <jkr888 at gmail.com> - mod_python fixups. Johny Kadarisman <jkr888 at gmail.com> - mod_python fixups.
Michael Murdock <mike at mmurdock dot org> - testing, documentation, bug finding and usability enhancements.
A big THANK YOU goes to: A big THANK YOU goes to:

View File

@ -1,401 +1,422 @@
/* /*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
* *
* Version: MPL 1.1 * Version: MPL 1.1
* *
* The contents of this file are subject to the Mozilla Public License Version * The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with * 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at * the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/ * http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the * for the specific language governing rights and limitations under the
* License. * License.
* *
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* *
* The Initial Developer of the Original Code is * The Initial Developer of the Original Code is
* Anthony Minessale II <anthmct@yahoo.com> * Anthony Minessale II <anthmct@yahoo.com>
* Portions created by the Initial Developer are Copyright (C) * Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved. * the Initial Developer. All Rights Reserved.
* *
* Contributor(s): * Contributor(s):
* *
* Anthony Minessale II <anthmct@yahoo.com> * Anthony Minessale II <anthmct@yahoo.com>
* Ken Rice, Asteria Solutions Group, Inc <ken@asteriasgi.com> * Ken Rice, Asteria Solutions Group, Inc <ken@asteriasgi.com>
* * Michael Murdock <mike at mmurdock dot org>
* *
* mod_dptools.c -- Raw Audio File Streaming Application Module *
* * mod_dptools.c -- Raw Audio File Streaming Application Module
*/ *
#include <switch.h> */
#include <switch.h>
static const char modname[] = "mod_dptools";
static const char modname[] = "mod_dptools";
static const switch_application_interface_t detect_speech_application_interface;
static const switch_application_interface_t detect_speech_application_interface;
static void detect_speech_function(switch_core_session_t *session, char *data)
{ static void detect_speech_function(switch_core_session_t *session, char *data)
char *argv[4]; {
int argc; char *argv[4];
char *lbuf = NULL; int argc;
char *lbuf = NULL;
if ((lbuf = switch_core_session_strdup(session, data)) && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
if (!strcasecmp(argv[0], "grammar") && argc >= 1) { if ((lbuf = switch_core_session_strdup(session, data)) && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
switch_ivr_detect_speech_load_grammar(session, argv[1], argv[2]); if (!strcasecmp(argv[0], "grammar") && argc >= 1) {
} else if (!strcasecmp(argv[0], "nogrammar")) { switch_ivr_detect_speech_load_grammar(session, argv[1], argv[2]);
switch_ivr_detect_speech_unload_grammar(session, argv[1]); } else if (!strcasecmp(argv[0], "nogrammar")) {
} else if (!strcasecmp(argv[0], "pause")) { switch_ivr_detect_speech_unload_grammar(session, argv[1]);
switch_ivr_pause_detect_speech(session); } else if (!strcasecmp(argv[0], "pause")) {
} else if (!strcasecmp(argv[0], "resume")) { switch_ivr_pause_detect_speech(session);
switch_ivr_resume_detect_speech(session); } else if (!strcasecmp(argv[0], "resume")) {
} else if (!strcasecmp(argv[0], "stop")) { switch_ivr_resume_detect_speech(session);
switch_ivr_stop_detect_speech(session); } else if (!strcasecmp(argv[0], "stop")) {
} else if (argc >= 3) { switch_ivr_stop_detect_speech(session);
switch_ivr_detect_speech(session, argv[0], argv[1], argv[2], argv[3], NULL); } else if (argc >= 3) {
} switch_ivr_detect_speech(session, argv[0], argv[1], argv[2], argv[3], NULL);
} else { }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", detect_speech_application_interface.syntax); } else {
} switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", detect_speech_application_interface.syntax);
}
}
}
static void ringback_function(switch_core_session_t *session, char *data)
{ static void ringback_function(switch_core_session_t *session, char *data)
switch_channel_t *channel; {
channel = switch_core_session_get_channel(session); switch_channel_t *channel;
assert(channel != NULL); channel = switch_core_session_get_channel(session);
switch_channel_ringback(channel); assert(channel != NULL);
} switch_channel_ringback(channel);
}
static void transfer_function(switch_core_session_t *session, char *data)
{ static void transfer_function(switch_core_session_t *session, char *data)
int argc; {
char *argv[4] = {0}; int argc;
char *mydata; char *argv[4] = {0};
char *mydata;
if ((mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) { if ((mydata = switch_core_session_strdup(session, data))) {
switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]); if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
} else { switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No extension specified.\n"); } else {
} switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No extension specified.\n");
} }
} }
}
static void sleep_function(switch_core_session_t *session, char *data)
{ static void sleep_function(switch_core_session_t *session, char *data)
{
if (switch_strlen_zero(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No timeout specified.\n"); if (switch_strlen_zero(data)) {
} else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No timeout specified.\n");
uint32_t ms = atoi(data); } else {
switch_ivr_sleep(session, ms); uint32_t ms = atoi(data);
} switch_ivr_sleep(session, ms);
} }
}
static void eval_function(switch_core_session_t *session, char *data)
{ static void eval_function(switch_core_session_t *session, char *data)
return; {
} return;
}
static void answer_function(switch_core_session_t *session, char *data)
{ static void answer_function(switch_core_session_t *session, char *data)
switch_channel_t *channel; {
channel = switch_core_session_get_channel(session); switch_channel_t *channel;
assert(channel != NULL); channel = switch_core_session_get_channel(session);
switch_channel_answer(channel); assert(channel != NULL);
} switch_channel_answer(channel);
}
static void set_function(switch_core_session_t *session, char *data)
{ static void set_function(switch_core_session_t *session, char *data)
switch_channel_t *channel; {
char *var, *val = NULL; switch_channel_t *channel;
char *var, *val = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL); channel = switch_core_session_get_channel(session);
assert(channel != NULL);
if (switch_strlen_zero(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n"); if (switch_strlen_zero(data)) {
} else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
var = switch_core_session_strdup(session, data); } else {
val = strchr(var, '='); var = switch_core_session_strdup(session, data);
val = strchr(var, '=');
if (val) {
*val++ = '\0'; if (val) {
if (!strcmp(val, "_UNDEF_")) { *val++ = '\0';
val = NULL; if (!strcmp(val, "_UNDEF_")) {
} val = NULL;
} }
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", var, val ? val : "UNDEF");
switch_channel_set_variable(channel, var, val); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", var, val ? val : "UNDEF");
} switch_channel_set_variable(channel, var, val);
} }
}
static void privacy_function(switch_core_session_t *session, char *data)
{ static void log_function(switch_core_session_t *session, char *data)
switch_channel_t *channel; {
switch_caller_profile_t *caller_profile; switch_channel_t *channel;
char *arg; channel = switch_core_session_get_channel(session);
assert(channel != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL); if (!switch_strlen_zero(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s\n", data);
caller_profile = switch_channel_get_caller_profile(channel); }
}
if (switch_strlen_zero(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No privacy mode specified.\n"); static void privacy_function(switch_core_session_t *session, char *data)
} else { {
arg = switch_core_session_strdup(session, data); switch_channel_t *channel;
switch_caller_profile_t *caller_profile;
switch_set_flag(caller_profile, SWITCH_CPF_SCREEN); char *arg;
if(!strcasecmp(arg, "no")) { channel = switch_core_session_get_channel(session);
switch_clear_flag(caller_profile, SWITCH_CPF_HIDE_NAME); assert(channel != NULL);
switch_clear_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER);
} else if (!strcasecmp(arg, "yes")) { caller_profile = switch_channel_get_caller_profile(channel);
switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
} else if (!strcasecmp(arg, "full")) { if (switch_strlen_zero(data)) {
switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No privacy mode specified.\n");
} else if (!strcasecmp(arg, "name")) { } else {
switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NAME); arg = switch_core_session_strdup(session, data);
} else if (!strcasecmp(arg, "number")) {
switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER); switch_set_flag(caller_profile, SWITCH_CPF_SCREEN);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID privacy mode specified. Use a valid mode [no|yes|name|full|number].\n"); if(!strcasecmp(arg, "no")) {
} switch_clear_flag(caller_profile, SWITCH_CPF_HIDE_NAME);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Privacy to %s [%d]\n", arg, caller_profile->flags); switch_clear_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER);
} } else if (!strcasecmp(arg, "yes")) {
} switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
} else if (!strcasecmp(arg, "full")) {
static void strftime_function(switch_core_session_t *session, char *data) switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
{ } else if (!strcasecmp(arg, "name")) {
char *argv[2]; switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NAME);
int argc; } else if (!strcasecmp(arg, "number")) {
char *lbuf; switch_set_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER);
} else {
if ((lbuf = switch_core_session_strdup(session, data))&&(argc = switch_separate_string(lbuf, '=', argv, (sizeof(argv) / sizeof(argv[0])))) > 1) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID privacy mode specified. Use a valid mode [no|yes|name|full|number].\n");
switch_size_t retsize; }
switch_time_exp_t tm; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Privacy to %s [%d]\n", arg, caller_profile->flags);
char date[80] = ""; }
switch_channel_t *channel; }
channel = switch_core_session_get_channel(session); static void strftime_function(switch_core_session_t *session, char *data)
assert(channel != NULL); {
char *argv[2];
switch_time_exp_lt(&tm, switch_time_now()); int argc;
switch_strftime(date, &retsize, sizeof(date), argv[1], &tm); char *lbuf;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", argv[0], date);
switch_channel_set_variable(channel, argv[0], date); if ((lbuf = switch_core_session_strdup(session, data))&&(argc = switch_separate_string(lbuf, '=', argv, (sizeof(argv) / sizeof(argv[0])))) > 1) {
} switch_size_t retsize;
} switch_time_exp_t tm;
char date[80] = "";
static switch_status_t strftime_api_function(char *fmt, switch_core_session_t *session, switch_stream_handle_t *stream) switch_channel_t *channel;
{
switch_size_t retsize; channel = switch_core_session_get_channel(session);
switch_time_exp_t tm; assert(channel != NULL);
char date[80] = "";
switch_time_exp_lt(&tm, switch_time_now());
switch_time_exp_lt(&tm, switch_time_now()); switch_strftime(date, &retsize, sizeof(date), argv[1], &tm);
switch_strftime(date, &retsize, sizeof(date), fmt, &tm); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", argv[0], date);
stream->write_function(stream, date); switch_channel_set_variable(channel, argv[0], date);
}
return SWITCH_STATUS_SUCCESS; }
}
static switch_status_t strftime_api_function(char *fmt, switch_core_session_t *session, switch_stream_handle_t *stream)
static switch_status_t presence_api_function(char *fmt, switch_core_session_t *session, switch_stream_handle_t *stream) {
{ switch_size_t retsize;
switch_event_t *event; switch_time_exp_t tm;
char *lbuf, *argv[4]; char date[80] = "";
int argc = 0;
switch_event_types_t type = SWITCH_EVENT_PRESENCE_IN; switch_time_exp_lt(&tm, switch_time_now());
switch_strftime(date, &retsize, sizeof(date), fmt, &tm);
if (fmt && (lbuf = strdup(fmt)) && (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) > 0) { stream->write_function(stream, date);
if (!strcasecmp(argv[0], "out")) {
type = SWITCH_EVENT_PRESENCE_OUT; return SWITCH_STATUS_SUCCESS;
} else if (argc != 4) { }
stream->write_function(stream, "Invalid");
return SWITCH_STATUS_SUCCESS; static switch_status_t presence_api_function(char *fmt, switch_core_session_t *session, switch_stream_handle_t *stream)
} {
switch_event_t *event;
if (switch_event_create(&event, type) == SWITCH_STATUS_SUCCESS) { char *lbuf, *argv[4];
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "dp"); int argc = 0;
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", __FILE__); switch_event_types_t type = SWITCH_EVENT_PRESENCE_IN;
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", argv[1]);
if (type == SWITCH_EVENT_PRESENCE_IN) { if (fmt && (lbuf = strdup(fmt)) && (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) > 0) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "%s", argv[2]); if (!strcasecmp(argv[0], "out")) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "%s", argv[3]); type = SWITCH_EVENT_PRESENCE_OUT;
} } else if (argc != 4) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); stream->write_function(stream, "Invalid");
switch_event_fire(&event); return SWITCH_STATUS_SUCCESS;
} }
stream->write_function(stream, "Event Sent");
switch_safe_free(lbuf); if (switch_event_create(&event, type) == SWITCH_STATUS_SUCCESS) {
} else { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "dp");
stream->write_function(stream, "Invalid"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", __FILE__);
} switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", argv[1]);
if (type == SWITCH_EVENT_PRESENCE_IN) {
return SWITCH_STATUS_SUCCESS; switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "%s", argv[2]);
} switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "%s", argv[3]);
}
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
static switch_status_t chat_api_function(char *fmt, switch_core_session_t *session, switch_stream_handle_t *stream) switch_event_fire(&event);
{ }
char *lbuf, *argv[4]; stream->write_function(stream, "Event Sent");
int argc = 0; switch_safe_free(lbuf);
} else {
if ((lbuf = strdup(fmt)) && (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) { stream->write_function(stream, "Invalid");
switch_chat_interface_t *ci; }
if ((ci = switch_loadable_module_get_chat_interface(argv[0]))) { return SWITCH_STATUS_SUCCESS;
ci->chat_send("dp", argv[1], argv[2], "", argv[3], ""); }
stream->write_function(stream, "Sent");
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", argv[0]); static switch_status_t chat_api_function(char *fmt, switch_core_session_t *session, switch_stream_handle_t *stream)
} {
} else { char *lbuf, *argv[4];
stream->write_function(stream, "Invalid"); int argc = 0;
}
if ((lbuf = strdup(fmt)) && (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
return SWITCH_STATUS_SUCCESS; switch_chat_interface_t *ci;
}
if ((ci = switch_loadable_module_get_chat_interface(argv[0]))) {
ci->chat_send("dp", argv[1], argv[2], "", argv[3], "");
static switch_api_interface_t chat_api_interface = { stream->write_function(stream, "Sent");
/*.interface_name */ "chat", } else {
/*.desc */ "chat", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", argv[0]);
/*.function */ chat_api_function, }
/*.syntax */ "<proto>|<from>|<to>|<message>", } else {
/*.next */ NULL stream->write_function(stream, "Invalid");
}; }
static switch_api_interface_t dptools_api_interface = { return SWITCH_STATUS_SUCCESS;
/*.interface_name */ "strftime", }
/*.desc */ "strftime",
/*.function */ strftime_api_function,
/*.syntax */ "<format_string>", static switch_api_interface_t chat_api_interface = {
/*.next */ &chat_api_interface /*.interface_name */ "chat",
}; /*.desc */ "chat",
/*.function */ chat_api_function,
static switch_api_interface_t presence_api_interface = { /*.syntax */ "<proto>|<from>|<to>|<message>",
/*.interface_name */ "presence", /*.next */ NULL
/*.desc */ "presence", };
/*.function */ presence_api_function,
/*.syntax */ "<user> <rpid> <message>", static switch_api_interface_t dptools_api_interface = {
/*.next */ &dptools_api_interface /*.interface_name */ "strftime",
}; /*.desc */ "strftime",
/*.function */ strftime_api_function,
static const switch_application_interface_t detect_speech_application_interface = { /*.syntax */ "<format_string>",
/*.interface_name */ "detect_speech", /*.next */ &chat_api_interface
/*.application_function */ detect_speech_function, };
/* long_desc */ "Detect speech on a channel.",
/* short_desc */ "Detect speech", static switch_api_interface_t presence_api_interface = {
/* syntax */ "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume", /*.interface_name */ "presence",
/*.next */ NULL /*.desc */ "presence",
}; /*.function */ presence_api_function,
/*.syntax */ "<user> <rpid> <message>",
static const switch_application_interface_t ringback_application_interface = { /*.next */ &dptools_api_interface
/*.interface_name */ "ringback", };
/*.application_function */ ringback_function,
/* long_desc */ "Indicate Ringback on a channel.", static const switch_application_interface_t detect_speech_application_interface = {
/* short_desc */ "Indicate Ringback", /*.interface_name */ "detect_speech",
/* syntax */ "", /*.application_function */ detect_speech_function,
/*.next */ &detect_speech_application_interface /* long_desc */ "Detect speech on a channel.",
}; /* short_desc */ "Detect speech",
/* syntax */ "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume",
static const switch_application_interface_t set_application_interface = { /*.next */ NULL
/*.interface_name */ "set", };
/*.application_function */ set_function,
/* long_desc */ "Set a channel varaible for the channel calling the application.", static const switch_application_interface_t ringback_application_interface = {
/* short_desc */ "Set a channel varaible", /*.interface_name */ "ringback",
/* syntax */ "<varname>=[<value>|_UNDEF_]", /*.application_function */ ringback_function,
/*.next */ &ringback_application_interface /* long_desc */ "Indicate Ringback on a channel.",
}; /* short_desc */ "Indicate Ringback",
/* syntax */ "",
static const switch_application_interface_t answer_application_interface = { /*.next */ &detect_speech_application_interface
/*.interface_name */ "answer", };
/*.application_function */ answer_function,
/* long_desc */ "Answer the call for a channel.", static const switch_application_interface_t set_application_interface = {
/* short_desc */ "Answer the call", /*.interface_name */ "set",
/* syntax */ "", /*.application_function */ set_function,
/*.next */ &set_application_interface /* long_desc */ "Set a channel varaible for the channel calling the application.",
/* short_desc */ "Set a channel varaible",
}; /* syntax */ "<varname>=[<value>|_UNDEF_]",
/*.next */ &ringback_application_interface
static const switch_application_interface_t eval_application_interface = { };
/*.interface_name */ "eval",
/*.application_function */ eval_function, static const switch_application_interface_t log_application_interface = {
/* long_desc */ "Do Nothing", /*.interface_name */ "log",
/* short_desc */ "Do Nothing", /*.application_function */ log_function,
/* syntax */ "", /* long_desc */ "Logs a channel varaible for the channel calling the application.",
/*.next */ &answer_application_interface /* short_desc */ "Logs a channel varaible",
/* syntax */ "<varname>",
}; /*.next */ &set_application_interface
};
static const switch_application_interface_t strftime_application_interface = {
/*.interface_name */ "strftime", static const switch_application_interface_t answer_application_interface = {
/*.application_function */ strftime_function, /*.interface_name */ "answer",
/* long_desc */ NULL, /*.application_function */ answer_function,
/* short_desc */ NULL, /* long_desc */ "Answer the call for a channel.",
/* syntax */ NULL, /* short_desc */ "Answer the call",
/*.next */ &eval_application_interface /* syntax */ "",
/*.next */ &log_application_interface
};
};
static const switch_application_interface_t sleep_application_interface = {
/*.interface_name */ "sleep", static const switch_application_interface_t eval_application_interface = {
/*.application_function */ sleep_function, /*.interface_name */ "eval",
/* long_desc */ "Pause the channel for a given number of milliseconds, consuming the audio for that period of time.", /*.application_function */ eval_function,
/* short_desc */ "Pause a channel", /* long_desc */ "Do Nothing",
/* syntax */ "<pausemilliseconds>", /* short_desc */ "Do Nothing",
/* next */ &strftime_application_interface /* syntax */ "",
}; /*.next */ &answer_application_interface
static const switch_application_interface_t transfer_application_interface = { };
/*.interface_name */ "transfer",
/*.application_function */ transfer_function, static const switch_application_interface_t strftime_application_interface = {
/* long_desc */ "Immediatly transfer the calling channel to a new extension", /*.interface_name */ "strftime",
/* short_desc */ "Transfer a channel", /*.application_function */ strftime_function,
/* syntax */ "<exten> [<dialplan> <context>]", /* long_desc */ NULL,
/* next */ &sleep_application_interface /* short_desc */ NULL,
}; /* syntax */ NULL,
/*.next */ &eval_application_interface
static const switch_application_interface_t privacy_application_interface = {
/*.interface_name */ "privacy", };
/*.application_function */ privacy_function,
/* long_desc */ "Set caller privacy on calls.", static const switch_application_interface_t sleep_application_interface = {
/* short_desc */ "Set privacy on calls", /*.interface_name */ "sleep",
/* syntax */ "off|on|name|full|number", /*.application_function */ sleep_function,
/*.next */ &transfer_application_interface /* long_desc */ "Pause the channel for a given number of milliseconds, consuming the audio for that period of time.",
}; /* short_desc */ "Pause a channel",
/* syntax */ "<pausemilliseconds>",
static const switch_loadable_module_interface_t mod_dptools_module_interface = { /* next */ &strftime_application_interface
/*.module_name = */ modname, };
/*.endpoint_interface = */ NULL,
/*.timer_interface = */ NULL, static const switch_application_interface_t transfer_application_interface = {
/*.dialplan_interface = */ NULL, /*.interface_name */ "transfer",
/*.codec_interface = */ NULL, /*.application_function */ transfer_function,
/*.application_interface */ &privacy_application_interface, /* long_desc */ "Immediatly transfer the calling channel to a new extension",
/*.api_interface */ &presence_api_interface /* short_desc */ "Transfer a channel",
}; /* syntax */ "<exten> [<dialplan> <context>]",
/* next */ &sleep_application_interface
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename) };
{
static const switch_application_interface_t privacy_application_interface = {
/* connect my internal structure to the blank pointer passed to me */ /*.interface_name */ "privacy",
*module_interface = &mod_dptools_module_interface; /*.application_function */ privacy_function,
/* long_desc */ "Set caller privacy on calls.",
/* short_desc */ "Set privacy on calls",
/* indicate that the module should continue to be loaded */ /* syntax */ "off|on|name|full|number",
return SWITCH_STATUS_SUCCESS; /*.next */ &transfer_application_interface
} };
/* 'switch_module_runtime' will start up in a thread by itself just by having it exist static const switch_loadable_module_interface_t mod_dptools_module_interface = {
if it returns anything but SWITCH_STATUS_TERM it will be called again automaticly /*.module_name = */ modname,
*/ /*.endpoint_interface = */ NULL,
/*.timer_interface = */ NULL,
/*.dialplan_interface = */ NULL,
//switch_status_t switch_module_runtime(void) /*.codec_interface = */ NULL,
/*.application_interface */ &privacy_application_interface,
/*.api_interface */ &presence_api_interface
};
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
{
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &mod_dptools_module_interface;
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
/* 'switch_module_runtime' will start up in a thread by itself just by having it exist
if it returns anything but SWITCH_STATUS_TERM it will be called again automaticly
*/
//switch_status_t switch_module_runtime(void)