]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_pjsip: Only set default audio stream on hold.
authorMaximilian Fridrich <m.fridrich@commend.com>
Thu, 19 May 2022 14:23:11 +0000 (16:23 +0200)
committerJoshua Colp <jcolp@sangoma.com>
Thu, 2 Jun 2022 16:37:47 +0000 (11:37 -0500)
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

channels/chan_pjsip.c

index 7c6b301080e1f4675cbcf4654cbf4914200d4bb1..07b908801f75cbeb4e5e8822aca85ba4f78bc8f9 100644 (file)
@@ -1471,18 +1471,13 @@ static int update_connected_line_information(void *data)
        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)
+/*! \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)
 {
+       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;
        }
-}
-
-/*! \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);
        ast_sip_session_refresh(session, NULL, NULL, NULL, AST_SIP_SESSION_REFRESH_METHOD_INVITE, 1, NULL);
        ao2_ref(session, -1);