From c315460abbb6ce30423c4d5bb092f4ac17ef2cc2 Mon Sep 17 00:00:00 2001 From: Matt Jordan Date: Sun, 7 Aug 2016 09:58:59 -0500 Subject: channels/chan_pjsip: Add PJSIP_SEND_SESSION_REFRESH This patch adds a new PJSIP specific dialplan function, PJSIP_SEND_SESSION_REFRESH. When invoked on a PJSIP channel, the media session will be refreshed via either an UPDATE or re-INVITE request. When used in conjunction with the PJSIP_MEDIA_OFFER dialplan function, the formats in use on a PJSIP channel can be re-negotiated and changed dynamically after call setup. ASTERISK-26277 #close Change-Id: Ib98fe09ba889aafe26d58d32f0fd1323f8fd9b1b (cherry picked from commit eec60dd77394f0519895fc6abce3a6f90f6470f1) --- channels/chan_pjsip.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'channels/chan_pjsip.c') diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index 2e87393a6..02da0db35 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -2433,6 +2433,11 @@ static struct ast_custom_function media_offer_function = { .write = pjsip_acf_media_offer_write }; +static struct ast_custom_function session_refresh_function = { + .name = "PJSIP_SEND_SESSION_REFRESH", + .write = pjsip_acf_session_refresh_write, +}; + /*! * \brief Load the module * @@ -2472,6 +2477,11 @@ static int load_module(void) goto end; } + if (ast_custom_function_register(&session_refresh_function)) { + ast_log(LOG_WARNING, "Unable to register PJSIP_SEND_SESSION_REFRESH dialplan function\n"); + goto end; + } + if (ast_sip_session_register_supplement(&chan_pjsip_supplement)) { ast_log(LOG_ERROR, "Unable to register PJSIP supplement\n"); goto end; @@ -2528,6 +2538,7 @@ end: pjsip_uids_onhold = NULL; ast_custom_function_unregister(&media_offer_function); ast_custom_function_unregister(&chan_pjsip_dial_contacts_function); + ast_custom_function_unregister(&session_refresh_function); ast_channel_unregister(&chan_pjsip_tech); ast_rtp_glue_unregister(&chan_pjsip_rtp_glue); @@ -2549,6 +2560,7 @@ static int unload_module(void) ast_custom_function_unregister(&media_offer_function); ast_custom_function_unregister(&chan_pjsip_dial_contacts_function); + ast_custom_function_unregister(&session_refresh_function); ast_channel_unregister(&chan_pjsip_tech); ao2_ref(chan_pjsip_tech.capabilities, -1); -- cgit v1.2.3