|
|
|
|
@ -113,6 +113,7 @@ struct localuser {
|
|
|
|
|
int allowdisconnect_in;
|
|
|
|
|
int allowdisconnect_out;
|
|
|
|
|
int forcecallerid;
|
|
|
|
|
int noforwardhtml;
|
|
|
|
|
struct localuser *next;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -134,7 +135,7 @@ static void hanguptree(struct localuser *outgoing, struct ast_channel *exception
|
|
|
|
|
|
|
|
|
|
#define AST_MAX_WATCHERS 256
|
|
|
|
|
|
|
|
|
|
static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localuser *outgoing, int *to, int *allowredir_in, int *allowredir_out, int *allowdisconnect_in, int *allowdisconnect_out, int *sentringing, char *status, size_t statussize)
|
|
|
|
|
static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localuser *outgoing, int *to, int *allowredir_in, int *allowredir_out, int *allowdisconnect_in, int *allowdisconnect_out, int *noforwardhtml, int *sentringing, char *status, size_t statussize)
|
|
|
|
|
{
|
|
|
|
|
struct localuser *o;
|
|
|
|
|
int found;
|
|
|
|
|
@ -207,6 +208,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
|
|
|
|
*allowredir_out = o->allowredirect_out;
|
|
|
|
|
*allowdisconnect_in = o->allowdisconnect_in;
|
|
|
|
|
*allowdisconnect_out = o->allowdisconnect_out;
|
|
|
|
|
*noforwardhtml = o->noforwardhtml;
|
|
|
|
|
}
|
|
|
|
|
} else if (o->chan && (o->chan == winner)) {
|
|
|
|
|
if (!ast_strlen_zero(o->chan->call_forward)) {
|
|
|
|
|
@ -301,6 +303,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
|
|
|
|
*allowredir_out = o->allowredirect_out;
|
|
|
|
|
*allowdisconnect_in = o->allowdisconnect_in;
|
|
|
|
|
*allowdisconnect_out = o->allowdisconnect_out;
|
|
|
|
|
*noforwardhtml = o->noforwardhtml;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case AST_CONTROL_BUSY:
|
|
|
|
|
@ -343,7 +346,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
|
|
|
|
/* Ignore going off hook */
|
|
|
|
|
break;
|
|
|
|
|
case -1:
|
|
|
|
|
if (!outgoing->ringbackonly && !outgoing->musiconhold) {
|
|
|
|
|
if (!outgoing->ringbackonly || !outgoing->musiconhold) {
|
|
|
|
|
if (option_verbose > 2)
|
|
|
|
|
ast_verbose( VERBOSE_PREFIX_3 "%s stopped sounds\n", o->chan->name);
|
|
|
|
|
ast_indicate(in, -1);
|
|
|
|
|
@ -361,7 +364,10 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
|
|
|
|
!(outgoing->ringbackonly || outgoing->musiconhold)) {
|
|
|
|
|
if (ast_write(in, f))
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to forward image\n");
|
|
|
|
|
} else if (single && (f->frametype == AST_FRAME_HTML) && !outgoing->noforwardhtml) {
|
|
|
|
|
ast_channel_sendhtml(in, f->subclass, f->data, f->datalen);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ast_frfree(f);
|
|
|
|
|
} else {
|
|
|
|
|
in->hangupcause = o->chan->hangupcause;
|
|
|
|
|
@ -397,6 +403,10 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
|
|
|
|
ast_frfree(f);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (single && f && (f->frametype == AST_FRAME_HTML) && !outgoing->noforwardhtml)
|
|
|
|
|
ast_channel_sendhtml(outgoing->chan, f->subclass, f->data, f->datalen);
|
|
|
|
|
|
|
|
|
|
if (single && ((f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_DTMF))) {
|
|
|
|
|
if (ast_write(outgoing->chan, f))
|
|
|
|
|
ast_log(LOG_WARNING, "Unable to forward voice\n");
|
|
|
|
|
@ -425,6 +435,7 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|
|
|
|
int allowredir_out=0;
|
|
|
|
|
int allowdisconnect_in=0;
|
|
|
|
|
int allowdisconnect_out=0;
|
|
|
|
|
int noforwardhtml=0;
|
|
|
|
|
int hasmacro = 0;
|
|
|
|
|
int privacy=0;
|
|
|
|
|
int announce=0;
|
|
|
|
|
@ -730,6 +741,9 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|
|
|
|
if (strchr(transfer, 'f'))
|
|
|
|
|
tmp->forcecallerid = 1;
|
|
|
|
|
else tmp->forcecallerid = 0;
|
|
|
|
|
if (url)
|
|
|
|
|
tmp->noforwardhtml = 1;
|
|
|
|
|
else tmp->noforwardhtml = 0;
|
|
|
|
|
}
|
|
|
|
|
strncpy(numsubst, number, sizeof(numsubst)-1);
|
|
|
|
|
/* If we're dialing by extension, look at the extension to know what to dial */
|
|
|
|
|
@ -884,7 +898,7 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|
|
|
|
strncpy(status, "CHANUNAVAIL", sizeof(status) - 1);
|
|
|
|
|
|
|
|
|
|
time(&start_time);
|
|
|
|
|
peer = wait_for_answer(chan, outgoing, &to, &allowredir_in, &allowredir_out, &allowdisconnect_in, &allowdisconnect_out, &sentringing, status, sizeof(status));
|
|
|
|
|
peer = wait_for_answer(chan, outgoing, &to, &allowredir_in, &allowredir_out, &allowdisconnect_in, &allowdisconnect_out, &sentringing, &noforwardhtml, status, sizeof(status));
|
|
|
|
|
|
|
|
|
|
if (!peer) {
|
|
|
|
|
if (to)
|
|
|
|
|
|