Merge branch 'master' into remove_redis

This commit is contained in:
Abdelkader Boudih 2025-02-05 13:11:10 +01:00 committed by GitHub
commit 3f82b50896
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 415 additions and 143 deletions

View File

@ -136,9 +136,9 @@ jobs:
- name: amd64
runner: ubuntu-latest
- name: arm32v7
runner: linux-arm64-4-core-public
runner: ubuntu-24.04-arm
- name: arm64v8
runner: linux-arm64-4-core-public
runner: ubuntu-24.04-arm
release:
- ${{ needs.preconfig.outputs.release }}
exclude: ${{ fromJson(needs.preconfig.outputs.deb) }}

View File

@ -48,6 +48,10 @@ Step by step tutorials to build FreeSWITCH with provided dependency packages:
* [Raspberry Pi](https://freeswitch.org/confluence/display/FREESWITCH/Raspberry+Pi)
* [CentOS 7](https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7)
### How to build Debian packages
* [Using FSDEB](/scripts/packaging/build)
## Downloads
* [Tarballs](https://files.freeswitch.org/releases/freeswitch/)

View File

@ -1521,7 +1521,7 @@ int main(int argc, char *argv[])
strncpy(internal_profile.host, "127.0.0.1", sizeof(internal_profile.host));
strncpy(internal_profile.pass, "ClueCon", sizeof(internal_profile.pass));
strncpy(internal_profile.name, hostname, sizeof(internal_profile.name));
snprintf(internal_profile.name, sizeof(internal_profile.name), "%s", hostname);
internal_profile.port = 8021;
set_fn_keys(&internal_profile);
esl_set_string(internal_profile.prompt_color, prompt_color);

View File

@ -1147,11 +1147,6 @@ fail:
hooks->deallocate(buffer->buffer);
}
if (printed != NULL)
{
hooks->deallocate(printed);
}
return NULL;
}

View File

@ -284,9 +284,12 @@ ESL_DECLARE(int) esl_snprintf(char *buffer, size_t count, const char *fmt, ...)
static void null_logger(const char *file, const char *func, int line, int level, const char *fmt, ...)
{
if (file && func && line && level && fmt) {
return;
}
(void)file;
(void)func;
(void)line;
(void)level;
(void)fmt;
return;
}
@ -696,7 +699,10 @@ ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_list
}
esl_socket_reuseaddr(server_sock);
if (esl_socket_reuseaddr(server_sock) != 0) {
status = ESL_FAIL;
goto end;
}
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
@ -751,7 +757,10 @@ ESL_DECLARE(esl_status_t) esl_listen_threaded(const char *host, esl_port_t port,
return ESL_FAIL;
}
esl_socket_reuseaddr(server_sock);
if (esl_socket_reuseaddr(server_sock) != 0) {
status = ESL_FAIL;
goto end;
}
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
@ -990,6 +999,8 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
}
memcpy(&handle->sockaddr, result->ai_addr, result->ai_addrlen);
freeaddrinfo(result);
switch(handle->sockaddr.ss_family) {
case AF_INET:
sockaddr_in = (struct sockaddr_in*)&(handle->sockaddr);
@ -1005,7 +1016,6 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
strncpy(handle->err, "Host resolves to unsupported address family", sizeof(handle->err));
goto fail;
}
freeaddrinfo(result);
handle->sock = socket(handle->sockaddr.ss_family, SOCK_STREAM, IPPROTO_TCP);
@ -1059,7 +1069,10 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *
}
}
#else
fcntl(handle->sock, F_SETFL, fd_flags);
if (fcntl(handle->sock, F_SETFL, fd_flags)) {
snprintf(handle->err, sizeof(handle->err), "Socket Connection Error");
goto fail;
}
#endif
rval = 0;
}
@ -1154,13 +1167,6 @@ ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle)
esl_event_safe_destroy(&handle->last_ievent);
esl_event_safe_destroy(&handle->info_event);
if (mutex) {
esl_mutex_unlock(mutex);
esl_mutex_lock(mutex);
esl_mutex_unlock(mutex);
esl_mutex_destroy(&mutex);
}
if (handle->packet_buf) {
esl_buffer_destroy(&handle->packet_buf);
}
@ -1168,6 +1174,13 @@ ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle)
memset(handle, 0, sizeof(*handle));
handle->destroyed = 1;
if (mutex) {
esl_mutex_unlock(mutex);
esl_mutex_lock(mutex);
esl_mutex_unlock(mutex);
esl_mutex_destroy(&mutex);
}
return status;
}
@ -1216,7 +1229,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms
status = ESL_BREAK;
}
if (handle->mutex) esl_mutex_unlock(handle->mutex);
esl_mutex_unlock(handle->mutex);
return status;
@ -1298,14 +1311,12 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_
*e++ = '\0';
while(*e == '\n' || *e == '\r') e++;
if (hval) {
esl_url_decode(hval);
esl_log(ESL_LOG_DEBUG, "RECV HEADER [%s] = [%s]\n", hname, hval);
if (!strncmp(hval, "ARRAY::", 7)) {
esl_event_add_array(revent, hname, hval);
} else {
esl_event_add_header_string(revent, ESL_STACK_BOTTOM, hname, hval);
}
esl_url_decode(hval);
esl_log(ESL_LOG_DEBUG, "RECV HEADER [%s] = [%s]\n", hname, hval);
if (!strncmp(hval, "ARRAY::", 7)) {
esl_event_add_array(revent, hname, hval);
} else {
esl_event_add_header_string(revent, ESL_STACK_BOTTOM, hname, hval);
}
p = e;
@ -1520,11 +1531,15 @@ ESL_DECLARE(esl_status_t) esl_send_recv_timed(esl_handle_t *handle, const char *
const char *hval;
esl_status_t status;
if (!handle || !handle->connected || handle->sock == ESL_SOCK_INVALID) {
return ESL_FAIL;
}
if (!handle) {
return ESL_FAIL;
}
esl_mutex_lock(handle->mutex);
if (!handle->connected || handle->sock == ESL_SOCK_INVALID) {
esl_mutex_unlock(handle->mutex);
return ESL_FAIL;
}
esl_event_safe_destroy(&handle->last_sr_event);

View File

@ -545,7 +545,6 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
header->value = NULL;
header->array = m;
header->idx++;
m = NULL;
}
i = header->idx + 1;

View File

@ -247,7 +247,7 @@ sendDirectoryDocument(TList * const listP,
uint32_t k;
if (text) {
sprintf(z, "Index of %s" CRLF, uri);
snprintf(z, sizeof(z), "Index of %s" CRLF, uri);
i = strlen(z)-2;
p = z + i + 2;
@ -257,17 +257,17 @@ sendDirectoryDocument(TList * const listP,
}
*p = '\0';
strcat(z, CRLF CRLF
strncat(z, CRLF CRLF
"Name Size "
"Date-Time Type" CRLF
"------------------------------------"
"--------------------------------------------"CRLF);
"--------------------------------------------"CRLF, sizeof(z) - strlen(z) - 1);
} else {
sprintf(z, "<HTML><HEAD><TITLE>Index of %s</TITLE></HEAD><BODY>"
snprintf(z, sizeof(z), "<HTML><HEAD><TITLE>Index of %s</TITLE></HEAD><BODY>"
"<H1>Index of %s</H1><PRE>",
uri, uri);
strcat(z, "Name Size "
"Date-Time Type<HR WIDTH=100%>"CRLF);
strncat(z, "Name Size "
"Date-Time Type<HR WIDTH=100%>"CRLF, sizeof(z) - strlen(z) - 1);
}
HTTPWriteBodyChunk(sessionP, z, strlen(z));
@ -293,7 +293,7 @@ sendDirectoryDocument(TList * const listP,
else
--i;
strcpy(z, fi->name);
snprintf(z, sizeof(z), "%s", fi->name);
k = strlen(z);
@ -303,14 +303,11 @@ sendDirectoryDocument(TList * const listP,
}
if (k > 24) {
z[10] = '\0';
strcpy(z1, z);
strcat(z1, "...");
strcat(z1, z + k - 11);
snprintf(z1, sizeof(z1), "%.10s...%s", z, z + k - 11);
k = 24;
p = z1 + 24;
p = z1 + k;
} else {
strcpy(z1, z);
snprintf(z1, sizeof(z1), "%s", z);
++k;
p = z1 + k;
@ -321,11 +318,11 @@ sendDirectoryDocument(TList * const listP,
}
xmlrpc_gmtime(fi->time_write, &ftm);
sprintf(z2, "%02u/%02u/%04u %02u:%02u:%02u",ftm.tm_mday,ftm.tm_mon+1,
snprintf(z2, sizeof(z2), "%02u/%02u/%04u %02u:%02u:%02u",ftm.tm_mday,ftm.tm_mon+1,
ftm.tm_year+1900,ftm.tm_hour,ftm.tm_min,ftm.tm_sec);
if (fi->attrib & A_SUBDIR) {
strcpy(z3, " -- ");
snprintf(z3, sizeof(z3), " -- ");
z4 = "Directory";
} else {
if (fi->size < 9999)
@ -343,7 +340,7 @@ sendDirectoryDocument(TList * const listP,
}
}
sprintf(z3, "%5" PRIu64 " %c", fi->size, u);
snprintf(z3, sizeof(z3), "%5" PRIu64 " %c", fi->size, u);
if (xmlrpc_streq(fi->name, ".."))
z4 = "";
@ -355,9 +352,9 @@ sendDirectoryDocument(TList * const listP,
}
if (text)
sprintf(z, "%s%s %s %s %s"CRLF, z1, p, z3, z2, z4);
snprintf(z, sizeof(z), "%s%s %s %s %s"CRLF, z1, p, z3, z2, z4);
else
sprintf(z, "<A HREF=\"%s%s\">%s</A>%s %s %s %s"CRLF,
snprintf(z, sizeof(z), "<A HREF=\"%s%s\">%s</A>%s %s %s %s"CRLF,
fi->name, fi->attrib & A_SUBDIR ? "/" : "",
z1, p, z3, z2, z4);
@ -366,9 +363,9 @@ sendDirectoryDocument(TList * const listP,
/* Write the tail of the file */
if (text)
strcpy(z, SERVER_PLAIN_INFO);
snprintf(z, sizeof(z), "%s", SERVER_PLAIN_INFO);
else
strcpy(z, "</PRE>" SERVER_HTML_INFO "</BODY></HTML>" CRLF CRLF);
snprintf(z, sizeof(z), "%s", "</PRE>" SERVER_HTML_INFO "</BODY></HTML>" CRLF CRLF);
HTTPWriteBodyChunk(sessionP, z, strlen(z));
}
@ -689,8 +686,7 @@ HandlerDefaultBuiltin(TSession * const sessionP) {
return TRUE;
}
strcpy(z, handlerP->filesPath);
strcat(z, sessionP->requestInfo.uri);
snprintf(z, sizeof(z), "%s%s", handlerP->filesPath, sessionP->requestInfo.uri);
p = z + strlen(z) - 1;
if (*p == '/') {
@ -710,7 +706,7 @@ HandlerDefaultBuiltin(TSession * const sessionP) {
** to avoid problems with some browsers (IE for examples) when
** they generate relative urls */
if (!endingslash) {
strcpy(z, sessionP->requestInfo.uri);
snprintf(z, sizeof(z), "%s", sessionP->requestInfo.uri);
p = z+strlen(z);
*p = '/';
*(p+1) = '\0';
@ -727,7 +723,7 @@ HandlerDefaultBuiltin(TSession * const sessionP) {
i = handlerP->defaultFileNames.size;
while (i-- > 0) {
*p = '\0';
strcat(z, (handlerP->defaultFileNames.item[i]));
strncat(z, handlerP->defaultFileNames.item[i], sizeof(z) - strlen(z) - 1);
if (FileStat(z, &fs)) {
if (!(fs.st_mode & S_IFDIR))
handleFile(sessionP, z, fs.st_mtime,

View File

@ -2416,6 +2416,7 @@ doStartTagNoAtts(XML_Parser const xmlParserP,
}
tag->buf = malloc(INIT_TAG_BUF_SIZE);
if (!tag->buf) {
free(tag);
*errorCodeP = XML_ERROR_NO_MEMORY;
return;
}
@ -3646,8 +3647,10 @@ doProlog(XML_Parser const xmlParserP,
switch (tok) {
case XML_TOK_PARAM_ENTITY_REF:
*errorCodeP = XML_ERROR_PARAM_ENTITY_REF;
break;
case XML_TOK_XML_DECL:
*errorCodeP = XML_ERROR_MISPLACED_XML_PI;
break;
default:
*errorCodeP = XML_ERROR_SYNTAX;
}

View File

@ -170,7 +170,7 @@ decodeMultibyte(xmlrpc_env * const envP,
Return the character in UTF-16 format as *wcP.
-----------------------------------------------------------------------------*/
wchar_t wc;
wchar_t wc = 0;
assert(utf8_seq[0] & 0x80); /* High bit set: this is multibyte seq */

View File

@ -256,7 +256,7 @@ system_listMethods(xmlrpc_env * const envP,
xmlrpc_registry * const registryP = serverInfo;
xmlrpc_value * retvalP;
xmlrpc_value * retvalP = NULL;
XMLRPC_ASSERT_ENV_OK(envP);
XMLRPC_ASSERT_VALUE_OK(paramArrayP);
@ -378,7 +378,7 @@ system_methodHelp(xmlrpc_env * const envP,
xmlrpc_registry * const registryP = serverInfo;
xmlrpc_value * retvalP;
xmlrpc_value * retvalP = NULL;
const char * methodName;
@ -546,7 +546,7 @@ system_methodSignature(xmlrpc_env * const envP,
xmlrpc_registry * const registryP = (xmlrpc_registry *) serverInfo;
xmlrpc_value * retvalP;
xmlrpc_value * retvalP = NULL;
const char * methodName;
xmlrpc_env env;
@ -615,7 +615,7 @@ system_shutdown(xmlrpc_env * const envP,
xmlrpc_registry * const registryP = (xmlrpc_registry *) serverInfo;
xmlrpc_value * retvalP;
xmlrpc_value * retvalP = NULL;
const char * comment;
xmlrpc_env env;
@ -700,7 +700,7 @@ system_capabilities(xmlrpc_env * const envP,
xmlrpc_registry * const registryP = serverInfo;
xmlrpc_value * retvalP;
xmlrpc_value * retvalP = NULL;
unsigned int paramCount;
@ -766,7 +766,7 @@ system_getCapabilities(xmlrpc_env * const envP,
xmlrpc_registry * const registryP = serverInfo;
xmlrpc_value * retvalP;
xmlrpc_value * retvalP = NULL;
unsigned int paramCount;

View File

@ -299,7 +299,7 @@ xmlrpc_value *
xmlrpc_datetime_new(xmlrpc_env * const envP,
xmlrpc_datetime const dt) {
xmlrpc_value * valP;
xmlrpc_value * valP = NULL;
const char ** readBufferP;
@ -502,7 +502,7 @@ xmlrpc_datetime_new_str(xmlrpc_env * const envP,
Do not extend this. The user should use more normal C representations
of datetimes.
-----------------------------------------------------------------------------*/
xmlrpc_value * retval;
xmlrpc_value * retval = NULL;
validateFormat(envP, datetimeString);
if (!envP->fault_occurred) {
@ -533,7 +533,7 @@ xmlrpc_datetime_new_usec(xmlrpc_env * const envP,
time_t const secs,
unsigned int const usecs) {
xmlrpc_value * valueP;
xmlrpc_value * valueP = NULL;
if (usecs >= 1000000)
xmlrpc_faultf(envP, "Number of fractional microseconds must be less "

View File

@ -181,9 +181,10 @@ releaseDecompArray(struct arrayDecomp const arrayDecomp,
static void
releaseDecompStruct(struct structDecomp const structDecomp,
releaseDecompStruct(struct structDecomp const *_structDecomp,
bool const oldstyleMemMgmt) {
struct structDecomp const structDecomp = *_structDecomp;
unsigned int i;
for (i = 0; i < structDecomp.mbrCnt; ++i) {
releaseDecomposition(structDecomp.mbrArray[i].decompTreeP,
@ -239,7 +240,7 @@ releaseDecomposition(const struct decompTreeNode * const decompRootP,
releaseDecompArray(decompRootP->store.Tarray, oldstyleMemMgmt);
break;
case '{':
releaseDecompStruct(decompRootP->store.Tstruct, oldstyleMemMgmt);
releaseDecompStruct(&decompRootP->store.Tstruct, oldstyleMemMgmt);
break;
}
}
@ -259,8 +260,9 @@ decomposeValueWithTree(xmlrpc_env * const envP,
static void
validateArraySize(xmlrpc_env * const envP,
const xmlrpc_value * const arrayP,
struct arrayDecomp const arrayDecomp) {
struct arrayDecomp const *_arrayDecomp) {
struct arrayDecomp const arrayDecomp = *_arrayDecomp;
unsigned int size;
size = xmlrpc_array_size(envP, arrayP);
@ -284,10 +286,12 @@ validateArraySize(xmlrpc_env * const envP,
static void
parsearray(xmlrpc_env * const envP,
const xmlrpc_value * const arrayP,
struct arrayDecomp const arrayDecomp,
struct arrayDecomp const *_arrayDecomp,
bool const oldstyleMemMgmt) {
validateArraySize(envP, arrayP, arrayDecomp);
struct arrayDecomp const arrayDecomp = *_arrayDecomp;
validateArraySize(envP, arrayP, &arrayDecomp);
if (!envP->fault_occurred) {
unsigned int doneCnt;
@ -324,9 +328,10 @@ parsearray(xmlrpc_env * const envP,
static void
parsestruct(xmlrpc_env * const envP,
xmlrpc_value * const structP,
struct structDecomp const structDecomp,
struct structDecomp const *_structDecomp,
bool const oldstyleMemMgmt) {
struct structDecomp const structDecomp = *_structDecomp;
unsigned int doneCount;
doneCount = 0; /* No members done yet */
@ -569,7 +574,7 @@ decomposeValueWithTree(xmlrpc_env * const envP,
"%s, but the '(...)' specifier requires type ARRAY",
xmlrpc_type_name(xmlrpc_value_type(valueP)));
else
parsearray(envP, valueP, decompRootP->store.Tarray,
parsearray(envP, valueP, &decompRootP->store.Tarray,
oldstyleMemMgmt);
break;
@ -580,7 +585,7 @@ decomposeValueWithTree(xmlrpc_env * const envP,
"%s, but the '{...}' specifier requires type STRUCT",
xmlrpc_type_name(xmlrpc_value_type(valueP)));
else
parsestruct(envP, valueP, decompRootP->store.Tstruct,
parsestruct(envP, valueP, &decompRootP->store.Tstruct,
oldstyleMemMgmt);
break;

View File

@ -179,9 +179,11 @@ sendResponse(xmlrpc_env * const envP,
ResponseStatus(abyssSessionP, 200);
#if 0 /* Uncomment once http_cookie is not NULL again */
if (http_cookie)
/* There's an auth cookie, so pass it back in the response. */
addAuthCookie(envP, abyssSessionP, http_cookie);
#endif
if ((size_t)(uint32_t)len != len)
xmlrpc_faultf(envP, "XML-RPC method generated a response too "

View File

@ -189,6 +189,7 @@ xmlrpc_server_cgi_process_call(xmlrpc_registry * const registryP) {
size_t input_size, output_size;
int code;
char *message;
char *err = NULL;
/* Error-handling preconditions. */
xmlrpc_env_init(&env);
@ -209,13 +210,13 @@ xmlrpc_server_cgi_process_call(xmlrpc_registry * const registryP) {
}
if (!type || !xmlrpc_strneq(type, "text/xml", strlen("text/xml"))) {
char *template = "Expected content type: \"text/xml\", received: \"%s\"";
size_t err_len = strlen(template) + strlen(type) + 1;
char *err = malloc(err_len);
size_t err_len = strlen(template) + (type ? strlen(type) : 0) + 1;
(void)snprintf(err, err_len, template, type);
err = malloc(err_len);
(void)snprintf(err, err_len, template, (type ? type : ""));
code = 400; message = "Bad Request";
XMLRPC_FAIL(&env, XMLRPC_INTERNAL_ERROR, err);
free(err);
}
if (!length_str) {
code = 411; message = "Length Required";
@ -254,6 +255,8 @@ xmlrpc_server_cgi_process_call(xmlrpc_registry * const registryP) {
send_xml(output_data, output_size);
cleanup:
if (err)
free(err);
if (input)
xmlrpc_mem_block_free(input);
if (output)

View File

@ -0,0 +1,53 @@
# Building FreeSWITCH packages using `FSDEB`
## Prerequisites
FreeSWITCH packages can be built when FreeSWITCH is cloned using `git` only.
(Methods described here won't work if you download a source tarball and extract it)
Please make sure you have `git` and `curl` installed:
```bash
apt-get update
apt-get install -y git curl
```
## Cloning FreeSWITCH
Assuming you build Debian packages for a FreeSWITCH release (this can be your fork or another branch as well).
```bash
cd /usr/src
git clone https://github.com/signalwire/freeswitch -b v1.10
```
## Configuring FreeSWITCH Debian repo (for dependencies)
Since we are building a FreeSWITCH release let's configure FreeSWITCH Community Release Debian repo.
We recommend using [FSGET](/scripts/packaging).
Replace `<PAT or API token>` with your `SignalWire Personal Access Token (PAT)`
[HOWTO Create a SignalWire Personal Access Token](https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Installation/how-to-create-a-personal-access-token/how-to-create-a-personal-access-token)
```bash
curl -sSL https://freeswitch.org/fsget | bash -s <PAT or API token>
```
## Building packages with `FSDEB`
```bash
curl -sSL https://freeswitch.org/fsdeb | bash -s -- -b 999 -o /usr/src/fsdebs/ -w /usr/src/freeswitch
```
That's pretty much it!
## Output
`FSDEB` will generate `.deb`, `.dsc`, `.changes`, and `.tar.*` files in the output directory:
```bash
ls -la /usr/src/fsdebs/
```
## Usage
You may be interested in other arguments of `FSDEB`:
```bash
curl -sSL https://freeswitch.org/fsdeb | bash -s -- -b BUILD_NUMBER -o OUTPUT_DIR [-w WORKING_DIR]
```
Required:
- `-b`: Build number (part of package version)
- `-o`: Output directory for packages
Optional:
- `-w`: Working directory (defaults to git root, needs to be git tree)

117
scripts/packaging/build/fsdeb.sh Executable file
View File

@ -0,0 +1,117 @@
#!/bin/bash
# lint: shfmt -w -s -bn -ci -sr -fn scripts/packaging/build/build-debs-native.sh
set -e # Exit immediately if a command exits with a non-zero status
set -u # Treat unset variables as an error
set -o pipefail # Return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status
print_usage()
{
echo "Usage: $0 -b BUILD_NUMBER -o OUTPUT_DIR [-w WORKING_DIR]"
exit 1
}
WORKING_DIR=$(git rev-parse --show-toplevel 2> /dev/null || pwd -P)
while getopts ":b:o:w:" opt; do
case ${opt} in
b) BUILD_NUMBER=$OPTARG ;;
o) OUTPUT_DIR=$OPTARG ;;
w) WORKING_DIR=$OPTARG ;;
\?) print_usage ;;
esac
done
if [ -z "${BUILD_NUMBER:-}" ] || [ -z "${OUTPUT_DIR:-}" ]; then
print_usage
fi
if [ "$(id -u)" != "0" ]; then
echo "Non-root user detected. Execution may fail."
fi
cd "${WORKING_DIR}" || exit 1
install_deps()
{
apt-get update || echo "WARNING: apt-get update failed"
apt-get install -y \
apt-transport-https \
debhelper \
gnupg2 \
build-essential \
ca-certificates \
curl \
devscripts \
dh-autoreconf \
dos2unix \
doxygen \
lsb-release \
pkg-config \
wget || echo "WARNING: package installation failed"
}
export_vars()
{
export CODENAME=$(lsb_release -sc)
if ! VERSION=$(cat ./build/next-release.txt | tr -d '\n'); then
echo "Failed to read version file" >&2
exit 1
fi
export GIT_SHA=$(git rev-parse --short HEAD)
}
setup_git_local()
{
if [ -z "$(git config user.email)" ]; then
git config user.email "$(id -un)@localhost"
fi
if [ -z "$(git config user.name)" ]; then
git config user.name "$(id -un)"
fi
git config --add safe.directory '*'
}
bootstrap_freeswitch()
{
./debian/util.sh prep-create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x
./debian/util.sh prep-create-dsc ${CODENAME}
}
install_freeswitch_deps()
{
apt-get update || echo "WARNING: apt-get update failed"
mk-build-deps --install --remove debian/control \
--tool "apt-get --yes --no-install-recommends" || echo "WARNING: mk-build-deps failed"
apt-get --yes --fix-broken install || echo "WARNING: apt-get fix-broken failed"
}
build_source_package()
{
dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \
--force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}"
./debian/util.sh create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x
}
build_and_move()
{
dpkg-source --diff-ignore=.* --compression=xz --compression-level=9 --build . \
&& debuild -b -us -uc \
&& mkdir -p "${OUTPUT_DIR}" \
&& mv -v ../*.{deb,dsc,changes,tar.*} "${OUTPUT_DIR}"/
}
main()
{
install_deps
export_vars
setup_git_local
bootstrap_freeswitch
install_freeswitch_deps
build_source_package
build_and_move
}
main "$@"

View File

@ -1,19 +1,89 @@
#!/bin/bash
TOKEN=$1
RELEASE=$2
INSTALL=$3
# lint: shfmt -w -s -bn -ci -sr -fn scripts/packaging/fsget.sh
# Source the os-release file (assuming it exists)
. /etc/os-release
echo $ID
echo $VERSION_CODENAME
set -e # Exit immediately if a command exits with a non-zero status
set -u # Treat unset variables as an error
set -o pipefail # Return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status
source_os_release()
{
if [ ! -f /etc/os-release ]; then
echo "Error: /etc/os-release not found"
exit 1
fi
. /etc/os-release
echo -n "Operating system identification:"
[ -n "$ID" ] && echo -n " ID=$ID"
[ -n "$VERSION_CODENAME" ] && echo -n " CODENAME=$VERSION_CODENAME"
echo
}
setup_common()
{
rm -f /etc/apt/sources.list.d/freeswitch.list
apt-get update && apt-get install -y \
apt-transport-https \
curl \
gnupg2 \
grep \
software-properties-common
}
configure_auth()
{
local domain=$1
local username=${2:-signalwire}
local token=$3
if ! grep -q "machine ${domain}" /etc/apt/auth.conf; then
echo "machine ${domain} login ${username} password ${token}" >> /etc/apt/auth.conf
chmod 600 /etc/apt/auth.conf
fi
}
install_freeswitch()
{
local edition="$1"
local action="$2"
apt-get update
if [ "${action}" = "install" ]; then
echo "Installing FreeSWITCH ${edition}"
apt-get install -y freeswitch-meta-all
echo "------------------------------------------------------------------"
echo " Done installing FreeSWITCH ${edition}"
echo "------------------------------------------------------------------"
else
echo "------------------------------------------------------------------"
echo " Done configuring FreeSWITCH Debian repository"
echo "------------------------------------------------------------------"
echo "To install FreeSWITCH ${edition} type: apt-get install -y freeswitch-meta-all"
fi
}
if [ "$(id -u)" != "0" ]; then
echo "Non-root user detected. Execution may fail."
fi
if [ "$#" -lt 1 ] || [ "$#" -gt 3 ]; then
echo "Usage: $0 <PAT or FSA token> [[release|prerelease] [install]]"
exit 1
fi
TOKEN=$1
RELEASE="${2:-release}"
ACTION="${3:-}"
source_os_release
if [ "${ID,,}" = "debian" ]; then
ARCH=$(dpkg --print-architecture)
if [[ "${TOKEN}" == pat_* ]]; then
echo "FreeSWITCH Community"
if [[ ${TOKEN} == pat_* ]]; then
DOMAIN="freeswitch.signalwire.com"
GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg"
RPI=""
if [ "${RELEASE,,}" = "prerelease" ]; then
@ -22,36 +92,28 @@ if [ "${ID,,}" = "debian" ]; then
RELEASE="release"
fi
echo $RELEASE
if [ "${ARCH,,}" = "armhf" ]; then
RPI="rpi/"
fi
rm -f /etc/apt/sources.list.d/freeswitch.list
apt-get update && apt-get install -y gnupg2 wget software-properties-common apt-transport-https
echo "FreeSWITCH Community ($RELEASE)"
wget --http-user=signalwire --http-password=$TOKEN -O /usr/share/keyrings/signalwire-freeswitch-repo.gpg https://freeswitch.signalwire.com/repo/deb/${RPI}debian-release/signalwire-freeswitch-repo.gpg
echo "machine freeswitch.signalwire.com login signalwire password $TOKEN" > /etc/apt/auth.conf
chmod 600 /etc/apt/auth.conf
echo "deb [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/${RPI}debian-${RELEASE}/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/freeswitch.list
echo "deb-src [signed-by=/usr/share/keyrings/signalwire-freeswitch-repo.gpg] https://freeswitch.signalwire.com/repo/deb/${RPI}debian-${RELEASE}/ ${VERSION_CODENAME} main" >> /etc/apt/sources.list.d/freeswitch.list
setup_common
configure_auth "${DOMAIN}" "" "${TOKEN}"
apt-get update
if [ "${INSTALL}" = "install" ]; then
echo "Installing FreeSWITCH Community"
apt-get install -y freeswitch-meta-all
echo "------------------------------------------------------------------"
echo " Done installing FreeSWITCH Community"
echo "------------------------------------------------------------------"
else
echo "------------------------------------------------------------------"
echo " Done configuring FreeSWITCH Debian repository"
echo "------------------------------------------------------------------"
echo "To install FreeSWITCH Community type: apt-get install -y freeswitch-meta-all"
fi
elif [[ "${TOKEN}" == PT* ]]; then
echo "FreeSWITCH Enterprise"
curl \
--fail \
--netrc-file /etc/apt/auth.conf \
--output ${GPG_KEY} \
https://${DOMAIN}/repo/deb/${RPI}debian-release/signalwire-freeswitch-repo.gpg
echo "deb [signed-by=${GPG_KEY}] https://${DOMAIN}/repo/deb/${RPI}debian-${RELEASE}/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/freeswitch.list
echo "deb-src [signed-by=${GPG_KEY}] https://${DOMAIN}/repo/deb/${RPI}debian-${RELEASE}/ ${VERSION_CODENAME} main" >> /etc/apt/sources.list.d/freeswitch.list
install_freeswitch "Community" "${ACTION}"
elif [[ ${TOKEN} == PT* ]]; then
DOMAIN="fsa.freeswitch.com"
RPI=""
if [ "${RELEASE,,}" = "prerelease" ]; then
RELEASE="unstable"
@ -59,37 +121,27 @@ if [ "${ID,,}" = "debian" ]; then
RELEASE="1.8"
fi
echo $RELEASE
if [ "${ARCH,,}" = "armhf" ]; then
RPI="-rpi"
fi
rm -f /etc/apt/sources.list.d/freeswitch.list
apt-get update && apt-get install -y gnupg2 wget software-properties-common apt-transport-https
echo "FreeSWITCH Enterprise ($RELEASE)"
wget --http-user=signalwire --http-password=$TOKEN -O - https://fsa.freeswitch.com/repo/deb/fsa${RPI}/pubkey.gpg | apt-key add -
echo "machine fsa.freeswitch.com login signalwire password $TOKEN" > /etc/apt/auth.conf
chmod 600 /etc/apt/auth.conf
echo "deb https://fsa.freeswitch.com/repo/deb/fsa${RPI}/ ${VERSION_CODENAME} ${RELEASE}" > /etc/apt/sources.list.d/freeswitch.list
echo "deb-src https://fsa.freeswitch.com/repo/deb/fsa${RPI}/ ${VERSION_CODENAME} ${RELEASE}" >> /etc/apt/sources.list.d/freeswitch.list
setup_common
configure_auth "${DOMAIN}" "" "${TOKEN}"
apt-get update
if [ "${INSTALL}" = "install" ]; then
echo "Installing FreeSWITCH Enterprise"
apt-get install -y freeswitch-meta-all
echo "------------------------------------------------------------------"
echo " Done installing FreeSWITCH Enterprise"
echo "------------------------------------------------------------------"
else
echo "------------------------------------------------------------------"
echo " Done configuring FreeSWITCH Debian repository"
echo "------------------------------------------------------------------"
echo "To install FreeSWITCH Enterprise type: apt-get install -y freeswitch-meta-all"
fi
curl \
--fail \
--netrc-file /etc/apt/auth.conf \
https://${DOMAIN}/repo/deb/fsa${RPI}/pubkey.gpg | tee /etc/apt/trusted.gpg.d/freeswitch-enterprise.asc
echo "deb https://${DOMAIN}/repo/deb/fsa${RPI}/ ${VERSION_CODENAME} ${RELEASE}" > /etc/apt/sources.list.d/freeswitch.list
echo "deb-src https://${DOMAIN}/repo/deb/fsa${RPI}/ ${VERSION_CODENAME} ${RELEASE}" >> /etc/apt/sources.list.d/freeswitch.list
install_freeswitch "Enterprise" "${ACTION}"
else
echo "Unrecognized token type"
fi
else
echo "Unrecognized OS. We support Debian only."
fi
fi

View File

@ -37,7 +37,6 @@
#include "mod_spandsp.h"
#include <spandsp/version.h>
#include "mod_spandsp_modem.h"
/* **************************************************************************

View File

@ -58,6 +58,12 @@ typedef int zap_socket_t;
#define SPANDSP_EVENT_TXFAXNEGOCIATERESULT "spandsp::txfaxnegociateresult"
#define SPANDSP_EVENT_RXFAXNEGOCIATERESULT "spandsp::rxfaxnegociateresult"
#include <spandsp/version.h>
#if SPANDSP_RELEASE_DATE < 20230620
#define V18_MODE_WEITBRECHT_5BIT_4545 V18_MODE_5BIT_4545
#define V18_MODE_WEITBRECHT_5BIT_50 V18_MODE_5BIT_50
#endif
/* The global stuff */

View File

@ -152,17 +152,27 @@ static void put_text_msg(void *user_data, const uint8_t *msg, int len)
}
#if SPANDSP_RELEASE_DATE >= 20230620
static void handle_v18_status(void *user_data, int status)
{
switch_core_session_t *session = (switch_core_session_t *) user_data;
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "%s detected V.18 modem: %s\n", switch_channel_get_name(channel), v18_status_to_str(status));
}
#endif
static int get_v18_mode(switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *var;
int r = V18_MODE_5BIT_4545;
int r = V18_MODE_WEITBRECHT_5BIT_4545;
if ((var = switch_channel_get_variable(channel, "v18_mode"))) {
if (!strcasecmp(var, "5BIT_45") || !strcasecmp(var, "baudot")) {
r = V18_MODE_5BIT_4545;
r = V18_MODE_WEITBRECHT_5BIT_4545;
} else if (!strcasecmp(var, "5BIT_50")) {
r = V18_MODE_5BIT_50;
r = V18_MODE_WEITBRECHT_5BIT_50;
} else if (!strcasecmp(var, "DTMF")) {
r = V18_MODE_DTMF;
} else if (!strcasecmp(var, "EDT")) {
@ -213,8 +223,11 @@ switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const c
return SWITCH_STATUS_FALSE;
}
#if SPANDSP_RELEASE_DATE >= 20230620
tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL, handle_v18_status, session);
#else
tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL);
#endif
v18_put(tdd_state, text, -1);
@ -260,7 +273,13 @@ switch_status_t spandsp_tdd_encode_session(switch_core_session_t *session, const
}
pvt->session = session;
#if SPANDSP_RELEASE_DATE >= 20230620
pvt->tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL, handle_v18_status, session);
#else
pvt->tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL);
#endif
pvt->head_lead = TDD_LEAD;
v18_put(pvt->tdd_state, text, -1);
@ -338,7 +357,12 @@ switch_status_t spandsp_tdd_decode_session(switch_core_session_t *session)
}
pvt->session = session;
#if SPANDSP_RELEASE_DATE >= 20230620
pvt->tdd_state = v18_init(NULL, FALSE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, pvt, handle_v18_status, session);
#else
pvt->tdd_state = v18_init(NULL, FALSE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, pvt);
#endif
if ((status = switch_core_media_bug_add(session, "spandsp_tdd_decode", NULL,
tdd_decode_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) {

View File

@ -19,7 +19,6 @@
<Task>
<Reference Include="Microsoft.Build" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Utilities.Core" />
<Code Type="Class" Language="cs">
<![CDATA[
using System;