[svn-commits] trunk r36177 - in /trunk: channels/chan_sip.c
doc/extconfig.txt doc/realtime.txt
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Tue Jun 27 10:30:15 MST 2006
Author: oej
Date: Tue Jun 27 12:30:14 2006
New Revision: 36177
URL: http://svn.digium.com/view/asterisk?rev=36177&view=rev
Log:
Inspired by issue 6742, but solved in a different way.
(Yes, I like the system name setting)
Modified:
trunk/channels/chan_sip.c
trunk/doc/extconfig.txt
trunk/doc/realtime.txt
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=36177&r1=36176&r2=36177&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Jun 27 12:30:14 2006
@@ -2175,12 +2175,20 @@
return 0;
}
-/*! \brief Update peer object in realtime storage */
+/*! \brief Update peer object in realtime storage
+ If the Asterisk system name is set in asterisk.conf, we will use
+ 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 *username, const char *fullcontact, int expirey)
{
char port[10];
char ipaddr[20];
char regseconds[20];
+
+ char *sysname = ast_config_AST_SYSTEM_NAME;
+ char *syslabel = NULL;
+
time_t nowtime = time(NULL) + expirey;
const char *fc = fullcontact ? "fullcontact" : NULL;
@@ -2188,9 +2196,14 @@
ast_inet_ntoa(ipaddr, sizeof(ipaddr), sin->sin_addr);
snprintf(port, sizeof(port), "%d", ntohs(sin->sin_port));
+ if (ast_strlen_zero(sysname)) /* No system name, disable this */
+ sysname = NULL;
+ else
+ syslabel = "regserver";
+
ast_update_realtime("sippeers", "name", peername, "ipaddr", ipaddr,
"port", port, "regseconds", regseconds,
- "username", username, fc, fullcontact, NULL); /* note fc _can_ be NULL */
+ "username", username, fc, fullcontact, syslabel, sysname, NULL); /* note fc _can_ be NULL */
}
/*! \brief Automatically add peer extension to dial plan */
@@ -7141,7 +7154,7 @@
{
if (!ast_test_flag(&global_flags[1], SIP_PAGE2_IGNOREREGEXPIRE)) {
if (ast_test_flag(&peer->flags[1], SIP_PAGE2_RT_FROMCONTACT))
- ast_update_realtime("sippeers", "name", peer->name, "fullcontact", "", "ipaddr", "", "port", "", "regseconds", "0", "username", "", NULL);
+ ast_update_realtime("sippeers", "name", peer->name, "fullcontact", "", "ipaddr", "", "port", "", "regseconds", "0", "username", "", "regserver", "", NULL);
else
ast_db_del("SIP/Registry", peer->name);
}
Modified: trunk/doc/extconfig.txt
URL: http://svn.digium.com/view/asterisk/trunk/doc/extconfig.txt?rev=36177&r1=36176&r2=36177&view=diff
==============================================================================
--- trunk/doc/extconfig.txt (original)
+++ trunk/doc/extconfig.txt Tue Jun 27 12:30:14 2006
@@ -54,6 +54,12 @@
in order to store appropriate parameters required for SIP.
+In addition to this, if you add a field named "regserver" to the
+SIP peers table and have the system name set in asterisk.conf,
+Asterisk will store the system name that the user registered on in
+the database. This can be used to direct calls to go through the server
+that holds the registration (for NAT traversal purposes).
+
A Voicemail table would look more like this:
+----------+---------+----------+----------+-----------+---------------+
Modified: trunk/doc/realtime.txt
URL: http://svn.digium.com/view/asterisk/trunk/doc/realtime.txt?rev=36177&r1=36176&r2=36177&view=diff
==============================================================================
--- trunk/doc/realtime.txt (original)
+++ trunk/doc/realtime.txt Tue Jun 27 12:30:14 2006
@@ -49,9 +49,8 @@
most of the functionality works the same way for realtime friends as for
the ones in static configuration.
-There is some work to create a solution for Realtime SIP devices that
-loads from database and stays in memory for the duration of a call or
-a registration, but that work is not integrated into Asterisk yet.
+With caching, the device stays in memory for a specified time. More
+information about this is to be found in the sip.conf sample file.
* New function in the dial plan: The Realtime Switch
----------------------------------------------------
@@ -94,8 +93,11 @@
Defined well-known family names are:
* sippeers, sipusers SIP peers and users
-* iaxfriends IAX2 peers
+* iaxpeers, iaxusers IAX2 peers and users
* voicemail Voicemail accounts
+* queues Queues
+* queue_members Queue members
+* extensions Realtime extensions (switch)
There is documentation of the SQL database in the file
doc/extconfig.txt in your Asterisk source code tree.
More information about the svn-commits
mailing list