From ae6eea19995b2bd8bfb16ccdf56b07ecdfaa07b3 Mon Sep 17 00:00:00 2001 From: Joshua Colp <jcolp@digium.com> Date: Fri, 8 Feb 2008 15:31:00 +0000 Subject: [PATCH] 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 --- channels/chan_sip.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index f0c593af42..6408f52aad 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -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. */ -- GitLab