mirror of
https://github.com/jambonz/freeswitch-modules.git
synced 2026-01-25 02:08:27 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a7ce3fdf8 | |||
| b019a634bd | |||
| f0b304b8a1 | |||
| be3714465b | |||
| b495dba126 |
@@ -173,13 +173,12 @@ public:
|
|||||||
char *metadata,
|
char *metadata,
|
||||||
const char* awsAccessKeyId,
|
const char* awsAccessKeyId,
|
||||||
const char* awsSecretAccessKey,
|
const char* awsSecretAccessKey,
|
||||||
|
const char* awsSessionToken,
|
||||||
responseHandler_t responseHandler,
|
responseHandler_t responseHandler,
|
||||||
errorHandler_t errorHandler) :
|
errorHandler_t errorHandler) :
|
||||||
m_bot(bot), m_alias(alias), m_region(region), m_sessionId(sessionId), m_finished(false), m_finishing(false), m_packets(0),
|
m_bot(bot), m_alias(alias), m_region(region), m_sessionId(sessionId), m_finished(false), m_finishing(false), m_packets(0),
|
||||||
m_pStream(nullptr), m_bPlayDone(false), m_bDiscardAudio(false)
|
m_pStream(nullptr), m_bPlayDone(false), m_bDiscardAudio(false)
|
||||||
{
|
{
|
||||||
Aws::String key(awsAccessKeyId);
|
|
||||||
Aws::String secret(awsSecretAccessKey);
|
|
||||||
Aws::String awsLocale(locale);
|
Aws::String awsLocale(locale);
|
||||||
Aws::Client::ClientConfiguration config;
|
Aws::Client::ClientConfiguration config;
|
||||||
config.region = region;
|
config.region = region;
|
||||||
@@ -191,7 +190,10 @@ public:
|
|||||||
keySnippet[19] = '\0';
|
keySnippet[19] = '\0';
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "GStreamer %p ACCESS_KEY_ID %s\n", this, keySnippet);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "GStreamer %p ACCESS_KEY_ID %s\n", this, keySnippet);
|
||||||
if (*awsAccessKeyId && *awsSecretAccessKey) {
|
if (*awsAccessKeyId && *awsSecretAccessKey && *awsSessionToken) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "using AWS creds %s %s %s\n", awsAccessKeyId, awsSecretAccessKey, awsSessionToken);
|
||||||
|
m_client = Aws::MakeUnique<LexRuntimeV2Client>(ALLOC_TAG, AWSCredentials(awsAccessKeyId, awsSecretAccessKey, awsSessionToken), config);
|
||||||
|
} else if (*awsAccessKeyId && *awsSecretAccessKey) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "using AWS creds %s %s\n", awsAccessKeyId, awsSecretAccessKey);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "using AWS creds %s %s\n", awsAccessKeyId, awsSecretAccessKey);
|
||||||
m_client = Aws::MakeUnique<LexRuntimeV2Client>(ALLOC_TAG, AWSCredentials(awsAccessKeyId, awsSecretAccessKey), config);
|
m_client = Aws::MakeUnique<LexRuntimeV2Client>(ALLOC_TAG, AWSCredentials(awsAccessKeyId, awsSecretAccessKey), config);
|
||||||
}
|
}
|
||||||
@@ -540,7 +542,7 @@ static void *SWITCH_THREAD_FUNC lex_thread(switch_thread_t *thread, void *obj) {
|
|||||||
bool ok = true;
|
bool ok = true;
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "lex_thread: starting cb %p\n", (void *) cb);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "lex_thread: starting cb %p\n", (void *) cb);
|
||||||
GStreamer* pStreamer = new GStreamer(cb->sessionId, cb->bot, cb->alias, cb->region, cb->locale,
|
GStreamer* pStreamer = new GStreamer(cb->sessionId, cb->bot, cb->alias, cb->region, cb->locale,
|
||||||
cb->intent, cb->metadata, cb->awsAccessKeyId, cb->awsSecretAccessKey,
|
cb->intent, cb->metadata, cb->awsAccessKeyId, cb->awsSecretAccessKey, cb->awsSessionToken,
|
||||||
cb->responseHandler, cb->errorHandler);
|
cb->responseHandler, cb->errorHandler);
|
||||||
if (!pStreamer) {
|
if (!pStreamer) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "lex_thread: Error allocating streamer\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "lex_thread: Error allocating streamer\n");
|
||||||
@@ -641,6 +643,7 @@ extern "C" {
|
|||||||
memset(cb, sizeof(cb), 0);
|
memset(cb, sizeof(cb), 0);
|
||||||
const char* awsAccessKeyId = switch_channel_get_variable(channel, "AWS_ACCESS_KEY_ID");
|
const char* awsAccessKeyId = switch_channel_get_variable(channel, "AWS_ACCESS_KEY_ID");
|
||||||
const char* awsSecretAccessKey = switch_channel_get_variable(channel, "AWS_SECRET_ACCESS_KEY");
|
const char* awsSecretAccessKey = switch_channel_get_variable(channel, "AWS_SECRET_ACCESS_KEY");
|
||||||
|
const char* awsSessionToken = switch_channel_get_variable(channel, "AWS_SESSION_TOKEN");
|
||||||
|
|
||||||
if (!hasDefaultCredentials && (!awsAccessKeyId || !awsSecretAccessKey)) {
|
if (!hasDefaultCredentials && (!awsAccessKeyId || !awsSecretAccessKey)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
|
||||||
@@ -654,6 +657,7 @@ extern "C" {
|
|||||||
if (awsAccessKeyId && awsSecretAccessKey) {
|
if (awsAccessKeyId && awsSecretAccessKey) {
|
||||||
strncpy(cb->awsAccessKeyId, awsAccessKeyId, 128);
|
strncpy(cb->awsAccessKeyId, awsAccessKeyId, 128);
|
||||||
strncpy(cb->awsSecretAccessKey, awsSecretAccessKey, 128);
|
strncpy(cb->awsSecretAccessKey, awsSecretAccessKey, 128);
|
||||||
|
if (awsSessionToken) strncpy(cb->awsSessionToken, awsSessionToken, 1024);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
strncpy(cb->awsAccessKeyId, std::getenv("AWS_ACCESS_KEY_ID"), 128);
|
strncpy(cb->awsAccessKeyId, std::getenv("AWS_ACCESS_KEY_ID"), 128);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ struct cap_cb {
|
|||||||
char sessionId[256];
|
char sessionId[256];
|
||||||
char awsAccessKeyId[128];
|
char awsAccessKeyId[128];
|
||||||
char awsSecretAccessKey[128];
|
char awsSecretAccessKey[128];
|
||||||
|
char awsSessionToken[1024];
|
||||||
SpeexResamplerState *resampler;
|
SpeexResamplerState *resampler;
|
||||||
void* streamer;
|
void* streamer;
|
||||||
responseHandler_t responseHandler;
|
responseHandler_t responseHandler;
|
||||||
|
|||||||
@@ -49,12 +49,11 @@ public:
|
|||||||
const char* region,
|
const char* region,
|
||||||
const char* awsAccessKeyId,
|
const char* awsAccessKeyId,
|
||||||
const char* awsSecretAccessKey,
|
const char* awsSecretAccessKey,
|
||||||
|
const char* awsSessionToken,
|
||||||
responseHandler_t responseHandler
|
responseHandler_t responseHandler
|
||||||
) : m_sessionId(sessionId), m_bugname(bugname), m_finished(false), m_interim(interim), m_finishing(false), m_connected(false), m_connecting(false),
|
) : m_sessionId(sessionId), m_bugname(bugname), m_finished(false), m_interim(interim), m_finishing(false), m_connected(false), m_connecting(false),
|
||||||
m_packets(0), m_responseHandler(responseHandler), m_pStream(nullptr),
|
m_packets(0), m_responseHandler(responseHandler), m_pStream(nullptr),
|
||||||
m_audioBuffer(320 * (samples_per_second == 8000 ? 1 : 2), 15) {
|
m_audioBuffer(320 * (samples_per_second == 8000 ? 1 : 2), 15) {
|
||||||
Aws::String key(awsAccessKeyId);
|
|
||||||
Aws::String secret(awsSecretAccessKey);
|
|
||||||
Aws::Client::ClientConfiguration config;
|
Aws::Client::ClientConfiguration config;
|
||||||
if (region != nullptr && strlen(region) > 0) config.region = region;
|
if (region != nullptr && strlen(region) > 0) config.region = region;
|
||||||
char keySnippet[20];
|
char keySnippet[20];
|
||||||
@@ -64,7 +63,9 @@ public:
|
|||||||
keySnippet[19] = '\0';
|
keySnippet[19] = '\0';
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "GStreamer %p ACCESS_KEY_ID %s, region %s\n", this, keySnippet, region);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "GStreamer %p ACCESS_KEY_ID %s, region %s\n", this, keySnippet, region);
|
||||||
if (*awsAccessKeyId && *awsSecretAccessKey) {
|
if (*awsAccessKeyId && *awsSecretAccessKey && *awsSessionToken) {
|
||||||
|
m_client = Aws::MakeUnique<TranscribeStreamingServiceClient>(ALLOC_TAG, AWSCredentials(awsAccessKeyId, awsSecretAccessKey, awsSessionToken), config);
|
||||||
|
} else if (*awsAccessKeyId && *awsSecretAccessKey) {
|
||||||
m_client = Aws::MakeUnique<TranscribeStreamingServiceClient>(ALLOC_TAG, AWSCredentials(awsAccessKeyId, awsSecretAccessKey), config);
|
m_client = Aws::MakeUnique<TranscribeStreamingServiceClient>(ALLOC_TAG, AWSCredentials(awsAccessKeyId, awsSecretAccessKey), config);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -320,8 +321,8 @@ static void *SWITCH_THREAD_FUNC aws_transcribe_thread(switch_thread_t *thread, v
|
|||||||
struct cap_cb *cb = (struct cap_cb *) obj;
|
struct cap_cb *cb = (struct cap_cb *) obj;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "transcribe_thread: starting cb %p\n", (void *) cb);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "transcribe_thread: starting cb %p\n", (void *) cb);
|
||||||
GStreamer* pStreamer = new GStreamer(cb->sessionId, cb->bugname, cb->channels, cb->lang, cb->interim, cb->samples_per_second, cb->region, cb->awsAccessKeyId, cb->awsSecretAccessKey,
|
GStreamer* pStreamer = new GStreamer(cb->sessionId, cb->bugname, cb->channels, cb->lang, cb->interim, cb->samples_per_second,
|
||||||
cb->responseHandler);
|
cb->region, cb->awsAccessKeyId, cb->awsSecretAccessKey, cb->awsSessionToken, cb->responseHandler);
|
||||||
if (!pStreamer) {
|
if (!pStreamer) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "transcribe_thread: Error allocating streamer\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "transcribe_thread: Error allocating streamer\n");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -408,6 +409,7 @@ extern "C" {
|
|||||||
memset(cb, sizeof(cb), 0);
|
memset(cb, sizeof(cb), 0);
|
||||||
const char* awsAccessKeyId = switch_channel_get_variable(channel, "AWS_ACCESS_KEY_ID");
|
const char* awsAccessKeyId = switch_channel_get_variable(channel, "AWS_ACCESS_KEY_ID");
|
||||||
const char* awsSecretAccessKey = switch_channel_get_variable(channel, "AWS_SECRET_ACCESS_KEY");
|
const char* awsSecretAccessKey = switch_channel_get_variable(channel, "AWS_SECRET_ACCESS_KEY");
|
||||||
|
const char* awsSessionToken = switch_channel_get_variable(channel, "AWS_SESSION_TOKEN");
|
||||||
const char* awsRegion = switch_channel_get_variable(channel, "AWS_REGION");
|
const char* awsRegion = switch_channel_get_variable(channel, "AWS_REGION");
|
||||||
cb->channels = channels;
|
cb->channels = channels;
|
||||||
LanguageCode code = LanguageCodeMapper::GetLanguageCodeForName(lang);
|
LanguageCode code = LanguageCodeMapper::GetLanguageCodeForName(lang);
|
||||||
@@ -419,12 +421,12 @@ extern "C" {
|
|||||||
strncpy(cb->sessionId, switch_core_session_get_uuid(session), MAX_SESSION_ID);
|
strncpy(cb->sessionId, switch_core_session_get_uuid(session), MAX_SESSION_ID);
|
||||||
strncpy(cb->bugname, bugname, MAX_BUG_LEN);
|
strncpy(cb->bugname, bugname, MAX_BUG_LEN);
|
||||||
|
|
||||||
if (awsAccessKeyId && awsSecretAccessKey && awsRegion) {
|
if (awsRegion) strncpy(cb->region, awsRegion, MAX_REGION);
|
||||||
|
if (awsAccessKeyId && awsSecretAccessKey) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Using channel vars for aws authentication\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Using channel vars for aws authentication\n");
|
||||||
strncpy(cb->awsAccessKeyId, awsAccessKeyId, 128);
|
strncpy(cb->awsAccessKeyId, awsAccessKeyId, 128);
|
||||||
strncpy(cb->awsSecretAccessKey, awsSecretAccessKey, 128);
|
strncpy(cb->awsSecretAccessKey, awsSecretAccessKey, 128);
|
||||||
strncpy(cb->region, awsRegion, MAX_REGION);
|
if (awsSessionToken) strncpy(cb->awsSessionToken, awsSessionToken, 1024);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (std::getenv("AWS_ACCESS_KEY_ID") &&
|
else if (std::getenv("AWS_ACCESS_KEY_ID") &&
|
||||||
std::getenv("AWS_SECRET_ACCESS_KEY") &&
|
std::getenv("AWS_SECRET_ACCESS_KEY") &&
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ struct cap_cb {
|
|||||||
char sessionId[MAX_SESSION_ID+1];
|
char sessionId[MAX_SESSION_ID+1];
|
||||||
char awsAccessKeyId[128];
|
char awsAccessKeyId[128];
|
||||||
char awsSecretAccessKey[128];
|
char awsSecretAccessKey[128];
|
||||||
|
char awsSessionToken[1024];
|
||||||
uint32_t channels;
|
uint32_t channels;
|
||||||
SpeexResamplerState *resampler;
|
SpeexResamplerState *resampler;
|
||||||
void* streamer;
|
void* streamer;
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ static switch_status_t a_speech_feed_tts(switch_speech_handle_t *sh, char *text,
|
|||||||
a->draining = 0;
|
a->draining = 0;
|
||||||
a->reads = 0;
|
a->reads = 0;
|
||||||
a->flushed = 0;
|
a->flushed = 0;
|
||||||
|
a->response_code = 0;
|
||||||
|
a->err_msg = NULL;
|
||||||
|
|
||||||
return azure_speech_feed_tts(a, text, flags);
|
return azure_speech_feed_tts(a, text, flags);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,14 +162,14 @@ namespace {
|
|||||||
if (!model && !customModel) {
|
if (!model && !customModel) {
|
||||||
std::string defaultModel;
|
std::string defaultModel;
|
||||||
if (getLanguageInfo(language, defaultModel)) {
|
if (getLanguageInfo(language, defaultModel)) {
|
||||||
oss << "&model=" << defaultModel;
|
oss << "model=" << defaultModel;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
oss << "model=base"; // most widely supported, though not ideal
|
oss << "model=base"; // most widely supported, though not ideal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (model) oss << "&model=" << model;
|
else if (model) oss << "model=" << model;
|
||||||
else if (customModel) oss << "&model=" << customModel;
|
else if (customModel) oss << "model=" << customModel;
|
||||||
|
|
||||||
if (var = switch_channel_get_variable(channel, "DEEPGRAM_SPEECH_MODEL_VERSION")) {
|
if (var = switch_channel_get_variable(channel, "DEEPGRAM_SPEECH_MODEL_VERSION")) {
|
||||||
oss << "&version";
|
oss << "&version";
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ static switch_status_t d_speech_feed_tts(switch_speech_handle_t *sh, char *text,
|
|||||||
deepgram_t *d = createOrRetrievePrivateData(sh);
|
deepgram_t *d = createOrRetrievePrivateData(sh);
|
||||||
d->draining = 0;
|
d->draining = 0;
|
||||||
d->reads = 0;
|
d->reads = 0;
|
||||||
|
d->response_code = 0;
|
||||||
|
d->err_msg = NULL;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "d_speech_feed_tts\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "d_speech_feed_tts\n");
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ static switch_status_t ell_speech_feed_tts(switch_speech_handle_t *sh, char *tex
|
|||||||
elevenlabs_t *el = createOrRetrievePrivateData(sh);
|
elevenlabs_t *el = createOrRetrievePrivateData(sh);
|
||||||
el->draining = 0;
|
el->draining = 0;
|
||||||
el->reads = 0;
|
el->reads = 0;
|
||||||
|
el->response_code = 0;
|
||||||
|
el->err_msg = NULL;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ell_speech_feed_tts\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ell_speech_feed_tts\n");
|
||||||
|
|
||||||
|
|||||||
@@ -404,12 +404,14 @@ extern "C" {
|
|||||||
jambonz::AudioPipe *pAudioPipe = static_cast<jambonz::AudioPipe *>(tech_pvt->pAudioPipe);
|
jambonz::AudioPipe *pAudioPipe = static_cast<jambonz::AudioPipe *>(tech_pvt->pAudioPipe);
|
||||||
if (pAudioPipe) reaper(tech_pvt);
|
if (pAudioPipe) reaper(tech_pvt);
|
||||||
destroy_tech_pvt(tech_pvt);
|
destroy_tech_pvt(tech_pvt);
|
||||||
|
switch_mutex_unlock(tech_pvt->mutex);
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%u) jb_transcribe_session_stop, bug removed\n", id);
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%u) jb_transcribe_session_stop, bug removed\n", id);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "jb_transcribe_session_stop: race condition, previous close completed\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "jb_transcribe_session_stop: race condition, previous close completed\n");
|
||||||
}
|
}
|
||||||
|
switch_mutex_unlock(tech_pvt->mutex);
|
||||||
}
|
}
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ static switch_status_t start_capture(switch_core_session_t *session, switch_medi
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
switch_channel_set_private(channel, bugname, bug);
|
switch_channel_set_private(channel, bugname, bug);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "added media bug for jb transcribe\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "added media bug for jb transcribe: %s\n", bugname);
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ SWITCH_STANDARD_API(jb_transcribe_function)
|
|||||||
if ((lsession = switch_core_session_locate(argv[0]))) {
|
if ((lsession = switch_core_session_locate(argv[0]))) {
|
||||||
if (!strcasecmp(argv[1], "stop")) {
|
if (!strcasecmp(argv[1], "stop")) {
|
||||||
char *bugname = argc > 2 ? argv[2] : MY_BUG_NAME;
|
char *bugname = argc > 2 ? argv[2] : MY_BUG_NAME;
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "stop transcribing\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "stop transcribing %s\n", bugname);
|
||||||
status = do_stop(lsession, bugname);
|
status = do_stop(lsession, bugname);
|
||||||
} else if (!strcasecmp(argv[1], "start")) {
|
} else if (!strcasecmp(argv[1], "start")) {
|
||||||
char* lang = argv[2];
|
char* lang = argv[2];
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ static switch_status_t p_speech_feed_tts(switch_speech_handle_t *sh, char *text,
|
|||||||
playht_t *p = createOrRetrievePrivateData(sh);
|
playht_t *p = createOrRetrievePrivateData(sh);
|
||||||
p->draining = 0;
|
p->draining = 0;
|
||||||
p->reads = 0;
|
p->reads = 0;
|
||||||
|
p->response_code = 0;
|
||||||
|
p->err_msg = NULL;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "p_speech_feed_tts\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "p_speech_feed_tts\n");
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ static CURL* createEasyHandle(void) {
|
|||||||
|
|
||||||
// set connect timeout to 3 seconds and total timeout to 109 seconds
|
// set connect timeout to 3 seconds and total timeout to 109 seconds
|
||||||
curl_easy_setopt(easy, CURLOPT_CONNECTTIMEOUT_MS, 3000L);
|
curl_easy_setopt(easy, CURLOPT_CONNECTTIMEOUT_MS, 3000L);
|
||||||
curl_easy_setopt(easy, CURLOPT_TIMEOUT, 10L);
|
//For long text, PlayHT took more than 20 seconds to complete the download.
|
||||||
|
curl_easy_setopt(easy, CURLOPT_TIMEOUT, 60L);
|
||||||
|
|
||||||
return easy ;
|
return easy ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ static switch_status_t d_speech_feed_tts(switch_speech_handle_t *sh, char *text,
|
|||||||
rimelabs_t *d = createOrRetrievePrivateData(sh);
|
rimelabs_t *d = createOrRetrievePrivateData(sh);
|
||||||
d->draining = 0;
|
d->draining = 0;
|
||||||
d->reads = 0;
|
d->reads = 0;
|
||||||
|
d->response_code = 0;
|
||||||
|
d->err_msg = NULL;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "d_speech_feed_tts\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "d_speech_feed_tts\n");
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ static switch_status_t w_speech_feed_tts(switch_speech_handle_t *sh, char *text,
|
|||||||
whisper_t *w = createOrRetrievePrivateData(sh);
|
whisper_t *w = createOrRetrievePrivateData(sh);
|
||||||
w->draining = 0;
|
w->draining = 0;
|
||||||
w->reads = 0;
|
w->reads = 0;
|
||||||
|
w->response_code = 0;
|
||||||
|
w->err_msg = NULL;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "w_speech_feed_tts\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "w_speech_feed_tts\n");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user