]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't override peer context with domain context.
authorMark Michelson <mmichelson@digium.com>
Wed, 28 Apr 2010 22:34:15 +0000 (22:34 +0000)
committerMark Michelson <mmichelson@digium.com>
Wed, 28 Apr 2010 22:34:15 +0000 (22:34 +0000)
(closes issue #17040)
Reported by: pprindeville
Patches:
      asterisk-1.6-bugid17040.patch uploaded by pprindeville (license 347)
Tested by: pprindeville

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

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

channels/chan_sip.c
channels/sip/include/sip.h

index 4d62561e847ae29cc4185e9b11a782fb48a35d59..a7b57438ab560af46ec0f297cda775bf2760acd7 100644 (file)
@@ -13508,8 +13508,9 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq, int *cc_
                                return -2;
                        }
                }
-               /* If we have a context defined, overwrite the original context */
-               if (!ast_strlen_zero(domain_context))
+               /* If we don't have a peer (i.e. we're a guest call),
+                * overwrite the original context */
+               if (!ast_test_flag(&p->flags[1], SIP_PAGE2_HAVEPEERCONTEXT) && !ast_strlen_zero(domain_context))
                        ast_string_field_set(p, context, domain_context);
        }
 
@@ -24945,6 +24946,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
                                ast_string_field_set(peer, cid_num, v->value);
                        } else if (!strcasecmp(v->name, "context")) {
                                ast_string_field_set(peer, context, v->value);
+                               ast_set_flag(&peer->flags[1], SIP_PAGE2_HAVEPEERCONTEXT);
                        } else if (!strcasecmp(v->name, "subscribecontext")) {
                                ast_string_field_set(peer, subscribecontext, v->value);
                        } else if (!strcasecmp(v->name, "fromdomain")) {
index 49f8ed09833a553618f8d38b285f39b9c9bfe87e..ddc4bb9c1b6fc42a895a807cc895264f4969ff96 100644 (file)
 #define SIP_PAGE2_REGISTERTRYING               (1 << 24)  /*!< DP: Send 100 Trying on REGISTER attempts */
 #define SIP_PAGE2_UDPTL_DESTINATION            (1 << 25)  /*!< DP: Use source IP of RTP as destination if NAT is enabled */
 #define SIP_PAGE2_VIDEOSUPPORT_ALWAYS          (1 << 26)  /*!< DP: Always set up video, even if endpoints don't support it */
+#define SIP_PAGE2_HAVEPEERCONTEXT      (1 << 27)       /*< Are we associated with a configured peer context? */
 
 #define SIP_PAGE2_FLAGS_TO_COPY \
        (SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_IGNORESDPVERSION | \
        SIP_PAGE2_BUGGY_MWI | SIP_PAGE2_TEXTSUPPORT | SIP_PAGE2_FAX_DETECT | \
        SIP_PAGE2_UDPTL_DESTINATION | SIP_PAGE2_VIDEOSUPPORT_ALWAYS | SIP_PAGE2_PREFERRED_CODEC | \
        SIP_PAGE2_RPID_IMMEDIATE | SIP_PAGE2_RPID_UPDATE | SIP_PAGE2_SYMMETRICRTP |\
-       SIP_PAGE2_Q850_REASON)
+       SIP_PAGE2_Q850_REASON | SIP_PAGE2_HAVEPEERCONTEXT)
 
 /*@}*/