diff options
author | Russell Bryant <russell@russellbryant.com> | 2005-07-15 23:24:51 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2005-07-15 23:24:51 +0000 |
commit | a9c7f50a099906898eacbcf48e57661472c65be8 (patch) | |
tree | 1d145d53531c453391f74d30f64b85c38318a447 /channel.c | |
parent | 22b0f5d30691e94b18e152ec44ed90a23f55b266 (diff) |
Allow manager originate to specifiy more than one variable to be set.
Allow manager originate and spool files to set writable dialplan functions,
including those that use the pipe symbol to seperate arguments.
Allow CDR dialplan function to be able to set the account code and userfield.
This deprecates the use of the Account header in manager originate and spool
files, as well as the SetAccount and SetCDRUserField applications.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6147 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channel.c')
-rwxr-xr-x | channel.c | 25 |
1 files changed, 11 insertions, 14 deletions
@@ -2031,20 +2031,8 @@ struct ast_channel *__ast_request_and_dial(const char *type, int format, void *d chan = ast_request(type, format, data, &cause); if (chan) { if (oh) { - char *tmp, *var; - /* JDG chanvar */ - if (oh->variable) - variable = ast_strdupa(oh->variable); - else - variable = NULL; - tmp = variable; - /* FIXME replace this call with strsep NOT*/ - while( (var = strtok_r(NULL, "|", &tmp)) ) { - pbx_builtin_setvar( chan, var ); - } /* /JDG */ + ast_set_variables(chan, oh->vars); ast_set_callerid(chan, oh->cid_num, oh->cid_name, oh->cid_num); - if (oh->account && *oh->account) - ast_cdr_setaccount(chan, oh->account); } ast_set_callerid(chan, cid_num, cid_name, cid_num); @@ -2107,7 +2095,8 @@ struct ast_channel *__ast_request_and_dial(const char *type, int format, void *d ast_copy_string(chan->context, oh->context, sizeof(chan->context)); if (oh->exten && *oh->exten) ast_copy_string(chan->exten, oh->exten, sizeof(chan->exten)); - chan->priority = oh->priority; + if (oh->priority) + chan->priority = oh->priority; } if (chan->_state == AST_STATE_UP) state = AST_CONTROL_ANSWER; @@ -3450,3 +3439,11 @@ char *ast_print_group(char *buf, int buflen, ast_group_t group) } return(buf); } + +void ast_set_variables(struct ast_channel *chan, struct ast_variable *vars) +{ + struct ast_variable *cur; + + for (cur = vars; cur; cur = cur->next) + pbx_builtin_setvar_helper(chan, cur->name, cur->value); +} |