[asterisk-commits] mmichelson: trunk r150311 - in /trunk: ./ channels/ doc/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 16 19:18:02 CDT 2008
Author: mmichelson
Date: Thu Oct 16 19:18:01 2008
New Revision: 150311
URL: http://svn.digium.com/view/asterisk?view=rev&rev=150311
Log:
Add an IAXregistry manager command. See doc/manager_1_1.txt
for more details of this command.
(closes issue #13326)
Reported by: ib2
Patches:
bug13326_trunk_20080822.diff uploaded by snuffy (license 35)
Modified:
trunk/CHANGES
trunk/channels/chan_iax2.c
trunk/doc/manager_1_1.txt
Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=150311&r1=150310&r2=150311
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Thu Oct 16 19:18:01 2008
@@ -308,6 +308,8 @@
* Originate now accepts codec settings with "Codecs: alaw, ulaw, h264"
* New command: Atxfer. See doc/manager_1_1.txt for more details or
manager show command Atxfer from the CLI
+ * New command: IAXregistry. See doc/manager_1_1.txt for more details or
+ manager show command IAXregistry from the CLI
Dialplan functions
------------------
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=150311&r1=150310&r2=150311
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Thu Oct 16 19:18:01 2008
@@ -5523,6 +5523,55 @@
return CLI_SUCCESS;
#undef FORMAT
#undef FORMAT2
+}
+
+static int manager_iax2_show_registry(struct mansession *s, const struct message *m)
+{
+ const char *id = astman_get_header(m, "ActionID");
+ struct iax2_registry *reg = NULL;
+ char idtext[256] = "";
+ char host[80] = "";
+ char perceived[80] = "";
+ int total = 0;
+
+ if (!ast_strlen_zero(id))
+ snprintf(idtext, sizeof(idtext), "ActionID: %s\r\n", id);
+
+ astman_send_listack(s, m, "Registrations will follow", "start");
+
+ AST_LIST_LOCK(®istrations);
+ AST_LIST_TRAVERSE(®istrations, reg, entry) {
+ snprintf(host, sizeof(host), "%s:%d", ast_inet_ntoa(reg->addr.sin_addr), ntohs(reg->addr.sin_port));
+
+ if (reg->us.sin_addr.s_addr) {
+ snprintf(perceived, sizeof(perceived), "%s:%d", ast_inet_ntoa(reg->us.sin_addr), ntohs(reg->us.sin_port));
+ } else {
+ ast_copy_string(perceived, "<Unregistered>", sizeof(perceived));
+ }
+
+ astman_append(s,
+ "Event: RegistryEntry\r\n"
+ "Host: %s\r\n"
+ "DNSmanager: %s\r\n"
+ "Username: %s\r\n"
+ "Perceived: %s\r\n"
+ "Refresh: %d\r\n"
+ "State: %s\r\n"
+ "\r\n", host, (reg->dnsmgr) ? "Y" : "N", reg->username, perceived,
+ reg->refresh, regstate2str(reg->regstate));
+
+ total++;
+ }
+ AST_LIST_UNLOCK(®istrations);
+
+ astman_append(s,
+ "Event: RegistrationsComplete\r\n"
+ "EventList: Complete\r\n"
+ "ListItems: %d\r\n"
+ "%s"
+ "\r\n", total, idtext);
+
+ return 0;
}
static char *handle_cli_iax2_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@@ -12233,6 +12282,7 @@
ast_manager_unregister( "IAXpeers" );
ast_manager_unregister( "IAXpeerlist" );
ast_manager_unregister( "IAXnetstats" );
+ ast_manager_unregister( "IAXregistry" );
ast_unregister_application(papp);
ast_cli_unregister_multiple(cli_iax2, sizeof(cli_iax2) / sizeof(struct ast_cli_entry));
ast_unregister_switch(&iax2_switch);
@@ -12368,6 +12418,7 @@
ast_manager_register( "IAXpeers", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_peers, "List IAX Peers" );
ast_manager_register( "IAXpeerlist", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_peer_list, "List IAX Peers" );
ast_manager_register( "IAXnetstats", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_netstats, "Show IAX Netstats" );
+ ast_manager_register( "IAXregistry", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, manager_iax2_show_registry, "Show IAX registrations");
if(set_config(config, 0) == -1)
return AST_MODULE_LOAD_DECLINE;
Modified: trunk/doc/manager_1_1.txt
URL: http://svn.digium.com/view/asterisk/trunk/doc/manager_1_1.txt?view=diff&rev=150311&r1=150310&r2=150311
==============================================================================
--- trunk/doc/manager_1_1.txt (original)
+++ trunk/doc/manager_1_1.txt Thu Oct 16 19:18:01 2008
@@ -1,6 +1,12 @@
Changes to manager version 1.1:
-------------------------------
+- Action: IAXregistry
+ Modules: chan_iax2
+ Purpose:
+ To list all IAX2 peers in the IAX registry with their registration status.
+ Variables:
+ ActionID: <id> Action ID for this transaction. Will be returned.
* SYNTAX CLEANUPS
-----------------
More information about the asterisk-commits
mailing list