--- channels/chan_sip.c.orig 2009-01-28 10:26:19.000000000 +0100 +++ channels/chan_sip.c 2009-01-28 12:22:19.000000000 +0100 @@ -1716,7 +1716,7 @@ static const char *sip_get_callid(struct ast_channel *chan); static int handle_request_do(struct sip_request *req, struct sockaddr_in *sin); -static int sip_standard_port(struct sip_socket s); +static int sip_standard_port(struct sip_pvt *p); static int sip_prepare_socket(struct sip_pvt *p); static int sip_parse_host(char *line, int lineno, char **hostname, int *portnum, enum sip_transport *transport); @@ -8665,12 +8665,12 @@ { /* Construct Contact: header */ if (p->socket.type & SIP_TRANSPORT_UDP) { - if (!sip_standard_port(p->socket)) - ast_string_field_build(p, our_contact, "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr), ntohs(p->socket.port)); + if (!sip_standard_port(p)) + ast_string_field_build(p, our_contact, "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr), ntohs(p->ourip.sin_port)); else ast_string_field_build(p, our_contact, "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr)); } else - ast_string_field_build(p, our_contact, "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr), ntohs(p->socket.port), get_transport_pvt(p)); + ast_string_field_build(p, our_contact, "", p->exten, ast_strlen_zero(p->exten) ? "" : "@", ast_inet_ntoa(p->ourip.sin_addr), ntohs(p->ourip.sin_port), get_transport_pvt(p)); } /*! \brief Build the Remote Party-ID & From using callingpres options */ @@ -8819,8 +8819,8 @@ l = tmp_l; } - 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); + if (!sip_standard_port(p) && 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->ourip.sin_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); @@ -18749,12 +18749,12 @@ } /*! \brief Returns the port to use for this socket */ -static int sip_standard_port(struct sip_socket s) +static int sip_standard_port(struct sip_pvt *p) { - if (s.type & SIP_TRANSPORT_TLS) - return s.port == htons(STANDARD_TLS_PORT); + if (p->socket.type & SIP_TRANSPORT_TLS) + return p->ourip.sin_port == htons(STANDARD_TLS_PORT); else - return s.port == htons(STANDARD_SIP_PORT); + return p->ourip.sin_port == htons(STANDARD_SIP_PORT); } /*! \todo document this function. */