]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add matchexterniplocally setting which only substitutes your externip/externhost...
authorJoshua Colp <jcolp@digium.com>
Mon, 12 Mar 2007 00:51:16 +0000 (00:51 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 12 Mar 2007 00:51:16 +0000 (00:51 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@58779 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c
configs/sip.conf.sample

index 65116bd8d860eb4708e3d22532c2b22a63d13174..1d5c4c7a6678063fc6a1fa64f3ca630667f7f738 100644 (file)
@@ -557,6 +557,8 @@ static int global_t1min;            /*!< T1 roundtrip time minimum */
 static int global_autoframing;          /*!< Turn autoframing on or off. */
 static enum transfermodes global_allowtransfer;        /*!< SIP Refer restriction scheme */
 
+static int global_matchexterniplocally; /*!< Match externip/externhost setting against localnet setting */
+
 /*! \brief Codecs that we support by default: */
 static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
 
@@ -1781,7 +1783,7 @@ static enum sip_result ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *
 
        if (localaddr && externip.sin_addr.s_addr &&
            (ast_apply_ha(localaddr, &theirs)) &&
-           (!ast_apply_ha(localaddr, &ours))) {
+           (!global_matchexterniplocally || !ast_apply_ha(localaddr, &ours))) {
                if (externexpire && time(NULL) >= externexpire) {
                        struct ast_hostent ahp;
                        struct hostent *hp;
@@ -16204,6 +16206,8 @@ static int reload_config(enum channelreloadreason reason)
        global_callevents = FALSE;
        global_t1min = DEFAULT_T1MIN;           
 
+       global_matchexterniplocally = FALSE;
+
        /* Copy the default jb config over global_jbconf */
        memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
 
@@ -16443,6 +16447,8 @@ static int reload_config(enum channelreloadreason reason)
                        default_maxcallbitrate = atoi(v->value);
                        if (default_maxcallbitrate < 0)
                                default_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE;
+               } else if (!strcasecmp(v->name, "matchexterniplocally")) {
+                       global_matchexterniplocally = ast_true(v->value);
                }
        }
 
index 293eafa636666f9b18c1038d8dfe3e5ac102e270..a533f64478427504253dba19112a0cdd1521cfcc 100644 (file)
@@ -136,6 +136,10 @@ srvlookup=yes                      ; Enable DNS SRV lookups on outbound calls
                                ; contrary to the RFC3551 specification, the peer _should_
                                ; be negotiating AAL2-G726-32 instead :-(
 
+;matchexterniplocally = yes     ; Only substitute the externip or externhost setting if it matches
+                                ; your localnet setting. Unless you have some sort of strange network
+                                ; setup you will not need to enable this.
+
 ;
 ; If regcontext is specified, Asterisk will dynamically create and destroy a
 ; NoOp priority 1 extension for a given peer who registers or unregisters with