Skip to content

Commit

Permalink
chore: add default busy and noanswer tones for the autopilot
Browse files Browse the repository at this point in the history
  • Loading branch information
psanders committed Mar 30, 2024
1 parent 787e490 commit b2e2bf2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .env.example
Expand Up @@ -27,6 +27,9 @@ WEBUI_FEEDBACK_URL=https://docs.google.com/forms/d/e/1FAIpQLSd1G2ahRYqkbksOvz7Xh
##
# API Server Configuration
##
APISERVER_AUTOPILOT_URL=http://apiserver:6445
APISERVER_AUTOPILOT_MEDIA_BUSY_MESSAGE='<media end="7s"><audio src="https://storage.googleapis.com/fonoster/sounds/busytone.mp3"/></media>'
APISERVER_AUTOPILOT_MEDIA_NOANSWER_MESSAGE='<media end="7s"><audio src="https://storage.googleapis.com/fonoster/sounds/busytone.mp3"/></media>'
APISERVER_ENDPOINT=apiserver:50052
APISERVER_ROUTR_API_HOST=routr
APISERVER_ROUTR_API_USERNAME=admin
Expand All @@ -45,7 +48,6 @@ APISERVER_S3_SERVER_SECRET=changeme
APISERVER_S3_SERVER_USE_SSL=false
APISERVER_JWT_AUTH_ISS=fonoster
APISERVER_JWT_PRIVATE_KEY=4e5f5aa678968f0a2ea43c5d5aaf5220
APISERVER_AUTOPILOT_URL=http://apiserver:6445
APISERVER_RBAC_CONFIG=/opt/fonoster/etc/rbac.json
APISERVER_REDIS_HOST=redis

Expand Down Expand Up @@ -81,4 +83,4 @@ ROUTR_RTPENGINE_HOST=rtpengine
ROUTR_RTPENGINE_PORT=8080
ROUTR_RTPENGINE_PROTO=http
ROUTR_CONVERT_TEL_TO_E164=true
ROUTR_JAVA_OPTS="-XX:NewRatio=2 -Xmx2200M"
ROUTR_JAVA_OPTS='-XX:NewRatio=2 -Xmx2200M'
4 changes: 3 additions & 1 deletion compose.yaml
Expand Up @@ -36,6 +36,9 @@ services:
image: fonoster/apiserver:latest
restart: unless-stopped
environment:
APISERVER_AUTOPILOT_URL: ${APISERVER_AUTOPILOT_URL}
APISERVER_AUTOPILOT_MEDIA_BUSY_MESSAGE: ${APISERVER_AUTOPILOT_MEDIA_BUSY_MESSAGE}
APISERVER_AUTOPILOT_MEDIA_NOANSWER_MESSAGE: ${APISERVER_AUTOPILOT_MEDIA_NOANSWER_MESSAGE}
APISERVER_ENDPOINT: ${APISERVER_ENDPOINT}
APISERVER_ROUTR_API_HOST: ${APISERVER_ROUTR_API_HOST}
APISERVER_ROUTR_API_USERNAME: ${APISERVER_ROUTR_API_USERNAME}
Expand All @@ -53,7 +56,6 @@ services:
APISERVER_S3_SERVER_USE_SSL: ${APISERVER_S3_SERVER_USE_SSL}
APISERVER_JWT_AUTH_ISS: ${APISERVER_JWT_AUTH_ISS}
APISERVER_JWT_PRIVATE_KEY: ${APISERVER_JWT_PRIVATE_KEY}
APISERVER_AUTOPILOT_URL: ${APISERVER_AUTOPILOT_URL}
REDIS_HOST: ${APISERVER_REDIS_HOST}
LOGS_LEVEL: ${LOGS_LEVEL}
LOGS_TRANSPORT: ${LOGS_TRANSPORT}
Expand Down
4 changes: 3 additions & 1 deletion mods/apiserver/etc/service_envs.json
Expand Up @@ -2,10 +2,12 @@
{
"module": "apiserver",
"env": [
"APISERVER_AUTOPILOT_URL",
"APISERVER_AUTOPILOT_MEDIA_BUSY_MESSAGE",
"APISERVER_AUTOPILOT_MEDIA_NOANSWER_MESSAGE",
"APISERVER_ASTERISK_ARI_INTERNAL_URL",
"APISERVER_ASTERISK_ARI_USERNAME",
"APISERVER_ASTERISK_ARI_SECRET",
"APISERVER_AUTOPILOT_URL",
"APISERVER_ENDPOINT",
"APISERVER_ROUTR_API_HOST",
"APISERVER_ROUTR_API_USERNAME",
Expand Down
4 changes: 4 additions & 0 deletions mods/autopilot/src/envs.ts
Expand Up @@ -21,3 +21,7 @@ export const APISERVER_AUTOPILOT_PORT = process.env.APISERVER_AUTOPILOT_PORT
: 6445;
export const APISERVER_AUTOPILOT_DEFAULT_LANGUAGE_CODE =
process.env.APISERVER_AUTOPILOT_DEFAULT_LANGUAGE_CODE || "en-US";
export const APISERVER_AUTOPILOT_MEDIA_BUSY_MESSAGE =
process.env.APISERVER_AUTOPILOT_MEDIA_BUSY_MESSAGE;
export const APISERVER_AUTOPILOT_MEDIA_NOANSWER_MESSAGE =
process.env.APISERVER_AUTOPILOT_MEDIA_NOANSWER_MESSAGE;
13 changes: 13 additions & 0 deletions mods/autopilot/src/pilot.ts
Expand Up @@ -31,6 +31,10 @@ import { getLogger, ulogger, ULogType } from "@fonoster/logger";
import GoogleTTS, { GoogleTTSConfig } from "@fonoster/googletts";
import Apps from "@fonoster/apps";
import Secrets from "@fonoster/secrets";
import {
APISERVER_AUTOPILOT_MEDIA_BUSY_MESSAGE,
APISERVER_AUTOPILOT_MEDIA_NOANSWER_MESSAGE
} from "./envs";

const logger = getLogger({ service: "autopilot", filePath: __filename });

Expand Down Expand Up @@ -150,6 +154,15 @@ export default function pilot(config: ServerConfig) {
}
}

const transfer = app.transferConfig;

transfer.messageNoAnswer = transfer.messageBusy =
transfer.messageBusy || APISERVER_AUTOPILOT_MEDIA_BUSY_MESSAGE;

transfer.messageNoAnswer =
transfer.messageNoAnswer ||
APISERVER_AUTOPILOT_MEDIA_NOANSWER_MESSAGE;

const cerebro = new Cerebro({
voiceRequest,
voiceResponse,
Expand Down

0 comments on commit b2e2bf2

Please sign in to comment.