示例#1
0
static int math(struct ast_channel *chan, const char *cmd, char *parse,
		char *buf, size_t len)
{
	double fnum1;
	double fnum2;
	double ftmp = 0;
	char *op;
	int iaction = -1;
	int type_of_result = FLOAT_RESULT;
	char *mvalue1, *mvalue2 = NULL, *mtype_of_result;
	int negvalue1 = 0;
	AST_DECLARE_APP_ARGS(args,
			     AST_APP_ARG(argv0);
			     AST_APP_ARG(argv1);
	);
示例#2
0
static int privacy_exec (struct ast_channel *chan, void *data)
{
	int res=0;
	int retries;
	int maxretries = 3;
	int minlength = 10;
	int x = 0;
	char phone[30];
	char *parse = NULL;
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(maxretries);
		AST_APP_ARG(minlength);
		AST_APP_ARG(options);
		AST_APP_ARG(checkcontext);
	);
示例#3
0
/* The entry point of the application. */
static int app_synth_exec(struct ast_channel *chan, ast_app_data data)
{
	struct ast_frame *f;
	ast_mrcp_profile_t *profile;
	apr_uint32_t speech_channel_number = get_next_speech_channel_number();
	const char *name;
	speech_channel_status_t status;
	char *parse;
	int i;
	mrcpsynth_options_t mrcpsynth_options;
	mrcpsynth_session_t mrcpsynth_session;

	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(prompt);
		AST_APP_ARG(options);
	);
示例#4
0
static int forkcdr_exec(struct ast_channel *chan, const char *data)
{
	char *parse;
	struct ast_flags flags = { 0, };
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(options);
	);
示例#5
0
/*** DOCUMENTATION
	<function name="SPRINTF" language="en_US">
		<synopsis>
			Format a variable according to a format string.
		</synopsis>
		<syntax>
			<parameter name="format" required="true" />
			<parameter name="arg1" required="true" />
			<parameter name="arg2" multiple="true" />
			<parameter name="argN" />
		</syntax>
		<description>
			<para>Parses the format string specified and returns a string matching 
			that format. Supports most options found in <emphasis>sprintf(3)</emphasis>.
			Returns a shortened string if a format specifier is not recognized.</para>
		</description>
		<see-also>
			<ref type="manpage">sprintf(3)</ref>
		</see-also>
	</function>
 ***/
static int acf_sprintf(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
#define SPRINTF_FLAG	0
#define SPRINTF_WIDTH	1
#define SPRINTF_PRECISION	2
#define SPRINTF_LENGTH	3
#define SPRINTF_CONVERSION	4
	int i, state = -1, argcount = 0;
	char *formatstart = NULL, *bufptr = buf;
	char formatbuf[256] = "";
	int tmpi;
	double tmpd;
	AST_DECLARE_APP_ARGS(arg,
				AST_APP_ARG(format);
				AST_APP_ARG(var)[100];
	);
示例#6
0
static int acf_version_exec(struct ast_channel *chan, const char *cmd,
			 char *parse, char *buffer, size_t buflen)
{
	const char *response_char = ast_get_version();
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(info);
	);
示例#7
0
static int bridgewait_exec(struct ast_channel *chan, const char *data)
{
	char *bridge_name = DEFAULT_BRIDGE_NAME;
	struct ast_bridge_features chan_features;
	struct ast_flags flags = { 0 };
	char *parse;
	int bridge_join_failed = 0;
	enum wait_bridge_roles role = ROLE_PARTICIPANT;
	char *opts[OPT_ARG_ARRAY_SIZE] = { NULL, };

	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(name);
		AST_APP_ARG(role);
		AST_APP_ARG(options);
		AST_APP_ARG(other);		/* Any remaining unused arguments */
	);
static int zapateller_exec(struct ast_channel *chan, const char *data)
{
	int res = 0;
	int i, answer = 0, nocallerid = 0;
	char *parse = ast_strdupa((char *)data);
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(options)[2];
	);
/*!
 * \brief Start monitor
 * \param chan
 * \param data arguments passed fname|options
 * \retval 0 on success.
 * \retval -1 on failure.
*/
static int start_monitor_exec(struct ast_channel *chan, const char *data)
{
	char *arg;
	char *options;
	char *delay;
	char *urlprefix = NULL;
	char tmp[256];
	int stream_action = X_REC_IN | X_REC_OUT;
	int joinfiles = 0;
	int waitforbridge = 0;
	int res = 0;
	char *parse;
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(format);
		AST_APP_ARG(fname_base);
		AST_APP_ARG(options);
	);
示例#10
0
static int readexten_exec(struct ast_channel *chan, void *data)
{
	int res = 0;
	char exten[256] = "";
	int maxdigits = sizeof(exten) - 1;
	int timeout = 0, digit_timeout = 0, x = 0;
	char *argcopy = NULL, *status = "";
	struct ind_tone_zone_sound *ts = NULL;
	struct ast_flags flags = {0};

	 AST_DECLARE_APP_ARGS(arglist,
		AST_APP_ARG(variable);
		AST_APP_ARG(filename);
		AST_APP_ARG(context);
		AST_APP_ARG(options);
		AST_APP_ARG(timeout);
	);
static int load_values_config(const char *tmp)
{
	char *vals = NULL, *save = NULL;
	struct values *value = NULL;
	int i;
	AST_DECLARE_APP_ARGS(val,
		AST_APP_ARG(ues)[200]; /* More than 200 columns in this CDR?  Yeah, right... */
	);
示例#12
0
static int espeak_exec(struct ast_channel *chan, const char *data)
{
	int res = 0;
	FILE *fl;
	int raw_fd;
	espeak_ERROR espk_error;
	char *mydata, *format;
	int writecache = 0;
	char cachefile[MAXLEN];
	char raw_name[17] = "/tmp/espk_XXXXXX";
	char slin_name[23];
	int sample_rate;
	const char *voice;
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(text);
		AST_APP_ARG(interrupt);
		AST_APP_ARG(language);
	);
示例#13
0
static int forkcdr_exec(struct ast_channel *chan, const char *data)
{
	int res = 0;
	char *argcopy = NULL;
	struct ast_flags flags = {0};
	char *opts[OPT_ARG_ARRAY_SIZE];
	AST_DECLARE_APP_ARGS(arglist,
		AST_APP_ARG(options);
	);
示例#14
0
static int page_exec(struct ast_channel *chan, const char *data)
{
	char *tech, *resource, *tmp;
	char confbridgeopts[128], originator[AST_CHANNEL_NAME];
	struct page_options options = { { 0, }, { 0, } };
	unsigned int confid = ast_random();
	struct ast_app *app;
	int res = 0, pos = 0, i = 0;
	struct ast_dial **dial_list;
	unsigned int num_dials;
	int timeout = 0;
	char *parse;

	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(devices);
		AST_APP_ARG(options);
		AST_APP_ARG(timeout);
	);
static int privacy_exec (struct ast_channel *chan, void *data)
{
	int res=0;
	int retries;
	int maxretries = 3;
	int minlength = 10;
	int x = 0;
	char *s;
	char phone[30];
	struct localuser *u;
	struct ast_config *cfg = NULL;
	char *parse = NULL;
	int priority_jump = 0;
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(maxretries);
		AST_APP_ARG(minlength);
		AST_APP_ARG(options);
	);
示例#16
0
/*
 * Master control routine
 */
static int acf_odbc_write(struct ast_channel *chan, char *cmd, char *s, const char *value)
{
	struct odbc_obj *obj;
	struct acf_odbc_query *query;
	char *t, buf[2048]="", varname[15];
	int res, i, retry=0;
	AST_DECLARE_APP_ARGS(values,
		AST_APP_ARG(field)[100];
	);
static int mcdget_exec(struct ast_channel *chan, const char *data) {

	memcached_return_t rc;
	memcached_st *mcd = memcached_pool_fetch(mcdpool, &to, &rc);
	if (rc) {
        ast_log(LOG_WARNING, "mcdget_exec: memcached pool error: %d\n", rc);
		return 0;
    }

	char *argcopy;
	char *key = (char *)ast_malloc(MEMCACHED_MAX_KEY);

	mcd_set_operation_result(chan, MEMCACHED_SUCCESS);

	// parse the app arguments
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(varname);
		AST_APP_ARG(key);
	);
示例#18
0
/*!
 * \brief Start monitor
 * \param chan
 * \param data arguments passed fname|options
 * \retval 0 on success.
 * \retval -1 on failure.
*/
static int start_monitor_exec(struct ast_channel *chan, const char *data)
{
	char *arg;
	char *options;
	char *delay;
	char *urlprefix = NULL;
	char tmp[256];
	int stream_action = X_REC_IN | X_REC_OUT;
	int joinfiles = 0;
	int res = 0;
	char *parse;
	struct ast_flags flags = { 0 };
	char *opts[OPT_ARG_ARRAY_SIZE] = { NULL, };
	char beep_id[64] = "";
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(format);
		AST_APP_ARG(fname_base);
		AST_APP_ARG(options);
	);
示例#19
0
文件: res_json.c 项目: cfhb/vlink-cti
static int jsonpretty_exec(struct ast_channel *chan, 
	const char *cmd, char *parse, char *buffer, size_t buflen
) {
// nicely format the contents of a varable that contains json

	buffer[0] = 0;

	// parse the function arguments
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(json);
	);
示例#20
0
static int disa_exec(struct ast_channel *chan, void *data)
{
	int i,j,k,x,did_ignore;
	int firstdigittimeout = 20000;
	int digittimeout = 10000;
	struct localuser *u;
	char *tmp, exten[AST_MAX_EXTENSION],acctcode[20]="";
	char pwline[256];
	char ourcidname[256],ourcidnum[256];
	struct ast_frame *f;
	struct timeval lastdigittime;
	int res;
	time_t rstart;
	FILE *fp;
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(passcode);
		AST_APP_ARG(context);
		AST_APP_ARG(cid);
		AST_APP_ARG(mailbox);
	);
示例#21
0
static int forkcdr_exec(struct ast_channel *chan, const char *data)
{
	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
	RAII_VAR(struct fork_cdr_message_payload *, payload, NULL, ao2_cleanup);
	RAII_VAR(struct stasis_message_router *, router, ast_cdr_message_router(), ao2_cleanup);

	char *parse;
	struct ast_flags flags = { 0, };
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(options);
	);
示例#22
0
static int disa_exec(struct ast_channel *chan, const char *data)
{
	int i = 0, j, k = 0, did_ignore = 0, special_noanswer = 0;
	int firstdigittimeout = (chan->pbx ? chan->pbx->rtimeoutms : 20000);
	int digittimeout = (chan->pbx ? chan->pbx->dtimeoutms : 10000);
	struct ast_flags flags;
	char *tmp, exten[AST_MAX_EXTENSION] = "", acctcode[20]="";
	char pwline[256];
	char ourcidname[256],ourcidnum[256];
	struct ast_frame *f;
	struct timeval lastdigittime;
	int res;
	FILE *fp;
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(passcode);
		AST_APP_ARG(context);
		AST_APP_ARG(cid);
		AST_APP_ARG(mailbox);
		AST_APP_ARG(options);
	);
示例#23
0
/* set defaults */
static int jb_framedata_init(struct jb_framedata *framedata, const char *data, const char *value)
{
	int jb_impl_type = DEFAULT_TYPE;

	/* Initialize defaults */
	framedata->timer_fd = -1;
	jb_conf_default(&framedata->jb_conf);
	if (!(framedata->jb_impl = ast_jb_get_impl(jb_impl_type))) {
		return -1;
	}
	if (!(framedata->timer = ast_timer_open())) {
		return -1;
	}
	framedata->timer_fd = ast_timer_fd(framedata->timer);
	framedata->timer_interval = DEFAULT_TIMER_INTERVAL;
	ast_timer_set_rate(framedata->timer, 1000 / framedata->timer_interval);
	framedata->start_tv = ast_tvnow();



	/* Now check user options to see if any of the defaults need to change. */
	if (!ast_strlen_zero(data)) {
		if (!strcasecmp(data, "fixed")) {
			jb_impl_type = AST_JB_FIXED;
		} else if (!strcasecmp(data, "adaptive")) {
			jb_impl_type = AST_JB_ADAPTIVE;
		} else {
			ast_log(LOG_WARNING, "Unknown Jitterbuffer type %s. Failed to create jitterbuffer.\n", data);
			return -1;
		}
		ast_copy_string(framedata->jb_conf.impl, data, sizeof(framedata->jb_conf.impl));
	}

	if (!ast_strlen_zero(value) && strcasecmp(value, "default")) {
		char *parse = ast_strdupa(value);
		int res = 0;
		AST_DECLARE_APP_ARGS(args,
			AST_APP_ARG(max_size);
			AST_APP_ARG(resync_threshold);
			AST_APP_ARG(target_extra);
		);
示例#24
0
static int transfer_exec(struct ast_channel *chan, const char *data)
{
	int res;
	int len;
	char *slash;
	char *tech = NULL;
	char *dest = NULL;
	char *status;
	char *parse;
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(dest);
	);
static int respoke_metadata_function_read(struct ast_channel *chan,
	const char *cmd, char *data, struct ast_str **buf, ssize_t len)
{
	char *parsed_data = ast_strdupa(data);
	const char *key;
	const struct respoke_session *session = chan ? ast_channel_tech_pvt(chan) : NULL;
	struct ast_json *value_json;
	int res = -1;

	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(key);
	);
示例#26
0
/*!
 * \brief Bridge channels
 * \param chan
 * \param data channel to bridge with.
 *
 * Split data, check we aren't bridging with ourself, check valid channel,
 * answer call if not already, check compatible channels, setup bridge config
 * now bridge call, if transferred party hangs up return to PBX extension.
 */
static int bridge_exec(struct ast_channel *chan, const char *data)
{
	struct ast_channel *current_dest_chan;
	char *tmp_data  = NULL;
	struct ast_flags opts = { 0, };
	struct ast_bridge_config bconfig = { { 0, }, };
	char *opt_args[OPT_ARG_ARRAY_SIZE];
	struct timeval calldurationlimit = { 0, };
	const char *context;
	const char *extension;
	int priority;
	int bridge_add_failed;
	struct ast_bridge_features chan_features;
	struct ast_bridge_features *peer_features;
	struct ast_bridge *bridge;
	struct ast_features_xfer_config *xfer_cfg;

	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(dest_chan);
		AST_APP_ARG(options);
	);
示例#27
0
static int festival_exec(struct ast_channel *chan, const char *vdata)
{
    int usecache;
    int res = 0;
    struct sockaddr_in serv_addr;
    struct hostent *serverhost;
    struct ast_hostent ahp;
    int fd;
    FILE *fs;
    const char *host;
    const char *cachedir;
    const char *temp;
    const char *festivalcommand;
    int port = 1314;
    int n;
    char ack[4];
    char *waveform;
    int filesize;
    char bigstring[MAXFESTLEN];
    int i;
    struct MD5Context md5ctx;
    unsigned char MD5Res[16];
    char MD5Hex[33] = "";
    char koko[4] = "";
    char cachefile[MAXFESTLEN]="";
    int readcache = 0;
    int writecache = 0;
    int strln;
    int fdesc = -1;
    char buffer[16384];
    int seekpos = 0;
    char *data;
    struct ast_config *cfg;
    char *newfestivalcommand;
    struct ast_flags config_flags = { 0 };
    AST_DECLARE_APP_ARGS(args,
                         AST_APP_ARG(text);
                         AST_APP_ARG(interrupt);
                        );
示例#28
0
文件: app_amd.c 项目: mtulio/mtulio
static void isAnsweringMachine(struct ast_channel *chan, const char *data)
{
	int res = 0;
	struct ast_frame *f = NULL;
	struct ast_dsp *silenceDetector = NULL;
	int dspsilence = 0, framelength = 0;
	struct ast_format readFormat;
	int inInitialSilence = 1;
	int inGreeting = 0;
	int voiceDuration = 0;
	int silenceDuration = 0;
	int iTotalTime = 0;
	int iWordsCount = 0;
	int currentState = STATE_IN_WORD;
	int consecutiveVoiceDuration = 0;
	char amdCause[256] = "", amdStatus[256] = "";
	char *parse = ast_strdupa(data);

	/* Lets set the initial values of the variables that will control the algorithm.
	   The initial values are the default ones. If they are passed as arguments
	   when invoking the application, then the default values will be overwritten
	   by the ones passed as parameters. */
	int initialSilence       = dfltInitialSilence;
	int greeting             = dfltGreeting;
	int afterGreetingSilence = dfltAfterGreetingSilence;
	int totalAnalysisTime    = dfltTotalAnalysisTime;
	int minimumWordLength    = dfltMinimumWordLength;
	int betweenWordsSilence  = dfltBetweenWordsSilence;
	int maximumNumberOfWords = dfltMaximumNumberOfWords;
	int silenceThreshold     = dfltSilenceThreshold;
	int maximumWordLength    = dfltMaximumWordLength;
	int maxWaitTimeForFrame  = dfltMaxWaitTimeForFrame;

	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(argInitialSilence);
		AST_APP_ARG(argGreeting);
		AST_APP_ARG(argAfterGreetingSilence);
		AST_APP_ARG(argTotalAnalysisTime);
		AST_APP_ARG(argMinimumWordLength);
		AST_APP_ARG(argBetweenWordsSilence);
		AST_APP_ARG(argMaximumNumberOfWords);
		AST_APP_ARG(argSilenceThreshold);
		AST_APP_ARG(argMaximumWordLength);
	);
示例#29
0
static int background_detect_exec(struct ast_channel *chan, const char *data)
{
	int res = 0;
	char *tmp;
	struct ast_frame *fr;
	int notsilent = 0;
	struct timeval start = { 0, 0 };
	struct timeval detection_start = { 0, 0 };
	int sil = 1000;
	int min = 100;
	int max = -1;
	int analysistime = -1;
	int continue_analysis = 1;
	int x;
	struct ast_format origrformat;
	struct ast_dsp *dsp = NULL;
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(filename);
		AST_APP_ARG(silence);
		AST_APP_ARG(min);
		AST_APP_ARG(max);
		AST_APP_ARG(analysistime);
	);
static int voicemail_detect_exec(struct ast_channel *chan, void *data)
{
	int res = 0;
	char *tmp;
	struct ast_frame *fr;
	int notsilent = 0;
	struct timeval start = { 0, 0 };
	struct timeval detection_start = { 0, 0 };
	int sil = 1000;
	int min = 100;
	int max = 3000; //-1
	int analysistime = 5000; //-1
	int continue_analysis = 1;
	int x;
	int origrformat = 0;
	struct ast_dsp *dsp = NULL;
	AST_DECLARE_APP_ARGS(args,
		AST_APP_ARG(filename);
		AST_APP_ARG(silence);
		AST_APP_ARG(min);
		AST_APP_ARG(max);
		AST_APP_ARG(analysistime);
	);