diff options
author | Mark Spencer <markster@digium.com> | 2003-07-02 14:06:12 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2003-07-02 14:06:12 +0000 |
commit | 1b473c2ef06535b8b2992eecee595824d0096fd7 (patch) | |
tree | e0db2ef95c0adeb25c39c836ffd3bd639270819e /apps | |
parent | 72d36d9c270077da8c0cf83295928db305688e19 (diff) |
Merge 'T' and other dialing enhancements
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1156 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/app_dial.c | 29 | ||||
-rwxr-xr-x | apps/app_queue.c | 27 |
2 files changed, 37 insertions, 19 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c index ab82268a3..89deefae8 100755 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -79,7 +79,8 @@ static char *descrip = struct localuser { struct ast_channel *chan; int stillgoing; - int allowredirect; + int allowredirect_in; + int allowredirect_out; int ringbackonly; int musiconhold; int dataquality; @@ -105,7 +106,7 @@ static void hanguptree(struct localuser *outgoing, struct ast_channel *exception #define MAX 256 -static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localuser *outgoing, int *to, int *allowredir, int *allowdisconnect) +static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localuser *outgoing, int *to, int *allowredir_in, int *allowredir_out, int *allowdisconnect) { struct localuser *o; int found; @@ -182,7 +183,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu if (option_verbose > 2) ast_verbose( VERBOSE_PREFIX_3 "%s answered %s\n", o->chan->name, in->name); peer = o->chan; - *allowredir = o->allowredirect; + *allowredir_in = o->allowredirect_in; + *allowredir_out = o->allowredirect_out; *allowdisconnect = o->allowdisconnect; } } else if (o->chan == winner) { @@ -218,7 +220,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu if (option_verbose > 2) ast_verbose( VERBOSE_PREFIX_3 "%s answered %s\n", o->chan->name, in->name); peer = o->chan; - *allowredir = o->allowredirect; + *allowredir_in = o->allowredirect_in; + *allowredir_out = o->allowredirect_out; *allowdisconnect = o->allowdisconnect; } break; @@ -326,7 +329,8 @@ static int dial_exec(struct ast_channel *chan, void *data) struct localuser *outgoing=NULL, *tmp; struct ast_channel *peer; int to; - int allowredir=0; + int allowredir_in=0; + int allowredir_out=0; int allowdisconnect=0; int privacy=0; int resetcdr=0; @@ -447,8 +451,11 @@ static int dial_exec(struct ast_channel *chan, void *data) memset(tmp, 0, sizeof(struct localuser)); if (transfer) { if (strchr(transfer, 't')) - tmp->allowredirect = 1; - else tmp->allowredirect = 0; + tmp->allowredirect_in = 1; + else tmp->allowredirect_in = 0; + if (strchr(transfer, 'T')) + tmp->allowredirect_out = 1; + else tmp->allowredirect_out = 0; if (strchr(transfer, 'r')) tmp->ringbackonly = 1; else tmp->ringbackonly = 0; @@ -583,7 +590,7 @@ static int dial_exec(struct ast_channel *chan, void *data) to = atoi(timeout) * 1000; else to = -1; - peer = wait_for_answer(chan, outgoing, &to, &allowredir, &allowdisconnect); + peer = wait_for_answer(chan, outgoing, &to, &allowredir_in, &allowredir_out, &allowdisconnect); if (!peer) { if (to) /* Musta gotten hung up */ @@ -637,14 +644,16 @@ static int dial_exec(struct ast_channel *chan, void *data) ast_channel_setoption(chan,AST_OPTION_AUDIO_MODE,&x,sizeof(char),0); ast_channel_setoption(peer,AST_OPTION_AUDIO_MODE,&x,sizeof(char),0); } - res = ast_bridge_call(chan, peer, allowredir, allowdisconnect | clearchannel); + res = ast_bridge_call(chan, peer, allowredir_in, allowredir_out, allowdisconnect | clearchannel); if (clearchannel) { int x = 1; ast_channel_setoption(chan,AST_OPTION_AUDIO_MODE,&x,sizeof(char),0); ast_channel_setoption(peer,AST_OPTION_AUDIO_MODE,&x,sizeof(char),0); } - ast_hangup(peer); + + if (res != AST_PBX_NO_HANGUP_PEER) + ast_hangup(peer); } out: hanguptree(outgoing, NULL); diff --git a/apps/app_queue.c b/apps/app_queue.c index 306c9f0fa..47df6417b 100755 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -92,7 +92,8 @@ static char *app_rqm_descrip = struct localuser { struct ast_channel *chan; int stillgoing; - int allowredirect; + int allowredirect_in; + int allowredirect_out; int ringbackonly; int musiconhold; int dataquality; @@ -283,7 +284,7 @@ static void hanguptree(struct localuser *outgoing, struct ast_channel *exception #define MAX 256 -static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localuser *outgoing, int *to, int *allowredir, int *allowdisconnect, char *queue) +static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localuser *outgoing, int *to, int *allowredir_in, int *allowredir_out, int *allowdisconnect, char *queue) { struct localuser *o; int found; @@ -329,7 +330,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu if (option_verbose > 2) ast_verbose( VERBOSE_PREFIX_3 "%s answered %s\n", o->chan->name, in->name); peer = o->chan; - *allowredir = o->allowredirect; + *allowredir_in = o->allowredirect_in; + *allowredir_out = o->allowredirect_out; *allowdisconnect = o->allowdisconnect; } } else if (o->chan == winner) { @@ -343,7 +345,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu if (option_verbose > 2) ast_verbose( VERBOSE_PREFIX_3 "%s answered %s\n", o->chan->name, in->name); peer = o->chan; - *allowredir = o->allowredirect; + *allowredir_in = o->allowredirect_in; + *allowredir_out = o->allowredirect_out; *allowdisconnect = o->allowdisconnect; } break; @@ -441,7 +444,8 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri struct member *cur; struct localuser *outgoing=NULL, *tmp = NULL; int to; - int allowredir=0; + int allowredir_in=0; + int allowredir_out=0; int allowdisconnect=0; char numsubst[AST_MAX_EXTENSION]; char restofit[AST_MAX_EXTENSION]; @@ -466,7 +470,9 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri memset(tmp, 0, sizeof(struct localuser)); if (options) { if (strchr(options, 't')) - tmp->allowredirect = 1; + tmp->allowredirect_in = 1; + if (strchr(options, 'T')) + tmp->allowredirect_out = 1; if (strchr(options, 'r')) tmp->ringbackonly = 1; if (strchr(options, 'm')) @@ -568,7 +574,7 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri to = -1; ast_pthread_mutex_unlock(&qe->parent->lock); - peer = wait_for_answer(qe->chan, outgoing, &to, &allowredir, &allowdisconnect, qe->parent->name); + peer = wait_for_answer(qe->chan, outgoing, &to, &allowredir_in, &allowredir_out, &allowdisconnect, qe->parent->name); if (!peer) { if (to) /* Musta gotten hung up */ @@ -629,8 +635,11 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri ast_log(LOG_DEBUG, "app_queue: sendurl=%s.\n", url); ast_channel_sendurl( peer, url ); } /* /JDG */ - bridge = ast_bridge_call(qe->chan, peer, allowredir, allowdisconnect); - ast_hangup(peer); + bridge = ast_bridge_call(qe->chan, peer, allowredir_in, allowredir_out, allowdisconnect); + + if(bridge != AST_PBX_NO_HANGUP_PEER) + ast_hangup(peer); + if( bridge == 0 ) res=1; /* JDG: bridge successfull, leave app_queue */ else res = bridge; /* bridge error, stay in the queue */ } |