diff -NaurbB old/chan_sip.c new/chan_sip.c --- old/chan_sip.c 2009-02-04 14:58:16.000000000 +0000 +++ new/chan_sip.c 2009-02-12 12:15:09.000000000 +0000 @@ -220,7 +220,8 @@ #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 */ @@ -8791,6 +8792,7 @@ 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 = ""; if (ast_test_flag(&p->flags[0], SIP_USEREQPHONE)) { @@ -8815,6 +8817,7 @@ 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; @@ -8824,6 +8827,7 @@ ((p->callingpres & AST_PRES_RESTRICTION) != AST_PRES_ALLOWED)) { l = CALLERID_UNKNOWN; n = l; + d = FROMDOMAIN_INVALID; } if (ast_strlen_zero(l)) l = default_callerid; @@ -8849,9 +8853,9 @@ } if (!sip_standard_port(p->socket) && ast_strlen_zero(p->fromdomain)) - snprintf(from, sizeof(from), "\"%s\" ;tag=%s", n, l, S_OR(p->fromdomain, ast_inet_ntoa(p->ourip.sin_addr)), ntohs(p->socket.port), p->tag); + snprintf(from, sizeof(from), "\"%s\" ;tag=%s", n, l, d, ntohs(p->socket.port), p->tag); else - snprintf(from, sizeof(from), "\"%s\" ;tag=%s", n, l, S_OR(p->fromdomain, ast_inet_ntoa(p->ourip.sin_addr)), p->tag); + snprintf(from, sizeof(from), "\"%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)) {