Add optional one way playback (bug #3397)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4871 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2005-01-21 21:27:17 +00:00
parent 32ba309c68
commit e969712c6f
2 changed files with 14 additions and 2 deletions

View File

@@ -70,6 +70,7 @@ static struct timeval lasttime;
static int usecnt;
static int silencesuppression = 0;
static int silencethreshold = 1000;
static int playbackonly = 0;
AST_MUTEX_DEFINE_STATIC(usecnt_lock);
@@ -565,9 +566,11 @@ static int oss_write(struct ast_channel *chan, struct ast_frame *f)
return 0;
/* Stop any currently playing sound */
cursound = -1;
if (!full_duplex) {
if (!full_duplex && !playbackonly) {
/* If we're half duplex, we have to switch to read mode
to honor immediate needs if necessary */
to honor immediate needs if necessary. But if we are in play
back only mode, then we don't switch because the console
is only being used one way -- just to playback something. */
res = soundcard_setinput(1);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set device to input mode\n");
@@ -1038,6 +1041,8 @@ int load_module()
strncpy(language, v->value, sizeof(language)-1);
else if (!strcasecmp(v->name, "extension"))
strncpy(exten, v->value, sizeof(exten)-1);
else if (!strcasecmp(v->name, "playbackonly"))
playbackonly = ast_true(v->value);
v=v->next;
}
ast_destroy(cfg);