summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index f76d7806d..ffc2cc15e 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -28025,6 +28025,10 @@ static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask
} else if (!strcasecmp(word, "nonat")) {
ast_set_flag(&flags[0], SIP_DIRECT_MEDIA);
ast_clear_flag(&flags[0], SIP_DIRECT_MEDIA_NAT);
+ } else if (!strcasecmp(word, "outgoing")) {
+ ast_set_flag(&flags[0], SIP_DIRECT_MEDIA);
+ ast_set_flag(&mask[2], SIP_PAGE3_DIRECT_MEDIA_OUTGOING);
+ ast_set_flag(&flags[2], SIP_PAGE3_DIRECT_MEDIA_OUTGOING);
} else {
ast_log(LOG_WARNING, "Unknown directmedia mode '%s' on line %d\n", v->value, v->lineno);
}
@@ -30706,6 +30710,18 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *i
ast_format_cap_copy(p->redircaps, cap);
changed = 1;
}
+
+ if (ast_test_flag(&p->flags[2], SIP_PAGE3_DIRECT_MEDIA_OUTGOING) && !p->outgoing_call) {
+ /* We only wish to withhold sending the initial direct media reinvite on the incoming dialog.
+ * Further direct media reinvites beyond the initial should be sent. In order to allow further
+ * direct media reinvites to be sent, we clear this flag.
+ */
+ ast_clear_flag(&p->flags[2], SIP_PAGE3_DIRECT_MEDIA_OUTGOING);
+ sip_pvt_unlock(p);
+ ast_channel_unlock(chan);
+ return 0;
+ }
+
if (changed && !ast_test_flag(&p->flags[0], SIP_GOTREFER) && !ast_test_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER)) {
if (ast_channel_state(chan) != AST_STATE_UP) { /* We are in early state */
if (p->do_history)