mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
res_pjsip: Add new endpoint option "suppress_moh_on_sendonly"
Normally, when one party in a call sends Asterisk an SDP with a "sendonly" or "inactive" attribute it means "hold" and causes Asterisk to start playing MOH back to the other party. This can be problematic if it happens at certain times, such as in a 183 Progress message, because the MOH will replace any early media you may be playing to the calling party. If you set this option to "yes" on an endpoint and the endpoint receives an SDP with "sendonly" or "inactive", Asterisk will NOT play MOH back to the other party. Resolves: #979 UserNote: The new "suppress_moh_on_sendonly" endpoint option can be used to prevent playing MOH back to a caller if the remote end sends "sendonly" or "inactive" (hold) to Asterisk in an SDP.
This commit is contained in:
@@ -1533,6 +1533,27 @@
|
||||
<configOption name="send_aoc" default="no">
|
||||
<synopsis>Send Advice-of-Charge messages</synopsis>
|
||||
</configOption>
|
||||
<configOption name="suppress_moh_on_sendonly" default="no">
|
||||
<synopsis>Suppress playing MOH to party A if party B sends
|
||||
"sendonly" or "inactive" in an SDP</synopsis>
|
||||
<description><para>
|
||||
Normally, when one party in a call sends Asterisk an SDP with a "sendonly"
|
||||
or "inactive" attribute it means "hold" and causes Asterisk to start
|
||||
playing MOH back to the other party. This can be problematic if it happens at
|
||||
certain times, such as in a 183 Progress message, because the MOH will
|
||||
replace any early media you may be playing to the calling party. If you set
|
||||
this option to "yes" on an endpoint and the endpoint receives an SDP
|
||||
with "sendonly" or "inactive", Asterisk will NOT play MOH back to the other
|
||||
party.
|
||||
</para>
|
||||
<note><para>
|
||||
This doesn't just apply to 183 responses. MOH will be suppressed when
|
||||
the attribute appears in any SDP received including INVITEs, re-INVITES,
|
||||
and other responses.
|
||||
</para>
|
||||
</note>
|
||||
</description>
|
||||
</configOption>
|
||||
</configObject>
|
||||
<configObject name="auth">
|
||||
<synopsis>Authentication type</synopsis>
|
||||
|
@@ -2304,6 +2304,8 @@ int ast_res_pjsip_initialize_configuration(void)
|
||||
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "security_negotiation", "no", security_negotiation_handler, security_negotiation_to_str, NULL, 0, 0);
|
||||
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_aoc", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_aoc));
|
||||
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tenantid", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, tenantid));
|
||||
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "suppress_moh_on_sendonly",
|
||||
"no", OPT_YESNO_T, 1, FLDSET(struct ast_sip_endpoint, suppress_moh_on_sendonly));
|
||||
|
||||
if (ast_sip_initialize_sorcery_transport()) {
|
||||
ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
|
||||
|
@@ -2321,14 +2321,18 @@ static int apply_negotiated_sdp_stream(struct ast_sip_session *session,
|
||||
if (session_media->remotely_held_changed) {
|
||||
if (session_media->remotely_held) {
|
||||
/* The remote side has put us on hold */
|
||||
ast_queue_hold(session->channel, session->endpoint->mohsuggest);
|
||||
ast_rtp_instance_stop(session_media->rtp);
|
||||
ast_queue_frame(session->channel, &ast_null_frame);
|
||||
if (!session->endpoint->suppress_moh_on_sendonly) {
|
||||
ast_queue_hold(session->channel, session->endpoint->mohsuggest);
|
||||
ast_rtp_instance_stop(session_media->rtp);
|
||||
ast_queue_frame(session->channel, &ast_null_frame);
|
||||
}
|
||||
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);
|
||||
if (!session->endpoint->suppress_moh_on_sendonly) {
|
||||
ast_queue_unhold(session->channel);
|
||||
ast_queue_frame(session->channel, &ast_null_frame);
|
||||
}
|
||||
session_media->remotely_held_changed = 0;
|
||||
}
|
||||
} else if ((pjmedia_sdp_neg_was_answer_remote(session->inv_session->neg) == PJ_FALSE)
|
||||
|
Reference in New Issue
Block a user