diff --git a/channels/chan_sip.c b/channels/chan_sip.c index f28ad58218..41ea8e6dc6 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -13954,7 +13954,7 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho ast_uri_encode(l, tmp_l, sizeof(tmp_l), ast_uri_sip_user); } - ourport = (p->fromdomainport) ? p->fromdomainport : ast_sockaddr_port(&p->ourip); + ourport = (p->fromdomainport && (p->fromdomainport != STANDARD_SIP_PORT)) ? p->fromdomainport : ast_sockaddr_port(&p->ourip); /* If a caller id name was specified, add a display name. */ if (cid_has_name || !cid_has_num) { @@ -14920,7 +14920,7 @@ static int transmit_notify_with_mwi(struct sip_pvt *p, int newmsgs, int oldmsgs, { struct sip_request req; struct ast_str *out = ast_str_alloca(500); - int ourport = (p->fromdomainport) ? p->fromdomainport : ast_sockaddr_port(&p->ourip); + int ourport = (p->fromdomainport && (p->fromdomainport != STANDARD_SIP_PORT)) ? p->fromdomainport : ast_sockaddr_port(&p->ourip); const char *domain; const char *exten = S_OR(vmexten, default_vmexten);