diff options
author | martinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-09-22 15:27:09 +0000 |
---|---|---|
committer | martinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-09-22 15:27:09 +0000 |
commit | afd7d66d7fce31a65e9ba0c33152ea51c0f51368 (patch) | |
tree | 3847bb85d068ba5039561c73c0bc5a9c2aeda993 /channel.c | |
parent | cb741d4947db6afbe80d406456c9d3d740460874 (diff) |
Create better 'failed' CDRs for outgoing spool calls with context,extension,priority
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1538 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rwxr-xr-x | channel.c | 26 |
1 files changed, 23 insertions, 3 deletions
@@ -1489,7 +1489,7 @@ int ast_set_read_format(struct ast_channel *chan, int fmts) return 0; } -struct ast_channel *ast_request_and_dial(char *type, int format, void *data, int timeout, int *outstate, char *callerid) +struct ast_channel *__ast_request_and_dial(char *type, int format, void *data, int timeout, int *outstate, char *callerid, struct outgoing_helper *oh) { int state = 0; struct ast_channel *chan; @@ -1497,8 +1497,23 @@ struct ast_channel *ast_request_and_dial(char *type, int format, void *data, int int res = 0; chan = ast_request(type, format, data); if (chan) { - if (callerid) - ast_set_callerid(chan, callerid, 1); + if (oh) { + char *tmp, *var; + /* JDG chanvar */ + tmp = oh->variable; + /* FIXME replace this call with strsep NOT*/ + while( (var = strtok_r(NULL, "|", &tmp)) ) { + pbx_builtin_setvar( chan, var ); + } /* /JDG */ + if (*oh->context) + strncpy(chan->context, oh->context, sizeof(chan->context) - 1); + if (*oh->exten) + strncpy(chan->exten, oh->exten, sizeof(chan->exten) - 1); + if (*oh->callerid) + ast_set_callerid(chan, oh->callerid, 1); + chan->priority = oh->priority; + } + if (!ast_call(chan, data, 0)) { while(timeout && (chan->_state != AST_STATE_UP)) { res = ast_waitfor(chan, timeout); @@ -1566,6 +1581,11 @@ struct ast_channel *ast_request_and_dial(char *type, int format, void *data, int return chan; } +struct ast_channel *ast_request_and_dial(char *type, int format, void *data, int timeout, int *outstate, char *callerid) +{ + return __ast_request_and_dial(type, format, data, timeout, outstate, callerid, NULL); +} + struct ast_channel *ast_request(char *type, int format, void *data) { struct chanlist *chan; |