App to send DTMF digits. More...
#include "asterisk.h"#include "asterisk/pbx.h"#include "asterisk/module.h"#include "asterisk/app.h"#include "asterisk/manager.h"#include "asterisk/channel.h"
Go to the source code of this file.
Functions | |
| AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Send DTMF digits Application") | |
| 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 *vdata) |
| static int | unload_module (void) |
Variables | |
| static char * | app = "SendDTMF" |
| static char | mandescr_playdtmf [] |
App to send DTMF digits.
Definition in file app_senddtmf.c.
| AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
| "Send DTMF digits Application" | ||||
| ) |
| static int load_module | ( | void | ) | [static] |
Definition at line 133 of file app_senddtmf.c.
References ast_manager_register2(), ast_register_application_xml, 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_xml(app, senddtmf_exec); 00139 00140 return res; 00141 }
| static int manager_play_dtmf | ( | struct mansession * | s, | |
| const struct message * | m | |||
| ) | [static] |
Definition at line 99 of file app_senddtmf.c.
References ast_channel_unlock, ast_get_channel_by_name_locked(), ast_senddigit(), ast_strlen_zero(), astman_get_header(), astman_send_ack(), astman_send_error(), and chan.
Referenced by load_module().
00100 { 00101 const char *channel = astman_get_header(m, "Channel"); 00102 const char *digit = astman_get_header(m, "Digit"); 00103 struct ast_channel *chan = ast_get_channel_by_name_locked(channel); 00104 00105 if (!chan) { 00106 astman_send_error(s, m, "Channel not specified"); 00107 return 0; 00108 } 00109 if (ast_strlen_zero(digit)) { 00110 astman_send_error(s, m, "No digit specified"); 00111 ast_channel_unlock(chan); 00112 return 0; 00113 } 00114 00115 ast_senddigit(chan, *digit, 0); 00116 00117 ast_channel_unlock(chan); 00118 astman_send_ack(s, m, "DTMF successfully queued"); 00119 00120 return 0; 00121 }
| static int senddtmf_exec | ( | struct ast_channel * | chan, | |
| void * | vdata | |||
| ) | [static] |
Definition at line 65 of file app_senddtmf.c.
References AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_dtmf_stream(), ast_log(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), and LOG_WARNING.
Referenced by load_module().
00066 { 00067 int res = 0; 00068 char *data; 00069 int timeout = 0, duration = 0; 00070 AST_DECLARE_APP_ARGS(args, 00071 AST_APP_ARG(digits); 00072 AST_APP_ARG(timeout); 00073 AST_APP_ARG(duration); 00074 ); 00075 00076 if (ast_strlen_zero(vdata)) { 00077 ast_log(LOG_WARNING, "SendDTMF requires an argument (digits or *#aAbBcCdD)\n"); 00078 return 0; 00079 } 00080 00081 data = ast_strdupa(vdata); 00082 AST_STANDARD_APP_ARGS(args, data); 00083 00084 if (!ast_strlen_zero(args.timeout)) 00085 timeout = atoi(args.timeout); 00086 if (!ast_strlen_zero(args.duration)) 00087 duration = atoi(args.duration); 00088 res = ast_dtmf_stream(chan, NULL, args.digits, timeout <= 0 ? 250 : timeout, duration); 00089 00090 return res; 00091 }
| static int unload_module | ( | void | ) | [static] |
Definition at line 123 of file app_senddtmf.c.
References ast_manager_unregister(), and ast_unregister_application().
00124 { 00125 int res; 00126 00127 res = ast_unregister_application(app); 00128 res |= ast_manager_unregister("PlayDTMF"); 00129 00130 return res; 00131 }
char* app = "SendDTMF" [static] |
Definition at line 63 of file app_senddtmf.c.
char mandescr_playdtmf[] [static] |
"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 93 of file app_senddtmf.c.
1.6.1