]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_sofia: don't complain that an info dtmf was ignored if it actually wasn't a dtmf...
authorMathieu Rene <mrene@avgs.ca>
Tue, 16 Aug 2011 20:38:13 +0000 (22:38 +0200)
committerMathieu Rene <mrene@avgs.ca>
Tue, 16 Aug 2011 20:38:13 +0000 (22:38 +0200)
src/mod/endpoints/mod_sofia/sofia.c

index 0f6486a361f5e4570773d24b6e1a58fc7d6410fd..f7fbacff1a082120e0965fc66e4fac71d0a5228e 100644 (file)
@@ -6745,35 +6745,37 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
                                goto end;
                        }
 
-                       if (dtmf.digit && (tech_pvt->dtmf_type == DTMF_INFO || 
-                                                          sofia_test_pflag(tech_pvt->profile, PFLAG_LIBERAL_DTMF) || sofia_test_flag(tech_pvt, TFLAG_LIBERAL_DTMF))) {
-                               /* queue it up */
-                               switch_channel_queue_dtmf(channel, &dtmf);
-
-                               /* print debug info */
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "INFO DTMF(%c)\n", dtmf.digit);
-
-                               if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
-                                       const char *uuid;
-                                       switch_core_session_t *session_b;
-
-                                       if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (session_b = switch_core_session_locate(uuid))) {
-                                               while (switch_channel_has_dtmf(channel)) {
-                                                       switch_dtmf_t idtmf = { 0, 0 };
-                                                       if (switch_channel_dequeue_dtmf(channel, &idtmf) == SWITCH_STATUS_SUCCESS) {
-                                                               switch_core_session_send_dtmf(session_b, &idtmf);
+                       if (dtmf.digit) {
+                               if (tech_pvt->dtmf_type == DTMF_INFO || 
+                                               sofia_test_pflag(tech_pvt->profile, PFLAG_LIBERAL_DTMF) || sofia_test_flag(tech_pvt, TFLAG_LIBERAL_DTMF)) {
+                                       /* queue it up */
+                                       switch_channel_queue_dtmf(channel, &dtmf);
+
+                                       /* print debug info */
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "INFO DTMF(%c)\n", dtmf.digit);
+
+                                       if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
+                                               const char *uuid;
+                                               switch_core_session_t *session_b;
+
+                                               if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (session_b = switch_core_session_locate(uuid))) {
+                                                       while (switch_channel_has_dtmf(channel)) {
+                                                               switch_dtmf_t idtmf = { 0, 0 };
+                                                               if (switch_channel_dequeue_dtmf(channel, &idtmf) == SWITCH_STATUS_SUCCESS) {
+                                                                       switch_core_session_send_dtmf(session_b, &idtmf);
+                                                               }
                                                        }
-                                               }
 
-                                               switch_core_session_rwunlock(session_b);
+                                                       switch_core_session_rwunlock(session_b);
+                                               }
                                        }
-                               }
 
-                               /* Send 200 OK response */
-                               nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
-                       } else {
-                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
-                                                                 "IGNORE INFO DTMF(%c) (This channel was not configured to use INFO DTMF!)\n", dtmf.digit);
+                                       /* Send 200 OK response */
+                                       nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
+                               } else {
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+                                                                         "IGNORE INFO DTMF(%c) (This channel was not configured to use INFO DTMF!)\n", dtmf.digit);
+                               }
                        }
                        goto end;
                }