]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix For Not Overriding The Default Settings In chan_sip
authorMichael L. Young <elgueromexicano@gmail.com>
Fri, 5 Apr 2013 20:34:16 +0000 (20:34 +0000)
committerMichael L. Young <elgueromexicano@gmail.com>
Fri, 5 Apr 2013 20:34:16 +0000 (20:34 +0000)
The initial report was that the "nat" setting in the [general] section was not
having any effect in overriding the default setting.  Upon confirming that this
was happening and looking into what was causing this, it was discovered that
other default settings would not be overriden as well.

This patch works similar to what occurs in build_peer().  We create a temporary
ast_flags structure and using a mask, we override the default settings with
whatever is set in the [general] section.

In the bug report, the reporter who helped to test this patch noted that the
directmedia settings were being overriden properly as well as the nat settings.

This issue is also present in Asterisk 1.8 and a separate patch will be applied
to it.

(issue ASTERISK-21225)
Reported by: Alexandre Vezina
Tested by: Alexandre Vezina, Michael L. Young
Patches:
  asterisk-21225-handle-options-default-prob_v4.diff
Michael L. Young (license 5026)

Review: https://reviewboard.asterisk.org/r/2385/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@384827 65c4cc65-6c06-0410-ace0-fbb531ad65f3

UPGRADE.txt
channels/chan_sip.c

index 1bc7e1eb4afa864b211445930fd7ca77937407b4..2700798e3ddb5b66f4c955aaaf46fba1070ac5c3 100644 (file)
 ===
 ===========================================================
 
+From 11.4 to 11.5:
+* The default settings for chan_sip are now overriden properly by the general
+  settings in sip.conf.  Please look over your settings upon upgrading.
+
 From 11.3 to 11.4:
 * Added the 'n' option to MeetMe to prevent application of the DENOISE function
   to a channel joining a conference. Some channel drivers that vary the number
index 4054c6cff313de16d5323a5491a41c61b4f1475c..6e2116c0abada2e26104d96e374483a4e1098e24 100644 (file)
@@ -31052,7 +31052,8 @@ static int reload_config(enum channelreloadreason reason)
        struct sip_peer *peer;
        char *cat, *stringp, *context, *oldregcontext;
        char newcontexts[AST_MAX_CONTEXT], oldcontexts[AST_MAX_CONTEXT];
-       struct ast_flags dummy[3];
+       struct ast_flags mask[3] = {{0}};
+       struct ast_flags setflags[3] = {{0}};
        struct ast_flags config_flags = { (reason == CHANNEL_MODULE_LOAD || reason == CHANNEL_ACL_RELOAD) ? 0 : ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS) ? 0 : CONFIG_FLAG_FILEUNCHANGED };
        int auto_sip_domains = FALSE;
        struct ast_sockaddr old_bindaddr = bindaddr;
@@ -31297,13 +31298,12 @@ static int reload_config(enum channelreloadreason reason)
        ast_clear_flag(&global_flags[1], SIP_PAGE2_TEXTSUPPORT);
        ast_clear_flag(&global_flags[1], SIP_PAGE2_IGNORESDPVERSION);
 
-
        /* Read the [general] config section of sip.conf (or from realtime config) */
        for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
-               if (handle_common_options(&global_flags[0], &dummy[0], v)) {
+               if (handle_common_options(&setflags[0], &mask[0], v)) {
                        continue;
                }
-               if (handle_t38_options(&global_flags[0], &dummy[0], v, &global_t38_maxdatagram)) {
+               if (handle_t38_options(&setflags[0], &mask[0], v, &global_t38_maxdatagram)) {
                        continue;
                }
                /* handle jb conf */
@@ -31845,6 +31845,11 @@ static int reload_config(enum channelreloadreason reason)
                }
        }
 
+       /* Override global defaults if setting found in general section */
+       ast_copy_flags(&global_flags[0], &setflags[0], mask[0].flags);
+       ast_copy_flags(&global_flags[1], &setflags[1], mask[1].flags);
+       ast_copy_flags(&global_flags[2], &setflags[2], mask[2].flags);
+
        /* For backwards compatibility the corresponding registration timer value is used if subscription timer value isn't set by configuration */
        if (!min_subexpiry_set) {
                min_subexpiry = min_expiry;