mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +00:00
add SMBF_ONE_ONLY flag and use it on dtmf detectors
This commit is contained in:
@@ -411,10 +411,28 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
|
||||
switch_media_bug_t *bug, *bp;
|
||||
switch_size_t bytes;
|
||||
switch_event_t *event;
|
||||
int tap_only = 1;
|
||||
int tap_only = 1, punt = 0;
|
||||
|
||||
const char *p;
|
||||
|
||||
if (!zstr(function)) {
|
||||
if ((flags & SMBF_ONE_ONLY)) {
|
||||
switch_thread_rwlock_wrlock(session->bug_rwlock);
|
||||
for (bp = session->bugs; bp; bp = bp->next) {
|
||||
if (!zstr(bp->function) && !strcasecmp(function, bp->function)) {
|
||||
punt = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch_thread_rwlock_unlock(session->bug_rwlock);
|
||||
}
|
||||
}
|
||||
|
||||
if (punt) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Only one bug of this type allowed!\n");
|
||||
}
|
||||
|
||||
|
||||
if (!switch_channel_media_ready(session->channel)) {
|
||||
if (switch_channel_pre_answer(session->channel) != SWITCH_STATUS_SUCCESS) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
Reference in New Issue
Block a user