[asterisk-commits] tilghman: trunk r121334 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 9 14:33:24 CDT 2008


Author: tilghman
Date: Mon Jun  9 14:33:23 2008
New Revision: 121334

URL: http://svn.digium.com/view/asterisk?view=rev&rev=121334
Log:
Add storage of the useragent in the realtime database.
(Closes AST-38)

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=121334&r1=121333&r2=121334
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Jun  9 14:33:23 2008
@@ -2056,7 +2056,7 @@
 static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask, struct ast_variable *v);
 
 /* Realtime device support */
-static void realtime_update_peer(const char *peername, struct sockaddr_in *sin, const char *username, const char *fullcontact, int expirey, int deprecated_username);
+static void realtime_update_peer(const char *peername, struct sockaddr_in *sin, const char *username, const char *fullcontact, const char *useragent, int expirey, int deprecated_username);
 static struct sip_user *realtime_user(const char *username);
 static void update_peer(struct sip_peer *p, int expiry);
 static struct ast_variable *get_insecure_variable_from_config(struct ast_config *config);
@@ -3630,7 +3630,7 @@
 	that name and store that in the "regserver" field in the sippeers
 	table to facilitate multi-server setups.
 */
-static void realtime_update_peer(const char *peername, struct sockaddr_in *sin, const char *defaultuser, const char *fullcontact, int expirey, int deprecated_username)
+static void realtime_update_peer(const char *peername, struct sockaddr_in *sin, const char *defaultuser, const char *fullcontact, const char *useragent, int expirey, int deprecated_username)
 {
 	char port[10];
 	char ipaddr[INET_ADDRSTRLEN];
@@ -3656,14 +3656,19 @@
 	else if (sip_cfg.rtsave_sysname)
 		syslabel = "regserver";
 
-	if (fc)
+	if (fc) {
 		ast_update_realtime(tablename, "name", peername, "ipaddr", ipaddr,
 			"port", port, "regseconds", regseconds,
-			deprecated_username ? "username" : "defaultuser", defaultuser, fc, fullcontact, syslabel, sysname, NULL); /* note fc and syslabel _can_ be NULL */
-	else
+			deprecated_username ? "username" : "defaultuser", defaultuser,
+			"useragent", useragent,
+			fc, fullcontact, syslabel, sysname, NULL); /* note fc and syslabel _can_ be NULL */
+	} else {
 		ast_update_realtime(tablename, "name", peername, "ipaddr", ipaddr,
 			"port", port, "regseconds", regseconds,
-			deprecated_username ? "username" : "defaultuser", defaultuser, syslabel, sysname, NULL); /* note syslabel _can_ be NULL */
+			"useragent", useragent,
+			deprecated_username ? "username" : "defaultuser", defaultuser,
+			syslabel, sysname, NULL); /* note syslabel _can_ be NULL */
+	}
 }
 
 /*! \brief Automatically add peer extension to dial plan */
@@ -3783,7 +3788,7 @@
 	int rtcachefriends = ast_test_flag(&p->flags[1], SIP_PAGE2_RTCACHEFRIENDS);
 	if (sip_cfg.peer_rtupdate &&
 	    (p->is_realtime || rtcachefriends)) {
-		realtime_update_peer(p->name, &p->addr, p->username, rtcachefriends ? p->fullcontact : NULL, expiry, p->deprecated_username);
+		realtime_update_peer(p->name, &p->addr, p->username, rtcachefriends ? p->fullcontact : NULL, p->useragent, expiry, p->deprecated_username);
 	}
 }
 
@@ -10093,7 +10098,7 @@
 
 	if (!sip_cfg.ignore_regexpire) {
 		if (peer->rt_fromcontact)
-			ast_update_realtime(tablename, "name", peer->name, "fullcontact", "", "ipaddr", "", "port", "", "regseconds", "0", peer->deprecated_username ? "username" : "defaultuser", "", "regserver", "", NULL);
+			ast_update_realtime(tablename, "name", peer->name, "fullcontact", "", "ipaddr", "", "port", "", "regseconds", "0", peer->deprecated_username ? "username" : "defaultuser", "", "regserver", "", "useragent", "", NULL);
 		else 
 			ast_db_del("SIP/Registry", peer->name);
 	}
@@ -22863,6 +22868,7 @@
 		"defaultuser", RQ_CHAR, 10,
 		"fullcontact", RQ_CHAR, 20,
 		"regserver", RQ_CHAR, 20,
+		"useragent", RQ_CHAR, 20,
 		NULL);
 
 	return AST_MODULE_LOAD_SUCCESS;




More information about the asterisk-commits mailing list