[Asterisk-cvs] asterisk/channels chan_iax2.c,1.262,1.263

kpfleming at lists.digium.com kpfleming at lists.digium.com
Thu Mar 31 22:56:55 CST 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv28968/channels

Modified Files:
	chan_iax2.c 
Log Message:
Add 'iax2 reload' CLI command and fix peer counting with regex matches (bug #3876)


Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.262
retrieving revision 1.263
diff -u -d -r1.262 -r1.263
--- chan_iax2.c	31 Mar 2005 19:29:54 -0000	1.262
+++ chan_iax2.c	1 Apr 2005 04:50:21 -0000	1.263
@@ -230,6 +230,8 @@
 
 static struct iax2_peer *realtime_peer(const char *peername);
 static int reload_config(void);
+static int iax2_reload(int fd, int argc, char *argv[]);
+
 
 struct iax2_user {
 	char name[80];
@@ -2003,6 +2005,10 @@
 "Usage: iax2 prune realtime [<peername>|all]\n"
 "       Prunes object(s) from the cache\n";
 
+static char iax2_reload_usage[] =
+"Usage: iax2 reload\n"
+"       Reloads IAX configuration from iax.conf\n";
+
 static struct ast_cli_entry cli_set_jitter = 
 { { "iax2", "set", "jitter", NULL }, iax2_set_jitter, "Sets IAX jitter buffer", jitter_usage };
 
@@ -2018,6 +2024,9 @@
 static struct ast_cli_entry  cli_prune_realtime =
 	{ { "iax2", "prune", "realtime", NULL }, iax2_prune_realtime, "Prune a cached realtime lookup", prune_realtime_usage, complete_iax2_show_peer };
 
+static struct ast_cli_entry  cli_reload =
+	{ { "iax2", "reload", NULL }, iax2_reload, "Reload IAX configuration", iax2_reload_usage };
+
 static unsigned int calc_rxstamp(struct chan_iax2_pvt *p, unsigned int offset);
 
 #ifdef BRIDGE_OPTIMIZATION
@@ -4066,7 +4075,6 @@
 		char nm[20];
 		char status[20] = "";
 		char srch[2000] = "";
-		total_peers++;
 
 		if (registeredonly && !peer->addr.sin_addr.s_addr)
 			continue;
@@ -4113,6 +4121,7 @@
 					nm,
 					ntohs(peer->addr.sin_port), ast_test_flag(peer, IAX_TRUNK) ? "(T)" : "   ",
 					peer->encmethods ? "(E)" : "   ", status);
+		total_peers++;
 	}
 	ast_mutex_unlock(&peerl.lock);
 
@@ -8458,6 +8467,11 @@
 	return 0;
 }
 
+static int iax2_reload(int fd, int argc, char *argv[])
+{
+	return reload_config();
+}
+
 int reload(void)
 {
 	return reload_config();
@@ -8997,6 +9011,7 @@
 	ast_cli_register(&cli_show_stats);
 	ast_cli_register(&cli_show_cache);
 	ast_cli_register(&cli_show_peer);
+	ast_cli_register(&cli_reload);
 
 	ast_register_application(papp, iax2_prov_app, psyn, pdescrip);
 	




More information about the svn-commits mailing list