dtmf overhaul testers wanted

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6952 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2007-12-22 00:32:20 +00:00
1 parent 601f7b6e4a
commit 2931fc9109
33 files changed
+475 -313

No files matched your search

@@ -1648,7 +1648,7 @@ static void conference_loop_output(conference_member_t * member)
/* if we have caller digits, feed them to the parser to find an action */
if (switch_channel_has_dtmf(channel)) {
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
switch_channel_dequeue_dtmf_string(channel, dtmf, sizeof(dtmf));
if (member->conference->dtmf_parser != NULL) {
@@ -2637,6 +2637,8 @@ static switch_status_t conf_api_sub_dtmf(conference_member_t * member, switch_st
{
switch_event_t *event;
char *dtmf = (char *) data;
char *p = dtmf;
switch_dtmf_t _dtmf = { 0, SWITCH_DEFAULT_DTMF_DURATION };
if (member == NULL) {
stream->write_function(stream, "Invalid member!\n");
@@ -2651,9 +2653,15 @@ 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);
switch_core_session_send_dtmf(member->session, dtmf);
switch_mutex_unlock(member->flag_mutex);
while(p && *p) {
_dtmf.digit = *p;
switch_core_session_send_dtmf(member->session, &_dtmf);
p++;
}
switch_mutex_unlock(member->flag_mutex);
if (stream != NULL) {
stream->write_function(stream, "OK sent %s to %u\n", (char *) data, member->id);
+12 -8
View File
@@ -193,10 +193,17 @@ 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};
if (!switch_strlen_zero(data)) {
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_channel_queue_dtmf(channel, data);
for (p = (char *)data; p && *p; p++) {
dtmf.digit = *p;
switch_channel_queue_dtmf(channel, &dtmf);
p++;
}
}
}
@@ -1048,7 +1055,7 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
{
char *dtmf = (char *) input;
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
const char *terminators;
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *p;
@@ -1061,14 +1068,11 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
if (!strcasecmp(terminators, "none")) {
terminators = NULL;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digits %s\n", dtmf);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digit %c\n", dtmf->digit);
for (p = terminators; p && *p; p++) {
char *d;
for (d = dtmf; d && *d; d++) {
if (*p == *d) {
return SWITCH_STATUS_BREAK;
}
if (*p == dtmf->digit) {
return SWITCH_STATUS_BREAK;
}
}
}
+3 -2
View File
@@ -48,8 +48,9 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
{
char *dtmf = (char *) input;
if (*dtmf == '*') {
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
if (dtmf->digit == '*') {
channel = switch_core_session_get_channel(session);
if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
channel = switch_core_session_get_channel(bleg);
+2 -2
View File
@@ -91,11 +91,11 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
{
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:{
char *dtmf = (char *) input;
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
struct dtmf_buffer *dtb;
dtb = (struct dtmf_buffer *) buf;
switch (*dtmf) {
switch (dtmf->digit) {
case '#':
switch_set_flag(dtb, SFLAG_MAIN);
return SWITCH_STATUS_BREAK;
@@ -615,9 +615,11 @@ static switch_status_t cancel_on_dtmf(switch_core_session_t *session, void *inpu
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
{
char *dtmf = (char *) input;
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
if (buf && buflen) {
switch_copy_string(buf, dtmf, buflen);
char *bp = (char *) buf;
bp[0] = dtmf->digit;
bp[1] = '\0';
}
return SWITCH_STATUS_BREAK;
}
@@ -643,13 +645,13 @@ static switch_status_t control_playback(switch_core_session_t *session, void *in
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
{
char *dtmf = (char *) input;
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
cc_t *cc = (cc_t *) buf;
switch_file_handle_t *fh = cc->fh;
uint32_t pos = 0;
if (!cc->noexit && (*dtmf == *cc->profile->delete_file_key || *dtmf == *cc->profile->save_file_key || *dtmf == *cc->profile->terminator_key)) {
*cc->buf = *dtmf;
if (!cc->noexit && (dtmf->digit == *cc->profile->delete_file_key || dtmf->digit == *cc->profile->save_file_key || dtmf->digit == *cc->profile->terminator_key)) {
*cc->buf = dtmf->digit;
return SWITCH_STATUS_BREAK;
}
@@ -657,7 +659,7 @@ static switch_status_t control_playback(switch_core_session_t *session, void *in
return SWITCH_STATUS_SUCCESS;
}
if (*dtmf == *cc->profile->pause_key) {
if (dtmf->digit == *cc->profile->pause_key) {
if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
switch_clear_flag(fh, SWITCH_FILE_PAUSE);
} else {
@@ -666,20 +668,20 @@ static switch_status_t control_playback(switch_core_session_t *session, void *in
return SWITCH_STATUS_SUCCESS;
}
if (*dtmf == *cc->profile->restart_key) {
if (dtmf->digit == *cc->profile->restart_key) {
unsigned int seekpos = 0;
fh->speed = 0;
switch_core_file_seek(fh, &seekpos, 0, SEEK_SET);
return SWITCH_STATUS_SUCCESS;
}
if (*dtmf == *cc->profile->ff_key) {
if (dtmf->digit == *cc->profile->ff_key) {
int samps = 24000;
switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
return SWITCH_STATUS_SUCCESS;
}
if (*dtmf == *cc->profile->rew_key) {
if (dtmf->digit == *cc->profile->rew_key) {
int samps = 24000;
switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
return SWITCH_STATUS_SUCCESS;