Formatting DTMF as a string

a '+' separated list of DTMF strings

Each element in the list can contain an @ followed by
a duration in ms.

e.g.
1234@250+4321@500

sends the digits 1 2 3 4 at a rate of 250ms then
4 3 2 1 at a rate of 500




git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7193 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2008-01-12 20:30:48 +00:00
1 parent 7accbe103f
commit 3a5a239846
6 files changed
+108 -30

No files matched your search

@@ -2647,20 +2647,6 @@ static switch_status_t conf_api_sub_dtmf(conference_member_t * member, switch_st
{
switch_event_t *event;
char *dtmf = (char *) data;
char *p;
switch_dtmf_t _dtmf = { 0, SWITCH_DEFAULT_DTMF_DURATION };
int tmp;
if ((p = strchr(dtmf, '+'))) {
tmp = atoi(p);
if (tmp > 0) {
if (member->orig_read_codec && member->orig_read_codec->implementation) {
_dtmf.duration = tmp * (member->orig_read_codec->implementation->samples_per_second / 1000);
} else {
_dtmf.duration = tmp * (member->conference->rate / 1000);
}
}
}
if (member == NULL) {
stream->write_function(stream, "Invalid member!\n");
@@ -2676,12 +2662,7 @@ static switch_status_t conf_api_sub_dtmf(conference_member_t * member, switch_st
switch_mutex_lock(member->flag_mutex);
switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
p = dtmf;
while(p && *p && is_dtmf(*p)) {
_dtmf.digit = *p;
switch_core_session_send_dtmf(member->session, &_dtmf);
p++;
}
switch_core_session_send_dtmf_string(member->session, (char *)data);
switch_mutex_unlock(member->flag_mutex);
+9 -10
View File
@@ -181,17 +181,15 @@ SWITCH_STANDARD_APP(break_function)
SWITCH_STANDARD_APP(queue_dtmf_function)
{
switch_channel_t *channel;
char *p;
switch_dtmf_t dtmf = {0, SWITCH_DEFAULT_DTMF_DURATION};
channel = switch_core_session_get_channel(session);
switch_channel_queue_dtmf_string(channel, (const char *) data);
}
if (!switch_strlen_zero(data)) {
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
for (p = (char *)data; p && *p; p++) {
dtmf.digit = *p;
switch_channel_queue_dtmf(channel, &dtmf);
}
}
SWITCH_STANDARD_APP(send_dtmf_function)
{
switch_core_session_send_dtmf_string(session, (const char *) data);
}
SWITCH_STANDARD_APP(transfer_function)
@@ -1583,6 +1581,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "<deflect_data>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "reject", "Send session reject (depricated)", "Send a respond message to a session.", respond_function, "<respond_data>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "<dtmf_data>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "sched_hangup", SCHED_HANGUP_DESCR, SCHED_HANGUP_DESCR, sched_hangup_function, "[+]<time> [<cause>]", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "sched_broadcast", SCHED_BROADCAST_DESCR, SCHED_BROADCAST_DESCR, sched_broadcast_function, "[+]<time> <path> [aleg|bleg|both]", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "sched_transfer", SCHED_TRANSF_DESCR, SCHED_TRANSF_DESCR, sched_transfer_function, "[+]<time> <extension> <dialplan> <context>", SAF_SUPPORT_NOMEDIA);