#include "asterisk.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/translate.h"
#include "asterisk/options.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
#include "asterisk/manager.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | load_module (void) |
static int | manager_play_dtmf (struct mansession *s, const struct message *m) |
static int | senddtmf_exec (struct ast_channel *chan, void *data) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "Send DTMF digits Application" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } |
static char * | app = "SendDTMF" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static char * | descrip |
static char | mandescr_playdtmf [] |
static char * | synopsis = "Sends arbitrary DTMF digits" |
Definition in file app_senddtmf.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 143 of file app_senddtmf.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 143 of file app_senddtmf.c.
static int load_module | ( | void | ) | [static] |
Definition at line 133 of file app_senddtmf.c.
References ast_manager_register2(), ast_register_application(), EVENT_FLAG_CALL, manager_play_dtmf(), and senddtmf_exec().
00134 { 00135 int res; 00136 00137 res = ast_manager_register2( "PlayDTMF", EVENT_FLAG_CALL, manager_play_dtmf, "Play DTMF signal on a specific channel.", mandescr_playdtmf ); 00138 res |= ast_register_application(app, senddtmf_exec, synopsis, descrip); 00139 00140 return res; 00141 }
static int manager_play_dtmf | ( | struct mansession * | s, | |
const struct message * | m | |||
) | [static] |
Definition at line 97 of file app_senddtmf.c.
References ast_get_channel_by_name_locked(), ast_mutex_unlock(), ast_senddigit(), ast_strlen_zero(), astman_get_header(), astman_send_ack(), astman_send_error(), ast_channel::lock, and s.
Referenced by load_module().
00098 { 00099 const char *channel = astman_get_header(m, "Channel"); 00100 const char *digit = astman_get_header(m, "Digit"); 00101 struct ast_channel *chan = ast_get_channel_by_name_locked(channel); 00102 00103 if (!chan) { 00104 astman_send_error(s, m, "Channel not specified"); 00105 return 0; 00106 } 00107 if (ast_strlen_zero(digit)) { 00108 astman_send_error(s, m, "No digit specified"); 00109 ast_mutex_unlock(&chan->lock); 00110 return 0; 00111 } 00112 00113 ast_senddigit(chan, *digit); 00114 00115 ast_mutex_unlock(&chan->lock); 00116 astman_send_ack(s, m, "DTMF successfully queued"); 00117 00118 return 0; 00119 }
static int senddtmf_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 59 of file app_senddtmf.c.
References ast_dtmf_stream(), ast_log(), ast_module_user_add, ast_module_user_remove, ast_strdupa, ast_strlen_zero(), ast_module_user::chan, and LOG_WARNING.
Referenced by load_module().
00060 { 00061 int res = 0; 00062 struct ast_module_user *u; 00063 char *digits = NULL, *to = NULL; 00064 int timeout = 250; 00065 00066 if (ast_strlen_zero(data)) { 00067 ast_log(LOG_WARNING, "SendDTMF requires an argument (digits or *#aAbBcCdD)\n"); 00068 return 0; 00069 } 00070 00071 u = ast_module_user_add(chan); 00072 00073 digits = ast_strdupa(data); 00074 00075 if ((to = strchr(digits,'|'))) { 00076 *to = '\0'; 00077 to++; 00078 timeout = atoi(to); 00079 } 00080 00081 if (timeout <= 0) 00082 timeout = 250; 00083 00084 res = ast_dtmf_stream(chan,NULL,digits,timeout); 00085 00086 ast_module_user_remove(u); 00087 00088 return res; 00089 }
static int unload_module | ( | void | ) | [static] |
Definition at line 121 of file app_senddtmf.c.
References ast_manager_unregister(), ast_module_user_hangup_all, and ast_unregister_application().
00122 { 00123 int res; 00124 00125 res = ast_unregister_application(app); 00126 res |= ast_manager_unregister("PlayDTMF"); 00127 00128 ast_module_user_hangup_all(); 00129 00130 return res; 00131 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "Send DTMF digits Application" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 143 of file app_senddtmf.c.
char* app = "SendDTMF" [static] |
Definition at line 48 of file app_senddtmf.c.
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 143 of file app_senddtmf.c.
char* descrip [static] |
Initial value:
" SendDTMF(digits[|timeout_ms]): Sends DTMF digits on a channel. \n" " Accepted digits: 0-9, *#abcd, w (.5s pause)\n" " The application will either pass the assigned digits or terminate if it\n" " encounters an error.\n"
Definition at line 52 of file app_senddtmf.c.
char mandescr_playdtmf[] [static] |
Initial value:
"Description: Plays a dtmf digit on the specified channel.\n" "Variables: (all are required)\n" " Channel: Channel name to send digit to\n" " Digit: The dtmf digit to play\n"
Definition at line 91 of file app_senddtmf.c.
char* synopsis = "Sends arbitrary DTMF digits" [static] |
Definition at line 50 of file app_senddtmf.c.