<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][16092] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=16092">16092</a></dd>
<dt>Author</dt> <dd>jmesquita</dd>
<dt>Date</dt> <dd>2009-12-29 22:12:55 -0600 (Tue, 29 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Just a shell of a configuration binding for the softphone. We still have to decide how to provide the configuration to it.</pre>

<h3>Added Paths</h3>
<ul>
<li>freeswitch/trunk/contrib/jmesquita/mod_config_handler/</li>
<li><a href="#freeswitchtrunkcontribjmesquitamod_config_handlerMakefile">freeswitch/trunk/contrib/jmesquita/mod_config_handler/Makefile</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitamod_config_handlerconfig_handlerconfxml">freeswitch/trunk/contrib/jmesquita/mod_config_handler/config_handler.conf.xml</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitamod_config_handlermod_config_handlerc">freeswitch/trunk/contrib/jmesquita/mod_config_handler/mod_config_handler.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkcontribjmesquitamod_config_handlerMakefile"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/mod_config_handler/Makefile (0 => 16092)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/mod_config_handler/Makefile                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/mod_config_handler/Makefile        2009-12-30 04:12:55 UTC (rev 16092)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+include ../../../build/modmake.rules
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitamod_config_handlerconfig_handlerconfxml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/mod_config_handler/config_handler.conf.xml (0 => 16092)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/mod_config_handler/config_handler.conf.xml                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/mod_config_handler/config_handler.conf.xml        2009-12-30 04:12:55 UTC (rev 16092)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+&lt;configuration name=&quot;config_handler.conf&quot; description=&quot;Softphone config handler&quot;&gt;
+  &lt;bindings&gt;
+    &lt;binding name=&quot;example&quot;&gt;
+      &lt;param name=&quot;bindings&quot; value=&quot;dialplan&quot;/&gt; 
+    &lt;/binding&gt;
+  &lt;/bindings&gt;
+&lt;/configuration&gt;
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitamod_config_handlermod_config_handlerc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/mod_config_handler/mod_config_handler.c (0 => 16092)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/mod_config_handler/mod_config_handler.c                                (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/mod_config_handler/mod_config_handler.c        2009-12-30 04:12:55 UTC (rev 16092)
</span><span class="lines">@@ -0,0 +1,150 @@
</span><ins>+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II &lt;anthm@freeswitch.org&gt;
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the &quot;License&quot;); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an &quot;AS IS&quot; basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II &lt;anthm@freeswitch.org&gt;
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Joao Mesquita &lt;jmesquita@freeswitch.org&gt;
+ *
+ */
+#include &lt;switch.h&gt;
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_config_handler_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_config_handler_shutdown);
+SWITCH_MODULE_DEFINITION(mod_config_handler, mod_config_handler_load, mod_config_handler_shutdown, NULL);
+
+
+struct xml_binding {
+        char *bindings;
+};
+
+typedef struct xml_binding xml_binding_t;
+
+
+static struct {
+    switch_memory_pool_t* pool;
+} globals;
+
+
+
+static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
+                                                                  void *user_data)
+{
+        xml_binding_t *binding = (xml_binding_t *) user_data;
+
+        if (!binding) {
+                return NULL;
+        }
+        /* All we have to do here is check the section requested and maybe use a
+           templating system to provide the corresponding xml */
+
+        return NULL;
+}
+
+#define ENABLE_PARAM_VALUE &quot;enabled&quot;
+static switch_status_t do_config(void)
+{
+        char *cf = &quot;config_handler.conf&quot;;
+        switch_xml_t cfg, xml, bindings_tag, binding_tag, param;
+        xml_binding_t *binding = NULL;
+        int x = 0;
+
+        if (!(xml = switch_xml_open_cfg(cf, &amp;cfg, NULL))) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, &quot;open of %s failed\n&quot;, cf);
+                return SWITCH_STATUS_TERM;
+        }
+
+        if (!(bindings_tag = switch_xml_child(cfg, &quot;bindings&quot;))) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, &quot;Missing &lt;bindings&gt; tag!\n&quot;);
+                goto done;
+        }
+
+        for (binding_tag = switch_xml_child(bindings_tag, &quot;binding&quot;); binding_tag; binding_tag = binding_tag-&gt;next) {
+                char *bname = (char *) switch_xml_attr_soft(binding_tag, &quot;name&quot;);
+                char *bind_mask = NULL;
+
+                for (param = switch_xml_child(binding_tag, &quot;param&quot;); param; param = param-&gt;next) {
+                        bind_mask = (char *) switch_xml_attr_soft(param, &quot;value&quot;);
+                }
+
+                /* We should fail here, shouldnt we */
+                if (!(binding = malloc(sizeof(*binding)))) {
+                        goto done;
+                }
+                memset(binding, 0, sizeof(*binding));
+
+
+                if (bind_mask) {
+                        binding-&gt;bindings = strdup(bind_mask);
+                }
+
+
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, &quot;Binding [%s] XML Fetch Function [%s]\n&quot;,
+                                                  zstr(bname) ? &quot;N/A&quot; : bname, binding-&gt;bindings ? binding-&gt;bindings : &quot;all&quot;);
+                switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(binding-&gt;bindings), binding);
+                x++;
+                binding = NULL;
+        }
+
+  done:
+        switch_xml_free(xml);
+
+        return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_config_handler_load)
+{
+        /*switch_api_interface_t *config_handler_api_interface;*/
+
+        /* connect my internal structure to the blank pointer passed to me */
+        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+        memset(&amp;globals,0,sizeof(globals));
+        globals.pool = pool;
+
+        if (do_config() == SWITCH_STATUS_SUCCESS) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, &quot;Binding worked!&quot;);
+        } else {
+                return SWITCH_STATUS_FALSE;
+        }
+
+
+        /* indicate that the module should continue to be loaded */
+        return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_config_handler_shutdown)
+{
+        switch_xml_unbind_search_function_ptr(xml_url_fetch);
+        return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */
</ins></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>