]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
freetdm: re-enable hw dtmf on channel destroy if needed
authorMoises Silva <moy@sangoma.com>
Thu, 24 Jun 2010 23:48:55 +0000 (19:48 -0400)
committerMoises Silva <moy@sangoma.com>
Fri, 25 Jun 2010 16:47:32 +0000 (12:47 -0400)
libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c

index 539d41188480cc0d01beddbc85438cb6eb759989..914e53e73033cf62425864fcdf8b641d63abbac4 100644 (file)
@@ -1185,6 +1185,19 @@ static FIO_CHANNEL_DESTROY_FUNCTION(wanpipe_channel_destroy)
 #endif
 
        if (ftdmchan->sockfd != FTDM_INVALID_SOCKET) {
+               /* enable HW DTMF. As odd as it seems. Why enable when the channel is being destroyed and won't be used anymore?
+                * because that way we can transfer the DTMF state back to the driver, if we're being restarted we will set again
+                * the FEATURE_DTMF flag and use HW DTMF, if we don't enable here, then on module restart we won't see
+                * HW DTMF available and will use software */
+               if (ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_DETECT)) {
+                       wanpipe_tdm_api_t tdm_api;
+                       int err;
+                       memset(&tdm_api, 0, sizeof(tdm_api));
+                       err = sangoma_tdm_enable_dtmf_events(ftdmchan->sockfd, &tdm_api);
+                       if (err) {
+                               ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed enabling Sangoma HW DTMF failed on channel destroy\n");
+                       }
+               }
                sangoma_close(&ftdmchan->sockfd);
        }