Add framework to connect to, and read and write protocol based messages from and to an external application using an Asterisk External Application Protocol (AEAP). This has been divided into several abstractions: 1. transport - base communication layer (currently websocket only) 2. message - AEAP description and data (currently JSON only) 3. transaction - links/binds requests and responses 4. aeap - transport, message, and transaction handler/manager This patch also adds an AEAP implementation for speech to text. Existing speech API callbacks for speech to text have been completed making it possible for Asterisk to connect to a configured external translator service and provide audio for STT. Results can also be received from the external translator, and made available as speech results in Asterisk. Unit tests have also been created that test the AEAP framework, and also the speech to text implementation. ASTERISK-29726 #close Change-Id: Iaa4b259f84aa63501e5fd2a6fb107f900b4d4ed2
59 lines
1.3 KiB
C
59 lines
1.3 KiB
C
/*
|
|
* Asterisk -- An open source telephony toolkit.
|
|
*
|
|
* Copyright (C) 2021, Sangoma Technologies Corporation
|
|
*
|
|
* Kevin Harwell <kharwell@sangoma.com>
|
|
*
|
|
* See http://www.asterisk.org for more information about
|
|
* the Asterisk project. Please do not directly contact
|
|
* any of the maintainers of this project for assistance;
|
|
* the project provides a web site, mailing lists and IRC
|
|
* channels for your use.
|
|
*
|
|
* This program is free software, distributed under the terms of
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
* at the top of the source tree.
|
|
*/
|
|
|
|
#include "asterisk.h"
|
|
|
|
#include "asterisk/astobj2.h"
|
|
#include "asterisk/sched.h"
|
|
|
|
#include "general.h"
|
|
|
|
/*! \brief Scheduler for transaction timeouts */
|
|
static struct ast_sched_context *sched = NULL;
|
|
|
|
struct ast_sched_context *aeap_sched_context(void)
|
|
{
|
|
return sched;
|
|
}
|
|
|
|
void aeap_general_finalize(void)
|
|
{
|
|
if (sched) {
|
|
ast_sched_context_destroy(sched);
|
|
sched = NULL;
|
|
}
|
|
}
|
|
|
|
int aeap_general_initialize(void)
|
|
{
|
|
sched = ast_sched_context_create();
|
|
if (!sched) {
|
|
ast_log(LOG_ERROR, "AEAP scheduler: unable to create context");
|
|
return -1;
|
|
}
|
|
|
|
if (ast_sched_start_thread(sched)) {
|
|
ast_log(LOG_ERROR, "AEAP scheduler: unable to start thread");
|
|
aeap_general_finalize();
|
|
return -1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|