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

<h2>branch: master updated</h2>
<pre>
       via: d53f3cd15054ff0a4c6d6b3131dae628432d15cd (commit)
       via: 1096e6732c6073228f78d7ab24be29780713f64c (commit)
       via: 500e9acd254e1e2b50d07aec2fe1241fe3e18aba (commit)
       via: 2e399b0baf871b82e8b1bd553fce16b54abe6d7b (commit)
       via: cd1982ceb7c7a7df598adea002cea51d040a3f62 (commit)
       via: 0bce777a4a06701798e426b13b8b7e0153836077 (commit)
       via: 17d521128014853b24f983307fc28317f11e950b (commit)
       via: e81e8096507dc39c8ba457f9641dc0a1c09900f7 (commit)
       via: 1341a75ad899d35f9003e4514cb5c8f724e0e7da (commit)
       via: 04bb74fcaeb72683754ed4b4d6df197a898887b7 (commit)
       via: 436413e0bb506a07758c60cdcf4a6be1adc0e575 (commit)
       via: 3fd7b8f2675b6198e9edbdf2359794d5dc134b0a (commit)
       via: a2c0da53f368f0b11340c3a72814c93b182753b7 (commit)
       via: 88d410d31485d13911f0958af5a73f1f6f49a454 (commit)
       via: 02234ae87db5fcca0168a140b5800618de65d3d9 (commit)
      from: f113c323fce749e1cc78caecef085f52957ef10e (commit)


</pre>= COMMIT LOG ===========================================================
<div class="highlight"><pre>committer: Moises Silva
comments: 
Merge remote branch &#39;fsorig/master&#39;
</pre></div>
<div class="highlight"><pre>committer: Marc Olivier Chouinard
comments: 
switch_core_sqldb: Index column name wrong on table registrations.  (This wont create the index for people who already have the table)

<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c</span>
<span style="color: #000080; font-weight: bold">index 120b256..f135e95 100644</span>
<span style="color: #A00000">--- a/src/switch_core_sqldb.c</span>
<span style="color: #00A000">+++ b/src/switch_core_sqldb.c</span>
<span style="color: #800080; font-weight: bold">@@ -1639,7 +1639,7 @@ static char create_registrations_sql[] =</span>
         &quot;   network_proto VARCHAR(256),\n&quot;
         &quot;   hostname VARCHAR(256)\n&quot;
         &quot;);\n&quot;
<span style="color: #A00000">-        &quot;create index regindex1 on registrations (user,realm,hostname);\n&quot;;</span>
<span style="color: #00A000">+        &quot;create index regindex1 on registrations (reg_user,realm,hostname);\n&quot;;</span>
         
 
 SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires, 
</pre></div>
<div class="highlight"><pre>committer: Marc Olivier Chouinard
comments: 
switch_core: Add capability to specify core-db-name in switch.conf.xml to have sqlite in a different location.  This is important for everyone with relatively &#39;high&#39; sip registration since the addition of sip registration to the core require sqlite db to be moved to a faster location (Ramdisk for example). Useful for everyone who moved their sqlite db for sofia to ramdisk because of performance issue.

<span style="color: #000080; font-weight: bold">diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml</span>
<span style="color: #000080; font-weight: bold">index 44893b9..95c4333 100644</span>
<span style="color: #A00000">--- a/conf/autoload_configs/switch.conf.xml</span>
<span style="color: #00A000">+++ b/conf/autoload_configs/switch.conf.xml</span>
<span style="color: #800080; font-weight: bold">@@ -94,6 +94,8 @@</span>
     &lt;!--&lt;param name=&quot;rtp-end-port&quot; value=&quot;32768&quot;/&gt;--&gt;
     &lt;param name=&quot;rtp-enable-zrtp&quot; value=&quot;true&quot;/&gt;
     &lt;!-- &lt;param name=&quot;core-db-dsn&quot; value=&quot;dsn:username:password&quot; /&gt; --&gt;
<span style="color: #00A000">+    &lt;!-- Allow to specify the sqlite db at a different location (In this example, move it to ramdrive for better performance on most linux distro (note, you loose the data if you reboot)) --&gt;</span>
<span style="color: #00A000">+    &lt;!-- &lt;param name=&quot;core-db-name&quot; value=&quot;/dev/shm/core.db&quot; /&gt; --&gt;</span>
     &lt;!-- The system will create all the db schemas automatically, set this to false to avoid this behaviour--&gt;
     &lt;!--&lt;param name=&quot;auto-create-schemas&quot; value=&quot;true&quot;/&gt;--&gt;
          &lt;!-- &lt;param name=&quot;core-dbtype&quot; value=&quot;MSSQL&quot;/&gt; --&gt;
<span style="color: #000080; font-weight: bold">diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h</span>
<span style="color: #000080; font-weight: bold">index 05cd24d..f8c6a79 100644</span>
<span style="color: #A00000">--- a/src/include/private/switch_core_pvt.h</span>
<span style="color: #00A000">+++ b/src/include/private/switch_core_pvt.h</span>
<span style="color: #800080; font-weight: bold">@@ -236,6 +236,7 @@ struct switch_runtime {</span>
         char *odbc_dsn;
         char *odbc_user;
         char *odbc_pass;
<span style="color: #00A000">+        char *dbname;</span>
         uint32_t debug_level;
         uint32_t runlevel;
         uint32_t tipping_point;
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core.c b/src/switch_core.c</span>
<span style="color: #000080; font-weight: bold">index 0eb51cc..66731b6 100644</span>
<span style="color: #A00000">--- a/src/switch_core.c</span>
<span style="color: #00A000">+++ b/src/switch_core.c</span>
<span style="color: #800080; font-weight: bold">@@ -1298,6 +1298,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc</span>
         runtime.default_dtmf_duration = SWITCH_DEFAULT_DTMF_DURATION;
         runtime.min_dtmf_duration = SWITCH_MIN_DTMF_DURATION;
         runtime.odbc_dbtype = DBTYPE_DEFAULT;
<span style="color: #00A000">+        runtime.dbname = NULL;</span>
 
         /* INIT APR and Create the pool context */
         if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
<span style="color: #800080; font-weight: bold">@@ -1641,6 +1642,8 @@ static void switch_load_core_config(const char *file)</span>
                                         switch_rtp_set_start_port((switch_port_t) atoi(val));
                                 } else if (!strcasecmp(var, &quot;rtp-end-port&quot;) &amp;&amp; !zstr(val)) {
                                         switch_rtp_set_end_port((switch_port_t) atoi(val));
<span style="color: #00A000">+                                } else if (!strcasecmp(var, &quot;core-db-name&quot;) &amp;&amp; !zstr(val)) {</span>
<span style="color: #00A000">+                                        runtime.dbname = switch_core_strdup(runtime.memory_pool, val);</span>
                                 } else if (!strcasecmp(var, &quot;core-db-dsn&quot;) &amp;&amp; !zstr(val)) {
                                         if (switch_odbc_available()) {
                                                 runtime.odbc_dsn = switch_core_strdup(runtime.memory_pool, val);
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c</span>
<span style="color: #000080; font-weight: bold">index f54bd65..120b256 100644</span>
<span style="color: #A00000">--- a/src/switch_core_sqldb.c</span>
<span style="color: #00A000">+++ b/src/switch_core_sqldb.c</span>
<span style="color: #800080; font-weight: bold">@@ -74,7 +74,11 @@ SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t</span>
 
                 r = _switch_cache_db_get_db_handle(dbh, SCDB_TYPE_ODBC, &amp;options, file, func, line);
         } else {
<span style="color: #A00000">-                options.core_db_options.db_path = SWITCH_CORE_DB;</span>
<span style="color: #00A000">+                if (runtime.dbname) {</span>
<span style="color: #00A000">+                        options.core_db_options.db_path = runtime.dbname;</span>
<span style="color: #00A000">+                } else {</span>
<span style="color: #00A000">+                        options.core_db_options.db_path = SWITCH_CORE_DB;</span>
<span style="color: #00A000">+                }</span>
                 r = _switch_cache_db_get_db_handle(dbh, SCDB_TYPE_CORE_DB, &amp;options, file, func, line);
         }
 
</pre></div>
<div class="highlight"><pre>committer: Marc Olivier Chouinard
comments: 
mod_callcenter: force loopback_bowout=false on originate.  This will need to be reworked, but should fix basic issues call to an agent using loopback

<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c</span>
<span style="color: #000080; font-weight: bold">index a06520f..9d9feed 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_callcenter/mod_callcenter.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_callcenter/mod_callcenter.c</span>
<span style="color: #800080; font-weight: bold">@@ -1384,6 +1384,8 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa</span>
                 switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, &quot;cc_agent&quot;, &quot;%s&quot;, h-&gt;agent_name);
                 switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, &quot;cc_agent_type&quot;, &quot;%s&quot;, h-&gt;agent_type);
                 switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, &quot;ignore_early_media&quot;, &quot;true&quot;);
<span style="color: #00A000">+                /* Force loopback to remain live, if not, the loop will detect the actual channel to gone */</span>
<span style="color: #00A000">+                switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, &quot;loopback_bowout&quot;, &quot;false&quot;);</span>
 
                 t_agent_called = switch_epoch_time_now(NULL);
                 dialstr = switch_mprintf(&quot;%s&quot;, h-&gt;originate_string);
</pre></div>
<div class="highlight"><pre>committer: Marc Olivier Chouinard
comments: 
mod_callcenter: IMPORTANT UPDATE, DTMF during moh created an loop to reactivate MOH but got canceled right away because of pending DTMF in the queue never been cleaned.  Could cause masive disk write of debug, and can cause problem to the rest of FS stability.  This patch also include basic fundation for DTMF capture support for member waiting.

<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c</span>
<span style="color: #000080; font-weight: bold">index 61305bb..a06520f 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_callcenter/mod_callcenter.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_callcenter/mod_callcenter.c</span>
<span style="color: #800080; font-weight: bold">@@ -2080,6 +2080,32 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj</span>
         return NULL; 
 }
 
<span style="color: #00A000">+struct moh_dtmf_helper {</span>
<span style="color: #00A000">+        const char *queue_name;</span>
<span style="color: #00A000">+        char dtmf;</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t moh_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen) {</span>
<span style="color: #00A000">+        struct moh_dtmf_helper *h = (struct moh_dtmf_helper *) buf;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch (itype) {</span>
<span style="color: #00A000">+                case SWITCH_INPUT_TYPE_DTMF:</span>
<span style="color: #00A000">+                        {</span>
<span style="color: #00A000">+                                /* Just laywork for people who want to get some DTMF actions */</span>
<span style="color: #00A000">+                                switch_dtmf_t *dtmf = (switch_dtmf_t *) input;</span>
<span style="color: #00A000">+                                if (strchr(&quot;#&quot;, dtmf-&gt;digit)) {</span>
<span style="color: #00A000">+                                        h-&gt;dtmf = dtmf-&gt;digit;</span>
<span style="color: #00A000">+                                        return SWITCH_STATUS_BREAK;</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+                default:</span>
<span style="color: #00A000">+                        break;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
 #define CC_DESC &quot;callcenter&quot;
 #define CC_USAGE &quot;queue_name&quot;
 
<span style="color: #800080; font-weight: bold">@@ -2226,8 +2252,6 @@ SWITCH_STANDARD_APP(callcenter_function)</span>
         switch_thread_create(&amp;thread, thd_attr, cc_member_thread_run, h, h-&gt;pool);
 
         /* Playback MOH */
<span style="color: #A00000">-        /* TODO Add DTMF callback support */</span>
<span style="color: #A00000">-        /* TODO add MOH infitite loop */        </span>
         if (cc_moh_override) {
                 cur_moh = switch_core_session_strdup(member_session, cc_moh_override);
         } else {
<span style="color: #800080; font-weight: bold">@@ -2237,6 +2261,12 @@ SWITCH_STANDARD_APP(callcenter_function)</span>
 
         while (switch_channel_ready(member_channel)) {
                 switch_input_args_t args = { 0 };
<span style="color: #00A000">+                struct moh_dtmf_helper ht;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                ht.dtmf = &#39;\0&#39;;</span>
<span style="color: #00A000">+                args.input_callback = moh_on_dtmf;</span>
<span style="color: #00A000">+                args.buf = (void *) &amp;ht;</span>
<span style="color: #00A000">+                args.buflen = sizeof(h);</span>
 
                 /* An agent was found, time to exit and let the bridge do it job */
                 if ((agent_uuid = switch_channel_get_variable(member_channel, &quot;cc_agent_uuid&quot;))) {
<span style="color: #800080; font-weight: bold">@@ -2260,6 +2290,8 @@ SWITCH_STANDARD_APP(callcenter_function)</span>
                         switch_ivr_collect_digits_callback(session, &amp;args, 0, 0);
                 }
 
<span style="color: #00A000">+                switch_yield(1000);</span>
<span style="color: #00A000">+</span>
         }
 
         /* Stop Member Thread */
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments: 
fix regression in rtp stack trying to avoid broken clients who send the wrong payload type, we were eating the stun packets in jingle calls

<span style="color: #000080; font-weight: bold">diff --git a/src/switch_rtp.c b/src/switch_rtp.c</span>
<span style="color: #000080; font-weight: bold">index 200f4f0..faa79e3 100644</span>
<span style="color: #A00000">--- a/src/switch_rtp.c</span>
<span style="color: #00A000">+++ b/src/switch_rtp.c</span>
<span style="color: #800080; font-weight: bold">@@ -2808,7 +2808,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_</span>
                         goto end;
                 }
 
<span style="color: #A00000">-                if (bytes &amp;&amp; !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) &amp;&amp; !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL) &amp;&amp;</span>
<span style="color: #00A000">+                if (bytes &amp;&amp; rtp_session-&gt;recv_msg.header.version == 2 &amp;&amp; </span>
<span style="color: #00A000">+                        !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) &amp;&amp; !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL) &amp;&amp;</span>
                         rtp_session-&gt;recv_msg.header.pt != 13 &amp;&amp; 
                         rtp_session-&gt;recv_msg.header.pt != rtp_session-&gt;recv_te &amp;&amp; 
                         (!rtp_session-&gt;cng_pt || rtp_session-&gt;recv_msg.header.pt != rtp_session-&gt;cng_pt) &amp;&amp; 
</pre></div>
<div class="highlight"><pre>committer: Brian West
comments: 
add make targets for mod_com_g729 mod_com_g729-activate mod_com_g729-install mod_com_g729-clean mod_com_g729-uninstall

<span style="color: #000080; font-weight: bold">diff --git a/.gitignore b/.gitignore</span>
<span style="color: #000080; font-weight: bold">index c53d07d..2480b83 100644</span>
<span style="color: #A00000">--- a/.gitignore</span>
<span style="color: #00A000">+++ b/.gitignore</span>
<span style="color: #800080; font-weight: bold">@@ -46,45 +46,47 @@ core.*</span>
 !/w32/Console/FreeSwitchConsole.vcproj.user
 !/w32/Setup/inno_setup/vcredist_x64.exe
 !/w32/Setup/inno_setup/vcredist_x86.exe
<span style="color: #A00000">-/.version</span>
<span style="color: #A00000">-/AUTHORS</span>
<span style="color: #A00000">-/COPYING</span>
<span style="color: #A00000">-/ChangeLog</span>
<span style="color: #A00000">-/Makefile</span>
<span style="color: #A00000">-/Makefile.in</span>
<span style="color: #A00000">-/NEWS</span>
<span style="color: #A00000">-/README</span>
<span style="color: #A00000">-/TAGS</span>
<span style="color: #00A000">+.version</span>
<span style="color: #00A000">+AUTHORS</span>
<span style="color: #00A000">+COPYING</span>
<span style="color: #00A000">+ChangeLog</span>
<span style="color: #00A000">+Makefile</span>
<span style="color: #00A000">+Makefile.in</span>
<span style="color: #00A000">+NEWS</span>
<span style="color: #00A000">+README</span>
<span style="color: #00A000">+TAGS</span>
 aclocal.m4
 autom4te.cache
<span style="color: #A00000">-/build/Makefile</span>
<span style="color: #A00000">-/build/Makefile.in</span>
<span style="color: #A00000">-/build/config/compile</span>
<span style="color: #A00000">-/build/config/config.guess</span>
<span style="color: #A00000">-/build/config/depcomp</span>
<span style="color: #A00000">-/build/config/install-sh</span>
<span style="color: #A00000">-/build/config/ltmain.sh</span>
<span style="color: #A00000">-/build/config/missing</span>
<span style="color: #A00000">-/build/freeswitch.pc</span>
<span style="color: #A00000">-/build/getlib.sh</span>
<span style="color: #A00000">-/build/getsounds.sh</span>
<span style="color: #A00000">-/build/modmake.rules</span>
<span style="color: #00A000">+build/Makefile</span>
<span style="color: #00A000">+build/Makefile.in</span>
<span style="color: #00A000">+build/config/compile</span>
<span style="color: #00A000">+build/config/config.guess</span>
<span style="color: #00A000">+build/config/depcomp</span>
<span style="color: #00A000">+build/config/install-sh</span>
<span style="color: #00A000">+build/config/ltmain.sh</span>
<span style="color: #00A000">+build/config/missing</span>
<span style="color: #00A000">+build/freeswitch.pc</span>
<span style="color: #00A000">+build/getlib.sh</span>
<span style="color: #00A000">+build/getsounds.sh</span>
<span style="color: #00A000">+build/modmake.rules</span>
<span style="color: #00A000">+build/getg729.sh</span>
 config.cache
 config.log
 config.status
<span style="color: #A00000">-/configure</span>
<span style="color: #00A000">+configure</span>
 configure.lineno
<span style="color: #A00000">-/freeswitch</span>
<span style="color: #A00000">-/fs_cli</span>
<span style="color: #A00000">-/fs_encode</span>
<span style="color: #A00000">-/fs_ivrd</span>
<span style="color: #A00000">-/libtool</span>
<span style="color: #A00000">-/modules.conf</span>
<span style="color: #A00000">-/quiet_libtool</span>
<span style="color: #A00000">-/tone2wav</span>
<span style="color: #A00000">-/scripts/fsxs</span>
<span style="color: #A00000">-/scripts/gentls_cert</span>
<span style="color: #A00000">-/a.out.dSYM</span>
<span style="color: #00A000">+freeswitch</span>
<span style="color: #00A000">+fs_cli</span>
<span style="color: #00A000">+fs_encode</span>
<span style="color: #00A000">+fs_ivrd</span>
<span style="color: #00A000">+libtool</span>
<span style="color: #00A000">+noreg</span>
<span style="color: #00A000">+modules.conf</span>
<span style="color: #00A000">+quiet_libtool</span>
<span style="color: #00A000">+tone2wav</span>
<span style="color: #00A000">+scripts/fsxs</span>
<span style="color: #00A000">+scripts/gentls_cert</span>
<span style="color: #00A000">+a.out.dSYM</span>
 src/mod/applications/mod_easyroute/Makefile
 src/mod/applications/mod_lcr/Makefile
 src/mod/applications/mod_nibblebill/Makefile
<span style="color: #800080; font-weight: bold">@@ -102,6 +104,7 @@ src/mod/say/mod_say_th/Makefile</span>
 src/mod/say/mod_say_zh/Makefile
 libs/curl/lib/ca-bundle.h
 libs/g729/
<span style="color: #00A000">+libs/fsg729-*-installer</span>
 src/mod/codecs/mod_com_g729/
 src/mod/languages/mod_lua/mod_lua_wrap.cpp.orig
 src/mod/languages/mod_perl/mod_perl_wrap.cpp.orig
<span style="color: #000080; font-weight: bold">diff --git a/build/getg729.sh.in b/build/getg729.sh.in</span>
new file mode 100755
<span style="color: #000080; font-weight: bold">index 0000000..c8a7227</span>
<span style="color: #A00000">--- /dev/null</span>
<span style="color: #00A000">+++ b/build/getg729.sh.in</span>
<span style="color: #800080; font-weight: bold">@@ -0,0 +1,34 @@</span>
<span style="color: #00A000">+#!/bin/sh</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+TAR=@TAR@</span>
<span style="color: #00A000">+ZCAT=@ZCAT@</span>
<span style="color: #00A000">+WGET=@WGET@</span>
<span style="color: #00A000">+CURL=@CURL@</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+if [ -f &quot;$WGET&quot; ] ; then</span>
<span style="color: #00A000">+    DOWNLOAD_CMD=$WGET</span>
<span style="color: #00A000">+else</span>
<span style="color: #00A000">+    if [ -f &quot;$CURL&quot; ] ; then</span>
<span style="color: #00A000">+        DOWNLOAD_CMD=&quot;$CURL -O&quot;</span>
<span style="color: #00A000">+    fi</span>
<span style="color: #00A000">+fi</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+base=http://files.freeswitch.org/g729/</span>
<span style="color: #00A000">+tarfile=$1</span>
<span style="color: #00A000">+url=`echo $tarfile | grep &quot;://&quot;`</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+if [ ! -z $url ] ; then</span>
<span style="color: #00A000">+    base=$tarfile/</span>
<span style="color: #00A000">+    tarfile=$2</span>
<span style="color: #00A000">+fi</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+if [ ! -f $tarfile ] ; then</span>
<span style="color: #00A000">+    $DOWNLOAD_CMD $base$tarfile</span>
<span style="color: #00A000">+    if [ ! -f $tarfile ] ; then</span>
<span style="color: #00A000">+        echo cannot find $tarfile</span>
<span style="color: #00A000">+        exit 1</span>
<span style="color: #00A000">+    fi</span>
<span style="color: #00A000">+fi</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+exit 0</span>
<span style="color: #00A000">+</span>
<span style="color: #000080; font-weight: bold">diff --git a/build/modules.conf.in b/build/modules.conf.in</span>
<span style="color: #000080; font-weight: bold">index 8d3dfaa..63a0ab4 100644</span>
<span style="color: #A00000">--- a/build/modules.conf.in</span>
<span style="color: #00A000">+++ b/build/modules.conf.in</span>
<span style="color: #800080; font-weight: bold">@@ -42,6 +42,7 @@ codecs/mod_amr</span>
 #codecs/mod_silk
 #codecs/mod_codec2
 codecs/mod_g729
<span style="color: #00A000">+#codecs/mod_com_g729</span>
 codecs/mod_h26x
 codecs/mod_bv
 codecs/mod_ilbc
<span style="color: #000080; font-weight: bold">diff --git a/configure.in b/configure.in</span>
<span style="color: #000080; font-weight: bold">index d91cf11..a0c9418 100644</span>
<span style="color: #A00000">--- a/configure.in</span>
<span style="color: #00A000">+++ b/configure.in</span>
<span style="color: #800080; font-weight: bold">@@ -730,6 +730,8 @@ AC_PATH_PROGS(WGET, wget)</span>
 AC_PATH_PROGS(CURL, curl)
 GETLIB=&quot;cd $switch_srcdir/libs &amp;&amp; ${SHELL} $switch_builddir/build/getlib.sh&quot;
 AC_SUBST(GETLIB)
<span style="color: #00A000">+GETG729=&quot;cd $switch_srcdir/libs &amp;&amp; ${SHELL} $switch_builddir/build/getg729.sh&quot;</span>
<span style="color: #00A000">+AC_SUBST(GETG729)</span>
 GETSOUNDS=&quot;${SHELL} $switch_builddir/build/getsounds.sh&quot;
 AC_SUBST(GETSOUNDS)
 
<span style="color: #800080; font-weight: bold">@@ -916,6 +918,7 @@ AC_CONFIG_FILES([Makefile</span>
                 src/mod/applications/mod_osp/Makefile
                 src/mod/applications/mod_stress/Makefile
                 src/mod/applications/mod_hash/Makefile
<span style="color: #00A000">+                src/mod/codecs/mod_com_g729/Makefile</span>
                 src/mod/endpoints/mod_portaudio/Makefile
                 src/mod/endpoints/mod_skinny/Makefile
                 src/mod/endpoints/mod_skypopen/Makefile
<span style="color: #800080; font-weight: bold">@@ -930,6 +933,7 @@ AC_CONFIG_FILES([Makefile</span>
                 src/include/switch_am_config.h
                 build/getsounds.sh
                 build/getlib.sh
<span style="color: #00A000">+                build/getg729.sh</span>
                 build/freeswitch.pc
                 build/modmake.rules
                 libs/xmlrpc-c/include/xmlrpc-c/config.h
<span style="color: #800080; font-weight: bold">@@ -1023,6 +1027,7 @@ AC_OUTPUT</span>
 ##
 ## Registering for ClueCon
 ##
<span style="color: #00A000">+if ! test -f noreg ; then</span>
 echo &quot;&quot;
 echo &quot;&quot;
 echo $ECHO_N &quot;Registering you for ClueCon http://www.cluecon.com $ECHO_C&quot; 1&gt;&amp;6
<span style="color: #800080; font-weight: bold">@@ -1040,6 +1045,7 @@ sleep 1</span>
 AC_MSG_RESULT([ See you in August. ;-)])
 sleep 2
 echo &quot;&quot;
<span style="color: #00A000">+fi</span>
 
 ##
 ## Configuration summary
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/Makefile.am b/src/mod/Makefile.am</span>
<span style="color: #000080; font-weight: bold">index e655cf7..5af782d 100644</span>
<span style="color: #A00000">--- a/src/mod/Makefile.am</span>
<span style="color: #00A000">+++ b/src/mod/Makefile.am</span>
<span style="color: #800080; font-weight: bold">@@ -21,7 +21,7 @@ $(OUR_MODULES) $(OUR_CLEAN_MODULES) $(OUR_INSTALL_MODULES) $(OUR_UNINSTALL_MODUL</span>
                 fi ; \
         fi ; \
         if test -z &quot;$$target&quot; ; then target=&quot;all&quot; ; fi ; \
<span style="color: #A00000">-        if ! test -f $$moddir/$$modname.c &amp;&amp; ! test -f $$moddir/$$modname.cpp ;        \</span>
<span style="color: #00A000">+        if ! test -f $$moddir/$$modname.c &amp;&amp; ! test -f $$moddir/$$modname.cpp &amp;&amp; test $$modname != &quot;mod_com_g729&quot; ;        \</span>
         then echo ; echo &quot;WARNING $$modname is not a valid FreeSWITCH module dir, skipping it...&quot; ; else \
                 echo ;\
                 echo making $$target $$modname ;\
<span style="color: #800080; font-weight: bold">@@ -35,6 +35,9 @@ $(OUR_MODULES) $(OUR_CLEAN_MODULES) $(OUR_INSTALL_MODULES) $(OUR_UNINSTALL_MODUL</span>
         fi; \
         test -z &quot;$$fail&quot; ;
 
<span style="color: #00A000">+mod_com_g729-activate:</span>
<span style="color: #00A000">+        cd $(switch_builddir)/src/mod/codecs/mod_com_g729 &amp;&amp; $(MAKE) $(AM_MAKEFLAGS) activate</span>
<span style="color: #00A000">+</span>
 .DEFAULT:
         @if test -z &quot;`echo $@ | grep all`&quot;; then  $(MAKE) $(AM_MAKEFLAGS) $@-all ; else echo Unknown target `echo $@ | sed -e &#39;s|-all||&#39;`; exit 1; fi
 
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/codecs/mod_com_g729/Makefile.am b/src/mod/codecs/mod_com_g729/Makefile.am</span>
new file mode 100644
<span style="color: #000080; font-weight: bold">index 0000000..7b63138</span>
<span style="color: #A00000">--- /dev/null</span>
<span style="color: #00A000">+++ b/src/mod/codecs/mod_com_g729/Makefile.am</span>
<span style="color: #800080; font-weight: bold">@@ -0,0 +1,39 @@</span>
<span style="color: #00A000">+include $(top_srcdir)/build/modmake.rulesam</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+MODNAME=mod_com_g729</span>
<span style="color: #00A000">+VERSION=193</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+if ISLINUX</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+G729INSTALLER = $(top_srcdir)/libs/fsg729-$(VERSION)-installer</span>
<span style="color: #00A000">+LICSERVER=/usr/sbin/freeswitch_licence_server</span>
<span style="color: #00A000">+VALIDATOR=$(bindir)/validator</span>
<span style="color: #00A000">+MOD=$(moddir)/mod_com_g729.so</span>
<span style="color: #00A000">+BUILT_SOURCES = $(G729INSTALLER)</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+install: $(LICSERVER) $(VALIDATOR) $(MOD)</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+$(LICSERVER) $(VALIDATOR) $(MOD): $(G729INSTALLER)</span>
<span style="color: #00A000">+        $(SHELL) $(G729INSTALLER) $(bindir) $(moddir) nobanner</span>
<span style="color: #00A000">+        $(ECHO)</span>
<span style="color: #00A000">+        $(ECHO)</span>
<span style="color: #00A000">+        $(ECHO) Now you can activate your license by running $(MAKE) mod_com_g729-activate</span>
<span style="color: #00A000">+        $(ECHO)</span>
<span style="color: #00A000">+        $(ECHO)</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+$(G729INSTALLER):</span>
<span style="color: #00A000">+        rm -f $(top_srcdir)/libs/fsg729-*-installer*</span>
<span style="color: #00A000">+        $(GETG729) fsg729-$(VERSION)-installer</span>
<span style="color: #00A000">+        chmod 755 $(G729INSTALLER)</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+clean:</span>
<span style="color: #00A000">+        rm -f $(top_srcdir)/libs/fsg729-*-installer*</span>
<span style="color: #00A000">+        rm -rf /tmp/fsg729</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+activate: $(LICSERVER) $(VALIDATOR) $(MOD)</span>
<span style="color: #00A000">+        $(VALIDATOR)</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+uninstall: clean</span>
<span style="color: #00A000">+        rm -f $(LICSERVER) $(VALIDATOR) $(MOD)</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+endif</span>
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments: 
don&#39;t encourage ppl to use vad on mod_dingaling

<span style="color: #000080; font-weight: bold">diff --git a/conf/jingle_profiles/client.xml b/conf/jingle_profiles/client.xml</span>
<span style="color: #000080; font-weight: bold">index 66c3492..cac7069 100644</span>
<span style="color: #A00000">--- a/conf/jingle_profiles/client.xml</span>
<span style="color: #00A000">+++ b/conf/jingle_profiles/client.xml</span>
<span style="color: #800080; font-weight: bold">@@ -24,7 +24,7 @@</span>
     &lt;!-- VAD choose one --&gt;
     &lt;!-- &lt;param name=&quot;vad&quot; value=&quot;in&quot;/&gt; --&gt;
     &lt;!-- &lt;param name=&quot;vad&quot; value=&quot;out&quot;/&gt; --&gt;
<span style="color: #A00000">-    &lt;param name=&quot;vad&quot; value=&quot;both&quot;/&gt;</span>
<span style="color: #00A000">+    &lt;!--&lt;param name=&quot;vad&quot; value=&quot;both&quot;/&gt;--&gt;</span>
     &lt;!--&lt;param name=&quot;avatar&quot; value=&quot;/path/to/tiny.jpg&quot;/&gt;--&gt;
     &lt;!--&lt;param name=&quot;candidate-acl&quot; value=&quot;wan.auto&quot;/&gt;--&gt;
     &lt;param name=&quot;local-network-acl&quot; value=&quot;localnet.auto&quot;/&gt;
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments: 
fix race with media bug exiting from write frame while read frame is trying to use it

<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core_io.c b/src/switch_core_io.c</span>
<span style="color: #000080; font-weight: bold">index decb587..4e1c707 100644</span>
<span style="color: #A00000">--- a/src/switch_core_io.c</span>
<span style="color: #00A000">+++ b/src/switch_core_io.c</span>
<span style="color: #800080; font-weight: bold">@@ -318,11 +318,24 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi</span>
                                 switch_codec_t *use_codec = read_frame-&gt;codec;
                                 if (do_bugs) {
                                         switch_thread_rwlock_wrlock(session-&gt;bug_rwlock);
<span style="color: #00A000">+                                        if (!session-&gt;bugs) {</span>
<span style="color: #00A000">+                                                do_bugs = 0;</span>
<span style="color: #00A000">+                                                switch_thread_rwlock_unlock(session-&gt;bug_rwlock);</span>
<span style="color: #00A000">+                                                goto done;</span>
<span style="color: #00A000">+                                        }</span>
<span style="color: #00A000">+</span>
                                         if (!switch_core_codec_ready(&amp;session-&gt;bug_codec)) {
                                                 switch_core_codec_copy(read_frame-&gt;codec, &amp;session-&gt;bug_codec, NULL);
                                         }
                                         use_codec = &amp;session-&gt;bug_codec;
                                         switch_thread_rwlock_unlock(session-&gt;bug_rwlock);
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                        switch_thread_rwlock_wrlock(session-&gt;bug_rwlock);</span>
<span style="color: #00A000">+                                        if (!session-&gt;bugs) {</span>
<span style="color: #00A000">+                                                do_bugs = 0;</span>
<span style="color: #00A000">+                                        }</span>
<span style="color: #00A000">+                                        switch_thread_rwlock_unlock(session-&gt;bug_rwlock);</span>
<span style="color: #00A000">+                                        if (!do_bugs) goto done;</span>
                                 }
 
                                 if (switch_test_flag(read_frame, SFF_PLC)) {
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments: 
FS-3050 FS-3051

<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c</span>
<span style="color: #000080; font-weight: bold">index 76b1dcc..5109e0b 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/sofia_reg.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/sofia_reg.c</span>
<span style="color: #800080; font-weight: bold">@@ -1543,6 +1543,8 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand</span>
                                 }
                         }
                 } else {
<span style="color: #00A000">+                        switch_core_del_registration(to_user, reg_host, call_id);</span>
<span style="color: #00A000">+</span>
                         if (switch_event_create_subclass(&amp;s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) {
                                 switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, &quot;profile-name&quot;, profile-&gt;name);
                                 switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, &quot;from-user&quot;, to_user);
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c</span>
<span style="color: #000080; font-weight: bold">index ba92ebc..f54bd65 100644</span>
<span style="color: #A00000">--- a/src/switch_core_sqldb.c</span>
<span style="color: #00A000">+++ b/src/switch_core_sqldb.c</span>
<span style="color: #800080; font-weight: bold">@@ -1625,7 +1625,7 @@ static char create_nat_sql[] =</span>
 
 static char create_registrations_sql[] =
         &quot;CREATE TABLE registrations (\n&quot;
<span style="color: #A00000">-        &quot;   user      VARCHAR(256),\n&quot;</span>
<span style="color: #00A000">+        &quot;   reg_user      VARCHAR(256),\n&quot;</span>
         &quot;   realm     VARCHAR(256),\n&quot;
         &quot;   token     VARCHAR(256),\n&quot;
         &quot;   url      TEXT,\n&quot;
<span style="color: #800080; font-weight: bold">@@ -1635,7 +1635,7 @@ static char create_registrations_sql[] =</span>
         &quot;   network_proto VARCHAR(256),\n&quot;
         &quot;   hostname VARCHAR(256)\n&quot;
         &quot;);\n&quot;
<span style="color: #A00000">-        &quot;create index regindex1 on registrations (user,real,hostname);\n&quot;;</span>
<span style="color: #00A000">+        &quot;create index regindex1 on registrations (user,realm,hostname);\n&quot;;</span>
         
 
 SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires, 
<span style="color: #800080; font-weight: bold">@@ -1653,7 +1653,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c</span>
         switch_cache_db_execute_sql(dbh, sql, NULL);
         free(sql);
 
<span style="color: #A00000">-        sql = switch_mprintf(&quot;insert into registrations (user,realm,token,url,expires,network_ip,network_port,network_proto,hostname) &quot;</span>
<span style="color: #00A000">+        sql = switch_mprintf(&quot;insert into registrations (reg_user,realm,token,url,expires,network_ip,network_port,network_proto,hostname) &quot;</span>
                                                  &quot;values (&#39;%q&#39;,&#39;%q&#39;,&#39;%q&#39;,&#39;%q&#39;,%ld,&#39;%q&#39;,&#39;%q&#39;,&#39;%q&#39;,&#39;%q&#39;)&quot;,
                                                  switch_str_nil(user),
                                                  switch_str_nil(realm),
<span style="color: #800080; font-weight: bold">@@ -1685,7 +1685,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, c</span>
                 return SWITCH_STATUS_FALSE;
         }
 
<span style="color: #A00000">-        sql = switch_mprintf(&quot;delete from registrations where user=&#39;%q&#39; and realm=&#39;%q&#39; and hostname=&#39;%q&#39;&quot;, user, realm, switch_core_get_hostname());</span>
<span style="color: #00A000">+        sql = switch_mprintf(&quot;delete from registrations where reg_user=&#39;%q&#39; and realm=&#39;%q&#39; and hostname=&#39;%q&#39;&quot;, user, realm, switch_core_get_hostname());</span>
 
         switch_cache_db_execute_sql(dbh, sql, NULL);
         switch_cache_db_release_db_handle(&amp;dbh);
<span style="color: #800080; font-weight: bold">@@ -1798,7 +1798,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_</span>
         switch_cache_db_test_reactive(dbh, &quot;select hostname from complete&quot;, &quot;DROP TABLE complete&quot;, create_complete_sql);
         switch_cache_db_test_reactive(dbh, &quot;select hostname from aliases&quot;, &quot;DROP TABLE aliases&quot;, create_alias_sql);
         switch_cache_db_test_reactive(dbh, &quot;select hostname from nat&quot;, &quot;DROP TABLE nat&quot;, create_nat_sql);
<span style="color: #A00000">-        switch_cache_db_test_reactive(dbh, &quot;delete from registrations where network_proto=&#39;tcp&#39; or network_proto=&#39;tls&#39;&quot;, </span>
<span style="color: #00A000">+        switch_cache_db_test_reactive(dbh, &quot;delete from registrations where reg_user=&#39;&#39; or network_proto=&#39;tcp&#39; or network_proto=&#39;tls&#39;&quot;, </span>
                                                                   &quot;DROP TABLE registrations&quot;, create_registrations_sql);
 
 
<span style="color: #800080; font-weight: bold">@@ -1816,7 +1816,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_</span>
                         }
                         switch_cache_db_test_reactive(dbh, &quot;select ikey from interfaces&quot;, &quot;DROP TABLE interfaces&quot;, create_interfaces_sql);
                         switch_cache_db_test_reactive(dbh, &quot;select hostname from tasks&quot;, &quot;DROP TABLE tasks&quot;, create_tasks_sql);
<span style="color: #A00000">-                        switch_cache_db_test_reactive(dbh, &quot;delete from registrations where network_proto=&#39;tcp&#39; or network_proto=&#39;tls&#39;&quot;, </span>
<span style="color: #00A000">+                        switch_cache_db_test_reactive(dbh, &quot;delete from registrations where reg_user=&#39;&#39; or network_proto=&#39;tcp&#39; or network_proto=&#39;tls&#39;&quot;, </span>
                                                                                   &quot;DROP TABLE registrations&quot;, create_registrations_sql);
 
                         if (runtime.odbc_dbtype == DBTYPE_DEFAULT) {
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments: 
clear unique headers on event_socket filters

<span style="color: #000080; font-weight: bold">diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c</span>
<span style="color: #000080; font-weight: bold">index 1462e4e..2bb1d45 100644</span>
<span style="color: #A00000">--- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c</span>
<span style="color: #00A000">+++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c</span>
<span style="color: #800080; font-weight: bold">@@ -1783,6 +1783,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even</span>
                 switch_mutex_lock(listener-&gt;filter_mutex);
                 if (!listener-&gt;filters) {
                         switch_event_create_plain(&amp;listener-&gt;filters, SWITCH_EVENT_CLONE);
<span style="color: #00A000">+                        switch_clear_flag(listener-&gt;filters, EF_UNIQ_HEADERS);</span>
                 }
 
                 if (!strcasecmp(header_name, &quot;delete&quot;) &amp;&amp; header_val) {
</pre></div>
<div class="highlight"><pre>committer: Marc Olivier Chouinard
comments: 
switch_channel: Add CS_NONE and correct variable name

<span style="color: #000080; font-weight: bold">diff --git a/src/switch_channel.c b/src/switch_channel.c</span>
<span style="color: #000080; font-weight: bold">index f750496..9e3064b 100644</span>
<span style="color: #A00000">--- a/src/switch_channel.c</span>
<span style="color: #00A000">+++ b/src/switch_channel.c</span>
<span style="color: #800080; font-weight: bold">@@ -184,7 +184,7 @@ struct switch_callstate_table {</span>
         const char *name;
         switch_channel_callstate_t callstate;
 };
<span style="color: #A00000">-static struct switch_callstate_table STATE_CHART[] = {</span>
<span style="color: #00A000">+static struct switch_callstate_table CALLSTATE_CHART[] = {</span>
     {&quot;DOWN&quot;, CCS_DOWN},
     {&quot;DIALING&quot;, CCS_DIALING},
     {&quot;RINGING&quot;, CCS_RINGING},
<span style="color: #800080; font-weight: bold">@@ -228,9 +228,9 @@ SWITCH_DECLARE(const char *) switch_channel_callstate2str(switch_channel_callsta</span>
         uint8_t x;
         const char *str = &quot;UNKNOWN&quot;;
 
<span style="color: #A00000">-        for (x = 0; x &lt; (sizeof(STATE_CHART) / sizeof(struct switch_cause_table)) - 1; x++) {</span>
<span style="color: #A00000">-                if (STATE_CHART[x].callstate == callstate) {</span>
<span style="color: #A00000">-                        str = STATE_CHART[x].name;</span>
<span style="color: #00A000">+        for (x = 0; x &lt; (sizeof(CALLSTATE_CHART) / sizeof(struct switch_cause_table)) - 1; x++) {</span>
<span style="color: #00A000">+                if (CALLSTATE_CHART[x].callstate == callstate) {</span>
<span style="color: #00A000">+                        str = CALLSTATE_CHART[x].name;</span>
                         break;
                 }
         }
<span style="color: #800080; font-weight: bold">@@ -238,6 +238,7 @@ SWITCH_DECLARE(const char *) switch_channel_callstate2str(switch_channel_callsta</span>
         return str;
 }
 
<span style="color: #00A000">+</span>
 SWITCH_DECLARE(switch_call_cause_t) switch_channel_str2callstate(const char *str)
 {
         uint8_t x;
<span style="color: #800080; font-weight: bold">@@ -246,9 +247,9 @@ SWITCH_DECLARE(switch_call_cause_t) switch_channel_str2callstate(const char *str</span>
         if (*str &gt; 47 &amp;&amp; *str &lt; 58) {
                 callstate = atoi(str);
         } else {
<span style="color: #A00000">-                for (x = 0; x &lt; (sizeof(STATE_CHART) / sizeof(struct switch_callstate_table)) - 1 &amp;&amp; STATE_CHART[x].name; x++) {</span>
<span style="color: #A00000">-                        if (!strcasecmp(STATE_CHART[x].name, str)) {</span>
<span style="color: #A00000">-                                callstate = STATE_CHART[x].callstate;</span>
<span style="color: #00A000">+                for (x = 0; x &lt; (sizeof(CALLSTATE_CHART) / sizeof(struct switch_callstate_table)) - 1 &amp;&amp; CALLSTATE_CHART[x].name; x++) {</span>
<span style="color: #00A000">+                        if (!strcasecmp(CALLSTATE_CHART[x].name, str)) {</span>
<span style="color: #00A000">+                                callstate = CALLSTATE_CHART[x].callstate;</span>
                                 break;
                         }
                 }
<span style="color: #800080; font-weight: bold">@@ -1606,6 +1607,7 @@ static const char *state_names[] = {</span>
         &quot;CS_HANGUP&quot;,
         &quot;CS_REPORTING&quot;,
         &quot;CS_DESTROY&quot;,
<span style="color: #00A000">+        &quot;CS_NONE&quot;,</span>
         NULL
 };
 
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments: 
add centralized registration db to core db and use it from mod_sofia

<span style="color: #000080; font-weight: bold">diff --git a/src/include/switch_core.h b/src/include/switch_core.h</span>
<span style="color: #000080; font-weight: bold">index 69b0642..984b54f 100644</span>
<span style="color: #A00000">--- a/src/include/switch_core.h</span>
<span style="color: #00A000">+++ b/src/include/switch_core.h</span>
<span style="color: #800080; font-weight: bold">@@ -2227,6 +2227,11 @@ SWITCH_DECLARE(const char *) switch_core_banner(void);</span>
 SWITCH_DECLARE(switch_bool_t) switch_core_session_in_thread(switch_core_session_t *session);
 SWITCH_DECLARE(uint32_t) switch_default_ptime(const char *name, uint32_t number);
 
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires, </span>
<span style="color: #00A000">+                                                                                                                         const char *network_ip, const char *network_port, const char *network_proto);</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, const char *realm, const char *token);</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force);</span>
<span style="color: #00A000">+</span>
 SWITCH_END_EXTERN_C
 #endif
 /* For Emacs:
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c</span>
<span style="color: #000080; font-weight: bold">index f34042a..030cb8e 100644</span>
<span style="color: #A00000">--- a/src/mod/applications/mod_commands/mod_commands.c</span>
<span style="color: #00A000">+++ b/src/mod/applications/mod_commands/mod_commands.c</span>
<span style="color: #800080; font-weight: bold">@@ -45,6 +45,149 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load);</span>
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown);
 SWITCH_MODULE_DEFINITION(mod_commands, mod_commands_load, mod_commands_shutdown, NULL);
 
<span style="color: #00A000">+</span>
<span style="color: #00A000">+struct cb_helper {</span>
<span style="color: #00A000">+        uint32_t row_process;</span>
<span style="color: #00A000">+        switch_stream_handle_t *stream;</span>
<span style="color: #00A000">+};</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static int url_callback(void *pArg, int argc, char **argv, char **columnNames)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        struct cb_helper *cb = (struct cb_helper *) pArg;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cb-&gt;row_process++;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (!zstr(argv[0])) {</span>
<span style="color: #00A000">+                cb-&gt;stream-&gt;write_function(cb-&gt;stream, &quot;%s,&quot;, argv[0]);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return 0;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static switch_status_t select_url(const char *user,</span>
<span style="color: #00A000">+                                           const char *domain,</span>
<span style="color: #00A000">+                                           const char *concat,</span>
<span style="color: #00A000">+                                           const char *exclude_contact, </span>
<span style="color: #00A000">+                                           switch_stream_handle_t *stream)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        struct cb_helper cb;</span>
<span style="color: #00A000">+        char *sql, *errmsg = NULL;</span>
<span style="color: #00A000">+        switch_core_flag_t cflags = switch_core_flags();</span>
<span style="color: #00A000">+        switch_cache_db_handle_t *db = NULL;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (!(cflags &amp; SCF_USE_SQL)) {</span>
<span style="color: #00A000">+                stream-&gt;write_function(stream, &quot;-ERR SQL DISABLED NO DATA AVAILABLE!\n&quot;);</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (switch_core_db_handle(&amp;db) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                stream-&gt;write_function(stream, &quot;%s&quot;, &quot;-ERR Databse Error!\n&quot;);</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        cb.row_process = 0;</span>
<span style="color: #00A000">+        cb.stream = stream;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (exclude_contact) {</span>
<span style="color: #00A000">+                sql = switch_mprintf(&quot;select url, &#39;%q&#39; &quot;</span>
<span style="color: #00A000">+                                                         &quot;from registrations where user=&#39;%q&#39; and realm=&#39;%q&#39; &quot;</span>
<span style="color: #00A000">+                                                         &quot;and url not like &#39;%%%s%%&#39;&quot;, (concat != NULL) ? concat : &quot;&quot;, user, domain, exclude_contact);</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                sql = switch_mprintf(&quot;select url, &#39;%q&#39; &quot;</span>
<span style="color: #00A000">+                                                         &quot;from registrations where user=&#39;%q&#39; and realm=&#39;%q&#39;&quot;,</span>
<span style="color: #00A000">+                                                         (concat != NULL) ? concat : &quot;&quot;, user, domain);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_assert(sql);</span>
<span style="color: #00A000">+        switch_cache_db_execute_sql_callback(db, sql, url_callback, &amp;cb, &amp;errmsg);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (errmsg) {</span>
<span style="color: #00A000">+                stream-&gt;write_function(stream, &quot;-ERR SQL Error [%s]\n&quot;, errmsg);</span>
<span style="color: #00A000">+                free(errmsg);</span>
<span style="color: #00A000">+                errmsg = NULL;</span>
<span style="color: #00A000">+        }        </span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_safe_free(sql);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (db) {</span>
<span style="color: #00A000">+                switch_cache_db_release_db_handle(&amp;db);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWITCH_STANDARD_API(reg_url_function)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        char *data;</span>
<span style="color: #00A000">+        char *user = NULL;</span>
<span style="color: #00A000">+        char *domain = NULL, *dup_domain = NULL;</span>
<span style="color: #00A000">+        char *concat = NULL;</span>
<span style="color: #00A000">+        const char *exclude_contact = NULL;</span>
<span style="color: #00A000">+        char *reply = &quot;error/facility_not_subscribed&quot;;</span>
<span style="color: #00A000">+        switch_stream_handle_t mystream = { 0 };</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (!cmd) {</span>
<span style="color: #00A000">+                stream-&gt;write_function(stream, &quot;%s&quot;, &quot;&quot;);</span>
<span style="color: #00A000">+                return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (session) {</span>
<span style="color: #00A000">+                switch_channel_t *channel = switch_core_session_get_channel(session);</span>
<span style="color: #00A000">+                exclude_contact = switch_channel_get_variable(channel, &quot;sip_exclude_contact&quot;);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        data = strdup(cmd);</span>
<span style="color: #00A000">+        switch_assert(data);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        user = data;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if ((domain = strchr(user, &#39;@&#39;))) {</span>
<span style="color: #00A000">+                *domain++ = &#39;\0&#39;;</span>
<span style="color: #00A000">+                if ((concat = strchr(domain, &#39;/&#39;))) {</span>
<span style="color: #00A000">+                        *concat++ = &#39;\0&#39;;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                if ((concat = strchr(user, &#39;/&#39;))) {</span>
<span style="color: #00A000">+                        *concat++ = &#39;\0&#39;;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (zstr(domain)) {</span>
<span style="color: #00A000">+                dup_domain = switch_core_get_variable_dup(&quot;domain&quot;);</span>
<span style="color: #00A000">+                domain = dup_domain;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (!user) goto end;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        SWITCH_STANDARD_STREAM(mystream);</span>
<span style="color: #00A000">+        switch_assert(mystream.data);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        select_url(user, domain, concat, exclude_contact, &amp;mystream);</span>
<span style="color: #00A000">+        reply = mystream.data;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+ end:</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        if (zstr(reply)) {</span>
<span style="color: #00A000">+                reply = &quot;error/user_not_registered&quot;;</span>
<span style="color: #00A000">+        } else if (end_of(reply) == &#39;,&#39;) {</span>
<span style="color: #00A000">+                end_of(reply) = &#39;\0&#39;;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        stream-&gt;write_function(stream, &quot;%s&quot;, reply);</span>
<span style="color: #00A000">+        reply = NULL;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_safe_free(mystream.data);                                        </span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_safe_free(data);</span>
<span style="color: #00A000">+        switch_safe_free(dup_domain);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
 SWITCH_STANDARD_API(banner_function)
 {
         stream-&gt;write_function(stream, &quot;%s&quot;, switch_core_banner());
<span style="color: #800080; font-weight: bold">@@ -3738,6 +3881,14 @@ SWITCH_STANDARD_API(show_function)</span>
                                 as = argv[3];
                         }
                 }
<span style="color: #00A000">+        } else if (!strcasecmp(command, &quot;registrations&quot;)) {</span>
<span style="color: #00A000">+                sprintf(sql, &quot;select * from registrations where hostname=&#39;%s&#39;&quot;, hostname);</span>
<span style="color: #00A000">+                if (argv[1] &amp;&amp; !strcasecmp(argv[1], &quot;count&quot;)) {</span>
<span style="color: #00A000">+                        holder.justcount = 1;</span>
<span style="color: #00A000">+                        if (argv[3] &amp;&amp; !strcasecmp(argv[2], &quot;as&quot;)) {</span>
<span style="color: #00A000">+                                as = argv[3];</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+                }</span>
         } else if (!strcasecmp(command, &quot;channels&quot;) &amp;&amp; argv[1] &amp;&amp; !strcasecmp(argv[1], &quot;like&quot;)) {
                 if (argv[2]) {
                         char *p;
<span style="color: #800080; font-weight: bold">@@ -4890,6 +5041,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)</span>
         SWITCH_ADD_API(commands_api_interface, &quot;tone_detect&quot;, &quot;Start Tone Detection on a channel&quot;, tone_detect_session_function, TONE_DETECT_SYNTAX);
         SWITCH_ADD_API(commands_api_interface, &quot;unload&quot;, &quot;Unload Module&quot;, unload_function, UNLOAD_SYNTAX);
         SWITCH_ADD_API(commands_api_interface, &quot;unsched_api&quot;, &quot;Unschedule an api command&quot;, unsched_api_function, UNSCHED_SYNTAX);
<span style="color: #00A000">+        SWITCH_ADD_API(commands_api_interface, &quot;reg_url&quot;, &quot;&quot;, reg_url_function, &quot;&lt;user&gt;@&lt;realm&gt;&quot;);</span>
         SWITCH_ADD_API(commands_api_interface, &quot;url_decode&quot;, &quot;url decode a string&quot;, url_decode_function, &quot;&lt;string&gt;&quot;);
         SWITCH_ADD_API(commands_api_interface, &quot;url_encode&quot;, &quot;url encode a string&quot;, url_encode_function, &quot;&lt;string&gt;&quot;);
         SWITCH_ADD_API(commands_api_interface, &quot;user_data&quot;, &quot;find user data&quot;, user_data_function, &quot;&lt;user&gt;@&lt;domain&gt; [var|param|attr] &lt;name&gt;&quot;);
<span style="color: #800080; font-weight: bold">@@ -5000,6 +5152,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)</span>
         switch_console_set_complete(&quot;add show management&quot;);
         switch_console_set_complete(&quot;add show modules&quot;);
         switch_console_set_complete(&quot;add show nat_map&quot;);
<span style="color: #00A000">+        switch_console_set_complete(&quot;add show registrations&quot;);</span>
         switch_console_set_complete(&quot;add show say&quot;);
         switch_console_set_complete(&quot;add show timer&quot;);
         switch_console_set_complete(&quot;add shutdown&quot;);
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #000080; font-weight: bold">index 07c285f..4853dff 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #800080; font-weight: bold">@@ -3314,6 +3314,7 @@ static int contact_callback(void *pArg, int argc, char **argv, char **columnName</span>
 
         return 0;
 }
<span style="color: #00A000">+</span>
 static int sql2str_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
         struct cb_helper_sql2str *cbt = (struct cb_helper_sql2str *) pArg;
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c</span>
<span style="color: #000080; font-weight: bold">index 631cbdb..76b1dcc 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/sofia_reg.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/sofia_reg.c</span>
<span style="color: #800080; font-weight: bold">@@ -877,6 +877,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand</span>
         const char *agent = &quot;unknown&quot;;
         const char *pres_on_reg = NULL;
         int send_pres = 0;
<span style="color: #00A000">+        int is_tls = 0, is_tcp = 0;</span>
 
         delete_subs = sofia_test_pflag(profile, PFLAG_DEL_SUBS_ON_REG);
 
<span style="color: #800080; font-weight: bold">@@ -944,8 +945,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand</span>
                 char *path_encoded = NULL;
                 int path_encoded_len = 0;
                 const char *proto = &quot;sip&quot;;
<span style="color: #A00000">-                int is_tls = 0, is_tcp = 0;</span>
<span style="color: #A00000">-</span>
 
                 if (switch_stristr(&quot;transport=tls&quot;, sip-&gt;sip_contact-&gt;m_url-&gt;url_params)) {
                         is_tls += 1;
<span style="color: #800080; font-weight: bold">@@ -1292,6 +1291,8 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand</span>
                 char guess_ip4[256];
                 const char *username = &quot;unknown&quot;;
                 const char *realm = reg_host;
<span style="color: #00A000">+                char *url = NULL;</span>
<span style="color: #00A000">+                char *contact = NULL;</span>
 
                 if (auth_params) {
                         username = switch_event_get_header(auth_params, &quot;sip_auth_username&quot;);
<span style="color: #800080; font-weight: bold">@@ -1327,7 +1328,15 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand</span>
 
                 switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET);
 
<span style="color: #00A000">+                contact = sofia_glue_get_url_from_contact(contact_str, 1);</span>
<span style="color: #00A000">+                url = switch_mprintf(&quot;sofia/%q/sip:%q&quot;, profile-&gt;name, sofia_glue_strip_proto(contact));</span>
                 
<span style="color: #00A000">+                switch_core_add_registration(to_user, reg_host, call_id, url, (long) switch_epoch_time_now(NULL) + (long) exptime + 60,</span>
<span style="color: #00A000">+                                                                         network_ip, network_port_c, is_tls ? &quot;tls&quot; : is_tcp ? &quot;tcp&quot; : &quot;udp&quot;);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                switch_safe_free(url);</span>
<span style="color: #00A000">+                switch_safe_free(contact);</span>
<span style="color: #00A000">+</span>
                 sql = switch_mprintf(&quot;insert into sip_registrations &quot;
                                                          &quot;(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires,&quot;
                                                          &quot;user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm,&quot;
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c</span>
<span style="color: #000080; font-weight: bold">index 73890a1..ba92ebc 100644</span>
<span style="color: #A00000">--- a/src/switch_core_sqldb.c</span>
<span style="color: #00A000">+++ b/src/switch_core_sqldb.c</span>
<span style="color: #800080; font-weight: bold">@@ -87,6 +87,7 @@ SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t</span>
 
 
 #define SQL_CACHE_TIMEOUT 120
<span style="color: #00A000">+#define SQL_REG_TIMEOUT 15</span>
 
 static void sql_close(time_t prune)
 {
<span style="color: #800080; font-weight: bold">@@ -906,7 +907,7 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand</span>
 
 static void *SWITCH_THREAD_FUNC switch_core_sql_db_thread(switch_thread_t *thread, void *obj)
 {
<span style="color: #A00000">-        int sec = 0;</span>
<span style="color: #00A000">+        int sec = 0, reg_sec = 0;;</span>
 
         sql_manager.db_thread_running = 1;
 
<span style="color: #800080; font-weight: bold">@@ -916,6 +917,11 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_db_thread(switch_thread_t *threa</span>
                         wake_thread(0);
                         sec = 0;
                 }
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (++reg_sec == SQL_REG_TIMEOUT) {</span>
<span style="color: #00A000">+                        switch_core_expire_registration(0);</span>
<span style="color: #00A000">+                        reg_sec = 0;</span>
<span style="color: #00A000">+                }</span>
                 switch_yield(1000000);
         }
 
<span style="color: #800080; font-weight: bold">@@ -1616,6 +1622,108 @@ static char create_nat_sql[] =</span>
         &quot;   hostname VARCHAR(256)\n&quot;
         &quot;);\n&quot;;
 
<span style="color: #00A000">+</span>
<span style="color: #00A000">+static char create_registrations_sql[] =</span>
<span style="color: #00A000">+        &quot;CREATE TABLE registrations (\n&quot;</span>
<span style="color: #00A000">+        &quot;   user      VARCHAR(256),\n&quot;</span>
<span style="color: #00A000">+        &quot;   realm     VARCHAR(256),\n&quot;</span>
<span style="color: #00A000">+        &quot;   token     VARCHAR(256),\n&quot;</span>
<span style="color: #00A000">+        &quot;   url      TEXT,\n&quot;</span>
<span style="color: #00A000">+        &quot;   expires  INTEGER,\n&quot;</span>
<span style="color: #00A000">+        &quot;   network_ip VARCHAR(256),\n&quot;</span>
<span style="color: #00A000">+        &quot;   network_port VARCHAR(256),\n&quot;</span>
<span style="color: #00A000">+        &quot;   network_proto VARCHAR(256),\n&quot;</span>
<span style="color: #00A000">+        &quot;   hostname VARCHAR(256)\n&quot;</span>
<span style="color: #00A000">+        &quot;);\n&quot;</span>
<span style="color: #00A000">+        &quot;create index regindex1 on registrations (user,real,hostname);\n&quot;;</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires, </span>
<span style="color: #00A000">+                                                                                                                         const char *network_ip, const char *network_port, const char *network_proto)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        switch_cache_db_handle_t *dbh;</span>
<span style="color: #00A000">+        char *sql;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (switch_core_db_handle(&amp;dbh) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, &quot;Error Opening DB!\n&quot;);</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        sql = switch_mprintf(&quot;delete from registrations where hostname=&#39;%q&#39; and (url=&#39;%q&#39; or token=&#39;%q&#39;)&quot;, switch_core_get_hostname(), url, switch_str_nil(token));</span>
<span style="color: #00A000">+        switch_cache_db_execute_sql(dbh, sql, NULL);</span>
<span style="color: #00A000">+        free(sql);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        sql = switch_mprintf(&quot;insert into registrations (user,realm,token,url,expires,network_ip,network_port,network_proto,hostname) &quot;</span>
<span style="color: #00A000">+                                                 &quot;values (&#39;%q&#39;,&#39;%q&#39;,&#39;%q&#39;,&#39;%q&#39;,%ld,&#39;%q&#39;,&#39;%q&#39;,&#39;%q&#39;,&#39;%q&#39;)&quot;,</span>
<span style="color: #00A000">+                                                 switch_str_nil(user),</span>
<span style="color: #00A000">+                                                 switch_str_nil(realm),</span>
<span style="color: #00A000">+                                                 switch_str_nil(token),</span>
<span style="color: #00A000">+                                                 switch_str_nil(url),</span>
<span style="color: #00A000">+                                                 expires,</span>
<span style="color: #00A000">+                                                 switch_str_nil(network_ip),</span>
<span style="color: #00A000">+                                                 switch_str_nil(network_port),</span>
<span style="color: #00A000">+                                                 switch_str_nil(network_proto),</span>
<span style="color: #00A000">+                                                 switch_core_get_hostname()</span>
<span style="color: #00A000">+                                                 );</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        switch_cache_db_execute_sql(dbh, sql, NULL);</span>
<span style="color: #00A000">+        switch_cache_db_release_db_handle(&amp;dbh);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        free(sql);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, const char *realm, const char *token)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_cache_db_handle_t *dbh;</span>
<span style="color: #00A000">+        char *sql;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (switch_core_db_handle(&amp;dbh) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, &quot;Error Opening DB!\n&quot;);</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        sql = switch_mprintf(&quot;delete from registrations where user=&#39;%q&#39; and realm=&#39;%q&#39; and hostname=&#39;%q&#39;&quot;, user, realm, switch_core_get_hostname());</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_cache_db_execute_sql(dbh, sql, NULL);</span>
<span style="color: #00A000">+        switch_cache_db_release_db_handle(&amp;dbh);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        free(sql);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        </span>
<span style="color: #00A000">+        switch_cache_db_handle_t *dbh;</span>
<span style="color: #00A000">+        char *sql;</span>
<span style="color: #00A000">+        switch_time_t now;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (switch_core_db_handle(&amp;dbh) != SWITCH_STATUS_SUCCESS) {</span>
<span style="color: #00A000">+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, &quot;Error Opening DB!\n&quot;);</span>
<span style="color: #00A000">+                return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        now = switch_epoch_time_now(NULL);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        if (force) {</span>
<span style="color: #00A000">+                sql = switch_mprintf(&quot;delete from registrations where hostname=&#39;%q&#39;&quot;, switch_core_get_hostname());</span>
<span style="color: #00A000">+        } else {</span>
<span style="color: #00A000">+                sql = switch_mprintf(&quot;delete from registrations where expires &lt;= %ld and hostname=&#39;%q&#39;&quot;, now, switch_core_get_hostname());</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        switch_cache_db_execute_sql(dbh, sql, NULL);</span>
<span style="color: #00A000">+        switch_cache_db_release_db_handle(&amp;dbh);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        free(sql);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
 switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_t manage)
 {
         switch_threadattr_t *thd_attr;
<span style="color: #800080; font-weight: bold">@@ -1690,6 +1798,8 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_</span>
         switch_cache_db_test_reactive(dbh, &quot;select hostname from complete&quot;, &quot;DROP TABLE complete&quot;, create_complete_sql);
         switch_cache_db_test_reactive(dbh, &quot;select hostname from aliases&quot;, &quot;DROP TABLE aliases&quot;, create_alias_sql);
         switch_cache_db_test_reactive(dbh, &quot;select hostname from nat&quot;, &quot;DROP TABLE nat&quot;, create_nat_sql);
<span style="color: #00A000">+        switch_cache_db_test_reactive(dbh, &quot;delete from registrations where network_proto=&#39;tcp&#39; or network_proto=&#39;tls&#39;&quot;, </span>
<span style="color: #00A000">+                                                                  &quot;DROP TABLE registrations&quot;, create_registrations_sql);</span>
 
 
         switch (dbh-&gt;type) {
<span style="color: #800080; font-weight: bold">@@ -1706,6 +1816,8 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_</span>
                         }
                         switch_cache_db_test_reactive(dbh, &quot;select ikey from interfaces&quot;, &quot;DROP TABLE interfaces&quot;, create_interfaces_sql);
                         switch_cache_db_test_reactive(dbh, &quot;select hostname from tasks&quot;, &quot;DROP TABLE tasks&quot;, create_tasks_sql);
<span style="color: #00A000">+                        switch_cache_db_test_reactive(dbh, &quot;delete from registrations where network_proto=&#39;tcp&#39; or network_proto=&#39;tls&#39;&quot;, </span>
<span style="color: #00A000">+                                                                                  &quot;DROP TABLE registrations&quot;, create_registrations_sql);</span>
 
                         if (runtime.odbc_dbtype == DBTYPE_DEFAULT) {
                                 switch_cache_db_execute_sql(dbh, &quot;begin;delete from channels where hostname=&#39;&#39;;delete from channels where hostname=&#39;&#39;;commit;&quot;, &amp;err);
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments: 
fix uuid_jitterbuffer edge case debugging a non-existant jb causing a seg

<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #000080; font-weight: bold">index 2a2ec63..07c285f 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/mod_sofia.c</span>
<span style="color: #800080; font-weight: bold">@@ -1366,7 +1366,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi</span>
                                                 if (s &amp;&amp; !strcmp(s, &quot;off&quot;)) {
                                                         s = NULL;
                                                 }
<span style="color: #A00000">-                                                switch_rtp_debug_jitter_buffer(tech_pvt-&gt;rtp_session, s);</span>
<span style="color: #00A000">+                                                status = switch_rtp_debug_jitter_buffer(tech_pvt-&gt;rtp_session, s);</span>
                                                 goto end;
                                         }
 
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_rtp.c b/src/switch_rtp.c</span>
<span style="color: #000080; font-weight: bold">index 4df867a..200f4f0 100644</span>
<span style="color: #A00000">--- a/src/switch_rtp.c</span>
<span style="color: #00A000">+++ b/src/switch_rtp.c</span>
<span style="color: #800080; font-weight: bold">@@ -1875,7 +1875,7 @@ static void jb_logger(const char *file, const char *func, int line, int level, c</span>
 SWITCH_DECLARE(switch_status_t) switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp_session, const char *name)
 {
 
<span style="color: #A00000">-        if (!switch_rtp_ready(rtp_session)) {</span>
<span style="color: #00A000">+        if (!switch_rtp_ready(rtp_session) || !rtp_session-&gt;jb) {</span>
                 return SWITCH_STATUS_FALSE;
         }
         
</pre></div>
<div class="highlight"><pre>committer: Anthony Minessale
comments: 
fix file leaks in mod_commandline_tts

<span style="color: #000080; font-weight: bold">diff --git a/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c b/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c</span>
<span style="color: #000080; font-weight: bold">index 6b261f1..0f3bc41 100644</span>
<span style="color: #A00000">--- a/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c</span>
<span style="color: #00A000">+++ b/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c</span>
<span style="color: #800080; font-weight: bold">@@ -120,6 +120,11 @@ static switch_status_t tts_commandline_speech_close(switch_speech_handle_t *sh,</span>
         tts_commandline_t *info = (tts_commandline_t *) sh-&gt;private_info;
         assert(info != NULL);
 
<span style="color: #00A000">+        if (switch_test_flag(info-&gt;fh, SWITCH_FILE_OPEN)) {</span>
<span style="color: #00A000">+                switch_core_file_close(info-&gt;fh);</span>
<span style="color: #00A000">+                unlink(info-&gt;file);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
         return SWITCH_STATUS_SUCCESS;
 }
 
<span style="color: #800080; font-weight: bold">@@ -130,6 +135,11 @@ static switch_status_t tts_commandline_speech_feed_tts(switch_speech_handle_t *s</span>
 
         assert(info != NULL);
 
<span style="color: #00A000">+        if (switch_test_flag(info-&gt;fh, SWITCH_FILE_OPEN)) {</span>
<span style="color: #00A000">+                switch_core_file_close(info-&gt;fh);</span>
<span style="color: #00A000">+                unlink(info-&gt;file);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
         message = switch_core_strdup(sh-&gt;memory_pool, globals.command);
 
         tmp = switch_util_quote_shell_arg(text);
<span style="color: #800080; font-weight: bold">@@ -152,7 +162,7 @@ static switch_status_t tts_commandline_speech_feed_tts(switch_speech_handle_t *s</span>
         }
 
         if (switch_core_file_open(info-&gt;fh, info-&gt;file, 0,        //number_of_channels,
<span style="color: #A00000">-                                                          0,        //samples_per_second,</span>
<span style="color: #00A000">+                                                          info-&gt;rate,        //samples_per_second,</span>
                                                           SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
                 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, &quot;Failed to open file: %s\n&quot;, info-&gt;file);
                 return SWITCH_STATUS_FALSE;
<span style="color: #800080; font-weight: bold">@@ -171,11 +181,14 @@ static switch_status_t tts_commandline_speech_read_tts(switch_speech_handle_t *s</span>
         assert(info != NULL);
 
         if (switch_core_file_read(info-&gt;fh, data, &amp;my_datalen) != SWITCH_STATUS_SUCCESS) {
<span style="color: #A00000">-                *datalen = my_datalen * 2;</span>
<span style="color: #00A000">+                switch_core_file_close(info-&gt;fh);</span>
<span style="color: #00A000">+                unlink(info-&gt;file);</span>
                 return SWITCH_STATUS_FALSE;
         }
         *datalen = my_datalen * 2;
         if (datalen == 0) {
<span style="color: #00A000">+                switch_core_file_close(info-&gt;fh);</span>
<span style="color: #00A000">+                unlink(info-&gt;file);</span>
                 return SWITCH_STATUS_BREAK;
         } else {
                 return SWITCH_STATUS_SUCCESS;
</pre></div>
========================================================================<pre>

Summary of changes:
 .gitignore                                         |   69 +++++-----
 build/getg729.sh.in                                |   34 +++++
 build/modules.conf.in                              |    1 +
 conf/autoload_configs/switch.conf.xml              |    2 +
 conf/jingle_profiles/client.xml                    |    2 +-
 configure.in                                       |    6 +
 src/include/private/switch_core_pvt.h              |    1 +
 src/include/switch_core.h                          |    5 +
 src/mod/Makefile.am                                |    5 +-
 .../applications/mod_callcenter/mod_callcenter.c   |   38 +++++-
 src/mod/applications/mod_commands/mod_commands.c   |  153 ++++++++++++++++++++
 .../mod_tts_commandline/mod_tts_commandline.c      |   17 ++-
 src/mod/codecs/mod_com_g729/Makefile.am            |   39 +++++
 src/mod/endpoints/mod_sofia/mod_sofia.c            |    3 +-
 src/mod/endpoints/mod_sofia/sofia_reg.c            |   15 ++-
 .../mod_event_socket/mod_event_socket.c            |    1 +
 src/switch_channel.c                               |   16 ++-
 src/switch_core.c                                  |    3 +
 src/switch_core_io.c                               |   13 ++
 src/switch_core_sqldb.c                            |  120 +++++++++++++++-
 src/switch_rtp.c                                   |    5 +-
 21 files changed, 495 insertions(+), 53 deletions(-)
 create mode 100755 build/getg729.sh.in
 create mode 100644 src/mod/codecs/mod_com_g729/Makefile.am
</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>