]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
freetdm: default iostats to yes and allow configuration thru freetdm.conf
authorMoises Silva <moy@sangoma.com>
Thu, 4 Aug 2011 00:30:39 +0000 (20:30 -0400)
committerMoises Silva <moy@sangoma.com>
Thu, 4 Aug 2011 00:30:39 +0000 (20:30 -0400)
libs/freetdm/conf/freetdm.conf
libs/freetdm/src/ftdm_io.c
libs/freetdm/src/include/freetdm.h

index cd269b7736a1a7296733d37b9d84fd5c3311df0c..eb506bef8d4a76fcefae8cd2fd5578df30261767 100644 (file)
@@ -34,6 +34,12 @@ trunk_type => FXS
 ; add FXS channels from 3 to 4 at wanpipe span 1 to this freetdm span
 fxs-channel => 1:3-4
 
+; IO stats. Defaults to yes, you can print the stats with ftdm iostats print <span> <chan>
+; This feature depends on the span IO type, currently only Wanpipe spans support it
+; This may cause a warning to be printed once in a while if audio is not provided fast enough
+; and causes the driver to transmit an idle frame (when there is no data provided by the application)
+iostats => yes
+
 [span wanpipe myWanpipe2]
 trunk_type => FXO
 ; This number will be used as DNIS for FXO devices
index 805c525269c591ac8104885ad7cdae6396f72970..0205ab36b1836bdcaea4db1fdd630a7f53f21da9 100644 (file)
@@ -4584,14 +4584,20 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_channels(ftdm_span_t *span, const
                return FTDM_FAIL;
        }
 
-       if (chan_config->debugdtmf) {
-               for (chan_index = currindex+1; chan_index <= span->chan_count; chan_index++) {
-                       if (!FTDM_IS_VOICE_CHANNEL(span->channels[chan_index])) {
-                               continue;
-                       }
-                       span->channels[chan_index]->dtmfdbg.requested = 1;
+       for (chan_index = currindex + 1; chan_index <= span->chan_count; chan_index++) {
+               if (chan_config->iostats) {
+                       ftdm_channel_set_feature(span->channels[chan_index], FTDM_CHANNEL_FEATURE_IO_STATS);
+               }
+
+               if (!FTDM_IS_VOICE_CHANNEL(span->channels[chan_index])) {
+                       continue;
+               }
+
+               if (chan_config->debugdtmf) {
+                               span->channels[chan_index]->dtmfdbg.requested = 1;
                }
        }
+
        return FTDM_SUCCESS;
 }
 
@@ -4658,6 +4664,8 @@ static ftdm_status_t load_config(void)
                                        /* it is confusing that parameters from one span affect others, so let's clear them */
                                        memset(&chan_config, 0, sizeof(chan_config));
                                        sprintf(chan_config.group_name, "__default");
+                                       /* default to storing iostats */
+                                       chan_config.iostats = FTDM_TRUE;
                                } else {
                                        ftdm_log(FTDM_LOG_CRIT, "failure creating span of type %s\n", type);
                                        span = NULL;
@@ -4784,6 +4792,13 @@ static ftdm_status_t load_config(void)
                        } else if (!strcasecmp(var, "debugdtmf")) {
                                chan_config.debugdtmf = ftdm_true(val);
                                ftdm_log(FTDM_LOG_DEBUG, "Setting debugdtmf to '%s'\n", chan_config.debugdtmf ? "yes" : "no");
+                       } else if (!strncasecmp(var, "iostats", sizeof("iostats")-1)) {
+                               if (ftdm_true(val)) {
+                                       chan_config.iostats = FTDM_TRUE;
+                               } else {
+                                       chan_config.iostats = FTDM_FALSE;
+                               }
+                               ftdm_log(FTDM_LOG_DEBUG, "Setting iostats to '%s'\n", chan_config.iostats ? "yes" : "no");
                        } else if (!strcasecmp(var, "group")) {
                                len = strlen(val);
                                if (len >= FTDM_MAX_NAME_STR_SZ) {
index 96ffdce62c162b2a15f2663c1f811bc838ab16bf..0948f16e29d00f5525c14c76e511d41d9a7a72b7 100755 (executable)
@@ -487,6 +487,7 @@ typedef struct ftdm_channel_config {
        float rxgain;
        float txgain;
        uint8_t debugdtmf;
+       uint8_t iostats;
 } ftdm_channel_config_t;
 
 /*!