[asterisk-commits] bridge core: Add owed T.38 terminate when channel leaves a b... (asterisk[13])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 29 18:09:53 CST 2016
Anonymous Coward #1000019 has submitted this change and it was merged.
Change subject: bridge core: Add owed T.38 terminate when channel leaves a bridge.
......................................................................
bridge core: Add owed T.38 terminate when channel leaves a bridge.
The channel is now going to get T.38 terminated when it leaves the
bridging system and the bridged peers are going to get T.38 terminated as
well.
ASTERISK-25582
Change-Id: I77a9205979910210e3068e1ddff400dbf35c4ca7
---
M include/asterisk/bridge_channel.h
M main/bridge_channel.c
M main/channel.c
3 files changed, 72 insertions(+), 0 deletions(-)
Approvals:
Mark Michelson: Looks good to me, approved
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/include/asterisk/bridge_channel.h b/include/asterisk/bridge_channel.h
index 03fe30e..55c2b3a 100644
--- a/include/asterisk/bridge_channel.h
+++ b/include/asterisk/bridge_channel.h
@@ -170,6 +170,8 @@
/*! Collected DTMF digits for DTMF hooks. */
char collected[MAXIMUM_DTMF_FEATURE_STRING];
} dtmf_hook_state;
+ /*! Non-zero if a T.38 session terminate is owed to the bridge. */
+ char owed_t38_terminate;
};
/*!
diff --git a/main/bridge_channel.c b/main/bridge_channel.c
index fa15b0f..c9262a8 100644
--- a/main/bridge_channel.c
+++ b/main/bridge_channel.c
@@ -637,6 +637,8 @@
*/
static int bridge_channel_write_frame(struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
{
+ const struct ast_control_t38_parameters *t38_parameters;
+
ast_assert(frame->frametype != AST_FRAME_BRIDGE_ACTION_SYNC);
ast_bridge_channel_lock_bridge(bridge_channel);
@@ -663,6 +665,27 @@
* We explicitly will not remember HOLD/UNHOLD frames because
* things like attended transfers will handle them.
*/
+ switch (frame->subclass.integer) {
+ case AST_CONTROL_T38_PARAMETERS:
+ t38_parameters = frame->data.ptr;
+ switch (t38_parameters->request_response) {
+ case AST_T38_REQUEST_NEGOTIATE:
+ case AST_T38_NEGOTIATED:
+ bridge_channel->owed_t38_terminate = 1;
+ break;
+ case AST_T38_REQUEST_TERMINATE:
+ case AST_T38_TERMINATED:
+ case AST_T38_REFUSED:
+ bridge_channel->owed_t38_terminate = 0;
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
default:
break;
}
@@ -689,6 +712,7 @@
static void bridge_channel_cancel_owed_events(struct ast_bridge_channel *bridge_channel)
{
bridge_channel->owed.dtmf_digit = '\0';
+ bridge_channel->owed_t38_terminate = 0;
}
void bridge_channel_settle_owed_events(struct ast_bridge *orig_bridge, struct ast_bridge_channel *bridge_channel)
@@ -708,6 +732,23 @@
bridge_channel->owed.dtmf_digit, orig_bridge->uniqueid,
ast_channel_name(bridge_channel->chan), frame.len);
bridge_channel->owed.dtmf_digit = '\0';
+ orig_bridge->technology->write(orig_bridge, NULL, &frame);
+ }
+ if (bridge_channel->owed_t38_terminate) {
+ struct ast_control_t38_parameters t38_parameters = {
+ .request_response = AST_T38_TERMINATED,
+ };
+ struct ast_frame frame = {
+ .frametype = AST_FRAME_CONTROL,
+ .subclass.integer = AST_CONTROL_T38_PARAMETERS,
+ .data.ptr = &t38_parameters,
+ .datalen = sizeof(t38_parameters),
+ .src = "Bridge channel owed T.38 terminate",
+ };
+
+ ast_debug(1, "T.38 terminate simulated to bridge %s because %s left.\n",
+ orig_bridge->uniqueid, ast_channel_name(bridge_channel->chan));
+ bridge_channel->owed_t38_terminate = 0;
orig_bridge->technology->write(orig_bridge, NULL, &frame);
}
}
@@ -2736,6 +2777,18 @@
ast_channel_sending_dtmf_tv(bridge_channel->chan), "bridge end");
}
+ /* Complete any T.38 session before exiting the bridge. */
+ if (ast_channel_is_t38_active(bridge_channel->chan)) {
+ struct ast_control_t38_parameters t38_parameters = {
+ .request_response = AST_T38_TERMINATED,
+ };
+
+ ast_debug(1, "Channel %s simulating T.38 terminate for bridge end.\n",
+ ast_channel_name(bridge_channel->chan));
+ ast_indicate_data(bridge_channel->chan, AST_CONTROL_T38_PARAMETERS,
+ &t38_parameters, sizeof(t38_parameters));
+ }
+
/* Indicate a source change since this channel is leaving the bridge system. */
ast_indicate(bridge_channel->chan, AST_CONTROL_SRCCHANGE);
diff --git a/main/channel.c b/main/channel.c
index de7c19c..4ed1f8b 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -4479,6 +4479,7 @@
* in switch statements. */
enum ast_control_frame_type condition = _condition;
struct ast_tone_zone_sound *ts = NULL;
+ const struct ast_control_t38_parameters *t38_parameters;
int res;
switch (condition) {
@@ -4498,6 +4499,22 @@
case AST_CONTROL_UNHOLD:
ast_channel_hold_state_set(chan, _condition);
break;
+ case AST_CONTROL_T38_PARAMETERS:
+ t38_parameters = data;
+ switch (t38_parameters->request_response) {
+ case AST_T38_REQUEST_NEGOTIATE:
+ case AST_T38_NEGOTIATED:
+ ast_channel_set_is_t38_active_nolock(chan, 1);
+ break;
+ case AST_T38_REQUEST_TERMINATE:
+ case AST_T38_TERMINATED:
+ case AST_T38_REFUSED:
+ ast_channel_set_is_t38_active_nolock(chan, 0);
+ break;
+ default:
+ break;
+ }
+ break;
default:
break;
}
--
To view, visit https://gerrit.asterisk.org/2301
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I77a9205979910210e3068e1ddff400dbf35c4ca7
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
More information about the asterisk-commits
mailing list