Create better 'failed' CDRs for outgoing spool calls with context,extension,priority

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1538 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Martin Pycko
2003-09-22 15:27:09 +00:00
parent a83662beda
commit c545cd3cf7
4 changed files with 49 additions and 25 deletions

View File

@@ -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;