[asterisk-commits] dvossel: trunk r201534 - in /trunk: ./ channels/ configs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 17 16:56:57 CDT 2009


Author: dvossel
Date: Wed Jun 17 16:56:42 2009
New Revision: 201534

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=201534
Log:
Add rtsavesysname to chan_iax

chan_sip has an option to save the sysname on rtupdate.  This patch copies that same logic to chan_iax.

(closes issue #14837)
Reported by: barthpbx
Patches:
      iax2-rtsavesysname.patch uploaded by barthpbx (license 744)
      rt_iax.diff uploaded by dvossel (license 671)


Modified:
    trunk/CHANGES
    trunk/channels/chan_iax2.c
    trunk/configs/iax.conf.sample

Modified: trunk/CHANGES
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/CHANGES?view=diff&rev=201534&r1=201533&r2=201534
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Wed Jun 17 16:56:42 2009
@@ -33,6 +33,11 @@
    will accept the SDP even if the SDP version number is not properly incremented,
    but will generate a warning in the log indicating that the SIP peer that sent
    the SDP should have the 'ignoresdpversion' option set.
+
+IAX2 Changes
+-----------
+ * Added rtsavesysname option into iax.conf to allow the systname to be saved
+   on realtime updates.
 
 Applications
 ------------

Modified: trunk/channels/chan_iax2.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=201534&r1=201533&r2=201534
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Wed Jun 17 16:56:42 2009
@@ -398,7 +398,7 @@
 #define IAX_USEJITTERBUF        (uint64_t)(1 << 5)    /*!< Use jitter buffer */
 #define IAX_DYNAMIC             (uint64_t)(1 << 6)    /*!< dynamic peer */
 #define IAX_SENDANI             (uint64_t)(1 << 7)    /*!< Send ANI along with CallerID */
-        /* (1 << 8) is currently unused due to the deprecation of an old option. Go ahead, take it! */
+#define IAX_RTSAVE_SYSNAME      (uint64_t)(1 << 8)    /*!< Save Systname on Realtime Updates */
 #define IAX_ALREADYGONE         (uint64_t)(1 << 9)    /*!< Already disconnected */
 #define IAX_PROVISION           (uint64_t)(1 << 10)   /*!< This is a provisioning request */
 #define IAX_QUELCH              (uint64_t)(1 << 11)   /*!< Whether or not we quelch audio */
@@ -3627,12 +3627,19 @@
 {
 	char port[10];
 	char regseconds[20];
-	
+	const char *sysname = ast_config_AST_SYSTEM_NAME;
+	char *syslabel = NULL;
+
+	if (ast_strlen_zero(sysname))	/* No system name, disable this */
+		sysname = NULL;
+	else if (ast_test_flag64(&globalflags, IAX_RTSAVE_SYSNAME))
+		syslabel = "regserver";
+
 	snprintf(regseconds, sizeof(regseconds), "%d", (int)regtime);
 	snprintf(port, sizeof(port), "%d", ntohs(sin->sin_port));
 	ast_update_realtime("iaxpeers", "name", peername, 
 		"ipaddr", ast_inet_ntoa(sin->sin_addr), "port", port, 
-		"regseconds", regseconds, SENTINEL);
+		"regseconds", regseconds, syslabel, sysname, SENTINEL); /* note syslable can be NULL */
 }
 
 struct create_addr_info {
@@ -11644,6 +11651,8 @@
 			ast_set2_flag64((&globalflags), ast_true(v->value), IAX_RTIGNOREREGEXPIRE);
 		else if (!strcasecmp(v->name, "rtupdate"))
 			ast_set2_flag64((&globalflags), ast_true(v->value), IAX_RTUPDATE);
+		else if (!strcasecmp(v->name, "rtsavesysname"))
+			ast_set2_flag64((&globalflags), ast_true(v->value), IAX_RTSAVE_SYSNAME);
 		else if (!strcasecmp(v->name, "trunktimestamps"))
 			ast_set2_flag64(&globalflags, ast_true(v->value), IAX_TRUNKTIMESTAMPS);
 		else if (!strcasecmp(v->name, "rtautoclear")) {

Modified: trunk/configs/iax.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/configs/iax.conf.sample?view=diff&rev=201534&r1=201533&r2=201534
==============================================================================
--- trunk/configs/iax.conf.sample (original)
+++ trunk/configs/iax.conf.sample Wed Jun 17 16:56:42 2009
@@ -286,6 +286,9 @@
 ;rtcachefriends=yes	; Cache realtime friends by adding them to the internal list
 			; just like friends added from the config file only on a
 			; as-needed basis? (yes|no)
+
+;rtsavesysname=yes    ; Save systemname in realtime database at registration
+                      ; Default = no
 
 ;rtupdate=yes		; Send registry updates to database using realtime? (yes|no)
 			; If set to yes, when a IAX2 peer registers successfully,




More information about the asterisk-commits mailing list