File 0014-Add-new-compile-time-setting-PJ_ICE_ST_USE_TURN_PERM.patch of Package pjproject
From afb1e188a9b1ee532634cabdd41937d0f21d97db Mon Sep 17 00:00:00 2001
From: Nanang Izzuddin <nanang@teluu.com>
Date: Fri, 7 Aug 2020 16:23:09 +0700
Subject: [PATCH 2/3] Add new compile-time setting
PJ_ICE_ST_USE_TURN_PERMANENT_PERM, if set, TURN client session will
automatically renew permission for all remote candidates.
---
pjnath/include/pjnath/config.h | 11 +++++++++++
pjnath/src/pjnath/ice_strans.c | 5 +++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/pjnath/include/pjnath/config.h b/pjnath/include/pjnath/config.h
index fc1e27550..bc2f4b158 100644
--- a/pjnath/include/pjnath/config.h
+++ b/pjnath/include/pjnath/config.h
@@ -457,6 +457,17 @@
#endif
+/**
+ * This constant specifies whether ICE stream transport should allow TURN
+ * client session to automatically renew permission for all remote candidates.
+ *
+ * Default: PJ_FALSE
+ */
+#ifndef PJ_ICE_ST_USE_TURN_PERMANENT_PERM
+# define PJ_ICE_ST_USE_TURN_PERMANENT_PERM PJ_FALSE
+#endif
+
+
/** ICE session pool initial size. */
#ifndef PJNATH_POOL_LEN_ICE_SESS
# define PJNATH_POOL_LEN_ICE_SESS 512
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c
index 54ae9f769..5630b69e5 100644
--- a/pjnath/src/pjnath/ice_strans.c
+++ b/pjnath/src/pjnath/ice_strans.c
@@ -1504,8 +1504,9 @@ PJ_DEF(pj_status_t) pj_ice_strans_start_ice( pj_ice_strans *ice_st,
}
if (count && !comp->turn[n].err_cnt && comp->turn[n].sock) {
- status = pj_turn_sock_set_perm(comp->turn[n].sock, count,
- addrs, 0);
+ status = pj_turn_sock_set_perm(
+ comp->turn[n].sock, count,
+ addrs, PJ_ICE_ST_USE_TURN_PERMANENT_PERM);
if (status != PJ_SUCCESS) {
pj_ice_strans_stop_ice(ice_st);
return status;
--
2.25.1