This change adds a PJSIP patch (which has been contributed upstream) to allow the registration of IPv6 transport types. Using this the res_pjsip_transport_websocket module now registers an IPv6 Websocket transport and uses it for the corresponding traffic. ASTERISK-26685 Change-Id: Id1f9126f995b31dc38db8fdb58afd289b4ad1647
63 lines
2.1 KiB
Diff
63 lines
2.1 KiB
Diff
From daeb0956524606b597704a90b54d81340e10b3e4 Mon Sep 17 00:00:00 2001
|
|
From: Joshua Colp <jcolp@digium.com>
|
|
Date: Tue, 7 Mar 2017 12:32:49 +0000
|
|
Subject: [PATCH] Add support for registering IPv6 transport type.
|
|
|
|
This change allows an IPv6 transport type to be registered
|
|
and used. The IPv4 transport is found (if available) and the
|
|
IPv4 flag added to its type to match how the finding of
|
|
IPv6 transport types works.
|
|
---
|
|
pjsip/src/pjsip/sip_transport.c | 15 +++++++++++++--
|
|
1 file changed, 13 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c
|
|
index 7df6138..ce72814 100644
|
|
--- a/pjsip/src/pjsip/sip_transport.c
|
|
+++ b/pjsip/src/pjsip/sip_transport.c
|
|
@@ -236,6 +236,7 @@ PJ_DEF(pj_status_t) pjsip_transport_register_type( unsigned tp_flag,
|
|
int *p_tp_type)
|
|
{
|
|
unsigned i;
|
|
+ pjsip_transport_type_e parent = 0;
|
|
|
|
PJ_ASSERT_RETURN(tp_flag && tp_name && def_port, PJ_EINVAL);
|
|
PJ_ASSERT_RETURN(pj_ansi_strlen(tp_name) <
|
|
@@ -243,6 +244,11 @@ PJ_DEF(pj_status_t) pjsip_transport_register_type( unsigned tp_flag,
|
|
PJ_ENAMETOOLONG);
|
|
|
|
for (i=1; i<PJ_ARRAY_SIZE(transport_names); ++i) {
|
|
+ if (tp_flag & PJSIP_TRANSPORT_IPV6 &&
|
|
+ pj_stricmp2(&transport_names[i].name, tp_name) == 0)
|
|
+ {
|
|
+ parent = transport_names[i].type;
|
|
+ }
|
|
if (transport_names[i].type == 0)
|
|
break;
|
|
}
|
|
@@ -250,14 +256,19 @@ PJ_DEF(pj_status_t) pjsip_transport_register_type( unsigned tp_flag,
|
|
if (i == PJ_ARRAY_SIZE(transport_names))
|
|
return PJ_ETOOMANY;
|
|
|
|
- transport_names[i].type = (pjsip_transport_type_e)i;
|
|
+ if (tp_flag & PJSIP_TRANSPORT_IPV6 && parent) {
|
|
+ transport_names[i].type = parent | PJSIP_TRANSPORT_IPV6;
|
|
+ } else {
|
|
+ transport_names[i].type = (pjsip_transport_type_e)i;
|
|
+ }
|
|
+
|
|
transport_names[i].port = (pj_uint16_t)def_port;
|
|
pj_ansi_strcpy(transport_names[i].name_buf, tp_name);
|
|
transport_names[i].name = pj_str(transport_names[i].name_buf);
|
|
transport_names[i].flag = tp_flag;
|
|
|
|
if (p_tp_type)
|
|
- *p_tp_type = i;
|
|
+ *p_tp_type = transport_names[i].type;
|
|
|
|
return PJ_SUCCESS;
|
|
}
|
|
--
|
|
2.7.4
|
|
|