[svn-commits] file: branch 11 r397604 - in /branches/11: ./ res/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Aug 23 16:57:15 CDT 2013
Author: file
Date: Fri Aug 23 16:57:14 2013
New Revision: 397604
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397604
Log:
Make libuuid an optional dependency for res_rtp_asterisk instead of a requirement.
Modified:
branches/11/UPGRADE.txt
branches/11/res/Makefile
branches/11/res/res_rtp_asterisk.c
Modified: branches/11/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/branches/11/UPGRADE.txt?view=diff&rev=397604&r1=397603&r2=397604
==============================================================================
--- branches/11/UPGRADE.txt (original)
+++ branches/11/UPGRADE.txt Fri Aug 23 16:57:14 2013
@@ -23,7 +23,9 @@
* res_agi will now properly indicate if there was an error in streaming an
audio file. The result code will be -1 and the result returned from the
the function will be RESULT_FAILURE instead of the prior behavior of always
- returning RESULT_SUCCESS even if there was an error.
+ returning RESULT_SUCCESS even if there was an error.
+* The libuuid development library is now optional for res_rtp_asterisk. If the
+ library is not present when building ICE and TURN support will not be present.
From 11.4 to 11.5:
* The default settings for chan_sip are now overriden properly by the general
Modified: branches/11/res/Makefile
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/Makefile?view=diff&rev=397604&r1=397603&r2=397604
==============================================================================
--- branches/11/res/Makefile (original)
+++ branches/11/res/Makefile Fri Aug 23 16:57:14 2013
@@ -9,7 +9,7 @@
# the GNU General Public License
#
--include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
+-include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps $(ASTTOPDIR)/build_tools/menuselect-deps
MODULE_PREFIX=res
MENUSELECT_CATEGORY=RES
@@ -86,7 +86,10 @@
$(PJ_LIB_FILES): FORCE
$(MAKE) -C $(patsubst %/lib/,%,$(dir $@))/build/ ../lib/$(notdir $@)
+ifeq ($(subst 1:0,1,$(UUID)), 1)
res_rtp_asterisk.o: $(PJ_LIB_FILES)
+res_rtp_asterisk.o: _ASTCFLAGS+=-DUSE_PJPROJECT
res_rtp_asterisk.o: _ASTCFLAGS+=$(PJ_CFLAGS)
res_rtp_asterisk.so: _ASTLDFLAGS+=$(PJ_LDFLAGS)
res_rtp_asterisk.so: LIBS+=$(PJ_LDLIBS)
+endif
Modified: branches/11/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/res_rtp_asterisk.c?view=diff&rev=397604&r1=397603&r2=397604
==============================================================================
--- branches/11/res/res_rtp_asterisk.c (original)
+++ branches/11/res/res_rtp_asterisk.c Fri Aug 23 16:57:14 2013
@@ -29,7 +29,7 @@
*/
/*** MODULEINFO
- <depend>uuid</depend>
+ <use type="external">uuid</use>
<support_level>core</support_level>
***/
@@ -47,6 +47,7 @@
#include <openssl/bio.h>
#endif
+#ifdef USE_PJPROJECT
/* Asterisk discourages the use of bzero in favor of memset, in fact if you try to use bzero it will tell you to use memset. As a result bzero has to be undefined
* here since it is used internally by pjlib. The only other option would be to modify pjlib... which won't happen. */
#undef bzero
@@ -54,6 +55,7 @@
#include "pjlib.h"
#include "pjlib-util.h"
#include "pjnath.h"
+#endif
#include "asterisk/stun.h"
#include "asterisk/pbx.h"
@@ -136,6 +138,8 @@
static int learning_min_sequential = DEFAULT_LEARNING_MIN_SEQUENTIAL; /*< Number of sequential RTP frames needed from a single source during learning mode to accept new source. */
static int icesupport = DEFAULT_ICESUPPORT;
static struct sockaddr_in stunaddr;
+
+#ifdef USE_PJPROJECT
static pj_str_t turnaddr;
static int turnport = DEFAULT_TURN_PORT;
static pj_str_t turnusername;
@@ -158,6 +162,7 @@
/*! \brief Notification that the ICE/TURN worker thread should stop */
static int worker_terminate;
+#endif
#define FLAG_3389_WARNING (1 << 0)
#define FLAG_NAT_ACTIVE (3 << 1)
@@ -255,6 +260,7 @@
struct rtp_red *red;
+#ifdef USE_PJPROJECT
pj_ice_sess *ice; /*!< ICE session */
pj_turn_sock *turn_rtp; /*!< RTP TURN relay */
pj_turn_sock *turn_rtcp; /*!< RTCP TURN relay */
@@ -272,6 +278,7 @@
struct ao2_container *local_candidates; /*!< The local ICE candidates */
struct ao2_container *remote_candidates; /*!< The remote ICE candidates */
+#endif
#ifdef HAVE_OPENSSL_SRTP
SSL_CTX *ssl_ctx; /*!< SSL context */
@@ -399,6 +406,7 @@
static int __rtp_sendto(struct ast_rtp_instance *instance, void *buf, size_t size, int flags, struct ast_sockaddr *sa, int rtcp, int *ice, int use_srtp);
+#ifdef USE_PJPROJECT
/*! \brief Destructor for locally created ICE candidates */
static void ast_rtp_ice_candidate_destroy(void *obj)
{
@@ -697,6 +705,7 @@
.get_local_candidates = ast_rtp_ice_get_local_candidates,
.ice_lite = ast_rtp_ice_lite,
};
+#endif
#ifdef HAVE_OPENSSL_SRTP
static void dtls_info_callback(const SSL *ssl, int where, int ret)
@@ -1024,7 +1033,9 @@
.stop = ast_rtp_stop,
.qos = ast_rtp_qos_set,
.sendcng = ast_rtp_sendcng,
+#ifdef USE_PJPROJECT
.ice = &ast_rtp_ice,
+#endif
#ifdef HAVE_OPENSSL_SRTP
.dtls = &ast_rtp_dtls,
.activate = ast_rtp_activate,
@@ -1033,6 +1044,7 @@
static void rtp_learning_seq_init(struct rtp_learning_info *info, uint16_t seq);
+#ifdef USE_PJPROJECT
static void ast_rtp_on_ice_complete(pj_ice_sess *ice, pj_status_t status)
{
struct ast_rtp *rtp = ice->user_data;
@@ -1200,6 +1212,7 @@
return 0;
}
+#endif
static inline int rtp_debug_test_addr(struct ast_sockaddr *addr)
{
@@ -1454,6 +1467,7 @@
}
#endif
+#ifdef USE_PJPROJECT
if (rtp->ice) {
pj_str_t combined = pj_str(ast_sockaddr_stringify(sa));
pj_sockaddr address;
@@ -1479,6 +1493,7 @@
}
rtp->passthrough = 0;
}
+#endif
if ((*in & 0xC0) && res_srtp && srtp && res_srtp->unprotect(srtp, buf, &len, rtcp) < 0) {
return -1;
@@ -1510,6 +1525,7 @@
return -1;
}
+#ifdef USE_PJPROJECT
if (rtp->ice) {
pj_thread_register_check();
@@ -1518,6 +1534,7 @@
return 0;
}
}
+#endif
return ast_sendto(rtcp ? rtp->rtcp->s : rtp->s, temp, len, flags, sa);
}
@@ -1635,6 +1652,7 @@
return (info->packets == 0);
}
+#ifdef USE_PJPROJECT
static void rtp_add_candidates_to_ice(struct ast_rtp_instance *instance, struct ast_rtp *rtp, struct ast_sockaddr *addr, int port, int component,
int transport, const pj_turn_sock_cb *turn_cb, pj_turn_sock **turn_sock)
{
@@ -1699,6 +1717,7 @@
}
}
}
+#endif
static int ast_rtp_new(struct ast_rtp_instance *instance,
struct ast_sched_context *sched, struct ast_sockaddr *addr,
@@ -1706,17 +1725,21 @@
{
struct ast_rtp *rtp = NULL;
int x, startplace;
+#ifdef USE_PJPROJECT
pj_stun_config stun_config;
pj_str_t ufrag, passwd;
+#endif
/* Create a new RTP structure to hold all of our data */
if (!(rtp = ast_calloc(1, sizeof(*rtp)))) {
return -1;
}
+#ifdef USE_PJPROJECT
/* Initialize synchronization aspects */
ast_mutex_init(&rtp->lock);
ast_cond_init(&rtp->cond, NULL);
+#endif
/* Set default parameters on the newly created RTP structure */
rtp->ssrc = ast_random();
@@ -1765,6 +1788,9 @@
}
}
+ ast_rtp_instance_set_data(instance, rtp);
+
+#ifdef USE_PJPROJECT
pj_thread_register_check();
pj_stun_config_init(&stun_config, &cachingpool.factory, 0, ioqueue, timerheap);
@@ -1774,8 +1800,6 @@
generate_random_string(rtp->local_passwd, sizeof(rtp->local_passwd));
passwd = pj_str(rtp->local_passwd);
- ast_rtp_instance_set_data(instance, rtp);
-
/* Create an ICE session for ICE negotiation */
if (icesupport && pj_ice_sess_create(&stun_config, NULL, PJ_ICE_SESS_ROLE_UNKNOWN, 2, &ast_rtp_ice_sess_cb, &ufrag, &passwd, &rtp->ice) == PJ_SUCCESS) {
/* Make this available for the callbacks */
@@ -1784,6 +1808,7 @@
/* Add all of the available candidates to the ICE session */
rtp_add_candidates_to_ice(instance, rtp, addr, x, COMPONENT_RTP, TRANSPORT_SOCKET_RTP, &ast_rtp_turn_rtp_sock_cb, &rtp->turn_rtp);
}
+#endif
/* Record any information we may need */
rtp->sched = sched;
@@ -1826,6 +1851,7 @@
ast_free(rtp->red);
}
+#ifdef USE_PJPROJECT
pj_thread_register_check();
/* Destroy the ICE session if being used */
@@ -1854,6 +1880,11 @@
ao2_ref(rtp->remote_candidates, -1);
}
+ /* Destroy synchronization items */
+ ast_mutex_destroy(&rtp->lock);
+ ast_cond_destroy(&rtp->cond);
+#endif
+
#ifdef HAVE_OPENSSL_SRTP
/* Destroy the SSL context if present */
if (rtp->ssl_ctx) {
@@ -1865,10 +1896,6 @@
SSL_free(rtp->ssl);
}
#endif
-
- /* Destroy synchronization items */
- ast_mutex_destroy(&rtp->lock);
- ast_cond_destroy(&rtp->cond);
/* Finally destroy ourselves */
ast_free(rtp);
@@ -1943,7 +1970,9 @@
ast_sockaddr_stringify(&remote_address),
strerror(errno));
}
+#ifdef USE_PJPROJECT
update_address_with_ice_candidate(rtp, COMPONENT_RTP, &remote_address);
+#endif
if (rtp_debug_test_addr(&remote_address)) {
ast_verbose("Sent RTP DTMF packet to %s%s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n",
ast_sockaddr_stringify(&remote_address),
@@ -1993,7 +2022,9 @@
strerror(errno));
}
+#ifdef USE_PJPROJECT
update_address_with_ice_candidate(rtp, COMPONENT_RTP, &remote_address);
+#endif
if (rtp_debug_test_addr(&remote_address)) {
ast_verbose("Sent RTP DTMF packet to %s%s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n",
@@ -2068,7 +2099,9 @@
strerror(errno));
}
+#ifdef USE_PJPROJECT
update_address_with_ice_candidate(rtp, COMPONENT_RTP, &remote_address);
+#endif
if (rtp_debug_test_addr(&remote_address)) {
ast_verbose("Sent RTP DTMF packet to %s%s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n",
@@ -2251,7 +2284,9 @@
rtp->rtcp->rr_count++;
+#ifdef USE_PJPROJECT
update_address_with_ice_candidate(rtp, COMPONENT_RTCP, &remote_address);
+#endif
if (rtcp_debug_test_addr(&remote_address)) {
ast_verbose("\n* Sending RTCP RR to %s%s\n"
@@ -2362,7 +2397,9 @@
rtp->rtcp->lastsrtxcount = rtp->txcount;
+#ifdef USE_PJPROJECT
update_address_with_ice_candidate(rtp, COMPONENT_RTCP, &remote_address);
+#endif
if (rtcp_debug_test_addr(&rtp->rtcp->them)) {
ast_verbose("* Sent RTCP SR to %s%s\n", ast_sockaddr_stringify(&remote_address), ice ? " (via ICE)" : "");
@@ -2551,7 +2588,9 @@
}
}
+#ifdef USE_PJPROJECT
update_address_with_ice_candidate(rtp, COMPONENT_RTP, &remote_address);
+#endif
if (rtp_debug_test_addr(&remote_address)) {
ast_verbose("Sent RTP packet to %s%s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n",
@@ -3430,7 +3469,9 @@
return 0;
}
+#ifdef USE_PJPROJECT
update_address_with_ice_candidate(rtp, COMPONENT_RTP, &remote_address);
+#endif
if (rtp_debug_test_addr(&remote_address)) {
ast_verbose("Sent RTP P2P packet to %s%s (type %-2.2d, len %-6.6u)\n",
@@ -3879,10 +3920,12 @@
ast_debug(1, "Setup RTCP on RTP instance '%p'\n", instance);
rtp->rtcp->schedid = -1;
+#ifdef USE_PJPROJECT
if (rtp->ice) {
rtp_add_candidates_to_ice(instance, rtp, &rtp->rtcp->us, ast_sockaddr_port(&rtp->rtcp->us), COMPONENT_RTCP, TRANSPORT_SOCKET_RTCP,
&ast_rtp_turn_rtcp_sock_cb, &rtp->turn_rtcp);
}
+#endif
return;
} else {
@@ -4171,7 +4214,9 @@
return res;
}
+#ifdef USE_PJPROJECT
update_address_with_ice_candidate(rtp, COMPONENT_RTP, &remote_address);
+#endif
if (rtp_debug_test_addr(&remote_address)) {
ast_verbose("Sent Comfort Noise RTP packet to %s%s (type %-2.2d, seq %-6.6u, ts %-6.6u, len %-6.6u)\n",
@@ -4361,11 +4406,13 @@
*/
icesupport = DEFAULT_ICESUPPORT;
+ memset(&stunaddr, 0, sizeof(stunaddr));
+#ifdef USE_PJPROJECT
turnport = DEFAULT_TURN_PORT;
- memset(&stunaddr, 0, sizeof(stunaddr));
turnaddr = pj_str(NULL);
turnusername = pj_str(NULL);
turnpassword = pj_str(NULL);
+#endif
if (cfg) {
if ((s = ast_variable_retrieve(cfg, "general", "rtpstart"))) {
@@ -4425,6 +4472,7 @@
ast_log(LOG_WARNING, "Invalid STUN server address: %s\n", s);
}
}
+#ifdef USE_PJPROJECT
if ((s = ast_variable_retrieve(cfg, "general", "turnaddr"))) {
struct sockaddr_in addr;
addr.sin_port = htons(DEFAULT_TURN_PORT);
@@ -4443,6 +4491,7 @@
if ((s = ast_variable_retrieve(cfg, "general", "turnpassword"))) {
pj_strdup2(pool, &turnpassword, s);
}
+#endif
ast_config_destroy(cfg);
}
if (rtpstart >= rtpend) {
@@ -4462,6 +4511,7 @@
static int load_module(void)
{
+#ifdef USE_PJPROJECT
pj_lock_t *lock;
pj_log_set_level(0);
@@ -4509,23 +4559,28 @@
pj_shutdown();
return AST_MODULE_LOAD_DECLINE;
}
+#endif
if (ast_rtp_engine_register(&asterisk_rtp_engine)) {
+#ifdef USE_PJPROJECT
worker_terminate = 1;
pj_thread_join(thread);
pj_thread_destroy(thread);
pj_caching_pool_destroy(&cachingpool);
pj_shutdown();
+#endif
return AST_MODULE_LOAD_DECLINE;
}
if (ast_cli_register_multiple(cli_rtp, ARRAY_LEN(cli_rtp))) {
+#ifdef USE_PJPROJECT
worker_terminate = 1;
pj_thread_join(thread);
pj_thread_destroy(thread);
ast_rtp_engine_unregister(&asterisk_rtp_engine);
pj_caching_pool_destroy(&cachingpool);
pj_shutdown();
+#endif
return AST_MODULE_LOAD_DECLINE;
}
@@ -4539,6 +4594,7 @@
ast_rtp_engine_unregister(&asterisk_rtp_engine);
ast_cli_unregister_multiple(cli_rtp, ARRAY_LEN(cli_rtp));
+#ifdef USE_PJPROJECT
worker_terminate = 1;
pj_thread_register_check();
@@ -4548,6 +4604,7 @@
pj_caching_pool_destroy(&cachingpool);
pj_shutdown();
+#endif
return 0;
}
More information about the svn-commits
mailing list