[Asterisk-code-review] chan sip deprecation. (asterisk[master])

Corey Farrell asteriskteam at digium.com
Wed Oct 10 07:26:13 CDT 2018


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/10460


Change subject: chan_sip deprecation.
......................................................................

chan_sip deprecation.

This officially deprecates chan_sip in Asterisk 17+.  A warning is
printed upon startup or module load to tell users that they should
consider migrating.  chan_sip is still built by default but the default
modules.conf skips loading it at startup.

Very important to note we are not scheduling a time where chan_sip will
be removed.  The goal of this change is to accurately inform end users
of the current state of chan_sip and encourage movement to the fully
supported chan_pjsip.

Change-Id: Icebd8848f63feab94ef882d36b2e99d73155af93
---
M CHANGES
M UPGRADE.txt
M channels/chan_sip.c
M channels/sip/config_parser.c
M channels/sip/dialplan_functions.c
M channels/sip/reqresp_parser.c
M channels/sip/route.c
M channels/sip/security_events.c
M channels/sip/utils.c
M configs/samples/modules.conf.sample
10 files changed, 68 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/60/10460/1

diff --git a/CHANGES b/CHANGES
index bd1a7a7..5bfdc54 100644
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,17 @@
 ==============================================================================
 
 ------------------------------------------------------------------------------
+--- Functionality changes from Asterisk 16 to Asterisk 17 --------------------
+------------------------------------------------------------------------------
+
+chan_sip
+------------------
+ * The chan_sip module is now deprecated, users should migrate to the
+   replacement module chan_pjsip.  See guides at the Asterisk Wiki:
+     https://wiki.asterisk.org/wiki/x/tAHOAQ
+     https://wiki.asterisk.org/wiki/x/hYCLAQ
+
+------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 16.0.0 to Asterisk 16.1.0 ------------
 ------------------------------------------------------------------------------
 
diff --git a/UPGRADE.txt b/UPGRADE.txt
index b7bbf3b..937182d 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -25,3 +25,11 @@
 === UPGRADE-16.txt  -- Upgrade info for 15 to 16
 ===========================================================
 
+New in 17.0.0:
+
+chan_sip:
+ - The chan_sip module is now deprecated, users should migrate to the
+   replacement module chan_pjsip.  See guides at the Asterisk Wiki:
+     https://wiki.asterisk.org/wiki/x/tAHOAQ
+     https://wiki.asterisk.org/wiki/x/hYCLAQ
+
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 42362b8..6c681a1 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -176,7 +176,7 @@
 /*** MODULEINFO
 	<use type="module">res_crypto</use>
 	<use type="module">res_http_websocket</use>
-	<support_level>extended</support_level>
+	<support_level>deprecated</support_level>
  ***/
 
 /*!  \page sip_session_timers SIP Session Timers in Asterisk Chan_sip
@@ -35321,6 +35321,37 @@
 	.sipinfo_send = sipinfo_send,
 };
 
+static void deprecation_notice(void)
+{
+	ast_log(LOG_WARNING, "chan_sip has no official maintainer and is deprecated.  Migration to\n");
+	ast_log(LOG_WARNING, "chan_pjsip is recommended.  See guides at the Asterisk Wiki:\n");
+	ast_log(LOG_WARNING, "https://wiki.asterisk.org/wiki/x/tAHOAQ\n");
+	ast_log(LOG_WARNING, "https://wiki.asterisk.org/wiki/x/hYCLAQ\n");
+}
+
+/*! \brief Event callback which indicates we're fully booted */
+static void startup_event_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
+{
+	struct ast_json_payload *payload;
+	const char *type;
+
+	if (stasis_message_type(message) != ast_manager_get_generic_type()) {
+		return;
+	}
+
+	payload = stasis_message_data(message);
+	type = ast_json_string_get(ast_json_object_get(payload->json, "type"));
+
+	if (strcmp(type, "FullyBooted")) {
+		return;
+	}
+
+	deprecation_notice();
+
+	stasis_unsubscribe(sub);
+}
+
+
 static int unload_module(void);
 
 /*!
@@ -35527,6 +35558,12 @@
 		ast_websocket_add_protocol("sip", sip_websocket_callback);
 	}
 
+	if (ast_fully_booted) {
+		deprecation_notice();
+	} else {
+		stasis_subscribe_pool(ast_manager_get_topic(), startup_event_cb, NULL);
+	}
+
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
@@ -35744,7 +35781,7 @@
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Session Initiation Protocol (SIP)",
-	.support_level = AST_MODULE_SUPPORT_CORE,
+	.support_level = AST_MODULE_SUPPORT_DEPRECATED,
 	.load = load_module,
 	.unload = unload_module,
 	.reload = reload,
diff --git a/channels/sip/config_parser.c b/channels/sip/config_parser.c
index 211f600..64cb66a 100644
--- a/channels/sip/config_parser.c
+++ b/channels/sip/config_parser.c
@@ -20,7 +20,7 @@
  */
 
 /*** MODULEINFO
-	<support_level>extended</support_level>
+	<support_level>deprecated</support_level>
  ***/
 
 #include "asterisk.h"
diff --git a/channels/sip/dialplan_functions.c b/channels/sip/dialplan_functions.c
index 09804ce..7c34fc9 100644
--- a/channels/sip/dialplan_functions.c
+++ b/channels/sip/dialplan_functions.c
@@ -20,7 +20,7 @@
  */
 
 /*** MODULEINFO
-	<support_level>extended</support_level>
+	<support_level>deprecated</support_level>
  ***/
 
 /*** DOCUMENTATION
diff --git a/channels/sip/reqresp_parser.c b/channels/sip/reqresp_parser.c
index 4d91446..b43bed6 100644
--- a/channels/sip/reqresp_parser.c
+++ b/channels/sip/reqresp_parser.c
@@ -20,7 +20,7 @@
  */
 
 /*** MODULEINFO
-	<support_level>extended</support_level>
+	<support_level>deprecated</support_level>
  ***/
 
 #include "asterisk.h"
diff --git a/channels/sip/route.c b/channels/sip/route.c
index 584b46b..916c3af 100644
--- a/channels/sip/route.c
+++ b/channels/sip/route.c
@@ -20,7 +20,7 @@
  */
 
 /*** MODULEINFO
-	<support_level>extended</support_level>
+	<support_level>deprecated</support_level>
  ***/
 
 #include "asterisk.h"
diff --git a/channels/sip/security_events.c b/channels/sip/security_events.c
index 86ba413..eabc904 100644
--- a/channels/sip/security_events.c
+++ b/channels/sip/security_events.c
@@ -25,7 +25,7 @@
  */
 
 /*** MODULEINFO
-	<support_level>extended</support_level>
+	<support_level>deprecated</support_level>
  ***/
 
 #include "asterisk.h"
diff --git a/channels/sip/utils.c b/channels/sip/utils.c
index 45a4128..d53316c 100644
--- a/channels/sip/utils.c
+++ b/channels/sip/utils.c
@@ -22,7 +22,7 @@
  */
 
 /*** MODULEINFO
-	<support_level>extended</support_level>
+	<support_level>deprecated</support_level>
  ***/
 
 #include "asterisk.h"
diff --git a/configs/samples/modules.conf.sample b/configs/samples/modules.conf.sample
index 179e9ef..df6784f 100644
--- a/configs/samples/modules.conf.sample
+++ b/configs/samples/modules.conf.sample
@@ -25,7 +25,7 @@
 ; the "require" keyword. Asterisk will exit with a status code of 2
 ; if a required module does not load.
 ;
-; require = chan_sip.so
+; require = chan_pjsip.so
 ; If you want you can combine with preload
 ; preload-require = res_odbc.so
 ;
@@ -41,4 +41,6 @@
 noload => res_hep.so
 noload => res_hep_pjsip.so
 noload => res_hep_rtcp.so
-;
+
+; Do not load chan_sip by default, it may conflict with res_pjsip.
+noload => chan_sip.so

-- 
To view, visit https://gerrit.asterisk.org/10460
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icebd8848f63feab94ef882d36b2e99d73155af93
Gerrit-Change-Number: 10460
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181010/ffdfa48e/attachment-0001.html>


More information about the asterisk-code-review mailing list