[asterisk-commits] eliel: branch eliel/data_api_providers_gsoc2010 r266432 - in /team/eliel/data...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat May 29 10:30:39 CDT 2010


Author: eliel
Date: Sat May 29 10:30:36 2010
New Revision: 266432

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=266432
Log:
- Describe the tone zone inside the channel data structure.
- Describe the callerid inside the channel data structure.


Modified:
    team/eliel/data_api_providers_gsoc2010/include/asterisk/indications.h
    team/eliel/data_api_providers_gsoc2010/main/channel.c
    team/eliel/data_api_providers_gsoc2010/main/indications.c

Modified: team/eliel/data_api_providers_gsoc2010/include/asterisk/indications.h
URL: http://svnview.digium.com/svn/asterisk/team/eliel/data_api_providers_gsoc2010/include/asterisk/indications.h?view=diff&rev=266432&r1=266431&r2=266432
==============================================================================
--- team/eliel/data_api_providers_gsoc2010/include/asterisk/indications.h (original)
+++ team/eliel/data_api_providers_gsoc2010/include/asterisk/indications.h Sat May 29 10:30:36 2010
@@ -27,6 +27,8 @@
 #define _ASTERISK_INDICATIONS_H
 
 #include "asterisk/astobj2.h"
+#include "asterisk/utils.h"
+#include "asterisk/data.h"
 
 /*!
  * \brief Description of a tone
@@ -237,4 +239,12 @@
 	return ts;
 }
 
+/*!
+ * \brief Add a tone_zone structure to the data tree specified.
+ *
+ * \retval <0 on error.
+ * \retval 0 on success.
+ */
+int ast_tone_zone_data_add_structure(struct ast_data *tree, struct ast_tone_zone *zone);
+
 #endif /* _ASTERISK_INDICATIONS_H */

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=266432&r1=266431&r2=266432
==============================================================================
--- team/eliel/data_api_providers_gsoc2010/main/channel.c (original)
+++ team/eliel/data_api_providers_gsoc2010/main/channel.c Sat May 29 10:30:36 2010
@@ -133,6 +133,19 @@
 #else
 #define NUM_CHANNEL_BUCKETS 1567
 #endif
+
+#define DATA_EXPORT_CALLERID(MEMBER)				\
+	MEMBER(ast_callerid, cid_dnid, AST_DATA_STRING)		\
+	MEMBER(ast_callerid, cid_num, AST_DATA_STRING)		\
+	MEMBER(ast_callerid, cid_name, AST_DATA_STRING)		\
+	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);
 
 #define DATA_EXPORT_CHANNEL(MEMBER)						\
 	MEMBER(ast_channel, blockproc, AST_DATA_STRING)				\
@@ -274,7 +287,8 @@
 	struct ast_channel *chan, int add_bridged)
 {
 	struct ast_channel *bc;
-	struct ast_data *data_bridged, *data_cdr, *data_flags;
+	struct ast_data *data_bridged, *data_cdr, *data_flags, *data_zones;
+	struct ast_data *data_callerid;
 
 	if (!tree) {
 		return -1;
@@ -310,6 +324,24 @@
 		return -1;
 	}
 	channel_data_add_flags(data_flags, chan);
+
+	ast_data_add_uint(tree, "timetohangup", chan->whentohangup.tv_sec);
+
+	/* callerid */
+	data_callerid = ast_data_add_node(tree, "callerid");
+	if (!data_callerid) {
+		return -1;
+	}
+	ast_data_add_structure(ast_callerid, data_callerid, &(chan->cid));
+
+	/* tone zone */
+	if (chan->zone) {
+		data_zones = ast_data_add_node(tree, "zone");
+		if (!data_zones) {
+			return -1;
+		}
+		ast_tone_zone_data_add_structure(data_zones, chan->zone);
+	}
 
 	/* insert cdr */
 	data_cdr = ast_data_add_node(tree, "cdr");

Modified: team/eliel/data_api_providers_gsoc2010/main/indications.c
URL: http://svnview.digium.com/svn/asterisk/team/eliel/data_api_providers_gsoc2010/main/indications.c?view=diff&rev=266432&r1=266431&r2=266432
==============================================================================
--- team/eliel/data_api_providers_gsoc2010/main/indications.c (original)
+++ team/eliel/data_api_providers_gsoc2010/main/indications.c Sat May 29 10:30:36 2010
@@ -38,8 +38,22 @@
 #include "asterisk/cli.h"
 #include "asterisk/module.h"
 #include "asterisk/astobj2.h"
+#include "asterisk/data.h"
 
 #include "asterisk/_private.h" /* _init(), _reload() */
+
+#define DATA_EXPORT_TONE_ZONE(MEMBER)					\
+	MEMBER(ast_tone_zone, country, AST_DATA_STRING)			\
+	MEMBER(ast_tone_zone, description, AST_DATA_STRING)		\
+	MEMBER(ast_tone_zone, nrringcadence, AST_DATA_UNSIGNED_INTEGER)
+
+AST_DATA_STRUCTURE(ast_tone_zone, DATA_EXPORT_TONE_ZONE);
+
+#define DATA_EXPORT_TONE_ZONE_SOUND(MEMBER)			\
+	MEMBER(ast_tone_zone_sound, name, AST_DATA_STRING)	\
+	MEMBER(ast_tone_zone_sound, data, AST_DATA_STRING)
+
+AST_DATA_STRUCTURE(ast_tone_zone_sound, DATA_EXPORT_TONE_ZONE_SOUND);
 
 /* Globals */
 static const char config[] = "indications.conf";
@@ -1102,6 +1116,33 @@
 			CMP_MATCH | CMP_STOP : 0;
 }
 
+int ast_tone_zone_data_add_structure(struct ast_data *tree, struct ast_tone_zone *zone)
+{
+	struct ast_data *data_zone_sound;
+	struct ast_tone_zone_sound *s;
+
+	ast_data_add_structure(ast_tone_zone, tree, zone);
+
+	if (AST_LIST_EMPTY(&zone->tones)) {
+		return 0;
+	}
+
+	data_zone_sound = ast_data_add_node(tree, "tones");
+	if (!data_zone_sound) {
+		return -1;
+	}
+
+	ast_tone_zone_lock(zone);
+
+	AST_LIST_TRAVERSE(&zone->tones, s, entry) {
+		ast_data_add_structure(ast_tone_zone_sound, data_zone_sound, s);
+	}
+
+	ast_tone_zone_unlock(zone);
+
+	return 0;
+}
+
 /*! \brief Load indications module */
 int ast_indications_init(void)
 {




More information about the asterisk-commits mailing list