add stricter checking
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2082 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
402f90deda
commit
da67398911
|
@ -992,6 +992,17 @@ static switch_status_t conference_play_file(conference_obj_t *conference, char *
|
||||||
{
|
{
|
||||||
confernce_file_node_t *fnode, *nptr;
|
confernce_file_node_t *fnode, *nptr;
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
|
uint32_t count;
|
||||||
|
|
||||||
|
switch_mutex_lock(conference->mutex);
|
||||||
|
switch_mutex_lock(conference->member_mutex);
|
||||||
|
count = conference->count;
|
||||||
|
switch_mutex_unlock(conference->member_mutex);
|
||||||
|
switch_mutex_unlock(conference->mutex);
|
||||||
|
|
||||||
|
if (!count) {
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (*file != '/') {
|
if (*file != '/') {
|
||||||
return conference_say(conference, file, leadin);
|
return conference_say(conference, file, leadin);
|
||||||
|
@ -1155,9 +1166,19 @@ static switch_status_t conference_say(conference_obj_t *conference, char *text,
|
||||||
confernce_file_node_t *fnode, *nptr;
|
confernce_file_node_t *fnode, *nptr;
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_TTS;
|
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_TTS;
|
||||||
|
uint32_t count;
|
||||||
|
|
||||||
|
switch_mutex_lock(conference->mutex);
|
||||||
|
switch_mutex_lock(conference->member_mutex);
|
||||||
|
count = conference->count;
|
||||||
if (!(conference->tts_engine && conference->tts_voice)) {
|
if (!(conference->tts_engine && conference->tts_voice)) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
count = 0;
|
||||||
|
}
|
||||||
|
switch_mutex_unlock(conference->member_mutex);
|
||||||
|
switch_mutex_unlock(conference->mutex);
|
||||||
|
|
||||||
|
if (!count) {
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup a memory pool to use. */
|
/* Setup a memory pool to use. */
|
||||||
|
@ -1406,10 +1427,13 @@ static switch_status_t conf_function(char *buf, switch_stream_handle_t *stream)
|
||||||
char *tbuf = NULL;
|
char *tbuf = NULL;
|
||||||
char *text;
|
char *text;
|
||||||
|
|
||||||
if ((tbuf = strdup(buf))) {
|
if (argc > 2 && (tbuf = strdup(buf))) {
|
||||||
if ((text = strstr(tbuf, "say"))) {
|
if ((text = strstr(tbuf, "say"))) {
|
||||||
text += 4;
|
text += 4;
|
||||||
if (text && conference_say(conference, text, 0) == SWITCH_STATUS_SUCCESS) {
|
while(*text == ' ') {
|
||||||
|
text++;
|
||||||
|
}
|
||||||
|
if (!switch_strlen_zero(text) && conference_say(conference, text, 0) == SWITCH_STATUS_SUCCESS) {
|
||||||
stream->write_function(stream, "(say) OK\n");
|
stream->write_function(stream, "(say) OK\n");
|
||||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
|
||||||
|
@ -1425,6 +1449,8 @@ static switch_status_t conf_function(char *buf, switch_stream_handle_t *stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
free(tbuf);
|
free(tbuf);
|
||||||
|
} else {
|
||||||
|
stream->write_function(stream, "(say) Error! No text.");
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(argv[1], "saymember")) {
|
} else if (!strcasecmp(argv[1], "saymember")) {
|
||||||
char *tbuf = NULL, *text, *name;
|
char *tbuf = NULL, *text, *name;
|
||||||
|
|
|
@ -215,12 +215,18 @@ static switch_status_t cepstral_speech_feed_tts(switch_speech_handle_t *sh, char
|
||||||
|
|
||||||
if (!strncasecmp(text, fp, len)) {
|
if (!strncasecmp(text, fp, len)) {
|
||||||
text += len;
|
text += len;
|
||||||
|
if (switch_strlen_zero(text)) {
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
swift_port_speak_file(cepstral->port, text, NULL, &cepstral->tts_stream, NULL);
|
swift_port_speak_file(cepstral->port, text, NULL, &cepstral->tts_stream, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
if (switch_strlen_zero(text)) {
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
swift_port_speak_text(cepstral->port, text, 0, NULL, &cepstral->tts_stream, NULL);
|
swift_port_speak_text(cepstral->port, text, 0, NULL, &cepstral->tts_stream, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cepstral_speech_flush_tts(switch_speech_handle_t *sh)
|
static void cepstral_speech_flush_tts(switch_speech_handle_t *sh)
|
||||||
|
|
Loading…
Reference in New Issue