pjproject-ring.paketlendi

This commit is contained in:
milisbir 2017-07-25 02:27:29 +03:00
parent b7e1c3046e
commit 1f9716c682
12 changed files with 3749 additions and 0 deletions

View File

@ -0,0 +1,63 @@
--- a/pjsip/src/pjsip/sip_transport.c
+++ b/pjsip/src/pjsip/sip_transport.c
@@ -183,6 +183,13 @@
PJSIP_TRANSPORT_RELIABLE | PJSIP_TRANSPORT_SECURE
},
{
+ PJSIP_TRANSPORT_DTLS,
+ 5061,
+ {"DTLS", 4},
+ "DTLS transport",
+ PJSIP_TRANSPORT_SECURE
+ },
+ {
PJSIP_TRANSPORT_SCTP,
5060,
{"SCTP", 4},
@@ -224,6 +231,13 @@
"TLS IPv6 transport",
PJSIP_TRANSPORT_RELIABLE | PJSIP_TRANSPORT_SECURE
},
+ {
+ PJSIP_TRANSPORT_DTLS6,
+ 5061,
+ {"DTLS", 4},
+ "DTLS IPv6 transport",
+ PJSIP_TRANSPORT_SECURE
+ },
};
static void tp_state_callback(pjsip_transport *tp,
@@ -249,7 +263,7 @@
*/
PJ_DEF(pj_status_t) pjsip_transport_register_type( unsigned tp_flag,
const char *tp_name,
- int def_port,
+ int def_port,
int *p_tp_type)
{
unsigned i;
--- a/pjsip/include/pjsip/sip_types.h
+++ b/pjsip/include/pjsip/sip_types.h
@@ -73,6 +73,9 @@
/** TLS. */
PJSIP_TRANSPORT_TLS,
+ /** DTLS. */
+ PJSIP_TRANSPORT_DTLS,
+
/** SCTP. */
PJSIP_TRANSPORT_SCTP,
@@ -95,7 +98,10 @@
PJSIP_TRANSPORT_TCP6 = PJSIP_TRANSPORT_TCP + PJSIP_TRANSPORT_IPV6,
/** TLS over IPv6 */
- PJSIP_TRANSPORT_TLS6 = PJSIP_TRANSPORT_TLS + PJSIP_TRANSPORT_IPV6
+ PJSIP_TRANSPORT_TLS6 = PJSIP_TRANSPORT_TLS + PJSIP_TRANSPORT_IPV6,
+
+ /** DTLS over IPv6 */
+ PJSIP_TRANSPORT_DTLS6 = PJSIP_TRANSPORT_DTLS + PJSIP_TRANSPORT_IPV6
} pjsip_transport_type_e;

View File

@ -0,0 +1,19 @@
diff --git a/pjlib/include/pj/config.h b/pjlib/include/pj/config.h
index 10f86fd..4ace1bc 100644
--- a/pjlib/include/pj/config.h
+++ b/pjlib/include/pj/config.h
@@ -245,7 +245,13 @@
# define PJ_M_NAME "armv4"
# define PJ_HAS_PENTIUM 0
# if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN
-# error Endianness must be declared for this processor
+# if defined(__GNUC__)
+# include <endian.h>
+# define PJ_IS_LITTLE_ENDIAN __BYTE_ORDER__ == __LITTLE_ENDIAN__
+# define PJ_IS_BIG_ENDIAN __BYTE_ORDER__ == __BIG_ENDIAN__
+# else
+# error Endianness must be declared for this processor
+# endif
# endif
#elif defined (PJ_M_POWERPC) || defined(__powerpc) || defined(__powerpc__) || \

View File

@ -0,0 +1,20 @@
--- a/pjlib-util/src/pjlib-util/base64.c 2017-05-03 10:29:07.200417026 -0400
+++ b/pjlib-util/src/pjlib-util/base64.c 2017-05-03 10:28:30.344335390 -0400
@@ -131,7 +131,7 @@
PJ_ASSERT_RETURN(input && out && out_len, PJ_EINVAL);
- while (buf[len-1] == '=' && len)
+ while (len && buf[len-1] == '=')
--len;
PJ_ASSERT_RETURN(*out_len >= PJ_BASE64_TO_BASE256_LEN(len),
@@ -161,7 +161,7 @@
out[j++] = (pj_uint8_t)(((c[2] & 0x03)<<6) | (c[3] & 0x3F));
}
- pj_assert(j < *out_len);
+ pj_assert(j <= *out_len);
*out_len = j;
return PJ_SUCCESS;

View File

@ -0,0 +1,19 @@
--- a/pjlib/src/pj/ioqueue_common_abs.c 2015-11-05 23:18:46.000000000 -0500
+++ b/pjlib/src/pj/ioqueue_common_abs.c 2016-10-21 13:49:09.183662433 -0400
@@ -1048,5 +1048,6 @@
* Check that address storage can hold the address parameter.
*/
- PJ_ASSERT_RETURN(addrlen <= (int)sizeof(pj_sockaddr_in), PJ_EBUG);
+ PJ_ASSERT_RETURN((((pj_sockaddr*)addr)->addr.sa_family == pj_AF_INET() && addrlen <= (int)sizeof(pj_sockaddr_in)) ||
+ (((pj_sockaddr*)addr)->addr.sa_family == pj_AF_INET6() && addrlen <= (int)sizeof(pj_sockaddr_in6)), PJ_EBUG);
/*
--- a/pjlib/src/pj/ioqueue_common_abs.h 2013-02-21 06:18:36.000000000 -0500
+++ b/pjlib/src/pj/ioqueue_common_abs.h 2016-10-21 14:04:04.148928591 -0400
@@ -64,5 +64,5 @@
pj_ssize_t written;
unsigned flags;
- pj_sockaddr_in rmt_addr;
+ pj_sockaddr rmt_addr;
int rmt_addrlen;
};

View File

@ -0,0 +1,53 @@
--- a/pjnath/src/pjnath/turn_session.c 2016-09-19 18:21:09.073614574 -0400
+++ b/pjnath/src/pjnath/turn_session.c 2016-09-19 18:21:30.648631620 -0400
@@ -653,3 +653,3 @@
- cnt = PJ_TURN_MAX_DNS_SRV_CNT;
+ cnt = 1;
ai = (pj_addrinfo*)
--- a/pjnath/src/pjnath/ice_strans.c 2016-09-19 18:36:04.180104330 -0400
+++ b/pjnath/src/pjnath/ice_strans.c 2016-09-19 18:37:10.614136809 -0400
@@ -1304,2 +1304,5 @@
+ if (!comp->turn[n].sock)
+ continue;
+
/* Gather remote addresses for this component */
@@ -1995,4 +1998,37 @@
sess_init_update(comp->ice_st);
+ } else if ((old_state == PJ_TURN_STATE_RESOLVING || old_state == PJ_TURN_STATE_ALLOCATING) &&
+ new_state >= PJ_TURN_STATE_DEALLOCATING)
+ {
+ pj_ice_sess_cand *cand = NULL;
+ unsigned i;
+
+ /* DNS resolution has failed! */
+ ++comp->turn[tp_idx].err_cnt;
+
+ /* Unregister ourself from the TURN relay */
+ pj_turn_sock_set_user_data(turn_sock, NULL);
+ comp->turn[tp_idx].sock = NULL;
+
+ /* Wait until initialization completes */
+ pj_grp_lock_acquire(comp->ice_st->grp_lock);
+
+ /* Find relayed candidate in the component */
+ for (i=0; i<comp->cand_cnt; ++i) {
+ if (comp->cand_list[i].type == PJ_ICE_CAND_TYPE_RELAYED &&
+ comp->cand_list[i].transport_id == data->transport_id)
+ {
+ cand = &comp->cand_list[i];
+ break;
+ }
+ }
+ pj_assert(cand != NULL);
+
+ pj_grp_lock_release(comp->ice_st->grp_lock);
+
+ cand->status = old_state == PJ_TURN_STATE_RESOLVING ? PJ_ERESOLVE : PJ_EINVALIDOP;
+
+ sess_init_update(comp->ice_st);
+
} else if (new_state >= PJ_TURN_STATE_DEALLOCATING) {
pj_turn_session_info info;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
--- a/pjnath/include/pjnath/config.h
+++ b/pjnath/include/pjnath/config.h
@@ -233,3 +233,3 @@
#ifndef PJ_ICE_MAX_CAND
-# define PJ_ICE_MAX_CAND 16
+# define PJ_ICE_MAX_CAND 256
#endif
@@ -243,3 +243,3 @@
#ifndef PJ_ICE_ST_MAX_CAND
-# define PJ_ICE_ST_MAX_CAND 8
+# define PJ_ICE_ST_MAX_CAND 32
#endif
@@ -254,3 +254,3 @@
#ifndef PJ_ICE_MAX_STUN
-# define PJ_ICE_MAX_STUN 2
+# define PJ_ICE_MAX_STUN 3
#endif
@@ -274,3 +274,3 @@
#ifndef PJ_ICE_COMP_BITS
-# define PJ_ICE_COMP_BITS 1
+# define PJ_ICE_COMP_BITS 2
#endif
@@ -325,3 +325,3 @@
#ifndef PJ_ICE_MAX_CHECKS
-# define PJ_ICE_MAX_CHECKS 32
+# define PJ_ICE_MAX_CHECKS 150
#endif

View File

@ -0,0 +1,11 @@
--- a/pjlib/include/pj/config.h
+++ b/pjlib/include/pj/config.h
@@ -549,7 +549,7 @@
* Default: 0 (disabled, for now)
*/
#ifndef PJ_HAS_IPV6
-# define PJ_HAS_IPV6 0
+# define PJ_HAS_IPV6 1
#endif
/**

View File

@ -0,0 +1,66 @@
diff --git a/pjproject/pjsip/src/pjsip/sip_transport.c b/pjproject_new/pjsip/src/pjsip/sip_transport.c
index 4b2cc1a..22e3603 100644
--- a/pjsip/src/pjsip/sip_transport.c
+++ b/pjsip/src/pjsip/sip_transport.c
@@ -1248,22 +1248,22 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_register_tpfactory( pjsip_tpmgr *mgr,
pj_lock_acquire(mgr->lock);
- /* Check that no factory with the same type has been registered. */
+ /* Check that no factory with the same type and bound address has been registered. */
status = PJ_SUCCESS;
for (p=mgr->factory_list.next; p!=&mgr->factory_list; p=p->next) {
- if (p->type == tpf->type) {
- status = PJSIP_ETYPEEXISTS;
- break;
- }
- if (p == tpf) {
- status = PJ_EEXISTS;
- break;
- }
+ if (p->type == tpf->type && !pj_sockaddr_cmp(&tpf->local_addr, &p->local_addr)) {
+ status = PJSIP_ETYPEEXISTS;
+ break;
+ }
+ if (p == tpf) {
+ status = PJ_EEXISTS;
+ break;
+ }
}
if (status != PJ_SUCCESS) {
- pj_lock_release(mgr->lock);
- return status;
+ pj_lock_release(mgr->lock);
+ return status;
}
pj_list_insert_before(&mgr->factory_list, tpf);
@@ -2047,13 +2047,11 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_acquire_transport2(pjsip_tpmgr *mgr,
pj_memcpy(&key.rem_addr, remote, addr_len);
transport = (pjsip_transport*)
- pj_hash_get(mgr->table, &key, key_len, NULL);
-
+ pj_hash_get(mgr->table, &key, key_len, NULL);
+ unsigned flag = pjsip_transport_get_flag_from_type(type);
if (transport == NULL) {
- unsigned flag = pjsip_transport_get_flag_from_type(type);
const pj_sockaddr *remote_addr = (const pj_sockaddr*)remote;
-
/* Ignore address for loop transports. */
if (type == PJSIP_TRANSPORT_LOOP ||
type == PJSIP_TRANSPORT_LOOP_DGRAM)
@@ -2135,6 +2135,11 @@ PJ_DEF(pj_status_t) pjsip_tpmgr_acquire_transport2(pjsip_tpmgr *mgr,
}
} else {
+ /* Make sure we don't use another factory than the one given if secure flag is set */
+ if (flag & PJSIP_TRANSPORT_SECURE) {
+ TRACE_((THIS_FILE, "Can't create new TLS transport with no provided suitable TLS listener."));
+ return PJSIP_ETPNOTSUITABLE;
+ }
/* Find factory with type matches the destination type */
factory = mgr->factory_list.next;

View File

@ -0,0 +1,97 @@
diff --git a/Makefile b/Makefile
index 33a4e6b..a486eb7 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ include build/host-$(HOST_NAME).mak
include version.mak
LIB_DIRS = pjlib/build pjlib-util/build pjnath/build third_party/build pjmedia/build pjsip/build
-DIRS = $(LIB_DIRS) pjsip-apps/build $(EXTRA_DIRS)
+DIRS = $(LIB_DIRS) $(EXTRA_DIRS)
ifdef MINSIZE
MAKE_FLAGS := MINSIZE=1
diff --git a/pjlib-util/build/Makefile b/pjlib-util/build/Makefile
index cb601cb..862a78a 100644
--- a/pjlib-util/build/Makefile
+++ b/pjlib-util/build/Makefile
@@ -54,7 +54,6 @@ export UTIL_TEST_OBJS += xml.o encryption.o stun.o resolver_test.o test.o \
export UTIL_TEST_CFLAGS += $(_CFLAGS)
export UTIL_TEST_CXXFLAGS += $(_CXXFLAGS)
export UTIL_TEST_LDFLAGS += $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(_LDFLAGS)
-export UTIL_TEST_EXE:=pjlib-util-test-$(TARGET_NAME)$(HOST_EXE)
export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
diff --git a/pjlib/build/Makefile b/pjlib/build/Makefile
index 1e64950..a75fa65 100644
--- a/pjlib/build/Makefile
+++ b/pjlib/build/Makefile
@@ -56,7 +56,6 @@ export TEST_OBJS += activesock.o atomic.o echo_clt.o errno.o exception.o \
export TEST_CFLAGS += $(_CFLAGS)
export TEST_CXXFLAGS += $(_CXXFLAGS)
export TEST_LDFLAGS += $(PJLIB_LDLIB) $(_LDFLAGS)
-export TEST_EXE := pjlib-test-$(TARGET_NAME)$(HOST_EXE)
export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
diff --git a/pjmedia/build/Makefile b/pjmedia/build/Makefile
index 8012cb7..2ca283a 100644
--- a/pjmedia/build/Makefile
+++ b/pjmedia/build/Makefile
@@ -165,7 +165,6 @@ export PJMEDIA_TEST_LDFLAGS += $(PJMEDIA_CODEC_LDLIB) \
$(PJLIB_UTIL_LDLIB) \
$(PJNATH_LDLIB) \
$(_LDFLAGS)
-export PJMEDIA_TEST_EXE:=pjmedia-test-$(TARGET_NAME)$(HOST_EXE)
export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
diff --git a/pjnath/build/Makefile b/pjnath/build/Makefile
index 1bc08b5..109f79b 100644
--- a/pjnath/build/Makefile
+++ b/pjnath/build/Makefile
@@ -54,7 +54,6 @@ export PJNATH_TEST_OBJS += ice_test.o stun.o sess_auth.o server.o concur_test.o
export PJNATH_TEST_CFLAGS += $(_CFLAGS)
export PJNATH_TEST_CXXFLAGS += $(_CXXFLAGS)
export PJNATH_TEST_LDFLAGS += $(PJNATH_LDLIB) $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(_LDFLAGS)
-export PJNATH_TEST_EXE:=pjnath-test-$(TARGET_NAME)$(HOST_EXE)
###############################################################################
@@ -65,7 +64,6 @@ export PJTURN_CLIENT_OBJS += client_main.o
export PJTURN_CLIENT_CFLAGS += $(_CFLAGS)
export PJTURN_CLIENT_CXXFLAGS += $(_CXXFLAGS)
export PJTURN_CLIENT_LDFLAGS += $(PJNATH_LDLIB) $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(_LDFLAGS)
-export PJTURN_CLIENT_EXE:=pjturn-client-$(TARGET_NAME)$(HOST_EXE)
###############################################################################
# Defines for building TURN server application
@@ -76,7 +74,6 @@ export PJTURN_SRV_OBJS += allocation.o auth.o listener_udp.o \
export PJTURN_SRV_CFLAGS += $(_CFLAGS)
export PJTURN_SRV_CXXFLAGS += $(_CXXFLAGS)
export PJTURN_SRV_LDFLAGS += $(PJNATH_LDLIB) $(PJLIB_UTIL_LDLIB) $(PJLIB_LDLIB) $(_LDFLAGS)
-export PJTURN_SRV_EXE:=pjturn-srv-$(TARGET_NAME)$(HOST_EXE)
diff --git a/pjsip/build/Makefile b/pjsip/build/Makefile
index d2a5c2a..7e2ec60 100644
--- a/pjsip/build/Makefile
+++ b/pjsip/build/Makefile
@@ -165,7 +165,6 @@ export PJSUA2_TEST_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
export PJSUA2_TEST_CFLAGS += $(_CFLAGS) $(PJ_VIDEO_CFLAGS)
export PJSUA2_TEST_CXXFLAGS = $(PJSUA2_LIB_CFLAGS)
export PJSUA2_TEST_LDFLAGS += $(PJ_LDXXFLAGS) $(PJ_LDXXLIBS) $(LDFLAGS)
-export PJSUA2_TEST_EXE := pjsua2-test-$(TARGET_NAME)$(HOST_EXE)
export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT
@@ -195,7 +194,6 @@ export TEST_LDFLAGS += $(PJSIP_LDLIB) \
$(PJLIB_UTIL_LDLIB) \
$(PJNATH_LDLIB) \
$(_LDFLAGS)
-export TEST_EXE := pjsip-test-$(TARGET_NAME)$(HOST_EXE)
export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT

View File

@ -0,0 +1,22 @@
--- a/pjnath/include/pjnath/ice_strans.h
+++ b/pjnath/include/pjnath/ice_strans.h
@@ -845,6 +845,8 @@ PJ_DECL(pj_status_t) pj_ice_strans_sendt
int dst_addr_len);
+PJ_DECL(pj_ice_sess *) pj_ice_strans_get_ice_sess(pj_ice_strans *ice_st);
+
/**
* @}
*/
--- a/pjnath/src/pjnath/ice_strans.c
+++ b/pjnath/src/pjnath/ice_strans.c
@@ -1243,6 +1243,11 @@ PJ_DEF(pj_status_t) pj_ice_strans_sendto
return PJ_EINVALIDOP;
}
+PJ_DECL(pj_ice_sess *) pj_ice_strans_get_ice_sess( pj_ice_strans *ice_st )
+{
+ return ice_st->ice;
+}
+

View File

@ -0,0 +1,57 @@
# Description: Open source SIP stack and media stack, built with patches from SavoirFaire Linux (mostly GnuTLS support)
# URL: http://www.pjsip.org/
# Packager: milisarge
# Depends on: gnutls portaudio speex alsa-lib libsamplerate ffmpeg libsrtp opus gsm libsrtp
name=pjproject-ring
_name=pjproject
version=2.6
release=1
source=(http://www.pjsip.org/release/2.6/$_name-$version.tar.bz2
endianness.patch
gnutls.patch
notestsapps.patch
fix_base64.patch
ipv6.patch
ice_config.patch
multiple_listeners.patch
pj_ice_sess.patch
fix_turn_fallback.patch
fix_ioqueue_ipv6_sendto.patch
add_dtls_transport.patch)
build() {
cd "${SRC}/${_name}-${version}"
for patch in endianness.patch gnutls.patch notestsapps.patch fix_base64.patch \
ipv6.patch ice_config.patch multiple_listeners.patch \
pj_ice_sess.patch fix_turn_fallback.patch \
fix_ioqueue_ipv6_sendto.patch add_dtls_transport.patch
do
patch -p1 < ../"$patch"
done
cd "${SRC}/${_name}-${version}"
export CXXFLAGS="${CXXFLAGS} -DNDEBUG -fPIC -DPJSIP_MAX_PKT_LEN=8000"
export CFLAGS="${CXXFLAGS}"
./configure \
--prefix=/usr \
--enable-shared \
--enable-ssl=gnutls \
--with-external-speex \
--with-external-srtp \
--with-external-pa \
--with-external-gsm \
--enable-ext-sound \
--disable-oss \
--disable-opencore-amr \
--disable-v4l2 \
--disable-video \
--disable-sound
make dep
make
make DESTDIR="${PKG}" install
}