aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-08 02:24:07 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-08 02:24:07 +0000
commita82143962ae68df80876a7fabd7c1fe2d18e8da9 (patch)
treeec518bd7b27a9f005244e746dcaa79c215c85745 /channels
parent9552ca15733ae21b49c19ebc35c641b84418daf4 (diff)
Support hold/unhold in Zap, update IAX2 parser to know about modern commands, forward hold/unhold in dial, add hold device state
and implement holding in the SLA. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@37318 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_zap.c30
-rw-r--r--channels/iax2-parser.c13
2 files changed, 42 insertions, 1 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 3f806dc28..94d054c5f 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -515,6 +515,8 @@ struct zt_subchannel {
unsigned int needcallerid:1;
unsigned int needanswer:1;
unsigned int needflash:1;
+ unsigned int needhold:1;
+ unsigned int needunhold:1;
unsigned int linear:1;
unsigned int inthreeway:1;
ZT_CONFINFO curconf;
@@ -3899,6 +3901,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
/* Okay -- probably call waiting*/
if (ast_bridged_channel(p->owner))
ast_moh_stop(ast_bridged_channel(p->owner));
+ p->subs[index].needunhold = 1;
break;
case AST_STATE_RESERVED:
/* Start up dialtone */
@@ -4056,8 +4059,10 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
/* Start music on hold if appropriate */
if (!p->subs[SUB_CALLWAIT].inthreeway && ast_bridged_channel(p->subs[SUB_CALLWAIT].owner))
ast_moh_start(ast_bridged_channel(p->subs[SUB_CALLWAIT].owner), NULL);
+ p->subs[SUB_CALLWAIT].needhold = 1;
if (ast_bridged_channel(p->subs[SUB_REAL].owner))
ast_moh_stop(ast_bridged_channel(p->subs[SUB_REAL].owner));
+ p->subs[SUB_REAL].needunhold = 1;
} else if (!p->subs[SUB_THREEWAY].owner) {
char cid_num[256];
char cid_name[256];
@@ -4116,6 +4121,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
/* Start music on hold if appropriate */
if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner))
ast_moh_start(ast_bridged_channel(p->subs[SUB_THREEWAY].owner), NULL);
+ p->subs[SUB_THREEWAY].needhold = 1;
}
}
} else {
@@ -4153,6 +4159,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
}
if (p->subs[otherindex].owner && ast_bridged_channel(p->subs[otherindex].owner))
ast_moh_stop(ast_bridged_channel(p->subs[otherindex].owner));
+ p->subs[otherindex].needunhold = 1;
p->owner = p->subs[SUB_REAL].owner;
if (ast->_state == AST_STATE_RINGING) {
ast_log(LOG_DEBUG, "Enabling ringtone on real and threeway\n");
@@ -4167,6 +4174,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
p->owner = p->subs[SUB_REAL].owner;
if (p->subs[SUB_REAL].owner && ast_bridged_channel(p->subs[SUB_REAL].owner))
ast_moh_stop(ast_bridged_channel(p->subs[SUB_REAL].owner));
+ p->subs[SUB_REAL].needunhold = 1;
zt_enable_ec(p);
}
@@ -4354,6 +4362,7 @@ static struct ast_frame *__zt_exception(struct ast_channel *ast)
p->owner = p->subs[SUB_REAL].owner;
if (p->owner && ast_bridged_channel(p->owner))
ast_moh_stop(ast_bridged_channel(p->owner));
+ p->subs[SUB_REAL].needunhold = 1;
}
switch (res) {
case ZT_EVENT_ONHOOK:
@@ -4397,6 +4406,7 @@ static struct ast_frame *__zt_exception(struct ast_channel *ast)
p->cidcwexpire = 0;
if (ast_bridged_channel(p->owner))
ast_moh_stop(ast_bridged_channel(p->owner));
+ p->subs[SUB_REAL].needunhold = 1;
} else
ast_log(LOG_WARNING, "Absorbed on hook, but nobody is left!?!?\n");
update_conf(p);
@@ -4544,6 +4554,26 @@ struct ast_frame *zt_read(struct ast_channel *ast)
return &p->subs[index].f;
}
+ if (p->subs[index].needhold) {
+ /* Send answer frame if requested */
+ p->subs[index].needhold = 0;
+ p->subs[index].f.frametype = AST_FRAME_CONTROL;
+ p->subs[index].f.subclass = AST_CONTROL_HOLD;
+ ast_mutex_unlock(&p->lock);
+ ast_log(LOG_DEBUG, "Sending hold on '%s'\n", ast->name);
+ return &p->subs[index].f;
+ }
+
+ if (p->subs[index].needunhold) {
+ /* Send answer frame if requested */
+ p->subs[index].needunhold = 0;
+ p->subs[index].f.frametype = AST_FRAME_CONTROL;
+ p->subs[index].f.subclass = AST_CONTROL_UNHOLD;
+ ast_mutex_unlock(&p->lock);
+ ast_log(LOG_DEBUG, "Sending unhold on '%s'\n", ast->name);
+ return &p->subs[index].f;
+ }
+
if (ast->rawreadformat == AST_FORMAT_SLINEAR) {
if (!p->subs[index].linear) {
p->subs[index].linear = 1;
diff --git a/channels/iax2-parser.c b/channels/iax2-parser.c
index 76339b096..b3d732657 100644
--- a/channels/iax2-parser.c
+++ b/channels/iax2-parser.c
@@ -444,7 +444,18 @@ void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, s
"ANSWER ",
"BUSY ",
"TKOFFHK",
- "OFFHOOK" };
+ "OFFHOOK",
+ "CONGSTN",
+ "FLASH ",
+ "WINK ",
+ "OPTION ",
+ "RDKEY ",
+ "RDUNKEY",
+ "PROGRES",
+ "PROCDNG",
+ "HOLD ",
+ "UNHOLD ",
+ "VIDUPDT", };
struct ast_iax2_full_hdr *fh;
char retries[20];
char class2[20];