[sr-dev] git:master:b874f56b: core: parser - macro to get sip port based on proto

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 6 20:45:12 CEST 2021


Module: kamailio
Branch: master
Commit: b874f56bcea104ce328e0cea19bc78cbf79749d6
URL: https://github.com/kamailio/kamailio/commit/b874f56bcea104ce328e0cea19bc78cbf79749d6

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-07-06T11:07:32+02:00

core: parser - macro to get sip port based on proto

---

Modified: src/core/parser/msg_parser.h

---

Diff:  https://github.com/kamailio/kamailio/commit/b874f56bcea104ce328e0cea19bc78cbf79749d6.diff
Patch: https://github.com/kamailio/kamailio/commit/b874f56bcea104ce328e0cea19bc78cbf79749d6.patch

---

diff --git a/src/core/parser/msg_parser.h b/src/core/parser/msg_parser.h
index 61d9ac6185..1ff73a0b98 100644
--- a/src/core/parser/msg_parser.h
+++ b/src/core/parser/msg_parser.h
@@ -184,6 +184,15 @@ if (  (*tmp==(firstchar) || *tmp==((firstchar) | 32)) &&                  \
 (((m)->new_uri.s && (m)->new_uri.len) ? (&(m)->new_uri) : (&(m)->first_line.u.request.uri))
 
 
+/*! \brief
+ * Return the SIP port.
+ * - _port if _port!=0
+ * - 5061 for _proto == TLS or WSS
+ * - 5060 for the other _proto
+ */
+#define GET_SIP_PORT(_port, _proto) ((_port==0)?((_proto==PROTO_TLS \
+					|| _proto==PROTO_WSS)?5061:5060):_port)
+
 enum _uri_type{ERROR_URI_T=0, SIP_URI_T, SIPS_URI_T, TEL_URI_T, TELS_URI_T, URN_URI_T};
 typedef enum _uri_type uri_type;
 enum _uri_flags{




More information about the sr-dev mailing list