mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-29 14:44:17 +00:00
spring cleaning
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4795 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
a021945cef
commit
3a54126261
143 files changed
+22413
-31567
No files matched your search
@@ -68,9 +68,9 @@ static uint32_t match_count(char *str, uint32_t max)
|
||||
{
|
||||
char tstr[80] = "";
|
||||
uint32_t matches = 0, x = 0;
|
||||
uint32_t len = (uint32_t)strlen(str);
|
||||
uint32_t len = (uint32_t) strlen(str);
|
||||
|
||||
for (x = 0; x < max ; x++) {
|
||||
for (x = 0; x < max; x++) {
|
||||
snprintf(tstr, sizeof(tstr), "%u", x);
|
||||
if (!strncasecmp(str, tstr, len)) {
|
||||
matches++;
|
||||
@@ -85,68 +85,68 @@ static uint32_t match_count(char *str, uint32_t max)
|
||||
dtmf handler function you can hook up to be executed when a digit is dialed during playback
|
||||
if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
|
||||
*/
|
||||
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
|
||||
|
||||
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf,
|
||||
unsigned int buflen)
|
||||
{
|
||||
switch (itype) {
|
||||
case SWITCH_INPUT_TYPE_DTMF: {
|
||||
char *dtmf = (char *) input;
|
||||
struct dtmf_buffer *dtb;
|
||||
dtb = (struct dtmf_buffer *) buf;
|
||||
|
||||
switch(*dtmf) {
|
||||
case '#':
|
||||
switch_set_flag(dtb, SFLAG_MAIN);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
case '6':
|
||||
dtb->index++;
|
||||
return SWITCH_STATUS_BREAK;
|
||||
case '4':
|
||||
dtb->index--;
|
||||
return SWITCH_STATUS_BREAK;
|
||||
case '*':
|
||||
if (switch_test_flag(dtb->sh, SWITCH_SPEECH_FLAG_PAUSE)) {
|
||||
switch_clear_flag(dtb->sh, SWITCH_SPEECH_FLAG_PAUSE);
|
||||
} else {
|
||||
switch_set_flag(dtb->sh, SWITCH_SPEECH_FLAG_PAUSE);
|
||||
}
|
||||
break;
|
||||
case '5':
|
||||
switch_core_speech_text_param_tts(dtb->sh, "voice", "next");
|
||||
switch_set_flag(dtb, SFLAG_INFO);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
break;
|
||||
case '9':
|
||||
switch_core_speech_text_param_tts(dtb->sh, "voice", dtb->voice);
|
||||
switch_set_flag(dtb, SFLAG_INFO);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
break;
|
||||
case '2':
|
||||
if (dtb->speed < 260) {
|
||||
dtb->speed += 30;
|
||||
case SWITCH_INPUT_TYPE_DTMF:{
|
||||
char *dtmf = (char *) input;
|
||||
struct dtmf_buffer *dtb;
|
||||
dtb = (struct dtmf_buffer *) buf;
|
||||
|
||||
switch (*dtmf) {
|
||||
case '#':
|
||||
switch_set_flag(dtb, SFLAG_MAIN);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
case '6':
|
||||
dtb->index++;
|
||||
return SWITCH_STATUS_BREAK;
|
||||
case '4':
|
||||
dtb->index--;
|
||||
return SWITCH_STATUS_BREAK;
|
||||
case '*':
|
||||
if (switch_test_flag(dtb->sh, SWITCH_SPEECH_FLAG_PAUSE)) {
|
||||
switch_clear_flag(dtb->sh, SWITCH_SPEECH_FLAG_PAUSE);
|
||||
} else {
|
||||
switch_set_flag(dtb->sh, SWITCH_SPEECH_FLAG_PAUSE);
|
||||
}
|
||||
break;
|
||||
case '5':
|
||||
switch_core_speech_text_param_tts(dtb->sh, "voice", "next");
|
||||
switch_set_flag(dtb, SFLAG_INFO);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
break;
|
||||
case '9':
|
||||
switch_core_speech_text_param_tts(dtb->sh, "voice", dtb->voice);
|
||||
switch_set_flag(dtb, SFLAG_INFO);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
break;
|
||||
case '2':
|
||||
if (dtb->speed < 260) {
|
||||
dtb->speed += 30;
|
||||
switch_core_speech_numeric_param_tts(dtb->sh, "speech/rate", dtb->speed);
|
||||
switch_set_flag(dtb, SFLAG_INFO);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
}
|
||||
break;
|
||||
case '7':
|
||||
dtb->speed = TTS_MEAN_SPEED;
|
||||
switch_core_speech_numeric_param_tts(dtb->sh, "speech/rate", dtb->speed);
|
||||
switch_set_flag(dtb, SFLAG_INFO);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
}
|
||||
break;
|
||||
case '7':
|
||||
dtb->speed = TTS_MEAN_SPEED;
|
||||
switch_core_speech_numeric_param_tts(dtb->sh, "speech/rate", dtb->speed);
|
||||
switch_set_flag(dtb, SFLAG_INFO);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
case '8':
|
||||
if (dtb->speed > 80) {
|
||||
dtb->speed -= 30;
|
||||
switch_core_speech_numeric_param_tts(dtb->sh, "speech/rate", dtb->speed);
|
||||
switch_set_flag(dtb, SFLAG_INFO);
|
||||
case '8':
|
||||
if (dtb->speed > 80) {
|
||||
dtb->speed -= 30;
|
||||
switch_core_speech_numeric_param_tts(dtb->sh, "speech/rate", dtb->speed);
|
||||
switch_set_flag(dtb, SFLAG_INFO);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
}
|
||||
break;
|
||||
case '0':
|
||||
switch_set_flag(dtb, SFLAG_INSTRUCT);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
}
|
||||
break;
|
||||
case '0':
|
||||
switch_set_flag(dtb, SFLAG_INSTRUCT);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -159,9 +159,9 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
switch_channel_t *channel;
|
||||
switch_status_t status;
|
||||
const char *err = NULL;
|
||||
struct dtmf_buffer dtb = {0};
|
||||
struct dtmf_buffer dtb = { 0 };
|
||||
switch_xml_t xml = NULL, item, xchannel = NULL;
|
||||
struct rss_entry entries[TTS_MAX_ENTRIES] = {{0}};
|
||||
struct rss_entry entries[TTS_MAX_ENTRIES] = { {0} };
|
||||
uint32_t i = 0;
|
||||
char *title_txt = "", *description_txt = "", *rights_txt = "";
|
||||
switch_codec_t speech_codec, *codec = switch_core_session_get_read_codec(session);
|
||||
@@ -169,31 +169,32 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
char *voice = TTS_DEFAULT_VOICE;
|
||||
char *timer_name = NULL;
|
||||
switch_speech_handle_t sh;
|
||||
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
|
||||
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
|
||||
switch_core_thread_session_t thread_session;
|
||||
uint32_t rate, interval = 20;
|
||||
int stream_id = 0;
|
||||
switch_timer_t timer = {0}, *timerp = NULL;
|
||||
switch_timer_t timer = { 0 }, *timerp = NULL;
|
||||
uint32_t last;
|
||||
char *mydata = NULL;
|
||||
char *filename = NULL;
|
||||
char *argv[3], *feed_list[TTS_MAX_ENTRIES] = {0} , *feed_names[TTS_MAX_ENTRIES] = {0};
|
||||
char *argv[3], *feed_list[TTS_MAX_ENTRIES] = { 0 }, *feed_names[TTS_MAX_ENTRIES] = {
|
||||
0};
|
||||
int argc, feed_index = 0;
|
||||
char *cf = "rss.conf";
|
||||
switch_xml_t cfg, cxml, feeds, feed;
|
||||
switch_xml_t cfg, cxml, feeds, feed;
|
||||
char buf[1024];
|
||||
int32_t jumpto = -1;
|
||||
uint32_t matches = 0;
|
||||
switch_input_args_t args = {0};
|
||||
switch_input_args_t args = { 0 };
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
assert(channel != NULL);
|
||||
|
||||
|
||||
if (!(cxml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
|
||||
return;
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((feeds = switch_xml_child(cfg, "feeds"))) {
|
||||
for (feed = switch_xml_child(feeds, "feed"); feed; feed = feed->next) {
|
||||
@@ -210,14 +211,14 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
}
|
||||
|
||||
switch_xml_free(cxml);
|
||||
|
||||
|
||||
switch_channel_answer(channel);
|
||||
|
||||
|
||||
|
||||
if (!switch_strlen_zero(data)) {
|
||||
if ((mydata = switch_core_session_strdup(session, data))) {
|
||||
argc = switch_separate_string(mydata, ' ', argv, sizeof(argv)/sizeof(argv[0]));
|
||||
argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]));
|
||||
|
||||
if (argv[0]) {
|
||||
engine = argv[0];
|
||||
@@ -246,40 +247,40 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
memset(&sh, 0, sizeof(sh));
|
||||
if (switch_core_speech_open(&sh,
|
||||
engine,
|
||||
voice,
|
||||
rate,
|
||||
&flags,
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
voice, rate, &flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (switch_core_codec_init(&speech_codec,
|
||||
"L16",
|
||||
NULL,
|
||||
(int)rate,
|
||||
(int) rate,
|
||||
interval,
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL,
|
||||
switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
|
||||
NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n", rate, interval);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
|
||||
rate, interval);
|
||||
flags = 0;
|
||||
switch_core_speech_close(&sh, &flags);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (timer_name) {
|
||||
if (switch_core_timer_init(&timer, timer_name, interval, (int)(rate / 50), switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_timer_init
|
||||
(&timer, timer_name, interval, (int) (rate / 50),
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
|
||||
switch_core_codec_destroy(&speech_codec);
|
||||
flags = 0;
|
||||
switch_core_speech_close(&sh, &flags);
|
||||
return;
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success %u bytes per %d ms!\n", (rate / 50)*2, interval);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "setup timer success %u bytes per %d ms!\n",
|
||||
(rate / 50) * 2, interval);
|
||||
|
||||
/* start a thread to absorb incoming audio */
|
||||
for (stream_id = 0; stream_id < switch_core_session_get_stream_count(session); stream_id++) {
|
||||
@@ -292,7 +293,7 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
while (switch_channel_ready(channel)) {
|
||||
int32_t len = 0, idx = 0;
|
||||
char cmd[3];
|
||||
main_menu:
|
||||
main_menu:
|
||||
filename = NULL;
|
||||
len = idx = 0;
|
||||
*cmd = '\0';
|
||||
@@ -304,36 +305,30 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
} else {
|
||||
switch_core_speech_flush_tts(&sh);
|
||||
#ifdef MATCH_COUNT
|
||||
snprintf(buf + len, sizeof(buf) - len,
|
||||
snprintf(buf + len, sizeof(buf) - len,
|
||||
",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
|
||||
"Select one of the following news sources, or press 0 to exit. "
|
||||
",<break time=\"600ms\"/>");
|
||||
"Select one of the following news sources, or press 0 to exit. " ",<break time=\"600ms\"/>");
|
||||
#else
|
||||
snprintf(buf + len, sizeof(buf) - len,
|
||||
snprintf(buf + len, sizeof(buf) - len,
|
||||
",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
|
||||
"Select one of the following news sources, followed by the pound key or press 0 to exit. "
|
||||
",<break time=\"600ms\"/>");
|
||||
#endif
|
||||
len = (int32_t)strlen(buf);
|
||||
len = (int32_t) strlen(buf);
|
||||
|
||||
for (idx = 0; idx < feed_index; idx++) {
|
||||
snprintf(buf + len, sizeof(buf) - len, "%d: %s. <break time=\"600ms\"/>", idx + 1, feed_names[idx]);
|
||||
len = (int32_t)strlen(buf);
|
||||
len = (int32_t) strlen(buf);
|
||||
}
|
||||
|
||||
|
||||
snprintf(buf + len, sizeof(buf) - len, "<break time=\"2000ms\"/>");
|
||||
len = (int32_t)strlen(buf);
|
||||
len = (int32_t) strlen(buf);
|
||||
|
||||
args.input_callback = NULL;
|
||||
args.buf = cmd;
|
||||
args.buflen = sizeof(cmd);
|
||||
status = switch_ivr_speak_text_handle(session,
|
||||
&sh,
|
||||
&speech_codec,
|
||||
timerp,
|
||||
buf,
|
||||
&args);
|
||||
status = switch_ivr_speak_text_handle(session, &sh, &speech_codec, timerp, buf, &args);
|
||||
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
||||
goto finished;
|
||||
}
|
||||
@@ -346,31 +341,31 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((p=strchr(cmd, '#'))) {
|
||||
if ((p = strchr(cmd, '#'))) {
|
||||
*p = '\0';
|
||||
#ifdef MATCH_COUNT
|
||||
/* Hmmm... I know there are no more matches so I don't *need* them to press pound but
|
||||
I already told them to press it. Will this confuse people or not? Let's make em press
|
||||
pound unless this define is enabled for now.
|
||||
*/
|
||||
*/
|
||||
} else if (match_count(cmd, feed_index) > 1) {
|
||||
#else
|
||||
} else {
|
||||
#endif
|
||||
char term;
|
||||
char *cp;
|
||||
int blen = sizeof(cmd) - (int)strlen(cmd);
|
||||
int blen = sizeof(cmd) - (int) strlen(cmd);
|
||||
|
||||
cp = cmd + blen;
|
||||
switch_ivr_collect_digits_count(session, cp, blen, blen, "#", &term, 5000);
|
||||
}
|
||||
|
||||
|
||||
i = atoi(cmd) - 1;
|
||||
|
||||
if (i > -1 && i < feed_index) {
|
||||
filename = feed_list[i];
|
||||
} else if (matches > 1) {
|
||||
|
||||
|
||||
} else {
|
||||
args.input_callback = NULL;
|
||||
args.buf = NULL;
|
||||
@@ -378,19 +373,17 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
status = switch_ivr_speak_text_handle(session,
|
||||
&sh,
|
||||
&speech_codec,
|
||||
timerp,
|
||||
"I'm sorry. That is an Invalid Selection. ",
|
||||
&args);
|
||||
timerp, "I'm sorry. That is an Invalid Selection. ", &args);
|
||||
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
||||
goto finished;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!filename) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (!(xml = switch_xml_parse_file(filename))) {
|
||||
@@ -411,7 +404,7 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
if ((title = switch_xml_child(xchannel, "title"))) {
|
||||
title_txt = title->txt;
|
||||
}
|
||||
|
||||
|
||||
if ((description = switch_xml_child(xchannel, "description"))) {
|
||||
description_txt = description->txt;
|
||||
}
|
||||
@@ -444,19 +437,19 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
if ((title = switch_xml_child(item, "title"))) {
|
||||
entries[i].title_txt = title->txt;
|
||||
}
|
||||
|
||||
|
||||
if ((description = switch_xml_child(item, "description"))) {
|
||||
char *t, *e;
|
||||
entries[i].description_txt = description->txt;
|
||||
for(;;) {
|
||||
for (;;) {
|
||||
if (!(t = strchr(entries[i].description_txt, '<'))) {
|
||||
break;
|
||||
}
|
||||
if (!(e = strchr(t, '>'))) {
|
||||
break;
|
||||
}
|
||||
|
||||
memset(t, 32, ++e-t);
|
||||
|
||||
memset(t, 32, ++e - t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,9 +464,8 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
if (entries[i].description_txt && (p = strchr(entries[i].description_txt, '<'))) {
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
#ifdef _STRIP_SOME_CHARS_
|
||||
for(p = entries[i].description_txt; *p; p++) {
|
||||
for (p = entries[i].description_txt; *p; p++) {
|
||||
if (*p == '\'' || *p == '"' || *p == ':') {
|
||||
*p = ' ';
|
||||
}
|
||||
@@ -493,17 +485,13 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
switch_strftime(date, &retsize, sizeof(date), "%I:%M %p", &tm);
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), ",<break time=\"500ms\"/>%s. %s. %s. local time: %s, Press 0 for options, 5 to change voice, or pound to return to the main menu. ",
|
||||
snprintf(buf, sizeof(buf),
|
||||
",<break time=\"500ms\"/>%s. %s. %s. local time: %s, Press 0 for options, 5 to change voice, or pound to return to the main menu. ",
|
||||
title_txt, description_txt, rights_txt, date);
|
||||
args.input_callback = NULL;
|
||||
args.buf = cmd;
|
||||
args.buflen = sizeof(cmd);
|
||||
status = switch_ivr_speak_text_handle(session,
|
||||
&sh,
|
||||
&speech_codec,
|
||||
timerp,
|
||||
buf,
|
||||
&args);
|
||||
status = switch_ivr_speak_text_handle(session, &sh, &speech_codec, timerp, buf, &args);
|
||||
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
||||
goto finished;
|
||||
}
|
||||
@@ -519,7 +507,7 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
}
|
||||
}
|
||||
|
||||
for(last = 0; last < TTS_MAX_ENTRIES; last++) {
|
||||
for (last = 0; last < TTS_MAX_ENTRIES; last++) {
|
||||
if (!entries[last].inuse) {
|
||||
last--;
|
||||
break;
|
||||
@@ -531,8 +519,8 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
dtb.speed = TTS_MEAN_SPEED;
|
||||
switch_set_flag(&dtb, SFLAG_INFO);
|
||||
switch_copy_string(dtb.voice, voice, sizeof(dtb.voice));
|
||||
while(entries[0].inuse && switch_channel_ready(channel)) {
|
||||
while(switch_channel_ready(channel)) {
|
||||
while (entries[0].inuse && switch_channel_ready(channel)) {
|
||||
while (switch_channel_ready(channel)) {
|
||||
uint8_t cont = 0;
|
||||
|
||||
if (dtb.index >= TTS_MAX_ENTRIES) {
|
||||
@@ -557,12 +545,8 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
if (switch_test_flag(&dtb, SFLAG_INFO)) {
|
||||
switch_clear_flag(&dtb, SFLAG_INFO);
|
||||
snprintf(buf + len, sizeof(buf) - len,
|
||||
"%s %s. I am speaking at %u words per minute. ",
|
||||
sh.engine,
|
||||
sh.voice,
|
||||
dtb.speed
|
||||
);
|
||||
len = (uint32_t)strlen(buf);
|
||||
"%s %s. I am speaking at %u words per minute. ", sh.engine, sh.voice, dtb.speed);
|
||||
len = (uint32_t) strlen(buf);
|
||||
}
|
||||
|
||||
if (switch_test_flag(&dtb, SFLAG_INSTRUCT)) {
|
||||
@@ -577,33 +561,29 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
"To hear these options again, press zero or press pound to return to the main menu. ");
|
||||
} else {
|
||||
snprintf(buf + len, sizeof(buf) - len, "Story %d. ", dtb.index + 1);
|
||||
len = (uint32_t)strlen(buf);
|
||||
len = (uint32_t) strlen(buf);
|
||||
|
||||
if (entries[dtb.index].subject_txt) {
|
||||
snprintf(buf + len, sizeof(buf) - len, "Subject: %s. ", entries[dtb.index].subject_txt);
|
||||
len = (uint32_t)strlen(buf);
|
||||
len = (uint32_t) strlen(buf);
|
||||
}
|
||||
|
||||
|
||||
if (entries[dtb.index].dept_txt) {
|
||||
snprintf(buf + len, sizeof(buf) - len, "From the %s department. ", entries[dtb.index].dept_txt);
|
||||
len = (uint32_t)strlen(buf);
|
||||
snprintf(buf + len, sizeof(buf) - len, "From the %s department. ",
|
||||
entries[dtb.index].dept_txt);
|
||||
len = (uint32_t) strlen(buf);
|
||||
}
|
||||
|
||||
if (entries[dtb.index].title_txt) {
|
||||
snprintf(buf + len, sizeof(buf) - len, "%s", entries[dtb.index].title_txt);
|
||||
len = (uint32_t)strlen(buf);
|
||||
len = (uint32_t) strlen(buf);
|
||||
}
|
||||
}
|
||||
switch_core_speech_flush_tts(&sh);
|
||||
args.input_callback = on_dtmf;
|
||||
args.buf = &dtb;
|
||||
args.buflen = sizeof(dtb);
|
||||
status = switch_ivr_speak_text_handle(session,
|
||||
&sh,
|
||||
&speech_codec,
|
||||
timerp,
|
||||
buf,
|
||||
&args);
|
||||
status = switch_ivr_speak_text_handle(session, &sh, &speech_codec, timerp, buf, &args);
|
||||
if (status == SWITCH_STATUS_BREAK) {
|
||||
continue;
|
||||
} else if (status != SWITCH_STATUS_SUCCESS) {
|
||||
@@ -614,7 +594,7 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
cont = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (entries[dtb.index].description_txt) {
|
||||
args.input_callback = on_dtmf;
|
||||
args.buf = &dtb;
|
||||
@@ -622,9 +602,7 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
status = switch_ivr_speak_text_handle(session,
|
||||
&sh,
|
||||
&speech_codec,
|
||||
timerp,
|
||||
entries[dtb.index].description_txt,
|
||||
&args);
|
||||
timerp, entries[dtb.index].description_txt, &args);
|
||||
}
|
||||
if (status == SWITCH_STATUS_BREAK) {
|
||||
continue;
|
||||
@@ -638,7 +616,7 @@ static void rss_function(switch_core_session_t *session, char *data)
|
||||
}
|
||||
}
|
||||
|
||||
finished:
|
||||
finished:
|
||||
switch_core_speech_close(&sh, &flags);
|
||||
switch_core_codec_destroy(&speech_codec);
|
||||
|
||||
@@ -659,7 +637,7 @@ static const switch_application_interface_t rss_application_interface = {
|
||||
/*.application_function */ rss_function,
|
||||
NULL, NULL, NULL,
|
||||
/* flags */ SAF_NONE,
|
||||
/*.next*/ NULL
|
||||
/*.next */ NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -677,7 +655,8 @@ static switch_loadable_module_interface_t rss_module_interface = {
|
||||
};
|
||||
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
|
||||
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
|
||||
char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = &rss_module_interface;
|
||||
|
||||
Reference in new issue
Block a user