diff options
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 71ff8171f..dbb3d9a6c 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -221,7 +221,8 @@ static int default_expiry = DEFAULT_DEFAULT_EXPIRY; #define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif -#define CALLERID_UNKNOWN "Unknown" +#define CALLERID_UNKNOWN "Anonymous" +#define FROMDOMAIN_INVALID "anonymous.invalid" #define DEFAULT_MAXMS 2000 /*!< Qualification: Must be faster than 2 seconds by default */ #define DEFAULT_QUALIFYFREQ 60 * 1000 /*!< Qualification: How often to check for the host to be up */ @@ -9239,6 +9240,7 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho char tmp_l[SIPBUFSIZE/2]; /* build a local copy of 'l' if needed */ const char *l = NULL; /* XXX what is this, exactly ? */ const char *n = NULL; /* XXX what is this, exactly ? */ + const char *d = NULL; /* domain in from header */ const char *urioptions = ""; int ourport; @@ -9264,6 +9266,7 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho snprintf(p->lastmsg, sizeof(p->lastmsg), "Init: %s", sip_methods[sipmethod].text); + d = S_OR(p->fromdomain, ast_inet_ntoa(p->ourip.sin_addr)); if (p->owner) { l = p->owner->cid.cid_num; n = p->owner->cid.cid_name; @@ -9273,6 +9276,7 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho ((p->callingpres & AST_PRES_RESTRICTION) != AST_PRES_ALLOWED)) { l = CALLERID_UNKNOWN; n = l; + d = FROMDOMAIN_INVALID; } if (ast_strlen_zero(l)) l = default_callerid; @@ -9299,9 +9303,9 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho ourport = ntohs(p->ourip.sin_port); if (!sip_standard_port(p->socket.type, ourport) && ast_strlen_zero(p->fromdomain)) - snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s:%d>;tag=%s", n, l, ast_inet_ntoa(p->ourip.sin_addr), ourport, p->tag); + snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s:%d>;tag=%s", n, l, d, ourport, p->tag); else - snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s>;tag=%s", n, l, S_OR(p->fromdomain, ast_inet_ntoa(p->ourip.sin_addr)), p->tag); + snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s>;tag=%s", n, l, d, p->tag); /* If we're calling a registered SIP peer, use the fullcontact to dial to the peer */ if (!ast_strlen_zero(p->fullcontact)) { |