当前位置: 首页>>代码示例>>C++>>正文


C++ pbx_builtin_getvar_helper函数代码示例

本文整理汇总了C++中pbx_builtin_getvar_helper函数的典型用法代码示例。如果您正苦于以下问题:C++ pbx_builtin_getvar_helper函数的具体用法?C++ pbx_builtin_getvar_helper怎么用?C++ pbx_builtin_getvar_helper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pbx_builtin_getvar_helper函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: bridge_check_monitor

/*!
 * \internal
 * \brief Check if Monitor needs to be started on a channel.
 * \since 12.0.0
 *
 * \param chan The bridge considers this channel the caller.
 * \param peer The bridge considers this channel the callee.
 *
 * \return Nothing
 */
static void bridge_check_monitor(struct ast_channel *chan, struct ast_channel *peer)
{
	const char *value;
	const char *monitor_args = NULL;
	struct ast_channel *monitor_chan = NULL;

	ast_channel_lock(chan);
	value = pbx_builtin_getvar_helper(chan, "AUTO_MONITOR");
	if (!ast_strlen_zero(value)) {
		monitor_args = ast_strdupa(value);
		monitor_chan = chan;
	}
	ast_channel_unlock(chan);
	if (!monitor_chan) {
		ast_channel_lock(peer);
		value = pbx_builtin_getvar_helper(peer, "AUTO_MONITOR");
		if (!ast_strlen_zero(value)) {
			monitor_args = ast_strdupa(value);
			monitor_chan = peer;
		}
		ast_channel_unlock(peer);
	}
	if (monitor_chan) {
		struct ast_app *monitor_app;

		monitor_app = pbx_findapp("Monitor");
		if (monitor_app) {
			pbx_exec(monitor_chan, monitor_app, monitor_args);
		}
	}
}
开发者ID:litnimax,项目名称:asterisk,代码行数:41,代码来源:features.c

示例2: fax_set_common

static int fax_set_common(struct cw_channel *chan, t30_state_t *t30, const char *file, int calling_party, int verbose)
{
    char *x;

    x = pbx_builtin_getvar_helper(chan, "LOCALSTATIONID");
    if (x  &&  x[0])
        t30_set_tx_ident(t30, x);
    x = pbx_builtin_getvar_helper(chan, "LOCALSUBADDRESS");
    if (x  &&  x[0])
        t30_set_tx_sub_address(t30, x);
    x = pbx_builtin_getvar_helper(chan, "LOCALHEADERINFO");
    if (x  &&  x[0])
        t30_set_tx_page_header_info(t30, x);
    t30_set_rx_file(t30, file, -1);

    x = pbx_builtin_getvar_helper(chan, "FAX_DISABLE_V17");
    if (x  &&  x[0])
        t30_set_supported_modems(t30, T30_SUPPORT_V29 | T30_SUPPORT_V27TER);

    x = pbx_builtin_getvar_helper(chan, "FAX_DISABLE_ECM");
    if (x  &&  x[0])
    {
        t30_set_supported_compressions(t30,
                                       T30_SUPPORT_T4_1D_COMPRESSION
                                     | T30_SUPPORT_T4_2D_COMPRESSION);
        cw_log(LOG_DEBUG, "Disabling ECM mode\n");
    }
    else 
    {
        t30_set_ecm_capability(t30, TRUE);
        t30_set_supported_compressions(t30,
                                       T30_SUPPORT_T4_1D_COMPRESSION
                                     | T30_SUPPORT_T4_2D_COMPRESSION
                                     | T30_SUPPORT_T6_COMPRESSION);
    }

    t30_set_supported_image_sizes(t30,
                                  T30_SUPPORT_US_LETTER_LENGTH
                                | T30_SUPPORT_US_LEGAL_LENGTH
                                | T30_SUPPORT_UNLIMITED_LENGTH
                                | T30_SUPPORT_215MM_WIDTH
                                | T30_SUPPORT_255MM_WIDTH
                                | T30_SUPPORT_303MM_WIDTH);
    t30_set_supported_resolutions(t30,
                                  T30_SUPPORT_STANDARD_RESOLUTION
                                | T30_SUPPORT_FINE_RESOLUTION
                                | T30_SUPPORT_SUPERFINE_RESOLUTION
                                | T30_SUPPORT_R8_RESOLUTION
                                | T30_SUPPORT_R16_RESOLUTION);

    //t30_set_phase_b_handler(t30, phase_b_handler, chan);
    t30_set_phase_d_handler(t30, phase_d_handler, chan);
    t30_set_phase_e_handler(t30, phase_e_handler, chan);

    return 0;
}
开发者ID:wildzero-cw,项目名称:callweaver,代码行数:56,代码来源:app_rxfax.c

示例3: set_local_info

static void set_local_info(t30_state_t *state, fax_session *s)
{
	const char *x;

	x = pbx_builtin_getvar_helper(s->chan, "LOCALSTATIONID");
	if (!ast_strlen_zero(x))
		t30_set_tx_ident(state, x);

	x = pbx_builtin_getvar_helper(s->chan, "LOCALHEADERINFO");
	if (!ast_strlen_zero(x))
		t30_set_tx_page_header_info(state, x);
}
开发者ID:bugrahantopall,项目名称:asterisk,代码行数:12,代码来源:app_fax.c

示例4: morsecode_exec

static int morsecode_exec(struct ast_channel *chan, void *data)
{
	int res=0, ditlen, tone;
	char *digit;
	const char *ditlenc, *tonec;
	struct ast_module_user *u;

	u = ast_module_user_add(chan);

	if (ast_strlen_zero(data)) {
		ast_log(LOG_WARNING, "Syntax: Morsecode(<string>) - no argument found\n");
		ast_module_user_remove(u);
		return 0;
	}

	/* Use variable MORESEDITLEN, if set (else 80) */
	ditlenc = pbx_builtin_getvar_helper(chan, "MORSEDITLEN");
	if (ast_strlen_zero(ditlenc) || (sscanf(ditlenc, "%30d", &ditlen) != 1)) {
		ditlen = 80;
	}

	/* Use variable MORSETONE, if set (else 800) */
	tonec = pbx_builtin_getvar_helper(chan, "MORSETONE");
	if (ast_strlen_zero(tonec) || (sscanf(tonec, "%30d", &tone) != 1)) {
		tone = 800;
	}

	for (digit = data; *digit; digit++) {
		int digit2 = *digit;
		char *dahdit;
		if (digit2 < 0) {
			continue;
		}
		for (dahdit = morsecode[digit2]; *dahdit; dahdit++) {
			if (*dahdit == '-') {
				playtone(chan, tone, 3 * ditlen);
			} else if (*dahdit == '.') {
				playtone(chan, tone, 1 * ditlen);
			} else {
				/* Account for ditlen of silence immediately following */
				playtone(chan, 0, 2 * ditlen);
			}

			/* Pause slightly between each dit and dah */
			playtone(chan, 0, 1 * ditlen);
		}
		/* Pause between characters */
		playtone(chan, 0, 2 * ditlen);
	}

	ast_module_user_remove(u);
	return res;
}
开发者ID:axiatp,项目名称:asterisk,代码行数:53,代码来源:app_morsecode.c

示例5: ast_eivr_getvariable

static void ast_eivr_getvariable(struct ast_channel *chan, char *data, char *outbuf, int outbuflen)
{
	/* original input data: "G,var1,var2," */
	/* data passed as "data":  "var1,var2" */

	char *inbuf, *variable;
	const char *value;
	int j;
	struct ast_str *newstring = ast_str_alloca(outbuflen); 

	outbuf[0] = '\0';

	for (j = 1, inbuf = data; ; j++) {
		variable = strsep(&inbuf, ",");
		if (variable == NULL) {
			int outstrlen = strlen(outbuf);
			if (outstrlen && outbuf[outstrlen - 1] == ',') {
				outbuf[outstrlen - 1] = 0;
			}
			break;
		}
		
		ast_channel_lock(chan);
		if (!(value = pbx_builtin_getvar_helper(chan, variable))) {
			value = "";
		}

		ast_str_append(&newstring, 0, "%s=%s,", variable, value);
		ast_channel_unlock(chan);
		ast_copy_string(outbuf, ast_str_buffer(newstring), outbuflen);
	}
}
开发者ID:mtulio,项目名称:mtulio,代码行数:32,代码来源:app_externalivr.c

示例6: cw_app_group_match_get_count

int cw_app_group_match_get_count(char *groupmatch, char *category)
{
	regex_t regexbuf;
	struct cw_channel *chan;
	int count = 0;
	char *test;
	char cat[80];
	char *s;

	if (cw_strlen_zero(groupmatch))
		return 0;

	/* if regex compilation fails, return zero matches */
	if (regcomp(&regexbuf, groupmatch, REG_EXTENDED | REG_NOSUB))
		return 0;

	s = (!cw_strlen_zero(category)) ? category : GROUP_CATEGORY_PREFIX;
	cw_copy_string(cat, s, sizeof(cat));

	chan = NULL;
	while ((chan = cw_channel_walk_locked(chan)) != NULL) {
		test = pbx_builtin_getvar_helper(chan, cat);
		if (test && !regexec(&regexbuf, test, 0, NULL, 0))
			count++;
		cw_mutex_unlock(&chan->lock);
	}

	regfree(&regexbuf);

	return count;
}
开发者ID:wildzero-cw,项目名称:callweaver,代码行数:31,代码来源:app.c

示例7: memcpy

char *replace_cw_vars(struct cw_channel *chan, const char *_string)
{
	char *var_start, *var_end, *key, *value, *string;
	int begin, end;
	if (!_string) return "";
	string = (char *)malloc((strlen(_string)+1)*sizeof(char));
	memcpy(string, _string, strlen(_string)+1);

	while((var_start = strstr(string, "${")) && (var_end = strchr(var_start,'}'))) {
		begin = strlen(string)-strlen(var_start); 
		end = strlen(string)-strlen(var_end);
		key = (char *)alloca((end-begin-1)*sizeof(char));
		memcpy(key, var_start+2, end-begin-2);
		key[end-begin-2] = '\0';
		value = pbx_builtin_getvar_helper(chan, key);
		if (value) { 
			string = (char *)realloc(string, (strlen(string)-(end-begin+1)+strlen(value)+1)*sizeof(char));
			memmove(var_start+strlen(value), var_end+1, strlen(var_end+1)+1);
			memcpy(var_start, value, strlen(value));
		} else {
			memmove(var_start, var_end+1, strlen(var_end+1)+1);
		}
	}
	return string;
}
开发者ID:wildzero-cw,项目名称:callweaver,代码行数:25,代码来源:app_ldap.c

示例8: checkMax

static int checkMax(struct ast_channel *chan, struct roomdetails *dtmfmatch)
{
	int res=0;
    	struct ast_app *app;
	char getvar[30]="AstVar";
	char roomno[30]="";
	char maxusers[30]="";
	char currentusers[30]="";
	char prompt[50]="";
	char arg[255]="";

    	strcpy(maxusers,dtmfmatch->maxusers);
	strcpy(roomno,dtmfmatch->roomno);
    	strcat(arg,roomno);
    	strcat(arg,",");
	strcat(arg,getvar);

	if(!(app = pbx_findapp(ConfAppCount))) {
		ast_log(LOG_WARNING, "Invalid participant count application: %s\n", ConfAppCount);
		return -1;
	}
 	res = pbx_exec(chan, app, arg);
   	strcpy(currentusers, pbx_builtin_getvar_helper(chan, getvar));
	if(atoi(currentusers) < atoi(maxusers)){
	ast_log(LOG_NOTICE, "Currentusers: %i\n", atoi(currentusers));
		if(atoi(currentusers)>0){
			strcpy(prompt,"conf-thereare");
			if (!ast_streamfile(chan, "conf-thereare", chan->language)){
				res = ast_waitstream(chan,"");
				ast_stopstream(chan);
				
				if (!ast_say_number(chan, (atoi(currentusers)), AST_DIGIT_ANY, chan->language, (char *) NULL)){
					res = ast_waitstream(chan,"");
					ast_stopstream(chan);
				}
				if (!ast_streamfile(chan, "conf-otherinparty", chan->language)){
					res = ast_waitstream(chan,"");
					ast_stopstream(chan);
				}
			}
		}
		res=1;
	}
	else{
        	ast_log(LOG_NOTICE, "Maximum users exeeded, Current users in room: %s\n",currentusers);
        	strcpy(prompt, "conf-locked");
        	if (!ast_streamfile(chan, prompt, chan->language)){
        		res = ast_waitstream(chan,"");
			ast_stopstream(chan);
		}
		res=-1;
	}
	return res;
}
开发者ID:banzayats,项目名称:web_meetme,代码行数:54,代码来源:app_cbmysql.c

示例9: global_read

static int global_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
	const char *var = pbx_builtin_getvar_helper(NULL, data);

	*buf = '\0';

	if (var)
		ast_copy_string(buf, var, len);

	return 0;
}
开发者ID:mehulsbhatt,项目名称:asterisk,代码行数:11,代码来源:func_global.c

示例10: mcd_write

static int mcd_write(
	struct ast_channel *chan, const char *cmd, char *parse, const char *value
) {

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

	char *key = (char *)ast_malloc(MEMCACHED_MAX_KEY);
	unsigned int timeout = mcdttl; 

	mcd_set_operation_result(chan, MEMCACHED_SUCCESS);

	// the app argument is the key to set
	if (ast_strlen_zero(parse)) {
		ast_log(LOG_WARNING, "MCD() requires argument (key)\n");
		mcd_set_operation_result(chan, MEMCACHED_ARGUMENT_NEEDED);
		free(key);
		return 0;
	}
	strcpy(key, parse);
	ast_log(LOG_DEBUG, "setting value for key: %s=%s\n", key, value);

	const char *ttlval = pbx_builtin_getvar_helper(chan, "MCDTTL");
	if (ttlval) {
		timeout = atoi(ttlval);
		if ((timeout == 0) && (strcmp(ttlval, "0") != 0)) {
			ast_log(LOG_WARNING, "dialplan variable MCDTTL=%s (not numeric), will use time-to-live value in the config file\n", ttlval);
			timeout = mcdttl;
		}
	}
	ast_log(LOG_DEBUG, "timeout: %d\n", timeout);

	memcached_return_t mcdret = MEMCACHED_FAILURE;
	mcdret = memcached_set(mcd, 
		key, strlen(key), value, strlen(value), (time_t)timeout, (uint32_t)0
	);
	if (mcdret)
		ast_log(LOG_WARNING, 
			"memcached_%s() error %d: %s\n", cmd, mcdret, memcached_strerror(mcd, mcdret)
		);

	mcd_set_operation_result(chan, mcdret);
	free(key);
	memcached_pool_release(mcdpool, mcd);
	return 0;

}
开发者ID:drivefast,项目名称:asterisk-res_memcached,代码行数:51,代码来源:res_memcached.c

示例11: return_exec

static int return_exec(struct ast_channel *chan, void *data)
{
	char *label = pbx_builtin_getvar_helper(chan, STACKVAR);

	if (ast_strlen_zero(label)) {
		ast_log(LOG_ERROR, "Return without Gosub: stack is empty\n");
		return -1;
	} else if (ast_parseable_goto(chan, label)) {
		ast_log(LOG_WARNING, "No next statement after Gosub?\n");
		return -1;
	}

	pbx_builtin_setvar_helper(chan, STACKVAR, NULL);
	return 0;
}
开发者ID:tpenguin,项目名称:solarisvoip-asterisk,代码行数:15,代码来源:app_stack.c

示例12: find_by_mark

static int find_by_mark(void *obj, void *arg, void *data, int flags)
{
	struct ast_channel *target = obj;/*!< Potential pickup target */
	const char *mark = data;
	const char *tmp;

	ast_channel_lock(target);
	tmp = pbx_builtin_getvar_helper(target, PICKUPMARK);
	if (tmp && !strcasecmp(tmp, mark) && ast_can_pickup(target)) {
		/* Return with the channel still locked on purpose */
		return CMP_MATCH | CMP_STOP;
	}
	ast_channel_unlock(target);

	return 0;
}
开发者ID:piyawad,项目名称:test1,代码行数:16,代码来源:app_directed_pickup.c

示例13: macro_fixup

static void macro_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
{
	int i;
	char varname[10];
	pbx_builtin_setvar_helper(new_chan, "MACRO_DEPTH", "0");
	pbx_builtin_setvar_helper(new_chan, "MACRO_CONTEXT", NULL);
	pbx_builtin_setvar_helper(new_chan, "MACRO_EXTEN", NULL);
	pbx_builtin_setvar_helper(new_chan, "MACRO_PRIORITY", NULL);
	pbx_builtin_setvar_helper(new_chan, "MACRO_OFFSET", NULL);
	for (i = 1; i < 100; i++) {
		snprintf(varname, sizeof(varname), "ARG%d", i);
		while (pbx_builtin_getvar_helper(new_chan, varname)) {
			/* Kill all levels of arguments */
			pbx_builtin_setvar_helper(new_chan, varname, NULL);
		}
	}
}
开发者ID:bugrahantopall,项目名称:asterisk,代码行数:17,代码来源:app_macro.c

示例14: set_touch_variable

static void set_touch_variable(enum set_touch_variables_res *res, struct ast_channel *chan, const char *var_name, char **touch)
{
	const char *c_touch;

	if (*res == SET_TOUCH_ALLOC_FAILURE) {
		return;
	}
	c_touch = pbx_builtin_getvar_helper(chan, var_name);
	if (!ast_strlen_zero(c_touch)) {
		*touch = ast_strdup(c_touch);
		if (!*touch) {
			*res = SET_TOUCH_ALLOC_FAILURE;
		} else {
			*res = SET_TOUCH_SUCCESS;
		}
	}
}
开发者ID:huangjingpei,项目名称:asterisk,代码行数:17,代码来源:bridge_builtin_features.c

示例15: pickup_by_mark

/* Attempt to pick up specified mark */
static int pickup_by_mark(struct ast_channel *chan, char *mark)
{
	int res = -1;
	const char *tmp = NULL;
	struct ast_channel *target = NULL;

	while ((target = ast_channel_walk_locked(target))) {
		if ((tmp = pbx_builtin_getvar_helper(target, PICKUPMARK)) &&
		    !strcasecmp(tmp, mark) &&
		    can_pickup(target)) {
			res = pickup_do(chan, target);
			ast_channel_unlock(target);
			break;
		}
		ast_channel_unlock(target);
	}

	return res;
}
开发者ID:axiatp,项目名称:asterisk,代码行数:20,代码来源:app_directed_pickup.c


注:本文中的pbx_builtin_getvar_helper函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。