Sat Aug 6 00:39:38 2011

Asterisk developer's documentation


app_zapateller.c File Reference

Playback the special information tone to get rid of telemarketers. More...

#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

static void __reg_module (void)
static void __unreg_module (void)
static int load_module (void)
static int unload_module (void)
static int zapateller_exec (struct ast_channel *chan, void *data)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "Block Telemarketers with Special Information Tone" , .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 = "Zapateller"
static const struct ast_module_infoast_module_info = &__mod_info
static char * descrip
static char * synopsis = "Block telemarketers with SIT"


Detailed Description

Playback the special information tone to get rid of telemarketers.

Author:
Mark Spencer <markster@digium.com>

Definition in file app_zapateller.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 120 of file app_zapateller.c.

static void __unreg_module ( void   )  [static]

Definition at line 120 of file app_zapateller.c.

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, and ast_callerid::cid_num.

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 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "Block Telemarketers with Special Information Tone" , .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 120 of file app_zapateller.c.

char* app = "Zapateller" [static]

Definition at line 44 of file app_zapateller.c.

const struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 120 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.


Generated on Sat Aug 6 00:39:38 2011 for Asterisk - the Open Source PBX by  doxygen 1.4.7