[svn-commits] eliel: branch eliel/data_api_providers_gsoc2010 r274683 - in /team/eliel/data...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 7 14:48:20 CDT 2010


Author: eliel
Date: Wed Jul  7 14:48:15 2010
New Revision: 274683

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=274683
Log:
Fix comments in review board.


Modified:
    team/eliel/data_api_providers_gsoc2010/channels/chan_dahdi.c
    team/eliel/data_api_providers_gsoc2010/channels/chan_iax2.c
    team/eliel/data_api_providers_gsoc2010/channels/chan_sip.c
    team/eliel/data_api_providers_gsoc2010/main/channel.c

Modified: team/eliel/data_api_providers_gsoc2010/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/eliel/data_api_providers_gsoc2010/channels/chan_dahdi.c?view=diff&rev=274683&r1=274682&r2=274683
==============================================================================
--- team/eliel/data_api_providers_gsoc2010/channels/chan_dahdi.c (original)
+++ team/eliel/data_api_providers_gsoc2010/channels/chan_dahdi.c Wed Jul  7 14:48:15 2010
@@ -17533,7 +17533,7 @@
 							"Unknown");
 		ast_data_add_str(data_span, "options",	s.lineconfig & DAHDI_CONFIG_CRC4 ?
 							s.lineconfig & DAHDI_CONFIG_NOTOPEN ? "CRC4/YEL" : "CRC4" :
-							"YEL");
+							s.lineconfig & DAHDI_CONFIG_NOTOPEN ? "YEL" : "");
 		ast_data_add_str(data_span, "lbo", lbostr[s.lbo]);
 
 		/* if this span doesn't match remove it. */
@@ -17589,15 +17589,15 @@
 		struct ast_data *data_root)
 {
 	int pseudo_fd = -1;
-	struct dahdi_versioninfo vi;
+	struct dahdi_versioninfo vi = {
+		.version = "Unknown",
+		.echo_canceller = "Unknown"
+	};
 
 	if ((pseudo_fd = open("/dev/dahdi/ctl", O_RDONLY)) < 0) {
 		ast_log(LOG_ERROR, "Failed to open control file to get version.\n");
 		return -1;
 	}
-
-	strcpy(vi.version, "Unknown");
-	strcpy(vi.echo_canceller, "Unknown");
 
 	if (ioctl(pseudo_fd, DAHDI_GETVERSION, &vi)) {
 		ast_log(LOG_ERROR, "Failed to get DAHDI version: %s\n", strerror(errno));

Modified: team/eliel/data_api_providers_gsoc2010/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/eliel/data_api_providers_gsoc2010/channels/chan_iax2.c?view=diff&rev=274683&r1=274682&r2=274683
==============================================================================
--- team/eliel/data_api_providers_gsoc2010/channels/chan_iax2.c (original)
+++ team/eliel/data_api_providers_gsoc2010/channels/chan_iax2.c Wed Jul  7 14:48:15 2010
@@ -14204,16 +14204,14 @@
 	MEMBER(iax2_peer, cid_name, AST_DATA_STRING)		\
 	MEMBER(iax2_peer, zonetag, AST_DATA_STRING)		\
 	MEMBER(iax2_peer, parkinglot, AST_DATA_STRING)		\
-	MEMBER(iax2_peer, expire, AST_DATA_INTEGER)		\
-	MEMBER(iax2_peer, expiry, AST_DATA_INTEGER)		\
+	MEMBER(iax2_peer, expiry, AST_DATA_SECONDS)		\
 	MEMBER(iax2_peer, callno, AST_DATA_INTEGER)		\
-	MEMBER(iax2_peer, pokeexpire, AST_DATA_INTEGER)		\
-	MEMBER(iax2_peer, lastms, AST_DATA_INTEGER)		\
-	MEMBER(iax2_peer, maxms, AST_DATA_INTEGER)		\
-	MEMBER(iax2_peer, pokefreqok, AST_DATA_INTEGER)		\
-	MEMBER(iax2_peer, pokefreqnotok, AST_DATA_INTEGER)	\
+	MEMBER(iax2_peer, lastms, AST_DATA_MILLISECONDS)	\
+	MEMBER(iax2_peer, maxms, AST_DATA_MILLISECONDS)		\
+	MEMBER(iax2_peer, pokefreqok, AST_DATA_MILLISECONDS)	\
+	MEMBER(iax2_peer, pokefreqnotok, AST_DATA_MILLISECONDS)	\
 	MEMBER(iax2_peer, historicms, AST_DATA_INTEGER)		\
-	MEMBER(iax2_peer, smoothing, AST_DATA_INTEGER)		\
+	MEMBER(iax2_peer, smoothing, AST_DATA_BOOLEAN)		\
         MEMBER(iax2_peer, maxcallno, AST_DATA_INTEGER)
 
 AST_DATA_STRUCTURE(iax2_peer, DATA_EXPORT_IAX2_PEER);
@@ -14277,17 +14275,15 @@
         MEMBER(iax2_user, cid_num, AST_DATA_STRING)			\
         MEMBER(iax2_user, cid_name, AST_DATA_STRING)			\
         MEMBER(iax2_user, parkinglot, AST_DATA_STRING)			\
-        MEMBER(iax2_user, amaflags, AST_DATA_INTEGER)			\
         MEMBER(iax2_user, maxauthreq, AST_DATA_INTEGER)			\
-        MEMBER(iax2_user, curauthreq, AST_DATA_INTEGER)			\
-        MEMBER(iax2_user, authmethods, AST_DATA_INTEGER)
+        MEMBER(iax2_user, curauthreq, AST_DATA_INTEGER)
 
 AST_DATA_STRUCTURE(iax2_user, DATA_EXPORT_IAX2_USER);
 
 static int users_data_provider_get(const struct ast_data_search *search,
 	struct ast_data *data_root)
 {
-	struct ast_data *data_user;
+	struct ast_data *data_user, *data_authmethods, *data_enum_node;
 	struct iax2_user *user;
 	struct ao2_iterator i;
 	char auth[90];
@@ -14315,6 +14311,25 @@
 		ast_data_add_password(data_user, "secret", auth);
 
 		ast_data_add_str(data_user, "context", user->contexts ? user->contexts->context : DEFAULT_CONTEXT);
+
+		/* authmethods */
+		data_authmethods = ast_data_add_node(data_user, "authmethods");
+		if (!data_authmethods) {
+			ast_data_remove_node(data_root, data_user);
+			continue;
+		}
+		ast_data_add_bool(data_authmethods, "rsa", user->authmethods & IAX_AUTH_RSA);
+		ast_data_add_bool(data_authmethods, "md5", user->authmethods & IAX_AUTH_MD5);
+		ast_data_add_bool(data_authmethods, "plaintext", user->authmethods & IAX_AUTH_PLAINTEXT);
+
+		/* amaflags */
+		data_enum_node = ast_data_add_node(data_user, "amaflags");
+		if (!data_enum_node) {
+			ast_data_remove_node(data_root, data_user);
+			continue;
+		}
+		ast_data_add_int(data_enum_node, "value", user->amaflags);
+		ast_data_add_str(data_enum_node, "text", ast_cdr_flags2str(user->amaflags));
 
 		ast_data_add_bool(data_user, "access-control", user->ha ? 1 : 0);
 

Modified: team/eliel/data_api_providers_gsoc2010/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/eliel/data_api_providers_gsoc2010/channels/chan_sip.c?view=diff&rev=274683&r1=274682&r2=274683
==============================================================================
--- team/eliel/data_api_providers_gsoc2010/channels/chan_sip.c (original)
+++ team/eliel/data_api_providers_gsoc2010/channels/chan_sip.c Wed Jul  7 14:48:15 2010
@@ -27570,27 +27570,20 @@
 	MEMBER(sip_peer, is_realtime, AST_DATA_BOOLEAN)		\
 	MEMBER(sip_peer, host_dynamic, AST_DATA_BOOLEAN)	\
 	MEMBER(sip_peer, autoframing, AST_DATA_BOOLEAN)		\
-	MEMBER(sip_peer, deprecated_username, AST_DATA_BOOLEAN)	\
-	MEMBER(sip_peer, amaflags, AST_DATA_INTEGER)		\
-	MEMBER(sip_peer, callingpres, AST_DATA_INTEGER)		\
 	MEMBER(sip_peer, inUse, AST_DATA_INTEGER)		\
 	MEMBER(sip_peer, inRinging, AST_DATA_INTEGER)		\
 	MEMBER(sip_peer, onHold, AST_DATA_INTEGER)		\
 	MEMBER(sip_peer, call_limit, AST_DATA_INTEGER)		\
 	MEMBER(sip_peer, t38_maxdatagram, AST_DATA_INTEGER)	\
-	MEMBER(sip_peer, lastmsgssent, AST_DATA_INTEGER)	\
-	MEMBER(sip_peer, sipoptions, AST_DATA_INTEGER)		\
 	MEMBER(sip_peer, maxcallbitrate, AST_DATA_INTEGER)	\
-	MEMBER(sip_peer, expire, AST_DATA_INTEGER)		\
-	MEMBER(sip_peer, rtptimeout, AST_DATA_INTEGER)		\
-	MEMBER(sip_peer, rtpholdtimeout, AST_DATA_INTEGER)	\
-	MEMBER(sip_peer, rtpkeepalive, AST_DATA_INTEGER)	\
-	MEMBER(sip_peer, pokeexpire, AST_DATA_INTEGER)		\
-	MEMBER(sip_peer, lastms, AST_DATA_INTEGER)		\
-	MEMBER(sip_peer, maxms, AST_DATA_INTEGER)		\
-	MEMBER(sip_peer, qualifyfreq, AST_DATA_INTEGER)		\
-	MEMBER(sip_peer, timer_t1, AST_DATA_INTEGER)		\
-	MEMBER(sip_peer, timer_b, AST_DATA_INTEGER)
+	MEMBER(sip_peer, rtptimeout, AST_DATA_SECONDS)		\
+	MEMBER(sip_peer, rtpholdtimeout, AST_DATA_SECONDS)	\
+	MEMBER(sip_peer, rtpkeepalive, AST_DATA_SECONDS)	\
+	MEMBER(sip_peer, lastms, AST_DATA_MILLISECONDS)		\
+	MEMBER(sip_peer, maxms, AST_DATA_MILLISECONDS)		\
+	MEMBER(sip_peer, qualifyfreq, AST_DATA_MILLISECONDS)	\
+	MEMBER(sip_peer, timer_t1, AST_DATA_MILLISECONDS)	\
+	MEMBER(sip_peer, timer_b, AST_DATA_MILLISECONDS)
 
 AST_DATA_STRUCTURE(sip_peer, DATA_EXPORT_SIP_PEER);
 
@@ -27600,7 +27593,8 @@
 	struct sip_peer *peer;
 	struct ao2_iterator i;
 	struct ast_data *data_peer, *data_peer_mailboxes = NULL, *data_peer_mailbox, *enum_node;
-	int total_mailboxes;
+	struct ast_data *data_sip_options;
+	int total_mailboxes, x;
 	struct sip_mailbox *mailbox;
 
 	i = ao2_iterator_init(peers, 0);
@@ -27654,6 +27648,31 @@
 			ast_data_add_str(data_peer_mailbox, "mailbox", mailbox->mailbox);
 			ast_data_add_str(data_peer_mailbox, "context", mailbox->context);
 		}
+
+		/* amaflags */
+		enum_node = ast_data_add_node(data_peer, "amaflags");
+		if (!enum_node) {
+			continue;
+		}
+		ast_data_add_int(enum_node, "value", peer->amaflags);
+		ast_data_add_str(enum_node, "text", ast_cdr_flags2str(peer->amaflags));
+
+		/* sip options */
+		data_sip_options = ast_data_add_node(data_peer, "sipoptions");
+		if (!data_sip_options) {
+			continue;
+		}
+		for (x = 0 ; x < ARRAY_LEN(sip_options); x++) {
+			ast_data_add_bool(data_sip_options, sip_options[x].text, peer->sipoptions & sip_options[x].id);
+		}
+
+		/* callingpres */
+		enum_node = ast_data_add_node(data_peer, "callingpres");
+		if (!enum_node) {
+			continue;
+		}
+		ast_data_add_int(enum_node, "value", peer->callingpres);
+		ast_data_add_str(enum_node, "text", ast_describe_caller_presentation(peer->callingpres));
 
 		/* codecs */
 		ast_data_add_codecs(data_peer, "codecs", peer->capability);

Modified: team/eliel/data_api_providers_gsoc2010/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/eliel/data_api_providers_gsoc2010/main/channel.c?view=diff&rev=274683&r1=274682&r2=274683
==============================================================================
--- team/eliel/data_api_providers_gsoc2010/main/channel.c (original)
+++ team/eliel/data_api_providers_gsoc2010/main/channel.c Wed Jul  7 14:48:15 2010
@@ -72,6 +72,10 @@
 #include <sys/epoll.h>
 #endif
 
+#ifdef HAVE_PRI
+#include "sig_pri.h"
+#endif
+
 struct ast_epoll_data {
 	struct ast_channel *chan;
 	int which;
@@ -142,8 +146,6 @@
 	MEMBER(ast_callerid, cid_ani, AST_DATA_STRING)		\
 	MEMBER(ast_callerid, cid_pres, AST_DATA_INTEGER)	\
 	MEMBER(ast_callerid, cid_ani2, AST_DATA_INTEGER)	\
-	MEMBER(ast_callerid, cid_ton, AST_DATA_INTEGER)		\
-	MEMBER(ast_callerid, cid_tns, AST_DATA_INTEGER)		\
 	MEMBER(ast_callerid, cid_tag, AST_DATA_STRING)
 
 AST_DATA_STRUCTURE(ast_callerid, DATA_EXPORT_CALLERID);
@@ -164,17 +166,14 @@
 	MEMBER(ast_channel, parkinglot, AST_DATA_STRING)			\
 	MEMBER(ast_channel, hangupsource, AST_DATA_STRING)			\
 	MEMBER(ast_channel, dialcontext, AST_DATA_STRING)			\
-	MEMBER(ast_channel, _softhangup, AST_DATA_INTEGER)			\
 	MEMBER(ast_channel, rings, AST_DATA_INTEGER)				\
 	MEMBER(ast_channel, priority, AST_DATA_INTEGER)				\
 	MEMBER(ast_channel, macropriority, AST_DATA_INTEGER)			\
-	MEMBER(ast_channel, amaflags, AST_DATA_INTEGER)				\
 	MEMBER(ast_channel, adsicpe, AST_DATA_INTEGER)				\
 	MEMBER(ast_channel, fin, AST_DATA_UNSIGNED_INTEGER)			\
 	MEMBER(ast_channel, fout, AST_DATA_UNSIGNED_INTEGER)			\
 	MEMBER(ast_channel, emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER)	\
 	MEMBER(ast_channel, visible_indication, AST_DATA_INTEGER)		\
-	MEMBER(ast_channel, transfercapability, AST_DATA_INTEGER)		\
 	MEMBER(ast_channel, context, AST_DATA_STRING)				\
 	MEMBER(ast_channel, exten, AST_DATA_STRING)				\
 	MEMBER(ast_channel, macrocontext, AST_DATA_STRING)			\
@@ -284,12 +283,36 @@
 	ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS));
 }
 
+static const char *callerid_ton2str(int ton)
+{
+#ifdef HAVE_PRI
+	switch (ton) {
+	case PRI_TON_INTERNATIONAL:
+		return "International Number";
+	case PRI_TON_NATIONAL:
+		return "National Number";
+	case PRI_TON_NET_SPECIFIC:
+		return "Network Specific Number";
+	case PRI_TON_SUBSCRIBER:
+		return "Subscriber Number";
+	case PRI_TON_ABBREVIATED:
+		return "Abbreviated number";
+	case PRI_TON_RESERVED:
+		return "Reserved Number";
+	case PRI_TON_UNKNOWN:
+	default:
+		return "Unknown Number Type";
+	}
+#endif
+	return "";
+}
+
 int ast_channel_data_add_structure(struct ast_data *tree,
 	struct ast_channel *chan, int add_bridged)
 {
 	struct ast_channel *bc;
 	struct ast_data *data_bridged, *data_cdr, *data_flags, *data_zones;
-	struct ast_data *data_callerid, *enum_node;
+	struct ast_data *data_callerid, *enum_node, *data_softhangup;
 
 	if (!tree) {
 		return -1;
@@ -315,6 +338,7 @@
 	ast_data_add_codecs(tree, "rawreadformat", chan->rawreadformat);
 	ast_data_add_codecs(tree, "rawwriteformat", chan->rawwriteformat);
 
+	/* state */
 	enum_node = ast_data_add_node(tree, "state");
 	if (!enum_node) {
 		return -1;
@@ -322,12 +346,42 @@
 	ast_data_add_str(enum_node, "text", ast_state2str(chan->_state));
 	ast_data_add_int(enum_node, "value", chan->_state);
 
+	/* hangupcause */
 	enum_node = ast_data_add_node(tree, "hangupcause");
 	if (!enum_node) {
 		return -1;
 	}
 	ast_data_add_str(enum_node, "text", ast_cause2str(chan->hangupcause));
 	ast_data_add_int(enum_node, "value", chan->hangupcause);
+
+	/* amaflags */
+	enum_node = ast_data_add_node(tree, "amaflags");
+	if (!enum_node) {
+		return -1;
+	}
+	ast_data_add_str(enum_node, "text", ast_cdr_flags2str(chan->amaflags));
+	ast_data_add_int(enum_node, "value", chan->amaflags);
+
+	/* transfercapability */
+	enum_node = ast_data_add_node(tree, "transfercapability");
+	if (!enum_node) {
+		return -1;
+	}
+	ast_data_add_str(enum_node, "text", ast_transfercapability2str(chan->transfercapability));
+	ast_data_add_int(enum_node, "value", chan->transfercapability);
+
+	/* _softphangup */
+	data_softhangup = ast_data_add_node(tree, "softhangup");
+	if (!data_softhangup) {
+		return -1;
+	}
+	ast_data_add_bool(data_softhangup, "dev", chan->_softhangup & AST_SOFTHANGUP_DEV);
+	ast_data_add_bool(data_softhangup, "asyncgoto", chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO);
+	ast_data_add_bool(data_softhangup, "shutdown", chan->_softhangup & AST_SOFTHANGUP_SHUTDOWN);
+	ast_data_add_bool(data_softhangup, "timeout", chan->_softhangup & AST_SOFTHANGUP_TIMEOUT);
+	ast_data_add_bool(data_softhangup, "appunload", chan->_softhangup & AST_SOFTHANGUP_APPUNLOAD);
+	ast_data_add_bool(data_softhangup, "explicit", chan->_softhangup & AST_SOFTHANGUP_EXPLICIT);
+	ast_data_add_bool(data_softhangup, "unbridge", chan->_softhangup & AST_SOFTHANGUP_UNBRIDGE);
 
 	/* channel flags */
 	data_flags = ast_data_add_node(tree, "flags");
@@ -344,6 +398,13 @@
 		return -1;
 	}
 	ast_data_add_structure(ast_callerid, data_callerid, &(chan->cid));
+	/* insert the callerid ton */
+	enum_node = ast_data_add_node(data_callerid, "cid_ton");
+	if (!enum_node) {
+		return -1;
+	}
+	ast_data_add_int(enum_node, "value", chan->cid.cid_ton);
+	ast_data_add_str(enum_node, "text", callerid_ton2str(chan->cid.cid_ton));
 
 	/* tone zone */
 	if (chan->zone) {




More information about the svn-commits mailing list