[asterisk-commits] russell: branch russell/data_retrieval r112562 - /team/russell/data_retrieval...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 3 00:33:19 CDT 2008


Author: russell
Date: Thu Apr  3 00:33:12 2008
New Revision: 112562

URL: http://svn.digium.com/view/asterisk?view=rev&rev=112562
Log:
Add more SIP settings, and add a sip_peers data provider

Modified:
    team/russell/data_retrieval/channels/chan_sip.c

Modified: team/russell/data_retrieval/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/channels/chan_sip.c?view=diff&rev=112562&r1=112561&r2=112562
==============================================================================
--- team/russell/data_retrieval/channels/chan_sip.c (original)
+++ team/russell/data_retrieval/channels/chan_sip.c Thu Apr  3 00:33:12 2008
@@ -21459,6 +21459,42 @@
 	AST_CLI_DEFINE(sip_show_tcp, "List TCP Connections")
 };
 
+static struct ast_data_node *sip_peers_data(const struct ast_data_provider *data_prov,
+	const struct ast_data_node *query)
+{
+	struct ast_data_node *peers_node;
+	int res = 0;
+
+	if (!(peers_node = ast_data_node_new("sip_peers", "SIP Peers"))) {
+		return NULL;
+	}
+
+	ASTOBJ_CONTAINER_TRAVERSE(&peerl, !res, do {
+		struct ast_data_node *peer_node;
+
+		if (!(peer_node = ast_data_node_add_child_grouping(peers_node, "peer", "SIP Peer"))) {
+			res = -1;
+			break;
+		}
+
+		ASTOBJ_RDLOCK(iterator);
+
+		res |= ast_data_node_add_child_str(peer_node, "name", "Name", iterator->name);
+		res |= ast_data_node_add_child_str(peer_node, "addr", "IP Address",
+			ast_inet_ntoa(iterator->addr.sin_addr));
+		res |= ast_data_node_add_child_bool(peer_node, "dynamic", "Dynamic Peer",
+			iterator->host_dynamic);
+
+		ASTOBJ_UNLOCK(iterator);
+	} while (0) );
+
+	if (res) {
+		peers_node = ast_data_node_destroy(peers_node);
+	}
+
+	return peers_node;
+}
+
 static struct ast_data_node *sip_settings_data(const struct ast_data_provider *data_prov,
 	const struct ast_data_node *query)
 {
@@ -21495,6 +21531,23 @@
 		!AST_LIST_EMPTY(&domain_list));
 	res |= ast_data_node_add_child_bool(settings_node, "allowexternaldomains", "Allow External Domains",
 		allow_external_domains);
+	res |= ast_data_node_add_child_bool(settings_node, "usereqphone", "URI user is phone",
+		ast_test_flag(&global_flags[0], SIP_USEREQPHONE));
+	res |= ast_data_node_add_child_str(settings_node, "realm", "Global Realm",
+		global_realm);
+	res |= ast_data_node_add_child_bool(settings_node, "realmauth", "Realm Authentication",
+		(authl != NULL));
+	res |= ast_data_node_add_child_bool(settings_node, "alwaysauthreject", "Always Auth Rejects",
+		global_alwaysauthreject);
+	res |= ast_data_node_add_child_bool(settings_node, "limitonpeers", "Call limit peers only",
+		global_limitonpeers);
+	res |= ast_data_node_add_child_bool(settings_node, "directrtpsetup", "Direct RTP Setup",
+		global_directrtpsetup);
+	res |= ast_data_node_add_child_str(settings_node, "useragent", "Server",
+		global_useragent);
+
+	/*! XXX \todo There are a ton more settings ... and I'm feeling lazy.  Let's just finish
+	 * these if this ever becomes more than proof of concept code ... */
 
 	if (res) {
 		settings_node = ast_data_node_destroy(settings_node);
@@ -21505,6 +21558,7 @@
 
 static struct ast_data_provider sip_data_providers[] = {
 	AST_DATA_PROVIDER(sip_settings_data, "sip_settings"),
+	AST_DATA_PROVIDER(sip_peers_data, "sip_peers"),
 };
 
 /*! \brief PBX load module - initialization */




More information about the asterisk-commits mailing list