@fonoster/apiserver 0.8.46 → 0.8.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,7 +32,6 @@ const common_1 = require("@fonoster/common");
32
32
  const logger_1 = require("@fonoster/logger");
33
33
  const convertToApplicationData_1 = require("./utils/convertToApplicationData");
34
34
  const validOrThrow_1 = require("./validation/validOrThrow");
35
- const envs_1 = require("../envs");
36
35
  const client_1 = require("@prisma/client");
37
36
  const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filename });
38
37
  function createCreateApplication(prisma) {
@@ -46,9 +45,9 @@ function createCreateApplication(prisma) {
46
45
  });
47
46
  if (type === client_1.ApplicationType.AUTOPILOT && !request.endpoint) {
48
47
  logger.verbose("setting default endpoint for autopilot application", {
49
- autopilotEndpoint: envs_1.APISERVER_AUTOPILOT_ENDPOINT
48
+ autopilotEndpoint: common_1.AUTOPILOT_SPECIAL_LOCAL_ADDRESS
50
49
  });
51
- request.endpoint = envs_1.APISERVER_AUTOPILOT_ENDPOINT;
50
+ request.endpoint = common_1.AUTOPILOT_SPECIAL_LOCAL_ADDRESS;
52
51
  }
53
52
  (0, validOrThrow_1.validOrThrow)(request);
54
53
  const result = yield prisma.application.create({
@@ -35,7 +35,6 @@ const createGetFnUtil_1 = require("./createGetFnUtil");
35
35
  const convertToApplicationData_1 = require("./utils/convertToApplicationData");
36
36
  const validOrThrow_1 = require("./validation/validOrThrow");
37
37
  const identity_1 = require("@fonoster/identity");
38
- const envs_1 = require("../envs");
39
38
  const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filename });
40
39
  function createUpdateApplication(prisma) {
41
40
  const getFn = (0, createGetFnUtil_1.createGetFnUtil)(prisma);
@@ -45,9 +44,9 @@ function createUpdateApplication(prisma) {
45
44
  const accessKeyId = (0, common_1.getAccessKeyIdFromCall)(call);
46
45
  if (type === types_1.ApplicationType.AUTOPILOT && !request.endpoint) {
47
46
  logger.verbose("setting default endpoint for autopilot application", {
48
- autopilotEndpoint: envs_1.APISERVER_AUTOPILOT_ENDPOINT
47
+ autopilotEndpoint: common_1.AUTOPILOT_SPECIAL_LOCAL_ADDRESS
49
48
  });
50
- request.endpoint = envs_1.APISERVER_AUTOPILOT_ENDPOINT;
49
+ request.endpoint = common_1.AUTOPILOT_SPECIAL_LOCAL_ADDRESS;
51
50
  }
52
51
  (0, validOrThrow_1.validOrThrow)(request);
53
52
  logger.verbose("call to updateApplication", {
@@ -30,6 +30,6 @@ const allowList = [
30
30
  "/fonoster.identity.v1beta2.Identity/SendVerificationCode",
31
31
  "/fonoster.identity.v1beta2.Identity/VerifyCode",
32
32
  "/fonoster.identity.v1beta2.Identity/GetPublicKey",
33
- "/fonoster.voice.v1beta2.Voice/CreateSession",
33
+ "/fonoster.voice.v1beta2.Voice/CreateSession"
34
34
  ];
35
35
  exports.allowList = allowList;
@@ -40,7 +40,10 @@ function buildWelcomeDemoService() {
40
40
  if (request) {
41
41
  const { callerNumber } = request;
42
42
  sessionRef = request.sessionRef;
43
- logger.verbose("welcome demo session started", { sessionRef, callerNumber });
43
+ logger.verbose("welcome demo session started", {
44
+ sessionRef,
45
+ callerNumber
46
+ });
44
47
  voice.write({
45
48
  answerRequest: {
46
49
  sessionRef: request.sessionRef
@@ -54,7 +57,9 @@ function buildWelcomeDemoService() {
54
57
  });
55
58
  }
56
59
  if (sayResponse && sessionRef) {
57
- logger.verbose("hanging up welcome demo session", { sessionRef });
60
+ logger.verbose("hanging up welcome demo session", {
61
+ sessionRef
62
+ });
58
63
  voice.write({
59
64
  hangupRequest: {
60
65
  sessionRef
@@ -63,7 +68,10 @@ function buildWelcomeDemoService() {
63
68
  }
64
69
  }
65
70
  catch (error) {
66
- logger.error("error in welcome demo session", { sessionRef, error });
71
+ logger.error("error in welcome demo session", {
72
+ sessionRef,
73
+ error
74
+ });
67
75
  if (sessionRef) {
68
76
  voice.write({
69
77
  hangupRequest: { sessionRef }
@@ -77,7 +85,10 @@ function buildWelcomeDemoService() {
77
85
  logger.verbose("welcome demo session ended", { sessionRef });
78
86
  });
79
87
  voice.on(common_1.StreamEvent.ERROR, (error) => {
80
- logger.error("stream error in welcome demo session", { sessionRef, error });
88
+ logger.error("stream error in welcome demo session", {
89
+ sessionRef,
90
+ error
91
+ });
81
92
  voice.end();
82
93
  });
83
94
  }
package/dist/envs.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export declare const APISERVER_BIND_ADDR: string;
2
2
  export declare const APISERVER_HOST: string;
3
- export declare const APISERVER_AUTOPILOT_ENDPOINT: string;
4
3
  export declare const APP_URL: string;
5
4
  export declare const ASTERISK_ARI_PROXY_URL: string;
6
5
  export declare const ASTERISK_ARI_SECRET: string;
package/dist/envs.js CHANGED
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  var _a;
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.SMTP_SECURE = exports.SMTP_PORT = exports.SMTP_HOST = exports.SMTP_AUTH_USER = exports.SMTP_AUTH_PASS = exports.ROUTR_DEFAULT_PEER_USERNAME = exports.ROUTR_DEFAULT_PEER_PASSWORD = exports.ROUTR_DEFAULT_PEER_NAME = exports.ROUTR_DEFAULT_PEER_AOR = exports.ROUTR_API_ENDPOINT = exports.OWNER_PASSWORD = exports.OWNER_NAME = exports.OWNER_EMAIL = exports.NATS_URL = exports.INTEGRATIONS_FILE = exports.INFLUXDB_USERNAME = exports.INFLUXDB_URL = exports.INFLUXDB_TOKEN = exports.INFLUXDB_PASSWORD = exports.INFLUXDB_ORG = exports.AUTHZ_SERVICE_METHODS = exports.AUTHZ_SERVICE_PORT = exports.AUTHZ_SERVICE_HOST = exports.AUTHZ_SERVICE_ENABLED = exports.IDENTITY_WORKSPACE_INVITATION_FAIL_URL = exports.IDENTITY_REFRESH_TOKEN_EXPIRES_IN = exports.IDENTITY_PUBLIC_KEY = exports.IDENTITY_PRIVATE_KEY = exports.IDENTITY_OAUTH2_GITHUB_CLIENT_SECRET = exports.IDENTITY_OAUTH2_GITHUB_CLIENT_ID = exports.IDENTITY_OAUTH2_GITHUB_ENABLED = exports.IDENTITY_USER_VERIFICATION_REQUIRED = exports.IDENTITY_ISSUER = exports.IDENTITY_ID_TOKEN_EXPIRES_IN = exports.IDENTITY_AUDIENCE = exports.IDENTITY_ACCESS_TOKEN_EXPIRES_IN = exports.HTTP_BRIDGE_PORT = exports.DEFAULT_NATS_QUEUE_GROUP = exports.CLOAK_ENCRYPTION_KEY = exports.CALLS_TRACK_CALL_SUBJECT = exports.CALLS_CREATE_SUBJECT = exports.ASTERISK_TRUNK = exports.ASTERISK_SYSTEM_DOMAIN = exports.ASTERISK_ARI_USERNAME = exports.ASTERISK_ARI_SECRET = exports.ASTERISK_ARI_PROXY_URL = exports.APP_URL = exports.APISERVER_AUTOPILOT_ENDPOINT = exports.APISERVER_HOST = exports.APISERVER_BIND_ADDR = void 0;
8
- exports.TWILIO_PHONE_NUMBER = exports.TWILIO_AUTH_TOKEN = exports.TWILIO_ACCOUNT_SID = exports.TEMPLATES_DIR = exports.SMTP_SENDER = void 0;
7
+ exports.SMTP_SENDER = exports.SMTP_SECURE = exports.SMTP_PORT = exports.SMTP_HOST = exports.SMTP_AUTH_USER = exports.SMTP_AUTH_PASS = exports.ROUTR_DEFAULT_PEER_USERNAME = exports.ROUTR_DEFAULT_PEER_PASSWORD = exports.ROUTR_DEFAULT_PEER_NAME = exports.ROUTR_DEFAULT_PEER_AOR = exports.ROUTR_API_ENDPOINT = exports.OWNER_PASSWORD = exports.OWNER_NAME = exports.OWNER_EMAIL = exports.NATS_URL = exports.INTEGRATIONS_FILE = exports.INFLUXDB_USERNAME = exports.INFLUXDB_URL = exports.INFLUXDB_TOKEN = exports.INFLUXDB_PASSWORD = exports.INFLUXDB_ORG = exports.AUTHZ_SERVICE_METHODS = exports.AUTHZ_SERVICE_PORT = exports.AUTHZ_SERVICE_HOST = exports.AUTHZ_SERVICE_ENABLED = exports.IDENTITY_WORKSPACE_INVITATION_FAIL_URL = exports.IDENTITY_REFRESH_TOKEN_EXPIRES_IN = exports.IDENTITY_PUBLIC_KEY = exports.IDENTITY_PRIVATE_KEY = exports.IDENTITY_OAUTH2_GITHUB_CLIENT_SECRET = exports.IDENTITY_OAUTH2_GITHUB_CLIENT_ID = exports.IDENTITY_OAUTH2_GITHUB_ENABLED = exports.IDENTITY_USER_VERIFICATION_REQUIRED = exports.IDENTITY_ISSUER = exports.IDENTITY_ID_TOKEN_EXPIRES_IN = exports.IDENTITY_AUDIENCE = exports.IDENTITY_ACCESS_TOKEN_EXPIRES_IN = exports.HTTP_BRIDGE_PORT = exports.DEFAULT_NATS_QUEUE_GROUP = exports.CLOAK_ENCRYPTION_KEY = exports.CALLS_TRACK_CALL_SUBJECT = exports.CALLS_CREATE_SUBJECT = exports.ASTERISK_TRUNK = exports.ASTERISK_SYSTEM_DOMAIN = exports.ASTERISK_ARI_USERNAME = exports.ASTERISK_ARI_SECRET = exports.ASTERISK_ARI_PROXY_URL = exports.APP_URL = exports.APISERVER_HOST = exports.APISERVER_BIND_ADDR = void 0;
8
+ exports.TWILIO_PHONE_NUMBER = exports.TWILIO_AUTH_TOKEN = exports.TWILIO_ACCOUNT_SID = exports.TEMPLATES_DIR = void 0;
9
9
  /*
10
10
  * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
11
11
  * http://github.com/fonoster/fonoster
@@ -56,7 +56,6 @@ const IDENTITY_PRIVATE_KEY_PATH = e.IDENTITY_PRIVATE_KEY_PATH || "/opt/fonoster/
56
56
  const IDENTITY_PUBLIC_KEY_PATH = e.IDENTITY_PUBLIC_KEY_PATH || "/opt/fonoster/keys/public.pem";
57
57
  exports.APISERVER_BIND_ADDR = e.APISERVER_BIND_ADDR || "0.0.0.0:50051";
58
58
  exports.APISERVER_HOST = e.APISERVER_HOST || "apiserver";
59
- exports.APISERVER_AUTOPILOT_ENDPOINT = e.APISERVER_AUTOPILOT_ENDPOINT || "autopilot:50061";
60
59
  // Frontend configurations
61
60
  exports.APP_URL = e.APP_URL;
62
61
  exports.ASTERISK_ARI_PROXY_URL = e.ASTERISK_ARI_PROXY_URL;
@@ -40,6 +40,8 @@ const getSttConfig_1 = require("./getSttConfig");
40
40
  const getTtsConfig_1 = require("./getTtsConfig");
41
41
  const SpeechToTextFactory_1 = require("../stt/SpeechToTextFactory");
42
42
  const TextToSpeechFactory_1 = require("../tts/TextToSpeechFactory");
43
+ const common_1 = require("@fonoster/common");
44
+ const envs_1 = require("../../envs");
43
45
  const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filename });
44
46
  const integrationsConfigSchema = zod_1.z.array(zod_1.z.object({
45
47
  name: zod_1.z.string(),
@@ -78,10 +80,15 @@ function createCreateContainer(prisma, pathToIntegrations) {
78
80
  const sttConfig = (0, getSttConfig_1.getSttConfig)(integrations, app);
79
81
  const tts = TextToSpeechFactory_1.TextToSpeechFactory.getEngine(app.textToSpeech.productRef, ttsConfig);
80
82
  const stt = SpeechToTextFactory_1.SpeechToTextFactory.getEngine(app.speechToText.productRef, sttConfig);
83
+ const actualEndpoint = app.endpoint === common_1.AUTOPILOT_SPECIAL_LOCAL_ADDRESS
84
+ ? common_1.AUTOPILOT_INTERNAL_ADDRESS
85
+ : app.endpoint === common_1.WELCOME_DEMO_SPECIAL_LOCAL_ADDRESS
86
+ ? `${envs_1.APISERVER_HOST}:50051`
87
+ : app.endpoint;
81
88
  return {
82
89
  ref: appRef,
83
90
  accessKeyId: app.accessKeyId,
84
- endpoint: app.endpoint,
91
+ endpoint: actualEndpoint,
85
92
  tts,
86
93
  stt
87
94
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/apiserver",
3
- "version": "0.8.46",
3
+ "version": "0.8.47",
4
4
  "description": "APIServer for Fonoster",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -21,13 +21,13 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@deepgram/sdk": "^3.5.1",
24
- "@fonoster/authz": "^0.8.45",
25
- "@fonoster/common": "^0.8.45",
26
- "@fonoster/identity": "^0.8.45",
27
- "@fonoster/logger": "^0.8.45",
28
- "@fonoster/sipnet": "^0.8.45",
29
- "@fonoster/streams": "^0.8.45",
30
- "@fonoster/types": "^0.8.45",
24
+ "@fonoster/authz": "^0.8.47",
25
+ "@fonoster/common": "^0.8.47",
26
+ "@fonoster/identity": "^0.8.47",
27
+ "@fonoster/logger": "^0.8.47",
28
+ "@fonoster/sipnet": "^0.8.47",
29
+ "@fonoster/streams": "^0.8.47",
30
+ "@fonoster/types": "^0.8.47",
31
31
  "@google-cloud/speech": "^6.6.0",
32
32
  "@google-cloud/text-to-speech": "^5.3.0",
33
33
  "@grpc/grpc-js": "~1.10.6",
@@ -73,5 +73,5 @@
73
73
  "@types/uuid": "^10.0.0",
74
74
  "@types/validator": "^13.12.0"
75
75
  },
76
- "gitHead": "f811ef9df8923fbfee40a9189d47056c4235fd65"
76
+ "gitHead": "33970ac7794e8e55333936ad3ad84f7260d5c138"
77
77
  }