diff --git a/src/mod/applications/mod_playback/mod_playback.c b/src/mod/applications/mod_playback/mod_playback.c index a7b10376a3..78898bff97 100644 --- a/src/mod/applications/mod_playback/mod_playback.c +++ b/src/mod/applications/mod_playback/mod_playback.c @@ -49,6 +49,43 @@ static switch_status_t on_dtmf(switch_core_session_t *session, char *dtmf, void } +static void speak_function(switch_core_session_t *session, char *data) +{ + switch_channel_t *channel; + char buf[10]; + char *argv[4] = {0}; + int argc; + char *engine = NULL; + char *voice = NULL; + char *text = NULL; + char *timer_name = NULL; + char *mydata = NULL; + switch_codec_t *codec; + + codec = switch_core_session_get_read_codec(session); + assert(codec != NULL); + + channel = switch_core_session_get_channel(session); + assert(channel != NULL); + + mydata = switch_core_session_strdup(session, data); + argc = switch_separate_string(mydata, '|', argv, sizeof(argv)/sizeof(argv[0])); + + engine = argv[0]; + voice = argv[1]; + text = argv[2]; + timer_name = argv[3]; + + if (!(engine && voice && text)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Params!\n"); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + + switch_channel_answer(channel); + switch_ivr_speak_text(session, engine, voice, timer_name, codec->implementation->samples_per_second, on_dtmf, text, buf, sizeof(buf)); + +} + static void playback_function(switch_core_session_t *session, char *data) { switch_channel_t *channel; @@ -85,9 +122,17 @@ static void record_function(switch_core_session_t *session, char *data) } + +static const switch_application_interface_t speak_application_interface = { + /*.interface_name */ "speak", + /*.application_function */ speak_function +}; + static const switch_application_interface_t record_application_interface = { /*.interface_name */ "record", - /*.application_function */ record_function + /*.application_function */ record_function, + NULL,NULL,NULL, + &speak_application_interface }; static const switch_application_interface_t playback_application_interface = { diff --git a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c index 5698cb7f0e..0963c8d72b 100644 --- a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c +++ b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c @@ -195,6 +195,8 @@ static switch_status_t cepstral_speech_close(switch_speech_handle_t *sh, switch_ static switch_status_t cepstral_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags) { cepstral_t *cepstral; + const char *fp = "file:"; + int len = strlen(fp); assert(sh != NULL); cepstral = sh->private_info; @@ -204,8 +206,13 @@ static switch_status_t cepstral_speech_feed_tts(switch_speech_handle_t *sh, char cepstral->done = 0; cepstral->tts_stream = NULL; - - swift_port_speak_text(cepstral->port, text, 0, NULL, &cepstral->tts_stream, NULL); + + if (!strncasecmp(text, fp, len)) { + text += len; + swift_port_speak_file(cepstral->port, text, NULL, &cepstral->tts_stream, NULL); + } else { + swift_port_speak_text(cepstral->port, text, 0, NULL, &cepstral->tts_stream, NULL); + } return SWITCH_STATUS_FALSE; } diff --git a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c index 6ed3b8f69e..4cc922bcc3 100644 --- a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c +++ b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c @@ -236,8 +236,6 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session) proceed = parse_exten(session, xexten, &extension); - //printf("ASS %s %d\n", (char *) switch_xml_attr_soft(xexten, "name"), proceed); - if (proceed && !switch_true(cont)) { break; }