{
switch_core_session_t *session = (switch_core_session_t *) match->user_data;
switch_channel_t *channel;
- char str[DMACHINE_MAX_DIGIT_LEN + 2];
switch_event_t *event;
switch_status_t status;
switch_core_session_t *use_session = session;
}
}
- /* send it back around flagged to skip the dmachine */
- switch_snprintf(str, sizeof(str), "!%s", match->match_digits);
-
- switch_channel_queue_dtmf_string(channel, str);
+ /* send it back around and skip the dmachine */
+ switch_channel_queue_dtmf_string(channel, match->match_digits);
if (use_session != session) {
switch_core_session_rwunlock(use_session);
return SWITCH_STATUS_FALSE;
}
- if (*dtmf_string == '!') {
+
+ dtmf.flags = DTMF_FLAG_SKIP_PROCESS;
+
+ if (*dtmf_string == '~') {
dtmf_string++;
- dtmf.flags = DTMF_FLAG_SKIP_PROCESS;
+ dtmf.flags = 0;
}
string = switch_core_session_strdup(channel->session, dtmf_string);
}
}
- if (dtmf.duration > switch_core_max_dtmf_duration(0)) {
- switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "EXCESSIVE DTMF DIGIT LEN %c %d\n", dtmf.digit, dtmf.duration);
- dtmf.duration = switch_core_max_dtmf_duration(0);
- } else if (dtmf.duration < switch_core_min_dtmf_duration(0)) {
- switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "SHORT DTMF DIGIT LEN %c %d\n", dtmf.digit, dtmf.duration);
- dtmf.duration = switch_core_min_dtmf_duration(0);
- } else if (!dtmf.duration) {
- dtmf.duration = switch_core_default_dtmf_duration(0);
- }
-
-
for (p = argv[i]; p && *p; p++) {
if (is_dtmf(*p)) {
dtmf.digit = *p;
+
+ if (dtmf.duration > switch_core_max_dtmf_duration(0)) {
+ switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "EXCESSIVE DTMF DIGIT LEN %c %d\n", dtmf.digit, dtmf.duration);
+ dtmf.duration = switch_core_max_dtmf_duration(0);
+ } else if (dtmf.duration < switch_core_min_dtmf_duration(0)) {
+ switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "SHORT DTMF DIGIT LEN %c %d\n", dtmf.digit, dtmf.duration);
+ dtmf.duration = switch_core_min_dtmf_duration(0);
+ } else if (!dtmf.duration) {
+ dtmf.duration = switch_core_default_dtmf_duration(0);
+ }
+
if (switch_channel_queue_dtmf(channel, &dtmf) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s Queue dtmf\ndigit=%c ms=%u samples=%u\n",
switch_channel_get_name(channel), dtmf.digit, dur, dtmf.duration);
new_dtmf.duration = switch_core_default_dtmf_duration(0);
}
-
- for (ptr = session->event_hooks.send_dtmf; ptr; ptr = ptr->next) {
- if ((status = ptr->send_dtmf(session, dtmf, SWITCH_DTMF_SEND)) != SWITCH_STATUS_SUCCESS) {
- return SWITCH_STATUS_SUCCESS;
+
+ if (!switch_test_flag(dtmf, DTMF_FLAG_SKIP_PROCESS)) {
+ for (ptr = session->event_hooks.send_dtmf; ptr; ptr = ptr->next) {
+ if ((status = ptr->send_dtmf(session, dtmf, SWITCH_DTMF_SEND)) != SWITCH_STATUS_SUCCESS) {
+ return SWITCH_STATUS_SUCCESS;
+ }
}
- }
- if (!switch_test_flag(dtmf, DTMF_FLAG_SKIP_PROCESS)) {
if (session->dmachine[1] && !switch_channel_test_flag(session->channel, CF_BROADCAST)) {
char str[2] = { new_dtmf.digit, '\0' };
switch_ivr_dmachine_feed(session->dmachine[1], str, NULL);
SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core_session_t *session, const char *dtmf_string)
{
char *p;
- switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
+ switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0), DTMF_FLAG_SKIP_PROCESS, 0};
int sent = 0, dur;
char *string;
int i, argc;
switch_assert(session != NULL);
+ if (*dtmf_string == '~') {
+ dtmf_string++;
+ dtmf.flags = 0;
+ }
if (switch_channel_down(session->channel)) {
return SWITCH_STATUS_FALSE;
}
- if (dtmf.duration > switch_core_max_dtmf_duration(0)) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
- switch_channel_get_name(session->channel), dtmf.digit, dtmf.duration);
- dtmf.duration = switch_core_max_dtmf_duration(0);
- } else if (dtmf.duration < switch_core_min_dtmf_duration(0)) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
- switch_channel_get_name(session->channel), dtmf.digit, dtmf.duration);
- dtmf.duration = switch_core_min_dtmf_duration(0);
- } else if (!dtmf.duration) {
- dtmf.duration = switch_core_default_dtmf_duration(0);
- }
-
for (p = argv[i]; p && *p; p++) {
if (is_dtmf(*p)) {
dtmf.digit = *p;
+
+ if (dtmf.duration > switch_core_max_dtmf_duration(0)) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
+ switch_channel_get_name(session->channel), dtmf.digit, dtmf.duration);
+ dtmf.duration = switch_core_max_dtmf_duration(0);
+ } else if (dtmf.duration < switch_core_min_dtmf_duration(0)) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
+ switch_channel_get_name(session->channel), dtmf.digit, dtmf.duration);
+ dtmf.duration = switch_core_min_dtmf_duration(0);
+ } else if (!dtmf.duration) {
+ dtmf.duration = switch_core_default_dtmf_duration(0);
+ }
+
if (switch_core_session_send_dtmf(session, &dtmf) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s send dtmf\ndigit=%c ms=%u samples=%u\n",
switch_channel_get_name(session->channel), dtmf.digit, dur, dtmf.duration);