[asterisk-commits] marquis: branch group/pinana-publish-1.4 r287466 - /team/group/pinana-publish...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 18 20:25:39 CDT 2010


Author: marquis
Date: Sat Sep 18 20:25:34 2010
New Revision: 287466

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=287466
Log:
Flesh out configuration parsing. Definitely a work in progress.

Modified:
    team/group/pinana-publish-1.4/channels/chan_sip.c

Modified: team/group/pinana-publish-1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pinana-publish-1.4/channels/chan_sip.c?view=diff&rev=287466&r1=287465&r2=287466
==============================================================================
--- team/group/pinana-publish-1.4/channels/chan_sip.c (original)
+++ team/group/pinana-publish-1.4/channels/chan_sip.c Sat Sep 18 20:25:34 2010
@@ -1160,6 +1160,22 @@
 	AST_LIST_HEAD_NOLOCK(, statechange) state_change_q;
 } device_state = {
 	.thread = AST_PTHREADT_NULL,
+};
+
+struct sip_publisher {
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(host);
+		AST_STRING_FIELD(domain);
+		AST_STRING_FIELD(filter);
+	);
+};
+
+struct sip_subscriber {
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(host);
+		AST_STRING_FIELD(domain);
+		AST_STRING_FIELD(filter);
+	);
 };
 
 struct statechange {
@@ -18986,6 +19002,45 @@
 static int presence_load_config(struct ast_config *pcfg)
 {
 	struct ast_variable *v;
+	char *cat = NULL;
+	struct sip_publisher *publish_to;
+	while ( (cat = ast_category_browse(pcfg, cat)) ) {
+		int publish = 0, subscribe = 0;
+		const char* utype = NULL;
+		if (!strcasecmp(cat, "general")) {
+					continue;
+		}
+
+		utype = ast_variable_retrieve(pcfg, cat, "type");
+		if (!utype) {
+			ast_log(LOG_WARNING, "Section '%s' lacks type\n", cat);
+			continue;
+		}
+		if (!strcasecmp(utype, "publish") || !strcasecmp(utype, "bidirectional")) {
+			publish = 1;
+		//	*publish_to = ast_calloc(1, sizeof(*publish_to));
+		}
+		if (!strcasecmp(utype, "subscribe") || !strcasecmp(utype, "bidirectional")) {
+			subscribe = 1;
+			struct sip_subscriber *subscribe_to = ast_calloc(1, sizeof(*subscribe_to));
+		}
+		for (v = ast_variable_browse(pcfg, cat); v; v = v->next) {
+			if (!strcasecmp(v->name, "host")) {
+
+			} else if (!strcasecmp(v->name, "filter")) {
+
+			} else if (!strcasecmp(v->name, "domain")) {
+
+			}
+		}
+		if (publish) {
+			ast_devstate_add(sip_devicestate_cb, publish_to);
+		}
+		if (subscribe) {
+
+		}
+	}
+
 	return TRUE;
 }
 




More information about the asterisk-commits mailing list