add last_dtmf_duration variable

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9526 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-09-11 17:29:08 +00:00
parent 49667777c9
commit 4db944c255

View File

@ -1028,6 +1028,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core
char *string;
int i, argc;
char *argv[256];
int dur_total = 0;
switch_assert(session != NULL);
@ -1078,10 +1079,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s send dtmf\ndigit=%c ms=%u samples=%u\n",
switch_channel_get_name(session->channel), dtmf.digit, dur, dtmf.duration);
sent++;
dur_total += dtmf.duration + 2000; /* account for 250ms pause */
}
}
}
if (dur_total) {
char tmp[32] = "";
switch_snprintf(tmp, sizeof(tmp), "%d", dur_total / 8);
switch_channel_set_variable(session->channel, "last_dtmf_duration", tmp);
}
}
return sent ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
}