mirror of
https://github.com/asterisk/asterisk.git
synced 2025-12-04 12:12:05 +00:00
ensure that port number in URI is presented when needed (bug #4784)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6194 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -4249,7 +4249,7 @@ static void build_contact(struct sip_pvt *p)
|
|||||||
char iabuf[INET_ADDRSTRLEN];
|
char iabuf[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
/* Construct Contact: header */
|
/* Construct Contact: header */
|
||||||
if (ourport != DEFAULT_SIP_PORT)
|
if (ourport != 5060) /* Needs to be 5060, according to the RFC */
|
||||||
snprintf(p->our_contact, sizeof(p->our_contact), "<sip:%s%s%s:%d>", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ourport);
|
snprintf(p->our_contact, sizeof(p->our_contact), "<sip:%s%s%s:%d>", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ourport);
|
||||||
else
|
else
|
||||||
snprintf(p->our_contact, sizeof(p->our_contact), "<sip:%s%s%s>", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip));
|
snprintf(p->our_contact, sizeof(p->our_contact), "<sip:%s%s%s>", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip));
|
||||||
@@ -4319,7 +4319,7 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho
|
|||||||
else /* Save for any further attempts */
|
else /* Save for any further attempts */
|
||||||
ast_copy_string(p->fromname, n, sizeof(p->fromname));
|
ast_copy_string(p->fromname, n, sizeof(p->fromname));
|
||||||
|
|
||||||
if ((ourport != DEFAULT_SIP_PORT) && ast_strlen_zero(p->fromdomain))
|
if ((ourport != 5060) && ast_strlen_zero(p->fromdomain)) /* Needs to be 5060 */
|
||||||
snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s:%d>;tag=as%08x", n, l, ast_strlen_zero(p->fromdomain) ? ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip) : p->fromdomain, ourport, p->tag);
|
snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s:%d>;tag=as%08x", n, l, ast_strlen_zero(p->fromdomain) ? ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip) : p->fromdomain, ourport, p->tag);
|
||||||
else
|
else
|
||||||
snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s>;tag=as%08x", n, l, ast_strlen_zero(p->fromdomain) ? ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip) : p->fromdomain, p->tag);
|
snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s>;tag=as%08x", n, l, ast_strlen_zero(p->fromdomain) ? ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip) : p->fromdomain, p->tag);
|
||||||
@@ -4330,12 +4330,12 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho
|
|||||||
ast_copy_string(invite, p->fullcontact, sizeof(invite));
|
ast_copy_string(invite, p->fullcontact, sizeof(invite));
|
||||||
/* Otherwise, use the username while waiting for registration */
|
/* Otherwise, use the username while waiting for registration */
|
||||||
} else if (!ast_strlen_zero(p->username)) {
|
} else if (!ast_strlen_zero(p->username)) {
|
||||||
if (ntohs(p->sa.sin_port) != DEFAULT_SIP_PORT) {
|
if (ntohs(p->sa.sin_port) != 5060) { /* Needs to be 5060 */
|
||||||
snprintf(invite, sizeof(invite), "sip:%s@%s:%d%s",p->username, p->tohost, ntohs(p->sa.sin_port), urioptions);
|
snprintf(invite, sizeof(invite), "sip:%s@%s:%d%s",p->username, p->tohost, ntohs(p->sa.sin_port), urioptions);
|
||||||
} else {
|
} else {
|
||||||
snprintf(invite, sizeof(invite), "sip:%s@%s%s",p->username, p->tohost, urioptions);
|
snprintf(invite, sizeof(invite), "sip:%s@%s%s",p->username, p->tohost, urioptions);
|
||||||
}
|
}
|
||||||
} else if (ntohs(p->sa.sin_port) != DEFAULT_SIP_PORT) {
|
} else if (ntohs(p->sa.sin_port) != 5060) { /* Needs to be 5060 */
|
||||||
snprintf(invite, sizeof(invite), "sip:%s:%d%s", p->tohost, ntohs(p->sa.sin_port), urioptions);
|
snprintf(invite, sizeof(invite), "sip:%s:%d%s", p->tohost, ntohs(p->sa.sin_port), urioptions);
|
||||||
} else {
|
} else {
|
||||||
snprintf(invite, sizeof(invite), "sip:%s%s", p->tohost, urioptions);
|
snprintf(invite, sizeof(invite), "sip:%s%s", p->tohost, urioptions);
|
||||||
|
|||||||
Reference in New Issue
Block a user