mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-03 17:53:59 +00:00
Merge branch 'master' into v1.11
This commit is contained in:
@@ -1,103 +0,0 @@
|
||||
ARG BUILDER_IMAGE=debian:bullseye-20240513
|
||||
|
||||
FROM ${BUILDER_IMAGE} AS builder
|
||||
|
||||
ARG MAINTAINER_NAME="Andrey Volk"
|
||||
ARG MAINTAINER_EMAIL="andrey@signalwire.com"
|
||||
|
||||
# Credentials
|
||||
ARG REPO_DOMAIN=freeswitch.signalwire.com
|
||||
ARG REPO_USERNAME=user
|
||||
|
||||
ARG BUILD_NUMBER=42
|
||||
ARG GIT_SHA=0000000000
|
||||
|
||||
ARG DATA_DIR=/data
|
||||
ARG CODENAME=bullseye
|
||||
ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg"
|
||||
|
||||
MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>"
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN apt-get -q update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -yq install \
|
||||
apt-transport-https \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
debhelper \
|
||||
devscripts \
|
||||
dh-autoreconf \
|
||||
dos2unix \
|
||||
doxygen \
|
||||
git \
|
||||
graphviz \
|
||||
libglib2.0-dev \
|
||||
libssl-dev \
|
||||
lsb-release \
|
||||
pkg-config \
|
||||
wget
|
||||
|
||||
RUN update-ca-certificates --fresh
|
||||
|
||||
RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \
|
||||
chmod +x ~/.env
|
||||
|
||||
RUN . ~/.env && cat <<EOF > /etc/apt/sources.list.d/freeswitch.list
|
||||
deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main
|
||||
deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main
|
||||
EOF
|
||||
|
||||
RUN git config --global --add safe.directory '*' \
|
||||
&& git config --global user.name "${MAINTAINER_NAME}" \
|
||||
&& git config --global user.email "${MAINTAINER_EMAIL}"
|
||||
|
||||
# Bootstrap and Build
|
||||
COPY . ${DATA_DIR}
|
||||
WORKDIR ${DATA_DIR}
|
||||
RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env
|
||||
|
||||
RUN . ~/.env && ./debian/util.sh prep-create-dsc -a amd64 ${CODENAME}
|
||||
|
||||
RUN --mount=type=secret,id=REPO_PASSWORD,required=true \
|
||||
printf "machine ${REPO_DOMAIN} " > /etc/apt/auth.conf && \
|
||||
printf "login ${REPO_USERNAME} " >> /etc/apt/auth.conf && \
|
||||
printf "password " >> /etc/apt/auth.conf && \
|
||||
cat /run/secrets/REPO_PASSWORD >> /etc/apt/auth.conf && \
|
||||
sha512sum /run/secrets/REPO_PASSWORD && \
|
||||
curl \
|
||||
--fail \
|
||||
--netrc-file /etc/apt/auth.conf \
|
||||
--output ${GPG_KEY} \
|
||||
https://${REPO_DOMAIN}/repo/deb/debian-release/signalwire-freeswitch-repo.gpg && \
|
||||
file ${GPG_KEY} && \
|
||||
apt-get --quiet update && \
|
||||
mk-build-deps \
|
||||
--install \
|
||||
--remove debian/control \
|
||||
--tool "apt-get -o Debug::pkgProblemResolver=yes --yes --no-install-recommends" && \
|
||||
apt-get --yes --fix-broken install && \
|
||||
rm -f /etc/apt/auth.conf
|
||||
|
||||
ENV DEB_BUILD_OPTIONS="parallel=1"
|
||||
RUN . ~/.env && ./debian/util.sh create-orig -n -v${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x
|
||||
|
||||
RUN . ~/.env && ORIGFILE=$(find ../ -name "freeswitch_*.orig.tar.xz" -type f) \
|
||||
&& ./debian/util.sh create-dsc -a amd64 -z9 ${CODENAME} "$ORIGFILE"
|
||||
|
||||
WORKDIR /
|
||||
RUN dpkg-source -x freeswitch_*.dsc
|
||||
|
||||
RUN cd freeswitch-*/ && debuild -S -sa -d -us -uc
|
||||
|
||||
RUN cd freeswitch-*/ && debuild -b -us -uc
|
||||
|
||||
RUN mkdir OUT && mv -v *.{deb,dsc,changes,tar.*} OUT/.
|
||||
|
||||
RUN ls -lah /OUT
|
||||
|
||||
# Artifacts image (mandatory part, the resulting image must have a single filesystem layer)
|
||||
FROM scratch
|
||||
COPY --from=builder /OUT/ /
|
||||
@@ -1,103 +0,0 @@
|
||||
ARG BUILDER_IMAGE=debian:bullseye-20240513
|
||||
|
||||
FROM ${BUILDER_IMAGE} AS builder
|
||||
|
||||
ARG MAINTAINER_NAME="Andrey Volk"
|
||||
ARG MAINTAINER_EMAIL="andrey@signalwire.com"
|
||||
|
||||
# Credentials
|
||||
ARG REPO_DOMAIN=freeswitch.signalwire.com
|
||||
ARG REPO_USERNAME=user
|
||||
|
||||
ARG BUILD_NUMBER=42
|
||||
ARG GIT_SHA=0000000000
|
||||
|
||||
ARG DATA_DIR=/data
|
||||
ARG CODENAME=bullseye
|
||||
ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg"
|
||||
|
||||
MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>"
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN apt-get -q update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -yq install \
|
||||
apt-transport-https \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
debhelper \
|
||||
devscripts \
|
||||
dh-autoreconf \
|
||||
dos2unix \
|
||||
doxygen \
|
||||
git \
|
||||
graphviz \
|
||||
libglib2.0-dev \
|
||||
libssl-dev \
|
||||
lsb-release \
|
||||
pkg-config \
|
||||
wget
|
||||
|
||||
RUN update-ca-certificates --fresh
|
||||
|
||||
RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \
|
||||
chmod +x ~/.env
|
||||
|
||||
RUN . ~/.env && cat <<EOF > /etc/apt/sources.list.d/freeswitch.list
|
||||
deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main
|
||||
deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main
|
||||
EOF
|
||||
|
||||
RUN git config --global --add safe.directory '*' \
|
||||
&& git config --global user.name "${MAINTAINER_NAME}" \
|
||||
&& git config --global user.email "${MAINTAINER_EMAIL}"
|
||||
|
||||
# Bootstrap and Build
|
||||
COPY . ${DATA_DIR}
|
||||
WORKDIR ${DATA_DIR}
|
||||
RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env
|
||||
|
||||
RUN . ~/.env && ./debian/util.sh prep-create-dsc -a amd64 ${CODENAME}
|
||||
|
||||
RUN --mount=type=secret,id=REPO_PASSWORD,required=true \
|
||||
printf "machine ${REPO_DOMAIN} " > /etc/apt/auth.conf && \
|
||||
printf "login ${REPO_USERNAME} " >> /etc/apt/auth.conf && \
|
||||
printf "password " >> /etc/apt/auth.conf && \
|
||||
cat /run/secrets/REPO_PASSWORD >> /etc/apt/auth.conf && \
|
||||
sha512sum /run/secrets/REPO_PASSWORD && \
|
||||
curl \
|
||||
--fail \
|
||||
--netrc-file /etc/apt/auth.conf \
|
||||
--output ${GPG_KEY} \
|
||||
https://${REPO_DOMAIN}/repo/deb/debian-unstable/signalwire-freeswitch-repo.gpg && \
|
||||
file ${GPG_KEY} && \
|
||||
apt-get --quiet update && \
|
||||
mk-build-deps \
|
||||
--install \
|
||||
--remove debian/control \
|
||||
--tool "apt-get -o Debug::pkgProblemResolver=yes --yes --no-install-recommends" && \
|
||||
apt-get --yes --fix-broken install && \
|
||||
rm -f /etc/apt/auth.conf
|
||||
|
||||
ENV DEB_BUILD_OPTIONS="parallel=1"
|
||||
RUN . ~/.env && ./debian/util.sh create-orig -n -v${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x
|
||||
|
||||
RUN . ~/.env && ORIGFILE=$(find ../ -name "freeswitch_*.orig.tar.xz" -type f) \
|
||||
&& ./debian/util.sh create-dsc -a amd64 -z9 ${CODENAME} "$ORIGFILE"
|
||||
|
||||
WORKDIR /
|
||||
RUN dpkg-source -x freeswitch_*.dsc
|
||||
|
||||
RUN cd freeswitch-*/ && debuild -S -sa -d -us -uc
|
||||
|
||||
RUN cd freeswitch-*/ && debuild -b -us -uc
|
||||
|
||||
RUN mkdir OUT && mv -v *.{deb,dsc,changes,tar.*} OUT/.
|
||||
|
||||
RUN ls -lah /OUT
|
||||
|
||||
# Artifacts image (mandatory part, the resulting image must have a single filesystem layer)
|
||||
FROM scratch
|
||||
COPY --from=builder /OUT/ /
|
||||
@@ -1,103 +0,0 @@
|
||||
ARG BUILDER_IMAGE=arm32v7/debian:bullseye-20240513
|
||||
|
||||
FROM --platform=linux/arm32 ${BUILDER_IMAGE} AS builder
|
||||
|
||||
ARG MAINTAINER_NAME="Andrey Volk"
|
||||
ARG MAINTAINER_EMAIL="andrey@signalwire.com"
|
||||
|
||||
# Credentials
|
||||
ARG REPO_DOMAIN=freeswitch.signalwire.com
|
||||
ARG REPO_USERNAME=user
|
||||
|
||||
ARG BUILD_NUMBER=42
|
||||
ARG GIT_SHA=0000000000
|
||||
|
||||
ARG DATA_DIR=/data
|
||||
ARG CODENAME=bullseye
|
||||
ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg"
|
||||
|
||||
MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>"
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN apt-get -q update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -yq install \
|
||||
apt-transport-https \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
debhelper \
|
||||
devscripts \
|
||||
dh-autoreconf \
|
||||
dos2unix \
|
||||
doxygen \
|
||||
git \
|
||||
graphviz \
|
||||
libglib2.0-dev \
|
||||
libssl-dev \
|
||||
lsb-release \
|
||||
pkg-config \
|
||||
wget
|
||||
|
||||
RUN update-ca-certificates --fresh
|
||||
|
||||
RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \
|
||||
chmod +x ~/.env
|
||||
|
||||
RUN . ~/.env && cat <<EOF > /etc/apt/sources.list.d/freeswitch.list
|
||||
deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-release ${CODENAME} main
|
||||
deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-release ${CODENAME} main
|
||||
EOF
|
||||
|
||||
RUN git config --global --add safe.directory '*' \
|
||||
&& git config --global user.name "${MAINTAINER_NAME}" \
|
||||
&& git config --global user.email "${MAINTAINER_EMAIL}"
|
||||
|
||||
# Bootstrap and Build
|
||||
COPY . ${DATA_DIR}
|
||||
WORKDIR ${DATA_DIR}
|
||||
RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env
|
||||
|
||||
RUN . ~/.env && ./debian/util.sh prep-create-dsc -a armhf ${CODENAME}
|
||||
|
||||
RUN --mount=type=secret,id=REPO_PASSWORD,required=true \
|
||||
printf "machine ${REPO_DOMAIN} " > /etc/apt/auth.conf && \
|
||||
printf "login ${REPO_USERNAME} " >> /etc/apt/auth.conf && \
|
||||
printf "password " >> /etc/apt/auth.conf && \
|
||||
cat /run/secrets/REPO_PASSWORD >> /etc/apt/auth.conf && \
|
||||
sha512sum /run/secrets/REPO_PASSWORD && \
|
||||
curl \
|
||||
--fail \
|
||||
--netrc-file /etc/apt/auth.conf \
|
||||
--output ${GPG_KEY} \
|
||||
https://${REPO_DOMAIN}/repo/deb/rpi/debian-release/signalwire-freeswitch-repo.gpg && \
|
||||
file ${GPG_KEY} && \
|
||||
apt-get --quiet update && \
|
||||
mk-build-deps \
|
||||
--install \
|
||||
--remove debian/control \
|
||||
--tool "apt-get -o Debug::pkgProblemResolver=yes --yes --no-install-recommends" && \
|
||||
apt-get --yes --fix-broken install && \
|
||||
rm -f /etc/apt/auth.conf
|
||||
|
||||
ENV DEB_BUILD_OPTIONS="parallel=1"
|
||||
RUN . ~/.env && ./debian/util.sh create-orig -n -v${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x
|
||||
|
||||
RUN . ~/.env && ORIGFILE=$(find ../ -name "freeswitch_*.orig.tar.xz" -type f) \
|
||||
&& ./debian/util.sh create-dsc -a armhf -z9 ${CODENAME} "$ORIGFILE"
|
||||
|
||||
WORKDIR /
|
||||
RUN dpkg-source -x freeswitch_*.dsc
|
||||
|
||||
RUN cd freeswitch-*/ && debuild -S -sa -d -us -uc
|
||||
|
||||
RUN cd freeswitch-*/ && debuild -b -us -uc
|
||||
|
||||
RUN mkdir OUT && mv -v *.{deb,dsc,changes,tar.*} OUT/.
|
||||
|
||||
RUN ls -lah /OUT
|
||||
|
||||
# Artifacts image (mandatory part, the resulting image must have a single filesystem layer)
|
||||
FROM scratch
|
||||
COPY --from=builder /OUT/ /
|
||||
@@ -1,103 +0,0 @@
|
||||
ARG BUILDER_IMAGE=arm32v7/debian:bullseye-20240513
|
||||
|
||||
FROM --platform=linux/arm32 ${BUILDER_IMAGE} AS builder
|
||||
|
||||
ARG MAINTAINER_NAME="Andrey Volk"
|
||||
ARG MAINTAINER_EMAIL="andrey@signalwire.com"
|
||||
|
||||
# Credentials
|
||||
ARG REPO_DOMAIN=freeswitch.signalwire.com
|
||||
ARG REPO_USERNAME=user
|
||||
|
||||
ARG BUILD_NUMBER=42
|
||||
ARG GIT_SHA=0000000000
|
||||
|
||||
ARG DATA_DIR=/data
|
||||
ARG CODENAME=bullseye
|
||||
ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg"
|
||||
|
||||
MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>"
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN apt-get -q update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -yq install \
|
||||
apt-transport-https \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
debhelper \
|
||||
devscripts \
|
||||
dh-autoreconf \
|
||||
dos2unix \
|
||||
doxygen \
|
||||
git \
|
||||
graphviz \
|
||||
libglib2.0-dev \
|
||||
libssl-dev \
|
||||
lsb-release \
|
||||
pkg-config \
|
||||
wget
|
||||
|
||||
RUN update-ca-certificates --fresh
|
||||
|
||||
RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \
|
||||
chmod +x ~/.env
|
||||
|
||||
RUN . ~/.env && cat <<EOF > /etc/apt/sources.list.d/freeswitch.list
|
||||
deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev ${CODENAME} main
|
||||
deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev ${CODENAME} main
|
||||
EOF
|
||||
|
||||
RUN git config --global --add safe.directory '*' \
|
||||
&& git config --global user.name "${MAINTAINER_NAME}" \
|
||||
&& git config --global user.email "${MAINTAINER_EMAIL}"
|
||||
|
||||
# Bootstrap and Build
|
||||
COPY . ${DATA_DIR}
|
||||
WORKDIR ${DATA_DIR}
|
||||
RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env
|
||||
|
||||
RUN . ~/.env && ./debian/util.sh prep-create-dsc -a armhf ${CODENAME}
|
||||
|
||||
RUN --mount=type=secret,id=REPO_PASSWORD,required=true \
|
||||
printf "machine ${REPO_DOMAIN} " > /etc/apt/auth.conf && \
|
||||
printf "login ${REPO_USERNAME} " >> /etc/apt/auth.conf && \
|
||||
printf "password " >> /etc/apt/auth.conf && \
|
||||
cat /run/secrets/REPO_PASSWORD >> /etc/apt/auth.conf && \
|
||||
sha512sum /run/secrets/REPO_PASSWORD && \
|
||||
curl \
|
||||
--fail \
|
||||
--netrc-file /etc/apt/auth.conf \
|
||||
--output ${GPG_KEY} \
|
||||
https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev/signalwire-freeswitch-repo.gpg && \
|
||||
file ${GPG_KEY} && \
|
||||
apt-get --quiet update && \
|
||||
mk-build-deps \
|
||||
--install \
|
||||
--remove debian/control \
|
||||
--tool "apt-get -o Debug::pkgProblemResolver=yes --yes --no-install-recommends" && \
|
||||
apt-get --yes --fix-broken install && \
|
||||
rm -f /etc/apt/auth.conf
|
||||
|
||||
ENV DEB_BUILD_OPTIONS="parallel=1"
|
||||
RUN . ~/.env && ./debian/util.sh create-orig -n -v${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x
|
||||
|
||||
RUN . ~/.env && ORIGFILE=$(find ../ -name "freeswitch_*.orig.tar.xz" -type f) \
|
||||
&& ./debian/util.sh create-dsc -a armhf -z9 ${CODENAME} "$ORIGFILE"
|
||||
|
||||
WORKDIR /
|
||||
RUN dpkg-source -x freeswitch_*.dsc
|
||||
|
||||
RUN cd freeswitch-*/ && debuild -S -sa -d -us -uc
|
||||
|
||||
RUN cd freeswitch-*/ && debuild -b -us -uc
|
||||
|
||||
RUN mkdir OUT && mv -v *.{deb,dsc,changes,tar.*} OUT/.
|
||||
|
||||
RUN ls -lah /OUT
|
||||
|
||||
# Artifacts image (mandatory part, the resulting image must have a single filesystem layer)
|
||||
FROM scratch
|
||||
COPY --from=builder /OUT/ /
|
||||
@@ -1,103 +0,0 @@
|
||||
ARG BUILDER_IMAGE=arm64v8/debian:bullseye-20240513
|
||||
|
||||
FROM --platform=linux/arm64 ${BUILDER_IMAGE} AS builder
|
||||
|
||||
ARG MAINTAINER_NAME="Andrey Volk"
|
||||
ARG MAINTAINER_EMAIL="andrey@signalwire.com"
|
||||
|
||||
# Credentials
|
||||
ARG REPO_DOMAIN=freeswitch.signalwire.com
|
||||
ARG REPO_USERNAME=user
|
||||
|
||||
ARG BUILD_NUMBER=42
|
||||
ARG GIT_SHA=0000000000
|
||||
|
||||
ARG DATA_DIR=/data
|
||||
ARG CODENAME=bullseye
|
||||
ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg"
|
||||
|
||||
MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>"
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN apt-get -q update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -yq install \
|
||||
apt-transport-https \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
debhelper \
|
||||
devscripts \
|
||||
dh-autoreconf \
|
||||
dos2unix \
|
||||
doxygen \
|
||||
git \
|
||||
graphviz \
|
||||
libglib2.0-dev \
|
||||
libssl-dev \
|
||||
lsb-release \
|
||||
pkg-config \
|
||||
wget
|
||||
|
||||
RUN update-ca-certificates --fresh
|
||||
|
||||
RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \
|
||||
chmod +x ~/.env
|
||||
|
||||
RUN . ~/.env && cat <<EOF > /etc/apt/sources.list.d/freeswitch.list
|
||||
deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main
|
||||
deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main
|
||||
EOF
|
||||
|
||||
RUN git config --global --add safe.directory '*' \
|
||||
&& git config --global user.name "${MAINTAINER_NAME}" \
|
||||
&& git config --global user.email "${MAINTAINER_EMAIL}"
|
||||
|
||||
# Bootstrap and Build
|
||||
COPY . ${DATA_DIR}
|
||||
WORKDIR ${DATA_DIR}
|
||||
RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env
|
||||
|
||||
RUN . ~/.env && ./debian/util.sh prep-create-dsc -a arm64 ${CODENAME}
|
||||
|
||||
RUN --mount=type=secret,id=REPO_PASSWORD,required=true \
|
||||
printf "machine ${REPO_DOMAIN} " > /etc/apt/auth.conf && \
|
||||
printf "login ${REPO_USERNAME} " >> /etc/apt/auth.conf && \
|
||||
printf "password " >> /etc/apt/auth.conf && \
|
||||
cat /run/secrets/REPO_PASSWORD >> /etc/apt/auth.conf && \
|
||||
sha512sum /run/secrets/REPO_PASSWORD && \
|
||||
curl \
|
||||
--fail \
|
||||
--netrc-file /etc/apt/auth.conf \
|
||||
--output ${GPG_KEY} \
|
||||
https://${REPO_DOMAIN}/repo/deb/debian-release/signalwire-freeswitch-repo.gpg && \
|
||||
file ${GPG_KEY} && \
|
||||
apt-get --quiet update && \
|
||||
mk-build-deps \
|
||||
--install \
|
||||
--remove debian/control \
|
||||
--tool "apt-get -o Debug::pkgProblemResolver=yes --yes --no-install-recommends" && \
|
||||
apt-get --yes --fix-broken install && \
|
||||
rm -f /etc/apt/auth.conf
|
||||
|
||||
ENV DEB_BUILD_OPTIONS="parallel=1"
|
||||
RUN . ~/.env && ./debian/util.sh create-orig -n -v${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x
|
||||
|
||||
RUN . ~/.env && ORIGFILE=$(find ../ -name "freeswitch_*.orig.tar.xz" -type f) \
|
||||
&& ./debian/util.sh create-dsc -a arm64 -z9 ${CODENAME} "$ORIGFILE"
|
||||
|
||||
WORKDIR /
|
||||
RUN dpkg-source -x freeswitch_*.dsc
|
||||
|
||||
RUN cd freeswitch-*/ && debuild -S -sa -d -us -uc
|
||||
|
||||
RUN cd freeswitch-*/ && debuild -b -us -uc
|
||||
|
||||
RUN mkdir OUT && mv -v *.{deb,dsc,changes,tar.*} OUT/.
|
||||
|
||||
RUN ls -lah /OUT
|
||||
|
||||
# Artifacts image (mandatory part, the resulting image must have a single filesystem layer)
|
||||
FROM scratch
|
||||
COPY --from=builder /OUT/ /
|
||||
@@ -1,103 +0,0 @@
|
||||
ARG BUILDER_IMAGE=arm64v8/debian:bullseye-20240513
|
||||
|
||||
FROM --platform=linux/arm64 ${BUILDER_IMAGE} AS builder
|
||||
|
||||
ARG MAINTAINER_NAME="Andrey Volk"
|
||||
ARG MAINTAINER_EMAIL="andrey@signalwire.com"
|
||||
|
||||
# Credentials
|
||||
ARG REPO_DOMAIN=freeswitch.signalwire.com
|
||||
ARG REPO_USERNAME=user
|
||||
|
||||
ARG BUILD_NUMBER=42
|
||||
ARG GIT_SHA=0000000000
|
||||
|
||||
ARG DATA_DIR=/data
|
||||
ARG CODENAME=bullseye
|
||||
ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg"
|
||||
|
||||
MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>"
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN apt-get -q update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -yq install \
|
||||
apt-transport-https \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
debhelper \
|
||||
devscripts \
|
||||
dh-autoreconf \
|
||||
dos2unix \
|
||||
doxygen \
|
||||
git \
|
||||
graphviz \
|
||||
libglib2.0-dev \
|
||||
libssl-dev \
|
||||
lsb-release \
|
||||
pkg-config \
|
||||
wget
|
||||
|
||||
RUN update-ca-certificates --fresh
|
||||
|
||||
RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \
|
||||
chmod +x ~/.env
|
||||
|
||||
RUN . ~/.env && cat <<EOF > /etc/apt/sources.list.d/freeswitch.list
|
||||
deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main
|
||||
deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-unstable ${CODENAME} main
|
||||
EOF
|
||||
|
||||
RUN git config --global --add safe.directory '*' \
|
||||
&& git config --global user.name "${MAINTAINER_NAME}" \
|
||||
&& git config --global user.email "${MAINTAINER_EMAIL}"
|
||||
|
||||
# Bootstrap and Build
|
||||
COPY . ${DATA_DIR}
|
||||
WORKDIR ${DATA_DIR}
|
||||
RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env
|
||||
|
||||
RUN . ~/.env && ./debian/util.sh prep-create-dsc -a arm64 ${CODENAME}
|
||||
|
||||
RUN --mount=type=secret,id=REPO_PASSWORD,required=true \
|
||||
printf "machine ${REPO_DOMAIN} " > /etc/apt/auth.conf && \
|
||||
printf "login ${REPO_USERNAME} " >> /etc/apt/auth.conf && \
|
||||
printf "password " >> /etc/apt/auth.conf && \
|
||||
cat /run/secrets/REPO_PASSWORD >> /etc/apt/auth.conf && \
|
||||
sha512sum /run/secrets/REPO_PASSWORD && \
|
||||
curl \
|
||||
--fail \
|
||||
--netrc-file /etc/apt/auth.conf \
|
||||
--output ${GPG_KEY} \
|
||||
https://${REPO_DOMAIN}/repo/deb/debian-unstable/signalwire-freeswitch-repo.gpg && \
|
||||
file ${GPG_KEY} && \
|
||||
apt-get --quiet update && \
|
||||
mk-build-deps \
|
||||
--install \
|
||||
--remove debian/control \
|
||||
--tool "apt-get -o Debug::pkgProblemResolver=yes --yes --no-install-recommends" && \
|
||||
apt-get --yes --fix-broken install && \
|
||||
rm -f /etc/apt/auth.conf
|
||||
|
||||
ENV DEB_BUILD_OPTIONS="parallel=1"
|
||||
RUN . ~/.env && ./debian/util.sh create-orig -n -v${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x
|
||||
|
||||
RUN . ~/.env && ORIGFILE=$(find ../ -name "freeswitch_*.orig.tar.xz" -type f) \
|
||||
&& ./debian/util.sh create-dsc -a arm64 -z9 ${CODENAME} "$ORIGFILE"
|
||||
|
||||
WORKDIR /
|
||||
RUN dpkg-source -x freeswitch_*.dsc
|
||||
|
||||
RUN cd freeswitch-*/ && debuild -S -sa -d -us -uc
|
||||
|
||||
RUN cd freeswitch-*/ && debuild -b -us -uc
|
||||
|
||||
RUN mkdir OUT && mv -v *.{deb,dsc,changes,tar.*} OUT/.
|
||||
|
||||
RUN ls -lah /OUT
|
||||
|
||||
# Artifacts image (mandatory part, the resulting image must have a single filesystem layer)
|
||||
FROM scratch
|
||||
COPY --from=builder /OUT/ /
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "bullseye",
|
||||
"version": "trixie",
|
||||
"platform": {
|
||||
"name": "arm32v7"
|
||||
}
|
||||
@@ -132,7 +132,6 @@ jobs:
|
||||
version:
|
||||
- trixie
|
||||
- bookworm
|
||||
- bullseye
|
||||
platform:
|
||||
- name: amd64
|
||||
runner: ubuntu-latest
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.11.2-release
|
||||
1.11.3-release
|
||||
|
||||
@@ -21,6 +21,11 @@
|
||||
<param name="userauth" value="true"/>
|
||||
<!-- setting this to true will allow anyone to register even with no account so use with care -->
|
||||
<param name="blind-reg" value="false"/>
|
||||
<!-- lets a client message to api+<command> run FreeSWITCH API commands. Not
|
||||
recommended: it is all or nothing and bypasses the per-user fsapi permission.
|
||||
Prefer the fsapi method with jsonrpc-allowed-fsapi, which allow-lists commands
|
||||
per user. This param is here for clients that already use api+<command>. -->
|
||||
<!-- <param name="enable-chat-api-proto" value="true"/> -->
|
||||
<param name="mcast-ip" value="224.1.1.1"/>
|
||||
<param name="mcast-port" value="1337"/>
|
||||
<param name="rtp-ip" value="$${local_ip_v4}"/>
|
||||
@@ -46,6 +51,7 @@
|
||||
<param name="userauth" value="true"/>
|
||||
<!-- setting this to true will allow anyone to register even with no account so use with care -->
|
||||
<param name="blind-reg" value="false"/>
|
||||
<!-- <param name="enable-chat-api-proto" value="true"/> -->
|
||||
<param name="rtp-ip" value="$${local_ip_v6}"/>
|
||||
<!-- <param name="ext-rtp-ip" value=""/> -->
|
||||
<param name="outbound-codec-string" value="opus,h264,vp8"/>
|
||||
|
||||
@@ -56,6 +56,8 @@
|
||||
<param name="inbound-codec-negotiation" value="generous"/>
|
||||
<param name="nonce-ttl" value="60"/>
|
||||
<param name="auth-calls" value="false"/>
|
||||
<!-- lets an inbound MESSAGE to api+<command> run FreeSWITCH API commands, so enable only for trusted peers -->
|
||||
<!-- <param name="enable-chat-api-proto" value="true"/> -->
|
||||
<param name="inbound-late-negotiation" value="true"/>
|
||||
<!--
|
||||
DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS!
|
||||
|
||||
@@ -56,6 +56,8 @@
|
||||
<param name="inbound-codec-negotiation" value="generous"/>
|
||||
<param name="nonce-ttl" value="60"/>
|
||||
<param name="auth-calls" value="false"/>
|
||||
<!-- lets an inbound MESSAGE to api+<command> run FreeSWITCH API commands, so enable only for trusted peers -->
|
||||
<!-- <param name="enable-chat-api-proto" value="true"/> -->
|
||||
<param name="inbound-late-negotiation" value="true"/>
|
||||
<!--
|
||||
DO NOT USE HOSTNAMES, ONLY IP ADDRESSES IN THESE SETTINGS!
|
||||
|
||||
@@ -93,6 +93,8 @@
|
||||
<!-- add a ;received="<ip>:<port>" to the contact when replying to register for nat handling -->
|
||||
<!--<param name="NDLB-received-in-nat-reg-contact" value="true"/>-->
|
||||
<param name="auth-calls" value="$${internal_auth_calls}"/>
|
||||
<!-- lets an inbound MESSAGE to api+<command> run FreeSWITCH API commands, so enable only for trusted peers -->
|
||||
<!-- <param name="enable-chat-api-proto" value="true"/> -->
|
||||
<!-- on authed calls, authenticate *all* the packets not just invite -->
|
||||
<param name="auth-all-packets" value="false"/>
|
||||
<!-- Shouldn't set these on IPv6 -->
|
||||
|
||||
@@ -107,6 +107,9 @@
|
||||
<!-- extended info parsing -->
|
||||
<!-- <param name="extended-info-parsing" value="true"/> -->
|
||||
|
||||
<!-- lets an inbound MESSAGE to api+<command> run FreeSWITCH API commands, so enable only for trusted peers -->
|
||||
<!-- <param name="enable-chat-api-proto" value="true"/> -->
|
||||
|
||||
<!--<param name="aggressive-nat-detection" value="true"/>-->
|
||||
<!--
|
||||
There are known issues (asserts and segfaults) when 100rel is enabled.
|
||||
|
||||
+2
-2
@@ -3,10 +3,10 @@
|
||||
|
||||
# Must change all of the below together
|
||||
# For a release, set revision for that tagged release as well and uncomment
|
||||
AC_INIT([freeswitch], [1.11.2-release], bugs@freeswitch.org)
|
||||
AC_INIT([freeswitch], [1.11.3-release], bugs@freeswitch.org)
|
||||
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
|
||||
AC_SUBST(SWITCH_VERSION_MINOR, [11])
|
||||
AC_SUBST(SWITCH_VERSION_MICRO, [2-release])
|
||||
AC_SUBST(SWITCH_VERSION_MICRO, [3-release])
|
||||
AC_SUBST(SWITCH_VERSION_REVISION, [])
|
||||
AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
|
||||
|
||||
|
||||
@@ -148,6 +148,10 @@
|
||||
<!-- extended info parsing -->
|
||||
<!-- <param name="extended-info-parsing" value="true"/> -->
|
||||
|
||||
<!-- lets an inbound MESSAGE to api+<command> run FreeSWITCH API commands,
|
||||
so enable only for trusted peers -->
|
||||
<!-- <param name="enable-chat-api-proto" value="true"/> -->
|
||||
|
||||
<!-- <param name="aggressive-nat-detection" value="true"/> -->
|
||||
<!-- There are known issues (asserts and segfaults) when 100rel is
|
||||
enabled. It is not recommended to enable 100rel at this time. -->
|
||||
|
||||
@@ -311,6 +311,7 @@ typedef enum {
|
||||
PFLAG_AUTH_REQUIRE_USER,
|
||||
PFLAG_AUTH_CALLS_ACL_ONLY,
|
||||
PFLAG_USE_PORT_FOR_ACL_CHECK,
|
||||
PFLAG_ENABLE_CHAT_API_PROTO,
|
||||
|
||||
/* No new flags below this line */
|
||||
PFLAG_MAX
|
||||
|
||||
@@ -4917,6 +4917,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
|
||||
} else {
|
||||
sofia_clear_pflag(profile, PFLAG_ENABLE_CHAT);
|
||||
}
|
||||
} else if (!strcasecmp(var, "enable-chat-api-proto")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_ENABLE_CHAT_API_PROTO);
|
||||
} else {
|
||||
sofia_clear_pflag(profile, PFLAG_ENABLE_CHAT_API_PROTO);
|
||||
}
|
||||
} else if (!strcasecmp(var, "fire-bye-response-events")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_FIRE_BYE_RESPONSE_EVENTS);
|
||||
|
||||
@@ -4871,11 +4871,32 @@ void sofia_presence_handle_sip_i_message(int status,
|
||||
|
||||
full_from = sip_header_as_string(nua_handle_get_home(nh), (void *) sip->sip_from);
|
||||
|
||||
if ((p = strchr(to_user, '+')) && p != to_user) {
|
||||
/* Only split a user that fits in proto: the copy below truncates, so a '+' past the
|
||||
buffer would leave nothing to split on, and a selector or address cut in half must
|
||||
not be parsed either. An over-long user is treated as a plain address. */
|
||||
if ((p = strchr(to_user, '+')) && p != to_user && strlen(to_user) < sizeof(proto)) {
|
||||
switch_copy_string(proto, to_user, sizeof(proto));
|
||||
p = strchr(proto, '+');
|
||||
*p++ = '\0';
|
||||
|
||||
if (!strcasecmp(proto, "api") && !sofia_test_pflag(profile, PFLAG_ENABLE_CHAT_API_PROTO)) {
|
||||
/* p is the rest of the To user, still percent-encoded and bounded by the proto buffer. */
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"Profile [%s] rejected a MESSAGE from %s@%s (%s:%d) addressed to the 'api' chat proto [%s]. "
|
||||
"Set enable-chat-api-proto=true on the profile to permit it.\n",
|
||||
profile->name, switch_str_nil(from_user), switch_str_nil(from_host), network_ip, network_port, p);
|
||||
|
||||
nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
|
||||
|
||||
if (full_from) {
|
||||
su_free(nua_handle_get_home(nh), full_from);
|
||||
}
|
||||
|
||||
/* Return rather than goto end: the end label answers 200/202, which would be a
|
||||
second response on this transaction. */
|
||||
return;
|
||||
}
|
||||
|
||||
if ((to_addr = strdup(p))) {
|
||||
if ((p = strchr(to_addr, '+'))) {
|
||||
*p = '@';
|
||||
|
||||
@@ -3986,6 +3986,20 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcasecmp(proto, "api") && !jsock->profile->enable_chat_api_proto) {
|
||||
/* Truncate: the rest of "to" comes straight from the client JSON and has no length bound. */
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||
"Profile [%s] rejected a message from %s (%s) addressed to the 'api' chat proto [%.256s]. "
|
||||
"Set enable-chat-api-proto=true on the profile to permit it.\n",
|
||||
jsock->profile->name, switch_str_nil(jsock->uid), switch_str_nil(jsock->name), switch_str_nil(to));
|
||||
|
||||
cJSON_AddItemToObject(*response, "message", cJSON_CreateString("The api chat proto is not permitted on this profile"));
|
||||
switch_safe_free(pproto);
|
||||
r = SWITCH_FALSE;
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!zstr(to) && !zstr(body) && switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", VERTO_CHAT_PROTO);
|
||||
|
||||
@@ -5343,6 +5357,8 @@ static switch_status_t parse_config(const char *cf)
|
||||
profile->jb_msec = switch_core_strdup(profile->pool, val);
|
||||
} else if (!strcasecmp(var, "blind-reg") && !zstr(val)) {
|
||||
profile->blind_reg = switch_true(val);
|
||||
} else if (!strcasecmp(var, "enable-chat-api-proto") && !zstr(val)) {
|
||||
profile->enable_chat_api_proto = switch_true(val);
|
||||
} else if (!strcasecmp(var, "userauth") && !zstr(val)) {
|
||||
profile->userauth = switch_core_strdup(profile->pool, val);
|
||||
} else if (!strcasecmp(var, "chop-domain") && !zstr(val)) {
|
||||
|
||||
@@ -247,6 +247,7 @@ struct verto_profile_s {
|
||||
|
||||
int in_thread;
|
||||
int blind_reg;
|
||||
int enable_chat_api_proto;
|
||||
|
||||
char *userauth;
|
||||
char *root_passwd;
|
||||
|
||||
@@ -6556,6 +6556,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
|
||||
}
|
||||
} else if (!switch_cmp_addr(rtp_session->from_addr, rtp_session->remote_addr, SWITCH_FALSE) &&
|
||||
!switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) &&
|
||||
rtp_session->timer.timer_interface &&
|
||||
switch_core_timer_check(&rtp_session->timer, SWITCH_FALSE) == SWITCH_STATUS_FALSE) {
|
||||
/**
|
||||
* nothing has been read from socket. We are not in auto-adjustment window anymore
|
||||
|
||||
+11
-10
@@ -38,6 +38,7 @@
|
||||
|
||||
#ifdef HAVE_TIMERFD_CREATE
|
||||
#include <sys/timerfd.h>
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
//#if defined(DARWIN)
|
||||
@@ -497,27 +498,27 @@ static switch_status_t _timerfd_next(switch_timer_t *timer)
|
||||
static switch_status_t _timerfd_check(switch_timer_t *timer, switch_bool_t step)
|
||||
{
|
||||
interval_timer_t *it = timer->private_info;
|
||||
struct itimerspec val;
|
||||
int diff;
|
||||
struct pollfd pfd = { .events = POLLIN };
|
||||
|
||||
if (!it) {
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
timerfd_gettime(it->fd, &val);
|
||||
diff = val.it_value.tv_nsec / 1000;
|
||||
pfd.fd = it->fd;
|
||||
|
||||
if (diff > 0) {
|
||||
/* still pending */
|
||||
timer->diff = diff;
|
||||
return SWITCH_STATUS_FALSE;
|
||||
} else {
|
||||
/* timer pending */
|
||||
if (poll(&pfd, 1, 0) > 0) {
|
||||
/* timer has fired */
|
||||
timer->diff = 0;
|
||||
if (step) {
|
||||
_timerfd_step(timer);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
} else {
|
||||
/* still pending */
|
||||
timer->diff = 1;
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ switch_ulp_recover1
|
||||
switch_ulp_recover2
|
||||
switch_ulp_recover3
|
||||
switch_ulp_recover4
|
||||
switch_timer
|
||||
switch_utils
|
||||
switch_vad
|
||||
switch_vpx
|
||||
|
||||
@@ -9,6 +9,7 @@ noinst_PROGRAMS+= switch_hold switch_sip
|
||||
noinst_PROGRAMS += switch_core_media
|
||||
noinst_PROGRAMS += test_mod_verto
|
||||
noinst_PROGRAMS += test_mod_event_socket
|
||||
noinst_PROGRAMS += switch_timer
|
||||
|
||||
if HAVE_PCAP
|
||||
noinst_PROGRAMS += switch_rtp_pcap
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2026, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Dmitry Verenitsin <dmitry.verenitsin@signalwire.com>
|
||||
*
|
||||
*
|
||||
* switch_timer.c -- timer tests
|
||||
*
|
||||
*/
|
||||
#include <switch.h>
|
||||
#include <test/switch_test.h>
|
||||
|
||||
static int module_loaded = 0;
|
||||
|
||||
FST_MINCORE_BEGIN("./conf")
|
||||
|
||||
FST_SUITE_BEGIN(switch_timer)
|
||||
|
||||
FST_SETUP_BEGIN()
|
||||
{
|
||||
if (!module_loaded) {
|
||||
const char *err = NULL;
|
||||
switch_loadable_module_init(SWITCH_FALSE);
|
||||
switch_loadable_module_load_module("", "CORE_SOFTTIMER_MODULE", SWITCH_TRUE, &err);
|
||||
module_loaded = 1;
|
||||
}
|
||||
}
|
||||
FST_SETUP_END()
|
||||
|
||||
FST_TEARDOWN_BEGIN()
|
||||
{
|
||||
}
|
||||
FST_TEARDOWN_END()
|
||||
|
||||
/* timer_check returns FALSE with non-zero diff when no tick has elapsed,
|
||||
* returns SUCCESS with diff=0 after sleeping past the interval */
|
||||
FST_TEST_BEGIN(test_timer_check)
|
||||
{
|
||||
switch_timer_t timer = { 0 };
|
||||
switch_status_t status;
|
||||
|
||||
fst_requires(switch_core_timer_init(&timer, "soft", 20, 160, fst_pool) == SWITCH_STATUS_SUCCESS);
|
||||
|
||||
/* immediately after init - no tick yet */
|
||||
status = switch_core_timer_check(&timer, SWITCH_FALSE);
|
||||
fst_check(status == SWITCH_STATUS_FALSE);
|
||||
fst_check(timer.diff != 0);
|
||||
|
||||
/* sleep past the 20ms interval */
|
||||
switch_sleep(50000); /* 50ms */
|
||||
|
||||
/* now the tick should be detected */
|
||||
status = switch_core_timer_check(&timer, SWITCH_FALSE);
|
||||
fst_check(status == SWITCH_STATUS_SUCCESS);
|
||||
fst_check(timer.diff == 0);
|
||||
|
||||
switch_core_timer_destroy(&timer);
|
||||
}
|
||||
FST_TEST_END()
|
||||
|
||||
/* step=FALSE does not advance tick/samplecount, step=TRUE advances by exactly 1 tick */
|
||||
FST_TEST_BEGIN(test_timer_check_step)
|
||||
{
|
||||
switch_timer_t timer = { 0 };
|
||||
switch_size_t tick_before;
|
||||
uint32_t samplecount_before;
|
||||
switch_status_t status;
|
||||
|
||||
fst_requires(switch_core_timer_init(&timer, "soft", 20, 160, fst_pool) == SWITCH_STATUS_SUCCESS);
|
||||
|
||||
switch_sleep(50000); /* 50ms - let the timer tick */
|
||||
|
||||
tick_before = timer.tick;
|
||||
samplecount_before = timer.samplecount;
|
||||
|
||||
/* step=FALSE: reports ready but does not advance */
|
||||
status = switch_core_timer_check(&timer, SWITCH_FALSE);
|
||||
fst_check(status == SWITCH_STATUS_SUCCESS);
|
||||
fst_check(timer.tick == tick_before);
|
||||
fst_check(timer.samplecount == samplecount_before);
|
||||
|
||||
/* step=TRUE: advances tick by 1, samplecount by samples */
|
||||
status = switch_core_timer_check(&timer, SWITCH_TRUE);
|
||||
fst_check(status == SWITCH_STATUS_SUCCESS);
|
||||
fst_check(timer.tick == tick_before + 1);
|
||||
fst_check(timer.samplecount == samplecount_before + 160);
|
||||
|
||||
switch_core_timer_destroy(&timer);
|
||||
}
|
||||
FST_TEST_END()
|
||||
|
||||
FST_SUITE_END()
|
||||
|
||||
FST_MINCORE_END()
|
||||
Reference in New Issue
Block a user