本文整理汇总了C++中pbx_builtin_getvar_helper函数的典型用法代码示例。如果您正苦于以下问题:C++ pbx_builtin_getvar_helper函数的具体用法?C++ pbx_builtin_getvar_helper怎么用?C++ pbx_builtin_getvar_helper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pbx_builtin_getvar_helper函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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(®exbuf, 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(®exbuf, test, 0, NULL, 0))
count++;
cw_mutex_unlock(&chan->lock);
}
regfree(®exbuf);
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
示例16: cw_app_group_get_count
int cw_app_group_get_count(char *group, char *category)
{
struct cw_channel *chan;
int count = 0;
char *test;
char cat[80];
char *s;
if (cw_strlen_zero(group))
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 && !strcasecmp(test, group))
count++;
cw_mutex_unlock(&chan->lock);
}
return count;
}
开发者ID:wildzero-cw,项目名称:callweaver,代码行数:24,代码来源:app.c
示例17: receive_ademco_event
/*!
* \brief Receive Ademco ContactID or other format Data String
*
* \param chan Asterisk Channel
* \param ehead Pointer to events list
* \param signalling_type Expected signalling type for the message
* \param no_checksum Should we calculate checksum for the message
*
* \retval 0 success
* \retval -1 failure
*/
static int receive_ademco_event(struct ast_channel *chan, event_node_t **ehead, char *signalling_type, int *no_checksum)
{
int res = 0;
const char *limit;
char event[17];
event_node_t *enew, *elp;
int got_some_digits = 0;
int events_received = 0;
int ack_retries = 0;
int limit_retries = 0;
int expected_length = sizeof(event) - 1;
database_increment("calls-received");
/* Wait for first event */
ast_verb(4, "AlarmReceiver: Waiting for first event from panel...\n");
while (res >= 0) {
int digits_received = 0;
res = 0;
if (log_individual_events) {
sprintf(signalling_type, "%s", UNKNOWN_FORMAT);
expected_length = 16;
*no_checksum = 0;
}
if (got_some_digits == 0) {
/* Send ACK tone sequence */
ast_verb(4, "AlarmReceiver: Sending 1400Hz 100ms burst (ACK)\n");
res = send_tone_burst(chan, "1400", 100, 0);
if (!res) {
ast_verb(4, "AlarmReceiver: Sending 2300Hz 100ms burst (ACK)\n");
res = send_tone_burst(chan, "2300", 100, 100);
}
}
if (res) {
return -1;
}
res = receive_dtmf_digits(chan, event, sizeof(event), expected_length, &digits_received);
if (res < 0) {
if (events_received == 0) {
/* Hangup with no events received should be logged in the DB */
database_increment("no-events-received");
ast_verb(4, "AlarmReceiver: No events received!\n");
} else {
if (ack_retries) {
database_increment("ack-retries");
ast_verb(4, "AlarmReceiver: ACK retries during this call: %d\n", ack_retries);
}
}
ast_verb(4, "AlarmReceiver: App exiting...\n");
break;
}
if (!strcmp(signalling_type, UNKNOWN_FORMAT) && digits_received > 5) {
expected_length = ademco_detect_format(signalling_type, event, no_checksum);
if (res > 0) {
if (digits_received == expected_length) {
res = limit_retries = 0;
} else if (digits_received == expected_length - 1
&& (!strcmp(signalling_type, ADEMCO_EXPRESS_4_2)
|| !strcmp(signalling_type, ADEMCO_EXPRESS_4_1))) {
/* ADEMCO EXPRESS without checksum */
res = limit_retries = 0;
expected_length--;
*no_checksum = 1;
ast_verb(4, "AlarmMonitoring: Skipping checksum for format %s.\n", signalling_type);
ast_debug(1, "AlarmMonitoring: Skipping checksum for format %s.\n", signalling_type);
}
}
}
ast_channel_lock(chan);
limit = pbx_builtin_getvar_helper(chan, "ALARMRECEIVER_CALL_LIMIT");
if (!ast_strlen_zero(limit)) {
if (ast_tvdiff_ms(ast_tvnow(), call_start_time) > atoi(limit)) {
ast_channel_unlock(chan);
return -1;
}
}
limit = pbx_builtin_getvar_helper(chan, "ALARMRECEIVER_RETRIES_LIMIT");
ast_channel_unlock(chan);
if (!ast_strlen_zero(limit)) {
if (limit_retries + 1 >= atoi(limit)) {
return -1;
//.........这里部分代码省略.........
开发者ID:litnimax,项目名称:asterisk,代码行数:101,代码来源:app_alarmreceiver.c
示例18: conf_do_originate
static int conf_do_originate(struct cw_conf_member *member, char *ext) {
int res;
pthread_t th;
pthread_attr_t attr;
struct fast_originate_helper *fast = malloc(sizeof(struct fast_originate_helper));
char dst[80]="";
char appdata[80]="";
char *var;
if (!fast) {
res = -1;
} else {
memset(fast, 0, sizeof(struct fast_originate_helper));
if ( (var = pbx_builtin_getvar_helper(member->chan, "NCONF_OUTBOUND_TIMEOUT")) ) {
fast->timeout = atoi(var) * 1000;
} else
fast->timeout = 30000;
strcat(dst,ext);
strcat(dst,"@");
if ( (var = pbx_builtin_getvar_helper(member->chan, "NCONF_OUTBOUND_CONTEXT")) )
strcat(dst,var);
else
strcat(dst,member->chan->context);
strcat(appdata,member->id);
strcat(appdata,"/");
if ( (var = pbx_builtin_getvar_helper(member->chan, "NCONF_OUTBOUND_PARAMS")) )
strcat(appdata,var);
else {
strcat(appdata,"Sdq");
#if ENABLE_VAD
strcat(appdata,"V");
#endif
}
cw_copy_string( fast->tech, "Local", sizeof(fast->tech) );
cw_copy_string( fast->data, dst, sizeof(fast->data) );
cw_copy_string( fast->app, APP_CONFERENCE_NAME, sizeof(fast->app) );
cw_copy_string( fast->appdata, appdata, sizeof(fast->appdata) );
if ( (var = pbx_builtin_getvar_helper(member->chan, "NCONF_OUTBOUND_CID_NAME")) )
cw_copy_string( fast->cid_name, var, sizeof(fast->cid_name) );
else
cw_copy_string( fast->cid_name,"NavyConference",sizeof(fast->cid_name) );
if ( (var = pbx_builtin_getvar_helper(member->chan, "NCONF_OUTBOUND_CID_NUM")) )
cw_copy_string( fast->cid_num, var,sizeof(fast->cid_num) );
else
cw_copy_string( fast->cid_num, member->id,sizeof(fast->cid_num) );
cw_copy_string( fast->context, "internal", sizeof(fast->context) );
cw_copy_string( fast->exten, ext, sizeof(fast->exten) );
fast->priority = 1;
fast->vars=NULL;
/**/
fast->frommember=member;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (cw_pthread_create(&th, &attr, fast_originate, fast)) {
free(fast);
res = -1;
} else {
res = 0;
}
}
cw_mutex_unlock(&member->chan->lock);
cw_conf_member_genactivate( member ) ;
return res;
}
开发者ID:mehulsbhatt,项目名称:voip-foip,代码行数:79,代码来源:conference.c
示例19: ast_monitor_stop
/* Stop monitoring a channel */
int ast_monitor_stop(struct ast_channel *chan, int need_lock)
{
int delfiles = 0;
LOCK_IF_NEEDED(chan, need_lock);
if (chan->monitor) {
char filename[ FILENAME_MAX ];
if (chan->monitor->read_stream) {
ast_closestream(chan->monitor->read_stream);
}
if (chan->monitor->write_stream) {
ast_closestream(chan->monitor->write_stream);
}
if (chan->monitor->filename_changed && !ast_strlen_zero(chan->monitor->filename_base)) {
if (ast_fileexists(chan->monitor->read_filename,NULL,NULL) > 0) {
snprintf(filename, FILENAME_MAX, "%s-in", chan->monitor->filename_base);
if (ast_fileexists(filename, NULL, NULL) > 0) {
ast_filedelete(filename, NULL);
}
ast_filerename(chan->monitor->read_filename, filename, chan->monitor->format);
} else {
ast_log(LOG_WARNING, "File %s not found\n", chan->monitor->read_filename);
}
if (ast_fileexists(chan->monitor->write_filename,NULL,NULL) > 0) {
snprintf(filename, FILENAME_MAX, "%s-out", chan->monitor->filename_base);
if (ast_fileexists(filename, NULL, NULL) > 0) {
ast_filedelete(filename, NULL);
}
ast_filerename(chan->monitor->write_filename, filename, chan->monitor->format);
} else {
ast_log(LOG_WARNING, "File %s not found\n", chan->monitor->write_filename);
}
}
if (chan->monitor->joinfiles && !ast_strlen_zero(chan->monitor->filename_base)) {
char tmp[1024];
char tmp2[1024];
char *format = !strcasecmp(chan->monitor->format,"wav49") ? "WAV" : chan->monitor->format;
char *name = chan->monitor->filename_base;
int directory = strchr(name, '/') ? 1 : 0;
char *dir = directory ? "" : ast_config_AST_MONITOR_DIR;
const char *execute, *execute_args;
/* Set the execute application */
execute = pbx_builtin_getvar_helper(chan, "MONITOR_EXEC");
if (ast_strlen_zero(execute)) {
execute = "nice -n 19 soxmix";
delfiles = 1;
}
execute_args = pbx_builtin_getvar_helper(chan, "MONITOR_EXEC_ARGS");
if (ast_strlen_zero(execute_args)) {
execute_args = "";
}
snprintf(tmp, sizeof(tmp), "%s \"%s/%s-in.%s\" \"%s/%s-out.%s\" \"%s/%s.%s\" %s &", execute, dir, name, format, dir, name, format, dir, name, format,execute_args);
if (delfiles) {
snprintf(tmp2,sizeof(tmp2), "( %s& rm -f \"%s/%s-\"* ) &",tmp, dir ,name); /* remove legs when done mixing */
ast_copy_string(tmp, tmp2, sizeof(tmp));
}
ast_log(LOG_DEBUG,"monitor executing %s\n",tmp);
if (ast_safe_system(tmp) == -1)
ast_log(LOG_WARNING, "Execute of %s failed.\n",tmp);
}
free(chan->monitor->format);
free(chan->monitor);
chan->monitor = NULL;
}
UNLOCK_IF_NEEDED(chan, need_lock);
return 0;
}
开发者ID:BackupTheBerlios,项目名称:solid-pbx-svn,代码行数:78,代码来源:res_monitor.c
示例20: _while_exec
static int _while_exec(struct cw_channel *chan, int argc, char **argv, int end)
{
int res=0;
struct localuser *u;
char *while_pri = NULL;
char *goto_str = NULL, *my_name = NULL;
char *label = NULL;
char varname[VAR_SIZE], end_varname[VAR_SIZE];
const char *prefix = "WHILE";
size_t size=0;
int used_index_i = -1, x=0;
char used_index[VAR_SIZE] = "0", new_index[VAR_SIZE] = "0";
if (!end && argc != 1) {
cw_log(LOG_ERROR, "Syntax: %s\n", while_syntax);
return -1;
}
if (!chan) {
/* huh ? */
return -1;
}
LOCAL_USER_ADD(u);
/* dont want run away loops if the chan isn't even up
this is up for debate since it slows things down a tad ......
*/
if (cw_waitfordigit(chan,1) < 0)
ALL_DONE(u,-1);
for (x=0;;x++) {
if (get_index(chan, prefix, x)) {
used_index_i = x;
} else
break;
}
snprintf(used_index, VAR_SIZE, "%d", used_index_i);
snprintf(new_index, VAR_SIZE, "%d", used_index_i + 1);
size = strlen(chan->context) + strlen(chan->exten) + 32;
my_name = alloca(size);
snprintf(my_name, size, "%s_%s_%d", chan->context, chan->exten, chan->priority);
if (cw_strlen_zero(label)) {
if (end)
label = used_index;
else if (!(label = pbx_builtin_getvar_helper(chan, my_name))) {
label = new_index;
pbx_builtin_setvar_helper(chan, my_name, label);
}
}
snprintf(varname, VAR_SIZE, "%s_%s", prefix, label);
while_pri = pbx_builtin_getvar_helper(chan, varname);
if ((while_pri = pbx_builtin_getvar_helper(chan, varname)) && !end) {
snprintf(end_varname, VAR_SIZE, "END_%s", varname);
}
if (!end && !cw_true(argv[0])) {
/* Condition Met (clean up helper vars) */
pbx_builtin_setvar_helper(chan, varname, NULL);
pbx_builtin_setvar_helper(chan, my_name, NULL);
snprintf(end_varname, VAR_SIZE, "END_%s", varname);
if ((goto_str=pbx_builtin_getvar_helper(chan, end_varname))) {
pbx_builtin_setvar_helper(chan, end_varname, NULL);
cw_parseable_goto(chan, goto_str);
} else {
int pri = find_matching_endwhile(chan);
if (pri > 0) {
if (option_verbose > 2)
cw_verbose(VERBOSE_PREFIX_3 "Jumping to priority %d\n", pri);
chan->priority = pri;
} else {
cw_log(LOG_WARNING, "Couldn't find matching EndWhile? (While at %[email protected]%s priority %d)\n", chan->context, chan->exten, chan->priority);
}
}
ALL_DONE(u,res);
}
if (!end && !while_pri) {
size = strlen(chan->context) + strlen(chan->exten) + 32;
goto_str = alloca(size);
snprintf(goto_str, size, "%s,%s,%d", chan->context, chan->exten, chan->priority);
pbx_builtin_setvar_helper(chan, varname, goto_str);
}
else if (end && while_pri) {
/* END of loop */
snprintf(end_varname, VAR_SIZE, "END_%s", varname);
if (! pbx_builtin_getvar_helper(chan, end_varname)) {
size = strlen(chan->context) + strlen(chan->exten) + 32;
goto_str = alloca(size);
snprintf(goto_str, size, "%s,%s,%d", chan->context, chan->exten, chan->priority+1);
pbx_builtin_setvar_helper(chan, end_varname, goto_str);
//.........这里部分代码省略.........
开发者ID:mehulsbhatt,项目名称:voip-foip,代码行数:101,代码来源:app_while.c
注:本文中的pbx_builtin_getvar_helper函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论