diff options
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjproject.c | 12 | ||||
-rw-r--r-- | res/res_pjsip.c | 4 | ||||
-rw-r--r-- | res/res_pjsip/location.c | 4 | ||||
-rw-r--r-- | res/res_pjsip_history.c | 5 | ||||
-rw-r--r-- | res/res_pjsip_refer.c | 32 | ||||
-rw-r--r-- | res/res_pjsip_sdp_rtp.c | 11 | ||||
-rw-r--r-- | res/res_rtp_asterisk.c | 7 | ||||
-rw-r--r-- | res/res_sdp_translator_pjmedia.c | 14 |
8 files changed, 63 insertions, 26 deletions
diff --git a/res/res_pjproject.c b/res/res_pjproject.c index f506a62fd..ebd71b99b 100644 --- a/res/res_pjproject.c +++ b/res/res_pjproject.c @@ -459,6 +459,18 @@ static struct ast_cli_entry pjproject_cli[] = { AST_CLI_DEFINE(handle_pjproject_show_log_level, "Show the maximum active pjproject logging level"), }; +void ast_pjproject_caching_pool_init(pj_caching_pool *cp, + const pj_pool_factory_policy *policy, pj_size_t max_capacity) +{ + /* Passing a max_capacity of zero disables caching pools */ + pj_caching_pool_init(cp, policy, ast_option_pjproject_cache_pools ? max_capacity : 0); +} + +void ast_pjproject_caching_pool_destroy(pj_caching_pool *cp) +{ + pj_caching_pool_destroy(cp); +} + static int load_module(void) { ast_debug(3, "Starting PJPROJECT logging to Asterisk logger\n"); diff --git a/res/res_pjsip.c b/res/res_pjsip.c index ca173a8af..9f6b5d115 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -4998,7 +4998,7 @@ static int unload_pjsip(void *data) ast_pjsip_endpoint = NULL; if (caching_pool.lock) { - pj_caching_pool_destroy(&caching_pool); + ast_pjproject_caching_pool_destroy(&caching_pool); } pj_shutdown(); @@ -5015,7 +5015,7 @@ static int load_pjsip(void) * example code from PJLIB. This can be adjusted * if necessary. */ - pj_caching_pool_init(&caching_pool, NULL, 1024 * 1024); + ast_pjproject_caching_pool_init(&caching_pool, NULL, 1024 * 1024); if (pjsip_endpt_create(&caching_pool.factory, "SIP", &ast_pjsip_endpoint) != PJ_SUCCESS) { ast_log(LOG_ERROR, "Failed to create PJSIP endpoint structure. Aborting load\n"); goto error; diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c index 84f73c742..22da80577 100644 --- a/res/res_pjsip/location.c +++ b/res/res_pjsip/location.c @@ -17,8 +17,8 @@ */ #include "asterisk.h" -#include "pjsip.h" -#include "pjlib.h" +#include <pjsip.h> +#include <pjlib.h> #include "asterisk/res_pjsip.h" #include "asterisk/logger.h" diff --git a/res/res_pjsip_history.c b/res/res_pjsip_history.c index fa9e27f00..ab035a296 100644 --- a/res/res_pjsip_history.c +++ b/res/res_pjsip_history.c @@ -42,6 +42,7 @@ #include "asterisk/netsock2.h" #include "asterisk/vector.h" #include "asterisk/lock.h" +#include "asterisk/res_pjproject.h" #define HISTORY_INITIAL_SIZE 256 @@ -1369,7 +1370,7 @@ static int load_module(void) ast_log(LOG_WARNING, "Unable to register history log level\n"); } - pj_caching_pool_init(&cachingpool, &pj_pool_factory_default_policy, 0); + ast_pjproject_caching_pool_init(&cachingpool, &pj_pool_factory_default_policy, 0); AST_VECTOR_INIT(&vector_history, HISTORY_INITIAL_SIZE); @@ -1387,7 +1388,7 @@ static int unload_module(void) ast_sip_push_task_synchronous(NULL, clear_history_entries, NULL); AST_VECTOR_FREE(&vector_history); - pj_caching_pool_destroy(&cachingpool); + ast_pjproject_caching_pool_destroy(&cachingpool); if (log_level != -1) { ast_logger_unregister_level("PJSIP_HISTORY"); diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c index 5e0141b09..7d892f653 100644 --- a/res/res_pjsip_refer.c +++ b/res/res_pjsip_refer.c @@ -468,10 +468,20 @@ static struct refer_attended *refer_attended_alloc(struct ast_sip_session *trans return attended; } -static int defer_termination_cancel(void *data) +static int session_end_if_deferred_task(void *data) { struct ast_sip_session *session = data; + ast_sip_session_end_if_deferred(session); + ao2_ref(session, -1); + return 0; +} + +static int defer_termination_cancel_task(void *data) +{ + struct ast_sip_session *session = data; + + ast_sip_session_end_if_deferred(session); ast_sip_session_defer_termination_cancel(session); ao2_ref(session, -1); return 0; @@ -513,6 +523,7 @@ static int refer_attended_task(void *data) { struct refer_attended *attended = data; int response; + int (*task_cb)(void *data); if (attended->transferer_second->channel) { ast_debug(3, "Performing a REFER attended transfer - Transferer #1: %s Transferer #2: %s\n", @@ -543,13 +554,18 @@ static int refer_attended_task(void *data) } } - ast_sip_session_end_if_deferred(attended->transferer); - if (response != 200) { - if (!ast_sip_push_task(attended->transferer->serializer, - defer_termination_cancel, attended->transferer)) { - /* Gave the ref to the pushed task. */ - attended->transferer = NULL; - } + if (response == 200) { + task_cb = session_end_if_deferred_task; + } else { + task_cb = defer_termination_cancel_task; + } + if (!ast_sip_push_task(attended->transferer->serializer, + task_cb, attended->transferer)) { + /* Gave the ref to the pushed task. */ + attended->transferer = NULL; + } else { + /* Do this anyway even though it is the wrong serializer. */ + ast_sip_session_end_if_deferred(attended->transferer); } ao2_ref(attended, -1); diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index ce8ed82df..9f0cdd300 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -219,10 +219,13 @@ static int create_rtp(struct ast_sip_session *session, struct ast_sip_session_me (session->endpoint->media.tos_audio || session->endpoint->media.cos_audio)) { ast_rtp_instance_set_qos(session_media->rtp, session->endpoint->media.tos_audio, session->endpoint->media.cos_audio, "SIP RTP Audio"); - } else if (session_media->type == AST_MEDIA_TYPE_VIDEO && - (session->endpoint->media.tos_video || session->endpoint->media.cos_video)) { - ast_rtp_instance_set_qos(session_media->rtp, session->endpoint->media.tos_video, - session->endpoint->media.cos_video, "SIP RTP Video"); + } else if (session_media->type == AST_MEDIA_TYPE_VIDEO) { + ast_rtp_instance_set_prop(session_media->rtp, AST_RTP_PROPERTY_RETRANS_RECV, session->endpoint->media.webrtc); + ast_rtp_instance_set_prop(session_media->rtp, AST_RTP_PROPERTY_RETRANS_SEND, session->endpoint->media.webrtc); + if (session->endpoint->media.tos_video || session->endpoint->media.cos_video) { + ast_rtp_instance_set_qos(session_media->rtp, session->endpoint->media.tos_video, + session->endpoint->media.cos_video, "SIP RTP Video"); + } } ast_rtp_instance_set_last_rx(session_media->rtp, time(NULL)); diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index d3273b463..b53b38ad7 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -71,6 +71,9 @@ #include "asterisk/smoother.h" #include "asterisk/uuid.h" #include "asterisk/test.h" +#ifdef HAVE_PJPROJECT +#include "asterisk/res_pjproject.h" +#endif #define MAX_TIMESTAMP_SKEW 640 @@ -7376,7 +7379,7 @@ static void rtp_terminate_pjproject(void) pj_thread_destroy(timer_thread); } - pj_caching_pool_destroy(&cachingpool); + ast_pjproject_caching_pool_destroy(&cachingpool); pj_shutdown(); } #endif @@ -7401,7 +7404,7 @@ static int load_module(void) return AST_MODULE_LOAD_DECLINE; } - pj_caching_pool_init(&cachingpool, &pj_pool_factory_default_policy, 0); + ast_pjproject_caching_pool_init(&cachingpool, &pj_pool_factory_default_policy, 0); pool = pj_pool_create(&cachingpool.factory, "timer", 512, 512, NULL); diff --git a/res/res_sdp_translator_pjmedia.c b/res/res_sdp_translator_pjmedia.c index 772be272c..676e740bc 100644 --- a/res/res_sdp_translator_pjmedia.c +++ b/res/res_sdp_translator_pjmedia.c @@ -17,6 +17,11 @@ */ #include "asterisk.h" + +#include <pjlib.h> +#include <pjmedia.h> + +#include "asterisk/res_pjproject.h" #include "asterisk/sdp_translator.h" #include "asterisk/sdp_options.h" #include "asterisk/vector.h" @@ -27,10 +32,6 @@ #include "asterisk/module.h" #include "asterisk/sdp.h" -#ifdef HAVE_PJPROJECT -#include <pjlib.h> -#include <pjmedia.h> -#endif /*** MODULEINFO <depend>pjproject</depend> @@ -573,7 +574,7 @@ static int load_module(void) if (ast_sdp_register_translator(&pjmedia_translator)) { return AST_MODULE_LOAD_DECLINE; } - pj_caching_pool_init(&sdp_caching_pool, NULL, 1024 * 1024); + ast_pjproject_caching_pool_init(&sdp_caching_pool, NULL, 1024 * 1024); AST_TEST_REGISTER(pjmedia_to_sdp_test); AST_TEST_REGISTER(sdp_to_pjmedia_test); @@ -583,7 +584,7 @@ static int load_module(void) static int unload_module(void) { ast_sdp_unregister_translator(&pjmedia_translator); - pj_caching_pool_destroy(&sdp_caching_pool); + ast_pjproject_caching_pool_destroy(&sdp_caching_pool); AST_TEST_UNREGISTER(pjmedia_to_sdp_test); AST_TEST_UNREGISTER(sdp_to_pjmedia_test); return 0; @@ -600,4 +601,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJMEDIA SDP Translato .unload = unload_module, .reload = reload_module, .load_pri = AST_MODPRI_CHANNEL_DEPEND, + .requires = "res_pjproject", ); |