77 unsigned short int tx;
78 unsigned short int rx;
79 unsigned short int state;
103 static inline void freq_invert(
short *amp,
int samples)
107 for (i = 0; i < samples; i += 2) {
128 ni = datastore->
data;
140 static int remove_scrambler(
struct ast_channel *chan)
148 ast_log(AST_LOG_WARNING,
"Cannot remove SCRAMBLE from %s: SCRAMBLE not currently enabled\n",
149 ast_channel_name(chan));
152 data = datastore->
data;
155 ast_log(AST_LOG_WARNING,
"Failed to remove SCRAMBLE audiohook from channel %s\n", ast_channel_name(chan));
160 ast_log(AST_LOG_WARNING,
"Failed to remove SCRAMBLE datastore from channel %s\n",
161 ast_channel_name(chan));
169 static int scramble_write(
struct ast_channel *chan,
const char *cmd,
char *data,
const char *value)
181 ast_log(LOG_WARNING,
"No channel was provided to %s function.\n", cmd);
188 if (!strcasecmp(args.direction,
"remove")) {
189 return remove_scrambler(chan);
191 if (!strcasecmp(args.direction,
"tx")) {
194 }
else if (!strcasecmp(args.direction,
"rx")) {
197 }
else if (strcasecmp(args.direction,
"both")) {
198 ast_log(LOG_ERROR,
"Direction must be either RX, TX, both, or remove\n");
201 ast_channel_lock(chan);
204 if (!(datastore = ast_datastore_alloc(&scramble_datastore, NULL))) {
213 datastore->
data = ni;
217 ni = datastore->
data;
221 ast_channel_unlock(chan);
228 .write = scramble_write,
231 static int unload_module(
void)
236 static int load_module(
void)
241 AST_MODULE_INFO_STANDARD(
ASTERISK_GPL_KEY,
"Frequency inverting voice scrambler");
Main Channel structure associated with a channel.
static const struct ast_datastore_info scramble_datastore
Static structure for datastore information.
Asterisk main include file. File version handling, generic pbx functions.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
int ast_audiohook_remove(struct ast_channel *chan, struct ast_audiohook *audiohook)
Remove an audiohook from a specified channel.
Structure for a data store type.
int ast_audiohook_attach(struct ast_channel *chan, struct ast_audiohook *audiohook)
Attach audiohook to channel.
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
int ast_audiohook_destroy(struct ast_audiohook *audiohook)
Destroys an audiohook structure.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
ast_audiohook_manipulate_callback manipulate_callback
int ast_audiohook_init(struct ast_audiohook *audiohook, enum ast_audiohook_type type, const char *source, enum ast_audiohook_init_flags flags)
Initialize an audiohook structure.
#define ast_audiohook_unlock(ah)
Unlock an audiohook.
#define SCOPED_CHANNELLOCK(varname, chan)
scoped lock specialization for channels.
General Asterisk PBX channel definitions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
Data structure associated with a custom dialplan function.
Core PBX routines and definitions.
int ast_audiohook_detach(struct ast_audiohook *audiohook)
Detach audiohook from channel.
static void destroy_callback(void *data)
Helper function used by datastores to destroy the speech structure upon hangup.
union ast_frame::@224 data
#define ast_calloc(num, len)
A wrapper for calloc()
Data structure associated with a single frame of data.
enum ast_audiohook_status status
enum ast_frame_type frametype
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define ast_audiohook_lock(ah)
Lock an audiohook.
Asterisk module definitions.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
#define ast_custom_function_register(acf)
Register a custom function.
#define AST_APP_ARG(name)
Define an application argument.