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

<h2>branch: master updated</h2>
<pre>
  discards  8037b69f40413784631c59942b5d4fc856cff845 (commit)
  discards  67edc7c3215f6476452f3ff7ee82ba559c39656f (commit)
  discards  2adfc50af7958eea12c15e023bcf80b18a4c73f9 (commit)
       via: eeac03ef5028b565b28364752ef5a48307ca17d4 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (8037b69f40413784631c59942b5d4fc856cff845)
            \
             N -- N -- N (eeac03ef5028b565b28364752ef5a48307ca17d4)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.


</pre>= COMMIT LOG ===========================================================
<div class="highlight"><pre>committer: Moises Silva
comments: 
freetdm: add code to troubleshoot crash on tone generation

<span style="color: #000080; font-weight: bold">diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c</span>
<span style="color: #000080; font-weight: bold">index c9000de..1e282d1 100644</span>
<span style="color: #A00000">--- a/libs/freetdm/src/ftdm_io.c</span>
<span style="color: #00A000">+++ b/libs/freetdm/src/ftdm_io.c</span>
<span style="color: #800080; font-weight: bold">@@ -2743,10 +2743,9 @@ static ftdm_status_t ftdmchan_activate_dtmf_buffer(ftdm_channel_t *ftdmchan)</span>
         if (!ftdmchan-&gt;dtmf_buffer) {
                 if (ftdm_buffer_create(&amp;ftdmchan-&gt;dtmf_buffer, 1024, 3192, 0) != FTDM_SUCCESS) {
                         ftdm_log(FTDM_LOG_ERROR, &quot;Failed to allocate DTMF Buffer!\n&quot;);
<span style="color: #A00000">-                        snprintf(ftdmchan-&gt;last_error, sizeof(ftdmchan-&gt;last_error), &quot;buffer error&quot;);</span>
                         return FTDM_FAIL;
                 } else {
<span style="color: #A00000">-                        ftdm_log(FTDM_LOG_DEBUG, &quot;Created DTMF Buffer!\n&quot;);</span>
<span style="color: #00A000">+                        ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, &quot;Created DTMF buffer\n&quot;);</span>
                 }
         }
 
<span style="color: #800080; font-weight: bold">@@ -3588,8 +3587,17 @@ static FIO_READ_FUNCTION(ftdm_raw_read)</span>
         return status;
 }
 
<span style="color: #A00000">-static ftdm_status_t handle_dtmf(ftdm_channel_t *ftdmchan, ftdm_size_t datalen)</span>
<span style="color: #00A000">+/* This function takes care of automatically generating DTMF or FSK tones when needed */</span>
<span style="color: #00A000">+static ftdm_status_t handle_tone_generation(ftdm_channel_t *ftdmchan, ftdm_size_t datalen)</span>
 {
<span style="color: #00A000">+        /*</span>
<span style="color: #00A000">+         * datalen: size in bytes of the chunk of data the user requested to read (this function </span>
<span style="color: #00A000">+         *          is called from the ftdm_channel_read function)</span>
<span style="color: #00A000">+         * dblen: size currently in use in any of the tone generation buffers (data available in the buffer)</span>
<span style="color: #00A000">+         * gen_dtmf_buffer: buffer holding the raw ASCII digits that the user requested to generate</span>
<span style="color: #00A000">+         * dtmf_buffer: raw linear tone data generated by teletone to be written to the devices</span>
<span style="color: #00A000">+         * fsk_buffer: raw linear FSK modulated data for caller id</span>
<span style="color: #00A000">+         */</span>
         ftdm_buffer_t *buffer = NULL;
         ftdm_size_t dblen = 0;
         int wrote = 0;
<span style="color: #800080; font-weight: bold">@@ -3604,7 +3612,7 @@ static ftdm_status_t handle_dtmf(ftdm_channel_t *ftdmchan, ftdm_size_t datalen)</span>
                 }
 
                 if (ftdm_buffer_read(ftdmchan-&gt;gen_dtmf_buffer, digits, dblen) &amp;&amp; !ftdm_strlen_zero_buf(digits)) {
<span style="color: #A00000">-                        ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, &quot;Generating DTMF [%s]\n&quot;, digits);        </span>
<span style="color: #00A000">+                        ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, &quot;Generating DTMF [%s]\n&quot;, digits);</span>
                 
                         cur = digits;
 
<span style="color: #800080; font-weight: bold">@@ -3618,7 +3626,7 @@ static ftdm_status_t handle_dtmf(ftdm_channel_t *ftdmchan, ftdm_size_t datalen)</span>
                                         ftdm_buffer_write(ftdmchan-&gt;dtmf_buffer, ftdmchan-&gt;tone_session.buffer, wrote * 2);
                                         x++;
                                 } else {
<span style="color: #A00000">-                                        ftdm_log(FTDM_LOG_ERROR, &quot;%d:%d Problem Adding DTMF SEQ [%s]\n&quot;, ftdmchan-&gt;span_id, ftdmchan-&gt;chan_id, digits);</span>
<span style="color: #00A000">+                                        ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, &quot;Problem adding DTMF sequence [%s]\n&quot;, digits);</span>
                                         return FTDM_FAIL;
                                 }
                         }
<span style="color: #800080; font-weight: bold">@@ -3631,6 +3639,7 @@ static ftdm_status_t handle_dtmf(ftdm_channel_t *ftdmchan, ftdm_size_t datalen)</span>
         
 
         if (!ftdmchan-&gt;buffer_delay || --ftdmchan-&gt;buffer_delay == 0) {
<span style="color: #00A000">+                /* time to pick a buffer, either the dtmf or fsk buffer */</span>
                 if (ftdmchan-&gt;dtmf_buffer &amp;&amp; (dblen = ftdm_buffer_inuse(ftdmchan-&gt;dtmf_buffer))) {
                         buffer = ftdmchan-&gt;dtmf_buffer;
                 } else if (ftdmchan-&gt;fsk_buffer &amp;&amp; (dblen = ftdm_buffer_inuse(ftdmchan-&gt;fsk_buffer))) {
<span style="color: #800080; font-weight: bold">@@ -3638,22 +3647,41 @@ static ftdm_status_t handle_dtmf(ftdm_channel_t *ftdmchan, ftdm_size_t datalen)</span>
                 }
         }
 
<span style="color: #00A000">+        /* if we picked a buffer, time to read from it and write the linear data to the device */</span>
         if (buffer) {
<span style="color: #A00000">-                ftdm_size_t dlen = datalen;</span>
                 uint8_t auxbuf[1024];
<span style="color: #00A000">+                /* we initialize dlen to datalen, which is the size in bytes the </span>
<span style="color: #00A000">+                 * user wants to read (typically chunks of 160 bytes, 20ms G.711) */</span>
<span style="color: #00A000">+                ftdm_size_t dlen = datalen;</span>
                 ftdm_size_t len, br, max = sizeof(auxbuf);
                 
<span style="color: #00A000">+                /* if the codec is not linear, then data is really twice as much cuz</span>
<span style="color: #00A000">+                   tone generation is done in linear (we assume anything different than linear is G.711) */</span>
                 if (ftdmchan-&gt;native_codec != FTDM_CODEC_SLIN) {
                         dlen *= 2;
                 }
<span style="color: #A00000">-                </span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* we do not expect the user chunks to be bigger than auxbuf */</span>
<span style="color: #00A000">+                ftdm_assert(dlen &lt;= sizeof(auxbuf), &quot;Unexpected size for user data chunk size\n&quot;);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* dblen is the size in use for dtmf_buffer or fsk_buffer, and dlen is the size</span>
<span style="color: #00A000">+                 * of the read chunks of the user, we pick the smaller one */</span>
                 len = dblen &gt; dlen ? dlen : dblen;
 
<span style="color: #00A000">+                /* we can&#39;t read more than the size of our auxiliary buffer */</span>
<span style="color: #00A000">+                ftdm_assert((len &lt;= sizeof(auxbuf)), &quot;Unexpected size to read into auxbuf\n&quot;);</span>
<span style="color: #00A000">+</span>
                 br = ftdm_buffer_read(buffer, auxbuf, len);                
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* the amount read can&#39;t possibly be bigger than what we requested */</span>
<span style="color: #00A000">+                ftdm_assert((br &lt;= len), &quot;Unexpected size read from tone generation buffer\n&quot;);</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                /* if we read less than the chunk size, we must fill in with silence the rest */</span>
                 if (br &lt; dlen) {
                         memset(auxbuf + br, 0, dlen - br);
                 }
 
<span style="color: #00A000">+                /* finally we convert to the native format for the channel if necessary */</span>
                 if (ftdmchan-&gt;native_codec != FTDM_CODEC_SLIN) {
                         if (ftdmchan-&gt;native_codec == FTDM_CODEC_ULAW) {
                                 fio_slin2ulaw(auxbuf, max, &amp;dlen);
<span style="color: #800080; font-weight: bold">@@ -3662,6 +3690,7 @@ static ftdm_status_t handle_dtmf(ftdm_channel_t *ftdmchan, ftdm_size_t datalen)</span>
                         }
                 }
                 
<span style="color: #00A000">+                /* write the tone to the channel */</span>
                 return ftdm_raw_write(ftdmchan, auxbuf, &amp;dlen);
         } 
 
<span style="color: #800080; font-weight: bold">@@ -3741,7 +3770,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data</span>
                         rdata[i] = ftdmchan-&gt;rxgain_table[rdata[i]];
                 }
         }
<span style="color: #A00000">-        handle_dtmf(ftdmchan, *datalen);</span>
<span style="color: #00A000">+        handle_tone_generation(ftdmchan, *datalen);</span>
 
         if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE) &amp;&amp; ftdmchan-&gt;effective_codec != ftdmchan-&gt;native_codec) {
                 if (ftdmchan-&gt;native_codec == FTDM_CODEC_ULAW &amp;&amp; ftdmchan-&gt;effective_codec == FTDM_CODEC_SLIN) {
<span style="color: #800080; font-weight: bold">@@ -3938,7 +3967,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *dat</span>
         if (!ftdmchan-&gt;buffer_delay &amp;&amp; 
                 ((ftdmchan-&gt;dtmf_buffer &amp;&amp; ftdm_buffer_inuse(ftdmchan-&gt;dtmf_buffer)) ||
                  (ftdmchan-&gt;fsk_buffer &amp;&amp; ftdm_buffer_inuse(ftdmchan-&gt;fsk_buffer)))) {
<span style="color: #A00000">-                /* read size writing DTMF ATM */</span>
<span style="color: #00A000">+                /* generating some kind of tone at the moment (see handle_tone_generation), </span>
<span style="color: #00A000">+                 * we ignore user data ... */</span>
                 goto done;
         }
 
</pre></div>
========================================================================<pre>

Summary of changes:
 conf/autoload_configs/switch.conf.xml              |    2 +-
 libs/freetdm/src/ftdm_io.c                         |   48 ++++++++++++++++----
 .../applications/mod_conference/mod_conference.c   |   45 +++++++------------
 src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c          |    2 +-
 4 files changed, 57 insertions(+), 40 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>