mirror of
https://github.com/jambonz/freeswitch-modules.git
synced 2026-01-25 02:08:27 +00:00
add properties to tts span for mod_*_tts (#45)
* add properties to tts span for mod_*_tts Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com> * support deepgram tts span Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com> * support tts span for playht Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com> * support rimelabs tts span Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com> --------- Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com>
This commit is contained in:
@@ -21,7 +21,6 @@ static void clearPlayht(playht_t* p, int freeAll) {
|
||||
|
||||
|
||||
if (p->request_id) free(p->request_id);
|
||||
if (p->reported_latency) free(p->reported_latency);
|
||||
if (p->ct) free(p->ct);
|
||||
if (p->err_msg) free(p->err_msg);
|
||||
if (p->name_lookup_time_ms) free(p->name_lookup_time_ms);
|
||||
@@ -43,7 +42,6 @@ static void clearPlayht(playht_t* p, int freeAll) {
|
||||
p->text_guidance = NULL;
|
||||
|
||||
p->request_id = NULL;
|
||||
p->reported_latency = NULL;
|
||||
p->ct = NULL;
|
||||
p->err_msg = NULL;
|
||||
p->name_lookup_time_ms = NULL;
|
||||
|
||||
@@ -19,7 +19,6 @@ typedef struct playht_data {
|
||||
/* result data */
|
||||
long response_code;
|
||||
char *ct;
|
||||
char *reported_latency;
|
||||
char *request_id;
|
||||
char *name_lookup_time_ms;
|
||||
char *connect_time_ms;
|
||||
|
||||
@@ -489,9 +489,6 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, ConnInfo_t *conn) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "write_cb: firing playback-started\n");
|
||||
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Playback-File-Type", "tts_stream");
|
||||
if (p->reported_latency) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "variable_tts_playht_reported_latency_ms", p->reported_latency);
|
||||
}
|
||||
if (p->request_id) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "variable_tts_playht_request_id", p->request_id);
|
||||
}
|
||||
@@ -567,8 +564,7 @@ static size_t header_callback(char *buffer, size_t size, size_t nitems, ConnInfo
|
||||
std::string input(buffer, bytes_received);
|
||||
if (parseHeader(input, header, value)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "recv header: %s with value %s\n", header.c_str(), value.c_str());
|
||||
if (0 == header.compare("openai-processing-ms")) p->reported_latency = strdup(value.c_str());
|
||||
else if (0 == header.compare("x-request-id")) p->request_id = strdup(value.c_str());
|
||||
if (0 == header.compare("x-job-ids")) p->request_id = strdup(value.c_str());
|
||||
}
|
||||
else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "header_callback: %s\n", input.c_str());
|
||||
|
||||
Reference in New Issue
Block a user