mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-03 19:16:46 +00:00
Version 0.3.0 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@559 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -31,8 +31,10 @@ static char *synopsis = "Block telemarketers with SIT";
|
|||||||
static char *descrip =
|
static char *descrip =
|
||||||
" Zapateller(options): Generates special information tone to block telemarketers\n"
|
" Zapateller(options): Generates special information tone to block telemarketers\n"
|
||||||
"from calling you. Returns 0 normally or -1 on hangup. Options is a pipe-delimited\n"
|
"from calling you. Returns 0 normally or -1 on hangup. Options is a pipe-delimited\n"
|
||||||
"list of options. The only supported option is 'answer' which will cause the line to\n"
|
"list of options. The following options are available: 'answer' causes the line to\n"
|
||||||
"be answered before playing the tone";
|
"be answered before playing the tone, 'nocallerid' causes Zapateller to only play\n"
|
||||||
|
"the tone if there is no callerid information available. Options should be\n"
|
||||||
|
"seperated by | characters.\n";
|
||||||
|
|
||||||
STANDARD_LOCAL_USER;
|
STANDARD_LOCAL_USER;
|
||||||
|
|
||||||
@@ -42,22 +44,44 @@ static int zapateller_exec(struct ast_channel *chan, void *data)
|
|||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
struct localuser *u;
|
struct localuser *u;
|
||||||
|
int answer = 0, nocallerid = 0;
|
||||||
|
char *c;
|
||||||
|
char *stringp=NULL;
|
||||||
|
|
||||||
LOCAL_USER_ADD(u);
|
LOCAL_USER_ADD(u);
|
||||||
|
|
||||||
|
stringp=data;
|
||||||
|
c = strsep(&stringp, "|");
|
||||||
|
while(c && strlen(c)) {
|
||||||
|
if (!strcasecmp(c, "answer"))
|
||||||
|
answer = 1;
|
||||||
|
else if (!strcasecmp(c, "nocallerid"))
|
||||||
|
nocallerid = 1;
|
||||||
|
|
||||||
|
c = strsep(&stringp, "|");
|
||||||
|
}
|
||||||
|
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
if (chan->_state != AST_STATE_UP) {
|
if (chan->_state != AST_STATE_UP) {
|
||||||
if (data && !strcasecmp(data, "answer"))
|
|
||||||
|
if (answer)
|
||||||
res = ast_answer(chan);
|
res = ast_answer(chan);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
res = ast_safe_sleep(chan, 500);
|
res = ast_safe_sleep(chan, 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (chan->callerid && nocallerid) {
|
||||||
|
LOCAL_USER_REMOVE(u);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_tonepair(chan, 950, 0, 330, 0);
|
res = ast_tonepair(chan, 950, 0, 330, 0);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_tonepair(chan, 1400, 0, 330, 0);
|
res = ast_tonepair(chan, 1400, 0, 330, 0);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_tonepair(chan, 1800, 0, 330, 0);
|
res = ast_tonepair(chan, 1800, 0, 330, 0);
|
||||||
|
if (!res)
|
||||||
|
res = ast_tonepair(chan, 0, 0, 1000, 0);
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user