Sign inSign up

rasonyang/freeswitch-aicc

By rasonyang

Updated about 8 hours ago

FreeSWITCH v1.11.3 + mod_audio_stream for aicc; PostgreSQL/S3 via env vars (amd64, arm64)

Image
Networking
Machine learning & AI
1

761

rasonyang/freeswitch-aicc repository overview

rasonyang/freeswitch-aicc

An aicc (AI-native call center) image built from FreeSWITCH v1.11.3 sources. The module set, configuration tree, Lua scripts and sound files inside the image match the aicc host environment (/usr/local/freeswitch); external dependencies such as PostgreSQL, S3, the voice bot and the PSTN gateway are injected at startup through environment variables.

  • Platforms: linux/amd64 and linux/arm64
  • FreeSWITCH: tag v1.11.3 (sofia-sip and spandsp pinned to specific commits, see the image LABELs)
  • Extra module: mod_audio_stream (rasonyang/mod_audio_stream, libwsc statically linked)
  • Base image: debian:bookworm-slim

Tags

TagDescription
v1.11.3Multi-arch manifest: linux/amd64 + linux/arm64
latestSame as the newest version, multi-arch (linux/amd64 + linux/arm64)

Quick start

docker run -d --name freeswitch --network host \
  -e FS_LOCAL_IP=192.168.31.55 \
  -e FS_ESL_LISTEN_IP=0.0.0.0 \
  -e AICC_LUA_DSN="pgsql://hostaddr=10.0.0.5 dbname=aicc user=aicc_lua password='secret'" \
  -e AICC_CC_DSN="pgsql://hostaddr=10.0.0.5 dbname=aicc_fs user=aicc password='secret'" \
  -e AICC_RECORDINGS_DIR="http://aicc-recordings.s3.example.com" \
  -v fs-db:/usr/local/freeswitch/db -v fs-log:/usr/local/freeswitch/log \
  rasonyang/freeswitch-aicc:v1.11.3

docker exec freeswitch fs_cli -P 18021 -x status

A complete example is in the image source tree at docker/aicc/docker-compose.example.yml.

Environment variables

Configuration is rewritten only for variables that are actually set; anything left unset keeps the same default as the host configuration. The one exception is local_ip_v4: the host configuration hardcodes the host IP, which a container cannot bind, so when FS_LOCAL_IP is unset the container's primary IP is used.

Network / identity (vars.xml)
VariableInjected intoDefault
FS_LOCAL_IPlocal_ip_v4 (SIP/RTP bind address)container primary IP
FS_EXTERNAL_IPexternal_rtp_ip, external_sip_ip (NAT public address)$${local_ip_v4}
FS_DOMAINdomain$${local_ip_v4}
FS_DEFAULT_PASSWORDdefault_password (extension default password)host value
ESL (event_socket.conf.xml)
VariableInjected intoDefault
FS_ESL_LISTEN_IPlisten-ip127.0.0.1 (must be 0.0.0.0 for access from outside the container)
FS_ESL_PORTlisten-port18021
FS_ESL_PASSWORDpasswordClueCon
FS_ESL_ACLapply-inbound-acllan (127.0.0.1 + 192.168.31.0/24 in acl.conf.xml)
PostgreSQL
VariableInjected intoDescription
AICC_LUA_DSNvars.xml aicc_lua_dsnBusiness database DSN used by the aicc_*.lua scripts
AICC_CC_DSNvars.xml aicc_cc_dsnCall center database DSN
FS_CORE_DB_DSNswitch.conf.xml core-db-dsnSwitch the core database to PostgreSQL (SQLite by default)
FS_CALLCENTER_DSNcallcenter.conf.xml odbc-dsnSwitch mod_callcenter to PostgreSQL (SQLite by default)

DSN format: pgsql://hostaddr=10.0.0.5 dbname=aicc user=aicc password='secret'.

Note: the database referenced by FS_CORE_DB_DSN must be reachable at startup, otherwise FreeSWITCH exits with Cannot Initialize; if FS_CALLCENTER_DSN is unreachable, mod_callcenter fails to load (the other modules are unaffected). AICC_LUA_DSN/AICC_CC_DSN are only connected when the Lua scripts run, so startup is not affected.

S3 / recordings
VariableInjected intoDescription
AICC_RECORDINGS_DIRvars.xml aicc_recordings_dirURL prefix for recording uploads (HTTP/S3/MinIO); the PUT is performed by mod_http_cache
FS_S3_ACCESS_KEY_IDhttp_cache.conf.xml aws-s3 profileS3 signing is enabled when all three are set
FS_S3_SECRET_ACCESS_KEYsame as above
FS_S3_BASE_DOMAINsame profile's base-domain and domainse.g. s3.example.com or minio.internal:9000
FS_S3_BUCKETsame profile's domains (optional)When set, the profile domain is <bucket>.<base-domain>, otherwise <base-domain>
FS_S3_REGIONsame profile's regionus-east-1 by default

mod_http_cache matches a profile by exact URL hostname against its domain, so the hostname formed from FS_S3_BUCKET/FS_S3_BASE_DOMAIN must equal the URL host in AICC_RECORDINGS_DIR. For example, AICC_RECORDINGS_DIR=http://aicc-recordings.s3.example.com corresponds to FS_S3_BUCKET=aicc-recordings and FS_S3_BASE_DOMAIN=s3.example.com.

Voice bot / PSTN gateway
VariableInjected into
AICC_BOT_HOST / AICC_BOT_PORTvars.xml aicc_bot_host / aicc_bot_port (defaults $${local_ip_v4} / 6060)
PSTN_GATEWAY_HOST / PSTN_GATEWAY_PORT / PSTN_GATEWAY_CALLER_IDvars.xml pstn_gateway_* (defaults 192.168.31.41 / 5080 / 95001)
Other
VariableInjected into
FS_RTP_START_PORT / FS_RTP_END_PORTswitch.conf.xml rtp-start-port / rtp-end-port (default 16384-32768)

At startup the entrypoint prints a single [entrypoint] injected: ... line listing the names of the injected variables (values are not printed).

Ports

PortPurpose
5060/udp,tcpSIP internal
5080/udp,tcpSIP external
5066/tcpSIP over WebSocket
7443/tcpSIP over WSS
18021/tcpESL
16384-32768/udpRTP

--network host is recommended for SIP/RTP. On a bridge network you must set FS_EXTERNAL_IP, narrow the FS_RTP_*_PORT range, and map the ports individually.

Volumes

PathContents
/usr/local/freeswitch/dbSQLite (core, sofia registrations, callcenter, voicemail)
/usr/local/freeswitch/logLogs and CDRs
/usr/local/freeswitch/recordingsLocal recordings
/usr/local/freeswitch/storageVoicemail
/usr/local/freeswitch/certsOptional. Mount wss.pem and dtls-srtp.pem; self-signed certificates are generated when missing

Modules (27, matching modules.conf.xml / pre_load_modules.conf.xml)

mod_console, mod_logfile, mod_cdr_csv, mod_event_socket, mod_sofia, mod_loopback, mod_commands, mod_dptools, mod_expr, mod_fifo, mod_hash, mod_voicemail, mod_valet_parking, mod_dialplan_xml, mod_g723_1, mod_g729, mod_opus, mod_sndfile, mod_native_file, mod_local_stream, mod_tone_stream, mod_lua, mod_http_cache, mod_say_en, mod_callcenter, mod_pgsql, mod_audio_stream.

Image contents

  • /usr/local/freeswitch/conf: the aicc configuration (vars.xml, sip_profiles, dialplan/aicc, autoload_configs and so on, with backup files removed)
  • /usr/local/freeswitch/scripts: aicc_inbound.lua, aicc_queue.lua, aicc_track.lua, aicc_xml.lua (the mod_lua XML handler; directory/configuration are served from PostgreSQL)
  • /usr/local/freeswitch/sounds: en/us/callie (8k/32k/48k) and music (8k/16k/32k/48k)

The process runs in the foreground as the freeswitch user (-nonat -nf -nc), and HEALTHCHECK uses fs_cli -x status.

Build

# Requires: the FreeSWITCH source repository (with tag v1.11.3), a host /usr/local/freeswitch,
# the mod_audio_stream sources (including the libs/libwsc submodule), and docker buildx
docker/aicc/build.sh                 # defaults: FS_REF=v1.11.3, IMAGE=rasonyang/freeswitch-aicc
FS_REF=v1.11.3 MOD_AUDIO_STREAM=~/src/mod_audio_stream MAKE_JOBS=3 docker/aicc/build.sh /path/to/ctx
LOAD=1 PLATFORM=linux/arm64 docker/aicc/build.sh   # single platform, loaded into the local daemon for testing

The build script exports the sources with git archive (working-tree changes are excluded), copies the host conf/scripts/sounds into the build context, then runs one docker buildx build --platform linux/amd64,linux/arm64 --push that builds both platforms and pushes the multi-arch v1.11.3 and latest tags. On Apple Silicon run Colima with --vz-rosetta so the amd64 half is compiled under Rosetta; QEMU user-mode emulation is not reliable for gcc (random segfaults).

Tag summary

Content type

Image

Digest

sha256:46d34d666

Size

87.8 MB

Last updated

14 days ago

docker pull rasonyang/freeswitch-aicc