mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
res/res_pjsip_sdp_rtp: Fix MOH transitions
Update the state of remote_hold immediately on receipt of remote SDP so that the information is available when building the SDP answer ASTERISK-28754 #close Change-Id: I7026032a807e9c95081cb8f060400b05deb4836f
This commit is contained in:
committed by
Torrey Searle
parent
838583783f
commit
77c9ba8e63
@@ -89,6 +89,8 @@ struct ast_sip_session_media {
|
|||||||
int timeout_sched_id;
|
int timeout_sched_id;
|
||||||
/*! \brief Stream is on hold by remote side */
|
/*! \brief Stream is on hold by remote side */
|
||||||
unsigned int remotely_held:1;
|
unsigned int remotely_held:1;
|
||||||
|
/*! \brief Stream is held by remote side changed during this negotiation*/
|
||||||
|
unsigned int remotely_held_changed:1;
|
||||||
/*! \brief Stream is on hold by local side */
|
/*! \brief Stream is on hold by local side */
|
||||||
unsigned int locally_held:1;
|
unsigned int locally_held:1;
|
||||||
/*! \brief Does remote support rtcp_mux */
|
/*! \brief Does remote support rtcp_mux */
|
||||||
|
@@ -1406,6 +1406,20 @@ static int negotiate_incoming_sdp_stream(struct ast_sip_session *session,
|
|||||||
/* If ICE support is enabled find all the needed attributes */
|
/* If ICE support is enabled find all the needed attributes */
|
||||||
check_ice_support(session, session_media, stream);
|
check_ice_support(session, session_media, stream);
|
||||||
|
|
||||||
|
/* Check if incomming SDP is changing the remotely held state */
|
||||||
|
if (ast_sockaddr_isnull(addrs) ||
|
||||||
|
ast_sockaddr_is_any(addrs) ||
|
||||||
|
pjmedia_sdp_media_find_attr2(stream, "sendonly", NULL) ||
|
||||||
|
pjmedia_sdp_media_find_attr2(stream, "inactive", NULL)) {
|
||||||
|
if (!session_media->remotely_held) {
|
||||||
|
session_media->remotely_held = 1;
|
||||||
|
session_media->remotely_held_changed = 1;
|
||||||
|
}
|
||||||
|
} else if (session_media->remotely_held) {
|
||||||
|
session_media->remotely_held = 0;
|
||||||
|
session_media->remotely_held_changed = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (set_caps(session, session_media, session_media_transport, stream, 1, asterisk_stream)) {
|
if (set_caps(session, session_media, session_media_transport, stream, 1, asterisk_stream)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1997,22 +2011,19 @@ static int apply_negotiated_sdp_stream(struct ast_sip_session *session,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_sockaddr_isnull(addrs) ||
|
if (session_media->remotely_held_changed) {
|
||||||
ast_sockaddr_is_any(addrs) ||
|
if (session_media->remotely_held) {
|
||||||
pjmedia_sdp_media_find_attr2(remote_stream, "sendonly", NULL) ||
|
|
||||||
pjmedia_sdp_media_find_attr2(remote_stream, "inactive", NULL)) {
|
|
||||||
if (!session_media->remotely_held) {
|
|
||||||
/* The remote side has put us on hold */
|
/* The remote side has put us on hold */
|
||||||
ast_queue_hold(session->channel, session->endpoint->mohsuggest);
|
ast_queue_hold(session->channel, session->endpoint->mohsuggest);
|
||||||
ast_rtp_instance_stop(session_media->rtp);
|
ast_rtp_instance_stop(session_media->rtp);
|
||||||
ast_queue_frame(session->channel, &ast_null_frame);
|
ast_queue_frame(session->channel, &ast_null_frame);
|
||||||
session_media->remotely_held = 1;
|
session_media->remotely_held_changed = 0;
|
||||||
|
} else {
|
||||||
|
/* The remote side has taken us off hold */
|
||||||
|
ast_queue_unhold(session->channel);
|
||||||
|
ast_queue_frame(session->channel, &ast_null_frame);
|
||||||
|
session_media->remotely_held_changed = 0;
|
||||||
}
|
}
|
||||||
} else if (session_media->remotely_held) {
|
|
||||||
/* The remote side has taken us off hold */
|
|
||||||
ast_queue_unhold(session->channel);
|
|
||||||
ast_queue_frame(session->channel, &ast_null_frame);
|
|
||||||
session_media->remotely_held = 0;
|
|
||||||
} else if ((pjmedia_sdp_neg_was_answer_remote(session->inv_session->neg) == PJ_FALSE)
|
} else if ((pjmedia_sdp_neg_was_answer_remote(session->inv_session->neg) == PJ_FALSE)
|
||||||
&& (session->inv_session->state == PJSIP_INV_STATE_CONFIRMED)) {
|
&& (session->inv_session->state == PJSIP_INV_STATE_CONFIRMED)) {
|
||||||
ast_queue_control(session->channel, AST_CONTROL_UPDATE_RTP_PEER);
|
ast_queue_control(session->channel, AST_CONTROL_UPDATE_RTP_PEER);
|
||||||
|
Reference in New Issue
Block a user