<h1>Project "FreeSWITCH Source" received a push.</h1>

<h2>branch: master updated</h2>
<pre>
       via: e7a8189b2b87d600c290998772d0aa53c26bc964 (commit)
      from: ea29a1dfcc53729af1e7798050a62566700d99fa (commit)


</pre>= COMMIT LOG ===========================================================
<div class="highlight"><pre>committer: Mathieu Parent
comments: 
Skinny: centralized registration

<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c</span>
<span style="color: #000080; font-weight: bold">index 5320ca5..91d81da 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_skinny/mod_skinny.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_skinny/mod_skinny.c</span>
<span style="color: #800080; font-weight: bold">@@ -1243,6 +1243,21 @@ static void walk_listeners(skinny_listener_callback_func_t callback, void *pvt)</span>
         switch_mutex_unlock(globals.mutex);
 }
 
<span style="color: #00A000">+static int flush_listener_callback(void *pArg, int argc, char **argv, char **columnNames)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        char *profile_name = argv[0];</span>
<span style="color: #00A000">+        char *value = argv[1];</span>
<span style="color: #00A000">+        char *domain_name = argv[2];</span>
<span style="color: #00A000">+        char *device_name = argv[3];</span>
<span style="color: #00A000">+        char *device_instance = argv[4];</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        char *token = switch_mprintf(&quot;skinny/%q/%q/%q:%q&quot;, profile_name, value, device_name, device_instance);</span>
<span style="color: #00A000">+        switch_core_del_registration(value, domain_name, token);</span>
<span style="color: #00A000">+        switch_safe_free(token);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return 0;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
 static void flush_listener(listener_t *listener)
 {
 
<span style="color: #800080; font-weight: bold">@@ -1251,6 +1266,18 @@ static void flush_listener(listener_t *listener)</span>
                 char *sql;
 
                 if ((sql = switch_mprintf(
<span style="color: #00A000">+                                &quot;SELECT &#39;%q&#39;, value, &#39;%q&#39;, &#39;%q&#39;, &#39;%d&#39; &quot;</span>
<span style="color: #00A000">+                                        &quot;FROM skinny_lines &quot;</span>
<span style="color: #00A000">+                                        &quot;WHERE device_name=&#39;%s&#39; AND device_instance=%d &quot;</span>
<span style="color: #00A000">+                                        &quot;ORDER BY position&quot;,</span>
<span style="color: #00A000">+                                profile-&gt;name, profile-&gt;domain, listener-&gt;device_name, listener-&gt;device_instance,</span>
<span style="color: #00A000">+                                listener-&gt;device_name, listener-&gt;device_instance</span>
<span style="color: #00A000">+                                ))) {</span>
<span style="color: #00A000">+                        skinny_execute_sql_callback(profile, profile-&gt;sql_mutex, sql, flush_listener_callback, NULL);</span>
<span style="color: #00A000">+                        switch_safe_free(sql);</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if ((sql = switch_mprintf(</span>
                                 &quot;DELETE FROM skinny_devices &quot;
                                         &quot;WHERE name=&#39;%s&#39; and instance=%d&quot;,
                                 listener-&gt;device_name, listener-&gt;device_instance))) {
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c</span>
<span style="color: #000080; font-weight: bold">index e7c761d..7d66a9c 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_skinny/skinny_server.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_skinny/skinny_server.c</span>
<span style="color: #800080; font-weight: bold">@@ -1006,6 +1006,10 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r</span>
                 }
                 if ((xbuttons = switch_xml_child(xskinny, &quot;buttons&quot;))) {
                         uint32_t line_instance = 1;
<span style="color: #00A000">+                        char *network_ip = inet_ntoa(request-&gt;data.reg.ip);</span>
<span style="color: #00A000">+                        int network_port = 0;</span>
<span style="color: #00A000">+                        char network_port_c[6];</span>
<span style="color: #00A000">+                        snprintf(network_port_c, sizeof(network_port_c), &quot;%d&quot;, network_port);</span>
                         for (xbutton = switch_xml_child(xbuttons, &quot;button&quot;); xbutton; xbutton = xbutton-&gt;next) {
                                 uint32_t position = atoi(switch_xml_attr_soft(xbutton, &quot;position&quot;));
                                 uint32_t type = skinny_str2button(switch_xml_attr_soft(xbutton, &quot;type&quot;));
<span style="color: #800080; font-weight: bold">@@ -1031,8 +1035,14 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r</span>
                                                         label, value, caller_name,
                                                         ring_on_idle, ring_on_active, busy_trigger,
                                                           forward_all, forward_busy, forward_noanswer, noanswer_duration))) {
<span style="color: #00A000">+                                                char *token, *url;</span>
                                                 skinny_execute_sql(profile, sql, profile-&gt;sql_mutex);
                                                 switch_safe_free(sql);
<span style="color: #00A000">+                                                token = switch_mprintf(&quot;skinny/%q/%q/%q:%d&quot;, profile-&gt;name, value, request-&gt;data.reg.device_name, request-&gt;data.reg.instance);</span>
<span style="color: #00A000">+                                                url = switch_mprintf(&quot;skinny/%q/%q&quot;, profile-&gt;name, value);</span>
<span style="color: #00A000">+                                                switch_core_add_registration(value, profile-&gt;domain, token, url, 0, network_ip, network_port_c, &quot;tcp&quot;);</span>
<span style="color: #00A000">+                                                switch_safe_free(token);</span>
<span style="color: #00A000">+                                                switch_safe_free(url);</span>
                                         }
                                         if (line_instance == 1) {
                                                 switch_event_t *message_query_event = NULL;
</pre></div>
========================================================================<pre>

Summary of changes:
 src/mod/endpoints/mod_skinny/mod_skinny.c    |   27 ++++++++++++++++++++++++++
 src/mod/endpoints/mod_skinny/skinny_server.c |   10 +++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
</pre>
<p>this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email<br />
For more info, see <a href="http://blog.chomperstomp.com/?p=630">http://blog.chomperstomp.com/?p=630</a>
-- <br />
FreeSWITCH Source</p>