Fix a network byte order issue and ensure when creating an outgoing dialog that the socket always contains information such as type and port.

(closes issue #11916)
Reported by: mnnojd


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103018 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp
2008-02-08 15:31:00 +00:00
parent 3d3852f125
commit ae6eea1999

View File

@@ -3942,6 +3942,10 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer)
int res = create_addr_from_peer(dialog, peer);
unref_peer(peer);
return res;
} else {
/* Setup default parameters for this dialog's socket. Currently we only support regular UDP SIP as the default */
dialog->socket.type = SIP_TRANSPORT_UDP;
dialog->socket.port = bindaddr.sin_port;
}
ast_string_field_set(dialog, tohost, peername);
@@ -17904,9 +17908,9 @@ static int handle_request_do(struct sip_request *req, struct sockaddr_in *sin)
static int sip_standard_port(struct sip_socket s)
{
if (s.type & SIP_TRANSPORT_TLS)
return s.port == STANDARD_TLS_PORT;
return s.port == htons(STANDARD_TLS_PORT);
else
return s.port == STANDARD_SIP_PORT;
return s.port == htons(STANDARD_SIP_PORT);
}
/*! \todo document this function. */