Allow SIP UPDATE messages without display updates

Previously if send-display-update was set to false we would also
remove UPDATE from our Allow: headers.  This is unnecessary.  The
UPDATE message is useful in SIP transactions even if we're not sending
display updates.

With this commit, we add a new boolean profile flag, allow-update.  If
set to true we'll send Allow: UPDATE.  If set to false, we will not.
If there is a conflict with another setting that requires UPDATE
support, the allow-update parameter will win and a warning will be
printed.

ref: RFC 3311
This commit is contained in:
Travis Cross 2014-06-25 19:24:11 +00:00
parent ba784f2548
commit f7b4ec617a
2 changed files with 14 additions and 1 deletions

View File

@ -262,6 +262,7 @@ typedef enum {
PFLAG_THREAD_PER_REG,
PFLAG_MWI_USE_REG_CALLID,
PFLAG_FIRE_MESSAGE_EVENTS,
PFLAG_ALLOW_UPDATE,
PFLAG_SEND_DISPLAY_UPDATE,
PFLAG_RUNNING_TRANS,
PFLAG_SOCKET_TCP_KEEPALIVE,

View File

@ -2805,7 +2805,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
NUTAG_AUTOALERT(0),
NUTAG_ENABLEMESSENGER(1),
NTATAG_EXTRA_100(0),
TAG_IF(sofia_test_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE), NUTAG_ALLOW("UPDATE")),
TAG_IF(sofia_test_pflag(profile, PFLAG_ALLOW_UPDATE), NUTAG_ALLOW("UPDATE")),
TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")),
TAG_IF((profile->mflags & MFLAG_REFER), NUTAG_ALLOW("REFER")),
TAG_IF(!sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_ALLOW("PRACK")),
@ -4001,6 +4001,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
sofia_set_media_flag(profile, SCMF_RTP_AUTOFLUSH_DURING_BRIDGE);
profile->contact_user = SOFIA_DEFAULT_CONTACT_USER;
sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
sofia_set_pflag(profile, PFLAG_ALLOW_UPDATE);
sofia_set_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE);
sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER);
//sofia_set_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER);
@ -4150,6 +4151,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
} else {
sofia_clear_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER);
}
} else if (!strcasecmp(var, "allow-update")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_ALLOW_UPDATE);
} else {
sofia_clear_pflag(profile, PFLAG_ALLOW_UPDATE);
}
} else if (!strcasecmp(var, "send-display-update")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE);
@ -5124,6 +5131,11 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION);
}
if (sofia_test_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE) && !sofia_test_pflag(profile, PFLAG_ALLOW_UPDATE)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "send-display-update=true is set, but we can't comply because allow-update=false\n");
sofia_clear_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE);
}
if ((!profile->cng_pt) && (!sofia_test_media_flag(profile, SCMF_SUPPRESS_CNG))) {
profile->cng_pt = SWITCH_RTP_CNG_PAYLOAD;
}