mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 11:28:25 +00:00
Pass through flash hook
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -362,7 +362,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
|||||||
ast_indicate(in, AST_CONTROL_PROGRESS);
|
ast_indicate(in, AST_CONTROL_PROGRESS);
|
||||||
break;
|
break;
|
||||||
case AST_CONTROL_OFFHOOK:
|
case AST_CONTROL_OFFHOOK:
|
||||||
/* Ignore going off hook */
|
case AST_CONTROL_FLASH:
|
||||||
|
/* Ignore going off hook and flash */
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
if (!outgoing->ringbackonly && !outgoing->musiconhold) {
|
if (!outgoing->ringbackonly && !outgoing->musiconhold) {
|
||||||
|
|||||||
@@ -2561,6 +2561,7 @@ int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, struct as
|
|||||||
|
|
||||||
flags = (config->allowdisconnect_out||config->allowredirect_out ? AST_BRIDGE_DTMF_CHANNEL_0 : 0) + (config->allowdisconnect_in||config->allowredirect_in ? AST_BRIDGE_DTMF_CHANNEL_1 : 0);
|
flags = (config->allowdisconnect_out||config->allowredirect_out ? AST_BRIDGE_DTMF_CHANNEL_0 : 0) + (config->allowdisconnect_in||config->allowredirect_in ? AST_BRIDGE_DTMF_CHANNEL_1 : 0);
|
||||||
|
|
||||||
|
*fo = NULL;
|
||||||
firstpass = config->firstpass;
|
firstpass = config->firstpass;
|
||||||
config->firstpass = 0;
|
config->firstpass = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -421,6 +421,7 @@ struct zt_subchannel {
|
|||||||
int needcongestion;
|
int needcongestion;
|
||||||
int needcallerid;
|
int needcallerid;
|
||||||
int needanswer;
|
int needanswer;
|
||||||
|
int needflash;
|
||||||
int linear;
|
int linear;
|
||||||
int inthreeway;
|
int inthreeway;
|
||||||
ZT_CONFINFO curconf;
|
ZT_CONFINFO curconf;
|
||||||
@@ -1982,6 +1983,7 @@ static int zt_hangup(struct ast_channel *ast)
|
|||||||
/* Real channel, do some fixup */
|
/* Real channel, do some fixup */
|
||||||
p->subs[index].owner = NULL;
|
p->subs[index].owner = NULL;
|
||||||
p->subs[index].needanswer = 0;
|
p->subs[index].needanswer = 0;
|
||||||
|
p->subs[index].needflash = 0;
|
||||||
p->subs[index].needringing = 0;
|
p->subs[index].needringing = 0;
|
||||||
p->subs[index].needbusy = 0;
|
p->subs[index].needbusy = 0;
|
||||||
p->subs[index].needcongestion = 0;
|
p->subs[index].needcongestion = 0;
|
||||||
@@ -2788,6 +2790,13 @@ static int zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
|
|||||||
zt_enable_ec(p1);
|
zt_enable_ec(p1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (f->frametype == AST_FRAME_CONTROL) {
|
||||||
|
*fo = f;
|
||||||
|
*rc = who;
|
||||||
|
if (slave && master)
|
||||||
|
zt_unlink(slave, master, 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (f->frametype == AST_FRAME_DTMF) {
|
if (f->frametype == AST_FRAME_DTMF) {
|
||||||
if (((who == c0) && (flags & AST_BRIDGE_DTMF_CHANNEL_0)) ||
|
if (((who == c0) && (flags & AST_BRIDGE_DTMF_CHANNEL_0)) ||
|
||||||
((who == c1) && (flags & AST_BRIDGE_DTMF_CHANNEL_1))) {
|
((who == c1) && (flags & AST_BRIDGE_DTMF_CHANNEL_1))) {
|
||||||
@@ -3548,6 +3557,9 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
|
|||||||
ast_log(LOG_WARNING, "Unable to allocate three-way subchannel\n");
|
ast_log(LOG_WARNING, "Unable to allocate three-way subchannel\n");
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_DEBUG, "Flash when call not up or ringing\n");
|
ast_log(LOG_DEBUG, "Flash when call not up or ringing\n");
|
||||||
|
} else if (!p->threewaycalling) {
|
||||||
|
/* Just send a flash if no 3-way calling or callwait */
|
||||||
|
p->subs[SUB_REAL].needflash = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Already have a 3 way call */
|
/* Already have a 3 way call */
|
||||||
@@ -3908,6 +3920,15 @@ struct ast_frame *zt_read(struct ast_channel *ast)
|
|||||||
return &p->subs[index].f;
|
return &p->subs[index].f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (p->subs[index].needflash) {
|
||||||
|
/* Send answer frame if requested */
|
||||||
|
p->subs[index].needflash = 0;
|
||||||
|
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
||||||
|
p->subs[index].f.subclass = AST_CONTROL_FLASH;
|
||||||
|
ast_mutex_unlock(&p->lock);
|
||||||
|
return &p->subs[index].f;
|
||||||
|
}
|
||||||
|
|
||||||
if (ast->pvt->rawreadformat == AST_FORMAT_SLINEAR) {
|
if (ast->pvt->rawreadformat == AST_FORMAT_SLINEAR) {
|
||||||
if (!p->subs[index].linear) {
|
if (!p->subs[index].linear) {
|
||||||
p->subs[index].linear = 1;
|
p->subs[index].linear = 1;
|
||||||
@@ -4223,6 +4244,7 @@ static int zt_indicate(struct ast_channel *chan, int condition)
|
|||||||
struct zt_pvt *p = chan->pvt->pvt;
|
struct zt_pvt *p = chan->pvt->pvt;
|
||||||
int res=-1;
|
int res=-1;
|
||||||
int index;
|
int index;
|
||||||
|
int func = ZT_FLASH;
|
||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
index = zt_get_index(chan, p, 0);
|
index = zt_get_index(chan, p, 0);
|
||||||
ast_log(LOG_DEBUG, "Requested indication %d on channel %s\n", condition, chan->name);
|
ast_log(LOG_DEBUG, "Requested indication %d on channel %s\n", condition, chan->name);
|
||||||
@@ -4318,6 +4340,19 @@ static int zt_indicate(struct ast_channel *chan, int condition)
|
|||||||
res = zt_set_hook(p->subs[index].zfd, ZT_RINGOFF);
|
res = zt_set_hook(p->subs[index].zfd, ZT_RINGOFF);
|
||||||
res = 0;
|
res = 0;
|
||||||
break;
|
break;
|
||||||
|
case AST_CONTROL_FLASH:
|
||||||
|
/* flash hookswitch */
|
||||||
|
if (ISTRUNK(p) && (p->sig != SIG_PRI)) {
|
||||||
|
/* Clear out the dial buffer */
|
||||||
|
p->dop.dialstr[0] = '\0';
|
||||||
|
if ((ioctl(p->subs[SUB_REAL].zfd,ZT_HOOK,&func) == -1) && (errno != EINPROGRESS)) {
|
||||||
|
ast_log(LOG_WARNING, "Unable to flash external trunk on channel %s: %s\n",
|
||||||
|
chan->name, strerror(errno));
|
||||||
|
} else
|
||||||
|
res = 0;
|
||||||
|
} else
|
||||||
|
res = 0;
|
||||||
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
res = tone_zone_play_tone(p->subs[index].zfd, -1);
|
res = tone_zone_play_tone(p->subs[index].zfd, -1);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -358,6 +358,8 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
|
|||||||
/* We ran out of time */
|
/* We ran out of time */
|
||||||
config->timelimit = 0;
|
config->timelimit = 0;
|
||||||
who = chan;
|
who = chan;
|
||||||
|
if (f)
|
||||||
|
ast_frfree(f);
|
||||||
f = NULL;
|
f = NULL;
|
||||||
res = 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
@@ -384,6 +386,12 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
|
|||||||
else
|
else
|
||||||
ast_indicate(chan, -1);
|
ast_indicate(chan, -1);
|
||||||
}
|
}
|
||||||
|
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_FLASH)) {
|
||||||
|
if (who == chan)
|
||||||
|
ast_indicate(peer, AST_CONTROL_FLASH);
|
||||||
|
else
|
||||||
|
ast_indicate(chan, AST_CONTROL_FLASH);
|
||||||
|
}
|
||||||
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_OPTION)) {
|
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_OPTION)) {
|
||||||
aoh = f->data;
|
aoh = f->data;
|
||||||
/* Forward option Requests */
|
/* Forward option Requests */
|
||||||
|
|||||||
Reference in New Issue
Block a user