[Asterisk-code-review] bridge native rtp: Improved handling of channel hold/unhold (asterisk[15])

Vitezslav Novy asteriskteam at digium.com
Tue Oct 24 07:09:18 CDT 2017


Vitezslav Novy has uploaded this change for review. ( https://gerrit.asterisk.org/6894


Change subject: bridge_native_rtp: Improved handling of channel hold/unhold
......................................................................

bridge_native_rtp: Improved handling of channel hold/unhold

When channel is put on hold, reinvite both bridge parties as
we need RTP via asterisk in that case.
When AST_CONTROL_UPDATE_RTP_PEER frame is handled by framehook
strat the bridge only if no member channel is on hold.

ASTERISK-27303

Change-Id: I811fcadd40912bf8814560b8b02582357f19ed5a
---
M bridges/bridge_native_rtp.c
1 file changed, 13 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/94/6894/1

diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c
index edbfe58..a0a97a2 100644
--- a/bridges/bridge_native_rtp.c
+++ b/bridges/bridge_native_rtp.c
@@ -540,6 +540,7 @@
 	struct ast_frame *f, enum ast_framehook_event event, void *data)
 {
 	struct ast_bridge *bridge;
+	struct ast_bridge_channel *bc0, *bc1;
 	struct native_rtp_framehook_data *native_data = data;
 
 	if (!f
@@ -565,10 +566,21 @@
 		if (!native_data->detached) {
 			switch (f->subclass.integer) {
 			case AST_CONTROL_HOLD:
-				native_rtp_bridge_stop(bridge, chan);
+				native_rtp_bridge_stop(bridge, NULL);
 				break;
 			case AST_CONTROL_UNHOLD:
+				native_rtp_bridge_start(bridge, NULL);
+				break;
 			case AST_CONTROL_UPDATE_RTP_PEER:
+				bc0 = AST_LIST_FIRST(&bridge->channels);
+				bc1 = AST_LIST_LAST(&bridge->channels);
+
+				if (bc0 && ast_channel_hold_state(bc0->chan) == AST_CONTROL_HOLD)
+					break;
+
+				if (bc1 && ast_channel_hold_state(bc1->chan) == AST_CONTROL_HOLD)
+					break;
+
 				native_rtp_bridge_start(bridge, chan);
 				break;
 			default:

-- 
To view, visit https://gerrit.asterisk.org/6894
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I811fcadd40912bf8814560b8b02582357f19ed5a
Gerrit-Change-Number: 6894
Gerrit-PatchSet: 1
Gerrit-Owner: Vitezslav Novy <a1 at vnovy.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171024/084ac4a5/attachment.html>


More information about the asterisk-code-review mailing list