[asterisk-commits] kmoore: trunk r369086 - in /trunk: channels/ include/asterisk/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 19 16:13:45 CDT 2012
Author: kmoore
Date: Tue Jun 19 16:13:41 2012
New Revision: 369086
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369086
Log:
Ensure that pvt cause information does not break native bridging
Channel drivers that allow native bridging need to handle
AST_CONTROL_PVT_CAUSE_CODE frames and previously did not handle them
properly, usually breaking out of the native bridge. This change
corrects that behavior and exposes the available cause code information
to the dialplan while native bridges are in place. This required
exposing the HANGUPCAUSE hash setter outside of channel.c, so
additional documentation has been added.
Modified:
trunk/channels/chan_dahdi.c
trunk/channels/chan_iax2.c
trunk/channels/chan_misdn.c
trunk/include/asterisk/channel.h
trunk/main/channel.c
trunk/main/rtp_engine.c
Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=369086&r1=369085&r2=369086
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Tue Jun 19 16:13:41 2012
@@ -7586,6 +7586,10 @@
f = ast_read(who);
switch (f ? f->frametype : AST_FRAME_CONTROL) {
case AST_FRAME_CONTROL:
+ if (f && f->subclass.integer == AST_CONTROL_PVT_CAUSE_CODE) {
+ ast_channel_hangupcause_hash_set((who == c0) ? c1 : c0, f->data.ptr);
+ break;
+ }
*fo = f;
*rc = who;
res = AST_BRIDGE_COMPLETE;
Modified: trunk/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=369086&r1=369085&r2=369086
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Tue Jun 19 16:13:41 2012
@@ -5593,19 +5593,24 @@
res = AST_BRIDGE_COMPLETE;
break;
}
- if ((f->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS) && (f->subclass.integer != AST_CONTROL_SRCUPDATE)) {
- *fo = f;
- *rc = who;
- res = AST_BRIDGE_COMPLETE;
- break;
- }
other = (who == c0) ? c1 : c0; /* the 'other' channel */
+ if ((f->frametype == AST_FRAME_CONTROL)) {
+ if (f->subclass.integer == AST_CONTROL_PVT_CAUSE_CODE) {
+ ast_channel_hangupcause_hash_set(other, f->data.ptr);
+ } else if (!(flags & AST_BRIDGE_IGNORE_SIGS)
+ && (f->subclass.integer != AST_CONTROL_SRCUPDATE)) {
+ *fo = f;
+ *rc = who;
+ res = AST_BRIDGE_COMPLETE;
+ break;
+ }
+ }
if ((f->frametype == AST_FRAME_VOICE) ||
(f->frametype == AST_FRAME_TEXT) ||
(f->frametype == AST_FRAME_VIDEO) ||
(f->frametype == AST_FRAME_IMAGE) ||
(f->frametype == AST_FRAME_DTMF) ||
- (f->frametype == AST_FRAME_CONTROL)) {
+ (f->frametype == AST_FRAME_CONTROL && f->subclass.integer != AST_CONTROL_PVT_CAUSE_CODE)) {
/* monitored dtmf take out of the bridge.
* check if we monitor the specific source.
*/
Modified: trunk/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_misdn.c?view=diff&rev=369086&r1=369085&r2=369086
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Tue Jun 19 16:13:41 2012
@@ -7583,7 +7583,7 @@
}
f = ast_read(who);
- if (!f || f->frametype == AST_FRAME_CONTROL) {
+ if (!f || (f->frametype == AST_FRAME_CONTROL && f->subtype.integer != AST_CONTROL_PVT_CAUSE_CODE)) {
/* got hangup .. */
if (!f) {
@@ -7613,7 +7613,11 @@
}
#endif
- ast_write((who == c0) ? c1 : c0, f);
+ if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_PVT_CAUSE_CODE) {
+ ast_channel_hangupcause_hash_set((who == c0) ? c1 : c0, f->data.ptr);
+ } else {
+ ast_write((who == c0) ? c1 : c0, f);
+ }
}
chan_misdn_log(1, ch1->bc->port, "I SEND: Splitting conference with Number:%d\n", ch1->bc->pid + 1);
Modified: trunk/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=369086&r1=369085&r2=369086
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Tue Jun 19 16:13:41 2012
@@ -3564,6 +3564,15 @@
* in the global channels conatiner, use this function.
*/
void ast_channel_unlink(struct ast_channel *chan);
+
+/*!
+ * \brief Sets the HANGUPCAUSE hash and optionally the SIP_CAUSE hash
+ * on the given channel
+ *
+ * \param chan channel on which to set the cause information
+ * \param cause_code ast_control_pvt_cause_code structure containing cause information
+ */
+void ast_channel_hangupcause_hash_set(struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code);
/* ACCESSOR FUNTIONS */
/*! \brief Set the channel name */
Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=369086&r1=369085&r2=369086
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Tue Jun 19 16:13:41 2012
@@ -4208,12 +4208,9 @@
return 0;
}
-/*! \brief Sets the HANGUPCAUSE hash and optionally the SIP_CAUSE hash
- * on the given channel */
-static void set_hangupcause_hash(struct ast_channel *chan, const void *data)
+void ast_channel_hangupcause_hash_set(struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code)
{
char causevar[256];
- const struct ast_control_pvt_cause_code *cause_code = data;
snprintf(causevar, sizeof(causevar), "HASH(HANGUPCAUSE,%s)", cause_code->chan_name);
ast_func_write(chan, causevar, cause_code->code);
@@ -4368,7 +4365,7 @@
ts = ast_get_indication_tone(ast_channel_zone(chan), "congestion");
break;
case AST_CONTROL_PVT_CAUSE_CODE:
- set_hangupcause_hash(chan, data);
+ ast_channel_hangupcause_hash_set(chan, data);
res = 0;
break;
case AST_CONTROL_PROGRESS:
@@ -5515,7 +5512,7 @@
break;
case AST_CONTROL_PVT_CAUSE_CODE:
- set_hangupcause_hash(chan, f->data.ptr);
+ ast_channel_hangupcause_hash_set(chan, f->data.ptr);
break;
/* Ignore these */
Modified: trunk/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/rtp_engine.c?view=diff&rev=369086&r1=369085&r2=369086
==============================================================================
--- trunk/main/rtp_engine.c (original)
+++ trunk/main/rtp_engine.c Tue Jun 19 16:13:41 2012
@@ -933,7 +933,7 @@
}
ast_frfree(fr);
} else if (fr->subclass.integer == AST_CONTROL_PVT_CAUSE_CODE) {
- ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
+ ast_channel_hangupcause_hash_set(other, fr->data.ptr);
ast_frfree(fr);
} else {
*fo = fr;
@@ -1227,7 +1227,7 @@
}
ast_frfree(fr);
} else if (fr->subclass.integer == AST_CONTROL_PVT_CAUSE_CODE) {
- ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
+ ast_channel_hangupcause_hash_set(other, fr->data.ptr);
ast_frfree(fr);
} else {
*fo = fr;
More information about the asterisk-commits
mailing list