#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"
Go to the source code of this file.
Functions | |
AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Block Telemarketers with Special Information Tone") | |
static int | load_module (void) |
static int | unload_module (void) |
static int | zapateller_exec (struct ast_channel *chan, void *data) |
Variables | |
static char * | app = "Zapateller" |
static char * | descrip |
static char * | synopsis = "Block telemarketers with SIT" |
Definition in file app_zapateller.c.
AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
"Block Telemarketers with Special Information Tone" | ||||
) |
static int load_module | ( | void | ) | [static] |
Definition at line 115 of file app_zapateller.c.
References ast_register_application(), and zapateller_exec().
00116 { 00117 return ast_register_application(app, zapateller_exec, synopsis, descrip); 00118 }
static int unload_module | ( | void | ) | [static] |
Definition at line 104 of file app_zapateller.c.
References ast_module_user_hangup_all, and ast_unregister_application().
00105 { 00106 int res; 00107 00108 res = ast_unregister_application(app); 00109 00110 ast_module_user_hangup_all(); 00111 00112 return res; 00113 }
static int zapateller_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 58 of file app_zapateller.c.
References ast_channel::_state, answer, ast_answer(), ast_module_user_add, ast_module_user_remove, ast_safe_sleep(), AST_STATE_UP, ast_stopstream(), ast_strlen_zero(), ast_tonepair(), ast_module_user::chan, ast_channel::cid, ast_callerid::cid_num, and strsep().
Referenced by load_module().
00059 { 00060 int res = 0; 00061 struct ast_module_user *u; 00062 int answer = 0, nocallerid = 0; 00063 char *c; 00064 char *stringp=NULL; 00065 00066 u = ast_module_user_add(chan); 00067 00068 stringp=data; 00069 c = strsep(&stringp, "|"); 00070 while(!ast_strlen_zero(c)) { 00071 if (!strcasecmp(c, "answer")) 00072 answer = 1; 00073 else if (!strcasecmp(c, "nocallerid")) 00074 nocallerid = 1; 00075 00076 c = strsep(&stringp, "|"); 00077 } 00078 00079 ast_stopstream(chan); 00080 if (chan->_state != AST_STATE_UP) { 00081 00082 if (answer) 00083 res = ast_answer(chan); 00084 if (!res) { 00085 res = ast_safe_sleep(chan, 500); 00086 } 00087 } 00088 if (!ast_strlen_zero(chan->cid.cid_num) && nocallerid) { 00089 ast_module_user_remove(u); 00090 return res; 00091 } 00092 if (!res) 00093 res = ast_tonepair(chan, 950, 0, 330, 0); 00094 if (!res) 00095 res = ast_tonepair(chan, 1400, 0, 330, 0); 00096 if (!res) 00097 res = ast_tonepair(chan, 1800, 0, 330, 0); 00098 if (!res) 00099 res = ast_tonepair(chan, 0, 0, 1000, 0); 00100 ast_module_user_remove(u); 00101 return res; 00102 }
char* app = "Zapateller" [static] |
Definition at line 44 of file app_zapateller.c.
char* descrip [static] |
Definition at line 48 of file app_zapateller.c.
char* synopsis = "Block telemarketers with SIT" [static] |
Definition at line 46 of file app_zapateller.c.