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


C++ LOCAL_USER_REMOVE函数代码示例

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


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

示例1: settransfercapability_exec

static int settransfercapability_exec(struct cw_channel *chan, int argc, char **argv)
{
	struct localuser *u;
	int x;
	int transfercapability = -1;
	
	LOCAL_USER_ADD(u);
	
	for (x = 0; x < (sizeof(transcaps) / sizeof(transcaps[0])); x++) {
		if (!strcasecmp(transcaps[x].name, argv[0])) {
			transfercapability = transcaps[x].val;
			break;
		}
	}
	if (transfercapability < 0) {
		cw_log(LOG_WARNING, "'%s' is not a valid transfer capability (see 'show application SetTransferCapability')\n", argv[0]);
		LOCAL_USER_REMOVE(u);
		return 0;
	}
		
	chan->transfercapability = (unsigned short)transfercapability;
	
	if (option_verbose > 2)
		cw_verbose(VERBOSE_PREFIX_3 "Setting transfer capability to: 0x%.2x - %s.\n", transfercapability, argv[0]);

	LOCAL_USER_REMOVE(u);

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

示例2: directory_exec

static int directory_exec(struct cw_channel *chan, int argc, char **argv)
{
	struct localuser *u;
	struct cw_config *cfg;
	char *context, *dialcontext, *dirintro;
	int res = 0;
	int last = 1;

	if (argc < 1 || argc > 3) {
		cw_log(LOG_ERROR, "Syntax: %s\n", directory_syntax);
		return -1;
	}

	LOCAL_USER_ADD(u);

	context = argv[0];
	dialcontext = (argc > 1 && argv[1][0] ? argv[1] : context);
	if (argc > 2 && strchr(argv[2], 'f'))
		last = 0;

	cfg = realtime_directory(context);
	if (!cfg) {
		LOCAL_USER_REMOVE(u);
		return -1;
	}

	dirintro = cw_variable_retrieve(cfg, context, "directoryintro");
	if (cw_strlen_zero(dirintro))
		dirintro = cw_variable_retrieve(cfg, "general", "directoryintro");
	if (cw_strlen_zero(dirintro)) {
		if (last)
			dirintro = "dir-intro";	
		else
			dirintro = "dir-intro-fn";
	}
	
	for (;;) {
		if (!res)
			res = cw_streamfile(chan, dirintro, chan->language);
		if (!res)
			res = cw_waitstream(chan, CW_DIGIT_ANY);
		cw_stopstream(chan);
		if (!res)
			res = cw_waitfordigit(chan, 5000);
		if (res >0) {
			res = do_directory(chan, cfg, context, dialcontext, res, last);
			if (res > 0){
				res = cw_waitstream(chan, CW_DIGIT_ANY);
				cw_stopstream(chan);
				if (res >= 0) {
					continue;
				}
			}
		}
		break;
	}
	cw_config_destroy(cfg);
	LOCAL_USER_REMOVE(u);
	return res;
}
开发者ID:mehulsbhatt,项目名称:voip-foip,代码行数:60,代码来源:app_directory.c

示例3: macroif_exec

static int macroif_exec(struct ast_channel *chan, void *data) 
{
	char *expr = NULL, *label_a = NULL, *label_b = NULL;
	int res = 0;
	struct localuser *u;

	LOCAL_USER_ADD(u);

	expr = ast_strdupa(data);
	if (!expr) {
		ast_log(LOG_ERROR, "Out of Memory!\n");
		LOCAL_USER_REMOVE(u);
		return -1;
	}

	if ((label_a = strchr(expr, '?'))) {
		*label_a = '\0';
		label_a++;
		if ((label_b = strchr(label_a, ':'))) {
			*label_b = '\0';
			label_b++;
		}
		if (ast_true(expr))
			macro_exec(chan, label_a);
		else if (label_b) 
			macro_exec(chan, label_b);
	} else
		ast_log(LOG_WARNING, "Invalid Syntax.\n");

	LOCAL_USER_REMOVE(u);

	return res;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:33,代码来源:app_macro.c

示例4: app_exec

static int app_exec(struct ast_channel *chan, void *data)
{
	int res = 0;
	struct ast_flags flags;
	struct localuser *u;
	char *options=NULL;
	char *dummy = NULL;
	char *args;
	int argc = 0;
	char *opts[2];
	char *argv[2];

	if (ast_strlen_zero(data)) {
		ast_log(LOG_WARNING, "%s requires an argument (dummy|[options])\n",app);
		return -1;
	}

	LOCAL_USER_ADD(u);
	
	/* Do our thing here */

	/* We need to make a copy of the input string if we are going to modify it! */
	args = ast_strdupa(data);	
	if (!args) {
		ast_log(LOG_ERROR, "Out of memory!\n");
		LOCAL_USER_REMOVE(u);
		return -1;
	}
	
	if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
		dummy = argv[0];
		options = argv[1];
		ast_app_parse_options(app_opts, &flags, opts, options);
	}

	if (!ast_strlen_zero(dummy)) 
		ast_log(LOG_NOTICE, "Dummy value is : %s\n", dummy);

	if (ast_test_flag(&flags, OPTION_A))
		ast_log(LOG_NOTICE, "Option A is set\n");

	if (ast_test_flag(&flags, OPTION_B))
		ast_log(LOG_NOTICE,"Option B is set with : %s\n", opts[0] ? opts[0] : "<unspecified>");

	if (ast_test_flag(&flags, OPTION_C))
		ast_log(LOG_NOTICE,"Option C is set with : %s\n", opts[1] ? opts[1] : "<unspecified>");

	LOCAL_USER_REMOVE(u);
	
	return res;
}
开发者ID:tpenguin,项目名称:solarisvoip-asterisk,代码行数:51,代码来源:app_skel.c

示例5: readfile_exec

static int readfile_exec(struct ast_channel *chan, void *data)
{
	int res=0;
	struct localuser *u;
	char *s, *varname=NULL, *file=NULL, *length=NULL, *returnvar=NULL;
	int len=0;

	if (ast_strlen_zero(data)) {
		ast_log(LOG_WARNING, "ReadFile require an argument!\n");
		return -1;
	}

	LOCAL_USER_ADD(u);

	s = ast_strdupa(data);
	if (!s) {
		ast_log(LOG_ERROR, "Out of memory\n");
		LOCAL_USER_REMOVE(u);
		return -1;
	}

	varname = strsep(&s, "=");
	file = strsep(&s, "|");
	length = s;

	if (!varname || !file) {
		ast_log(LOG_ERROR, "No file or variable specified!\n");
		LOCAL_USER_REMOVE(u);
		return -1;
	}

	if (length) {
		if ((sscanf(length, "%d", &len) != 1) || (len < 0)) {
			ast_log(LOG_WARNING, "%s is not a positive number, defaulting length to max\n", length);
			len = 0;
		}
	}

	if ((returnvar = ast_read_textfile(file))) {
		if (len > 0) {
			if (len < strlen(returnvar))
				returnvar[len]='\0';
			else
				ast_log(LOG_WARNING, "%s is longer than %d, and %d \n", file, len, (int)strlen(returnvar));
		}
		pbx_builtin_setvar_helper(chan, varname, returnvar);
		free(returnvar);
	}
	LOCAL_USER_REMOVE(u);
	return res;
}
开发者ID:tpenguin,项目名称:solarisvoip-asterisk,代码行数:51,代码来源:app_readfile.c

示例6: cut_exec

static int cut_exec(struct ast_channel *chan, void *data)
{
	int res=0;
	struct localuser *u;
	char *s, *newvar=NULL, result[512];
	static int dep_warning = 0;

	LOCAL_USER_ADD(u);

	if (!dep_warning) {
		ast_log(LOG_WARNING, "The application Cut is deprecated.  Please use the CUT() function instead.\n");
		dep_warning=1;
	}

	/* Check and parse arguments */
	if (data) {
		s = ast_strdupa((char *)data);
		if (s) {
			newvar = strsep(&s, "=");
		} else {
			ast_log(LOG_ERROR, "Out of memory\n");
			LOCAL_USER_REMOVE(u);
			return -1;
		}
	}

	switch (cut_internal(chan, s, result, sizeof(result))) {
	case ERROR_NOARG:
		ast_log(LOG_ERROR, "Cut() requires an argument\n");
		res = 0;
		break;
	case ERROR_NOMEM:
		ast_log(LOG_ERROR, "Out of memory\n");
		res = -1;
		break;
	case ERROR_USAGE:
		ast_log(LOG_ERROR, "Usage: %s\n", cut_synopsis);
		res = 0;
		break;
	case 0:
		pbx_builtin_setvar_helper(chan, newvar, result);
		res = 0;
		break;
	default:
		ast_log(LOG_ERROR, "Unknown internal error\n");
		res = -1;
	}
	LOCAL_USER_REMOVE(u);
	return res;
}
开发者ID:tpenguin,项目名称:solarisvoip-asterisk,代码行数:50,代码来源:app_cut.c

示例7: intercom_exec

static int intercom_exec(struct ast_channel *chan, void *data)
{
	int res = 0;
	struct localuser *u;
	struct ast_frame *f;
	int oreadformat;
	LOCAL_USER_ADD(u);
	/* Remember original read format */
	oreadformat = chan->readformat;
	/* Set mode to signed linear */
	res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
	if (res < 0) {
		ast_log(LOG_WARNING, "Unable to set format to signed linear on channel %s\n", chan->name);
		LOCAL_USER_REMOVE(u);
		return -1;
	}
	/* Read packets from the channel */
	while(!res) {
		res = ast_waitfor(chan, -1);
		if (res > 0) {
			res = 0;
			f = ast_read(chan);
			if (f) {
				if (f->frametype == AST_FRAME_DTMF) {
					ast_frfree(f);
					break;
				} else {
					if (f->frametype == AST_FRAME_VOICE) {
						if (f->subclass == AST_FORMAT_SLINEAR) {
							res = write_audio(f->data, f->datalen);
							if (res > 0)
								res = 0;
						} else
							ast_log(LOG_DEBUG, "Unable to handle non-signed linear frame (%d)\n", f->subclass);
					} 
				}
				ast_frfree(f);
			} else
				res = -1;
		}
	}
	
	if (!res)
		ast_set_read_format(chan, oreadformat);

	LOCAL_USER_REMOVE(u);

	return res;
}
开发者ID:tpenguin,项目名称:solarisvoip-asterisk,代码行数:49,代码来源:app_intercom.c

示例8: eval_exec

static int eval_exec(struct cw_channel *chan, int argc, char **argv)
{
	static int dep_warning = 0;
	char tmp[MAXRESULT];
	struct localuser *u;
	char *newvar = NULL;
	int res = 0;

	if (!dep_warning) {
		cw_log(LOG_WARNING, "This application has been deprecated in favor of the dialplan function, EVAL\n");
		dep_warning = 1;
	}

	LOCAL_USER_ADD(u);
	
	/* Check and parse arguments */
	if (argv[0]) {
		newvar = strsep(&argv[0], "=");
		if (newvar && (newvar[0] != '\0')) {
			pbx_substitute_variables_helper(chan, argv[0], tmp, sizeof(tmp));
			pbx_builtin_setvar_helper(chan, newvar, tmp);
		}
	}

	LOCAL_USER_REMOVE(u);
	return res;
}
开发者ID:wildzero-cw,项目名称:callweaver,代码行数:27,代码来源:app_eval.c

示例9: waitforsilence_exec

static int waitforsilence_exec(struct ast_channel *chan, void *data)
{
	int res = 1;
	struct localuser *u;
	int maxsilence = 1000;
	int iterations = 1, i;

	LOCAL_USER_ADD(u);
	
	res = ast_answer(chan); /* Answer the channel */

	if (!data || ((sscanf(data, "%d|%d", &maxsilence, &iterations) != 2) &&
		(sscanf(data, "%d", &maxsilence) != 1))) {
		ast_log(LOG_WARNING, "Using default value of 1000ms, 1 iteration\n");
	}

	if (option_verbose > 2)
		ast_verbose(VERBOSE_PREFIX_3 "Waiting %d time(s) for %d ms silence\n", iterations, maxsilence);
	
	res = 1;
	for (i=0; (i<iterations) && (res == 1); i++) {
		res = do_waiting(chan, maxsilence);
	}
	LOCAL_USER_REMOVE(u);
	if (res > 0)
		res = 0;
	return res;
}
开发者ID:BackupTheBerlios,项目名称:solid-pbx-svn,代码行数:28,代码来源:app_waitforsilence.c

示例10: gosubif_exec

static int gosubif_exec(struct ast_channel *chan, void *data)
{
	struct localuser *u;
	char *condition="", *label1, *label2, *args;
	int res=0;

	if (ast_strlen_zero(data)) {
		ast_log(LOG_WARNING, "GosubIf requires an argument\n");
		return 0;
	}

	args = ast_strdupa((char *)data);
	if (!args) {
		ast_log(LOG_ERROR, "Out of memory\n");
		return -1;
	}

	LOCAL_USER_ADD(u);

	condition = strsep(&args, "?");
	label1 = strsep(&args, ":");
	label2 = args;

	if (pbx_checkcondition(condition)) {
		if (label1) {
			res = gosub_exec(chan, label1);
		}
	} else if (label2) {
		res = gosub_exec(chan, label2);
	}

	LOCAL_USER_REMOVE(u);
	return res;
}
开发者ID:tpenguin,项目名称:solarisvoip-asterisk,代码行数:34,代码来源:app_stack.c

示例11: userevent_exec

static int userevent_exec(struct cw_channel *chan, int argc, char **argv)
{
	char eventname[512];
	struct localuser *u;

	if (argc < 1 || argc > 2 || !argv[0][0]) {
		cw_log(LOG_ERROR, "Syntax: %s\n", userevent_syntax);
		return -1;
	}

	LOCAL_USER_ADD(u);

	snprintf(eventname, sizeof(eventname), "UserEvent%s", argv[0]);

	if (argc > 1 && argv[1][0]) {
            cw_log(LOG_DEBUG, "Sending user event: %s, %s\n", eventname, argv[1]);
            manager_event(EVENT_FLAG_USER, eventname, 
			"Channel: %s\r\nUniqueid: %s\r\n%s\r\n",
			chan->name, chan->uniqueid, argv[1]);
	} else {
            cw_log(LOG_DEBUG, "Sending user event: %s\n", eventname);
            manager_event(EVENT_FLAG_USER, eventname, 
			"Channel: %s\r\nUniqueid: %s\r\n", chan->name, chan->uniqueid);
	}

	LOCAL_USER_REMOVE(u);
	return 0;
}
开发者ID:wildzero-cw,项目名称:callweaver,代码行数:28,代码来源:app_userevent.c

示例12: exec_exec

static int exec_exec(struct ast_channel *chan, void *data)
{
	int res=0;
	struct localuser *u;
	char *s, *appname, *endargs, args[MAXRESULT] = "";
	struct ast_app *app;

	LOCAL_USER_ADD(u);

	/* Check and parse arguments */
	if (data) {
		s = ast_strdupa(data);
		appname = strsep(&s, "(");
		if (s) {
			endargs = strrchr(s, ')');
			if (endargs)
				*endargs = '\0';
			pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
		}
		if (appname) {
			app = pbx_findapp(appname);
			if (app) {
				res = pbx_exec(chan, app, args);
			} else {
				ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
				res = -1;
			}
		}
	}

	LOCAL_USER_REMOVE(u);
	return res;
}
开发者ID:BackupTheBerlios,项目名称:solid-pbx-svn,代码行数:33,代码来源:app_exec.c

示例13: eval_exec

static int eval_exec(struct ast_channel *chan, void *data)
{
	int res=0;
	struct localuser *u;
	char *s, *newvar=NULL, tmp[MAXRESULT];
	static int dep_warning = 0;

	LOCAL_USER_ADD(u);
	
	if (!dep_warning) {
		ast_log(LOG_WARNING, "This application has been deprecated in favor of the dialplan function, EVAL\n");
		dep_warning = 1;
	}

	/* Check and parse arguments */
	if (data) {
		s = ast_strdupa((char *)data);
		if (s) {
			newvar = strsep(&s, "=");
			if (newvar && (newvar[0] != '\0')) {
				memset(tmp, 0, MAXRESULT);
				pbx_substitute_variables_helper(chan, s, tmp, MAXRESULT - 1);
				pbx_builtin_setvar_helper(chan, newvar, tmp);
			}
		} else {
			ast_log(LOG_ERROR, "Out of memory\n");
			res = -1;
		}
	}

	LOCAL_USER_REMOVE(u);
	return res;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:33,代码来源:app_eval.c

示例14: senddtmf_exec

static int senddtmf_exec(struct ast_channel *chan, void *data)
{
	int res = 0;
	struct localuser *u;
	char *digits = NULL, *to = NULL;
	int timeout = 250;

	if (ast_strlen_zero(data)) {
		ast_log(LOG_WARNING, "SendDTMF requires an argument (digits or *#aAbBcCdD)\n");
		return 0;
	}

	LOCAL_USER_ADD(u);

	digits = ast_strdupa(data);

	if ((to = strchr(digits,'|'))) {
		*to = '\0';
		to++;
		timeout = atoi(to);
	}
		
	if (timeout <= 0)
		timeout = 250;

	res = ast_dtmf_stream(chan,NULL,digits,timeout);
		
	LOCAL_USER_REMOVE(u);

	return res;
}
开发者ID:BackupTheBerlios,项目名称:solid-pbx-svn,代码行数:31,代码来源:app_senddtmf.c

示例15: curl_exec

static int curl_exec(struct ast_channel *chan, void *data)
{
	int res = 0;
	struct localuser *u;
	char *info, *post_data=NULL, *url;
	struct MemoryStruct chunk = { NULL, 0 };
	static int dep_warning = 0;
	
	if (!dep_warning) {
		ast_log(LOG_WARNING, "The application Curl is deprecated.  Please use the CURL() function instead.\n");
		dep_warning = 1;
	}

	if (ast_strlen_zero(data)) {
		ast_log(LOG_WARNING, "Curl requires an argument (URL)\n");
		return -1;
	}
	
	LOCAL_USER_ADD(u);
	
	if ((info = ast_strdupa(data))) {
		url = strsep(&info, "|");
		post_data = info;
	} else {
		ast_log(LOG_ERROR, "Out of memory\n");
		LOCAL_USER_REMOVE(u);
		return -1;
	}

	if (! curl_internal(&chunk, url, post_data)) {
		if (chunk.memory) {
			chunk.memory[chunk.size] = '\0';
			if (chunk.memory[chunk.size - 1] == 10)
				chunk.memory[chunk.size - 1] = '\0';

			pbx_builtin_setvar_helper(chan, "CURL", chunk.memory);

			free(chunk.memory);
		}
	} else {
		ast_log(LOG_ERROR, "Cannot allocate curl structure\n");
		res = -1;
	}

	LOCAL_USER_REMOVE(u);
	return res;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:47,代码来源:app_curl.c


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