[Asterisk-code-review] chan_pjsip: Only set default audio stream on hold. (asterisk[16])

Friendly Automation asteriskteam at digium.com
Thu Jun 2 11:33:20 CDT 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18571 )

Change subject: chan_pjsip: Only set default audio stream on hold.
......................................................................

chan_pjsip: Only set default audio stream on hold.

When a PJSIP channel is set on hold or off hold, all streams were set
on/off hold. This is not the desired behaviour and caused issues
when there were multiple streams in the topology.

Now, only the default audio stream is set on/off hold when a hold is
indicated.

ASTERISK-30051

Change-Id: I04f1110565fd05fea565f5539b534b54549d4f71
---
M channels/chan_pjsip.c
1 file changed, 4 insertions(+), 9 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index b717104..95e5c07 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -1456,18 +1456,13 @@
 	return 0;
 }
 
-/*! \brief Callback which changes the value of locally held on the media stream */
-static void local_hold_set_state(struct ast_sip_session_media *session_media, unsigned int held)
-{
-	if (session_media) {
-		session_media->locally_held = held;
-	}
-}
-
 /*! \brief Update local hold state and send a re-INVITE with the new SDP */
 static int remote_send_hold_refresh(struct ast_sip_session *session, unsigned int held)
 {
-	AST_VECTOR_CALLBACK_VOID(&session->active_media_state->sessions, local_hold_set_state, held);
+	struct ast_sip_session_media *session_media = session->active_media_state->default_session[AST_MEDIA_TYPE_AUDIO];
+	if (session_media) {
+		session_media->locally_held = held;
+	}
 	ast_sip_session_refresh(session, NULL, NULL, NULL, AST_SIP_SESSION_REFRESH_METHOD_INVITE, 1, NULL);
 	ao2_ref(session, -1);
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18571
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I04f1110565fd05fea565f5539b534b54549d4f71
Gerrit-Change-Number: 18571
Gerrit-PatchSet: 5
Gerrit-Owner: Maximilian Fridrich <m.fridrich at commend.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220602/4d9044a2/attachment.html>


More information about the asterisk-code-review mailing list