--- chan_sip.c 2004-11-24 10:56:47.000000000 +0100 +++ chan_sip.c.new 2004-11-24 10:56:16.000000000 +0100 @@ -3645,10 +3645,18 @@ { char iabuf[INET_ADDRSTRLEN]; /* Construct Contact: header */ - if (ourport != 5060) - snprintf(p->our_contact, sizeof(p->our_contact), "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ourport); - else - snprintf(p->our_contact, sizeof(p->our_contact), "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip)); + if (ourport != 5060) { + if (!ast_strlen_zero(p->fromdomain)) + snprintf(p->our_contact, sizeof(p->our_contact), "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", p->fromdomain, ourport); + else + snprintf(p->our_contact, sizeof(p->our_contact), "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ourport); + } + else { + if (!ast_strlen_zero(p->fromdomain)) + snprintf(p->our_contact, sizeof(p->our_contact), "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", p->fromdomain); + else + snprintf(p->our_contact, sizeof(p->our_contact), "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip)); + } } /*--- initreqprep: Initiate SIP request to peer/user ---*/ @@ -9312,5 +9320,3 @@ { return desc; } - -