--- channels/chan_sip.c 2007-03-17 14:38:34.000000000 +0100 +++ channels/chan_sip.c 2007-03-17 16:40:02.000000000 +0100 @@ -148,6 +148,7 @@ static const char notify_config[] = "sip #define RTP 1 #define NO_RTP 0 +#define DEFAULT_USEEXTERNRTPIP "yes" /* Do _NOT_ make any changes to this enum, or the array following it; if you think you are doing the right thing, you are probably @@ -328,6 +329,7 @@ static const struct cfsip_options { #define DEFAULT_SIP_PORT 5060 /*!< From RFC 3261 (former 2543) */ #define SIP_MAX_PACKET 4096 /*!< Also from RFC 3261 (2543), should sub headers tho */ +static char default_useexternrtpip[AST_MAX_EXTENSION]; static char default_useragent[AST_MAX_EXTENSION] = DEFAULT_USERAGENT; #define DEFAULT_CONTEXT "default" @@ -4589,6 +4591,9 @@ static int add_sdp(struct sip_request *r /* We break with the "recommendation" and send our IP, in order that our peer doesn't have to ast_gethostbyname() us */ + if (strcasestr(default_useexternrtpip, "no")) + ast_ouraddrfor(&p->sa.sin_addr, &dest.sin_addr); + snprintf(v, sizeof(v), "v=0\r\n"); snprintf(o, sizeof(o), "o=root %d %d IN IP4 %s\r\n", p->sessionid, p->sessionversion, ast_inet_ntoa(iabuf, sizeof(iabuf), dest.sin_addr)); snprintf(s, sizeof(s), "s=session\r\n"); @@ -12681,6 +12686,7 @@ static int reload_config(void) externrefresh = 10; ast_copy_string(default_useragent, DEFAULT_USERAGENT, sizeof(default_useragent)); ast_copy_string(default_notifymime, DEFAULT_NOTIFYMIME, sizeof(default_notifymime)); + ast_copy_string(default_useexternrtpip, DEFAULT_USEEXTERNRTPIP, sizeof(default_useexternrtpip)); global_notifyringing = 1; global_alwaysauthreject = 0; ast_copy_string(global_realm, DEFAULT_REALM, sizeof(global_realm)); @@ -12778,6 +12784,8 @@ static int reload_config(void) videosupport = ast_true(v->value); } else if (!strcasecmp(v->name, "compactheaders")) { compactheaders = ast_true(v->value); + } else if (!strcasecmp(v->name, "useexternrtpip")) { + ast_copy_string(default_useexternrtpip, v->value, sizeof(default_useexternrtpip)); } else if (!strcasecmp(v->name, "notifymimetype")) { ast_copy_string(default_notifymime, v->value, sizeof(default_notifymime)); } else if (!strcasecmp(v->name, "notifyringing")) {