@avakado.ai/schemas 1.1.17 → 1.1.18

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avakado.ai/schemas",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "description": "Canonical Mongo schemas, models, enums and index declarations shared by the Avakado services.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
package/src/media.js CHANGED
@@ -41,6 +41,7 @@ export const CONVERTERS = new Set([
41
41
  "identity",
42
42
  "pcm16:8000->pcm16:16000",
43
43
  "pcm16:8000->pcm16:24000",
44
+ "pcm16:16000->pcm16:24000",
44
45
  "pcm16:24000->pcm16:8000",
45
46
  "pcm16:24000->pcm16:16000",
46
47
  "pcm16:24000->g711_ulaw:8000",
@@ -73,9 +74,8 @@ export const CHANNEL_CATALOGS = {
73
74
  export const PROVIDER_CARDS = {
74
75
  openai: {
75
76
  symmetric: true,
77
+ // audio/pcm is 24 kHz only. audio/pcmu and audio/pcma carry no rate.
76
78
  wires: [
77
- wire("pcm16", 8000),
78
- wire("pcm16", 16000),
79
79
  wire("pcm16", 24000),
80
80
  wire("g711_ulaw", 8000),
81
81
  wire("g711_alaw", 8000),
package/src/media.test.js CHANGED
@@ -2,24 +2,25 @@ import assert from "node:assert/strict";
2
2
  import test from "node:test";
3
3
  import { MediaPlanError, negotiateCall, selectChannelMedia } from "./media.js";
4
4
 
5
- test("exotel default and openai share pcm16 8 kHz", () => {
5
+ test("exotel 8 kHz pcm is resampled to openai 24 kHz", () => {
6
6
  const plan = negotiateCall({ channelName: "Exotel", provider: "openai" });
7
7
  assert.deepEqual(plan.channel, { encoding: "pcm16", rate: 8000 });
8
- assert.deepEqual(plan.provider.input, plan.channel);
9
- assert.deepEqual(plan.provider.output, plan.channel);
10
- assert.equal(plan.uplink, "identity");
11
- assert.equal(plan.downlink, "identity");
8
+ assert.deepEqual(plan.provider.input, { encoding: "pcm16", rate: 24000 });
9
+ assert.deepEqual(plan.provider.output, { encoding: "pcm16", rate: 24000 });
10
+ assert.equal(plan.uplink, "pcm16:8000->pcm16:24000");
11
+ assert.equal(plan.downlink, "pcm16:24000->pcm16:8000");
12
12
  });
13
13
 
14
- test("user can move exotel to 16 kHz and openai follows", () => {
14
+ test("exotel 16 kHz pcm is resampled to openai 24 kHz", () => {
15
15
  const plan = negotiateCall({
16
16
  channelName: "exotel",
17
17
  channelConfig: { media: { encoding: "pcm16", rate: 16000 } },
18
18
  provider: "openai",
19
19
  });
20
20
  assert.equal(plan.channel.rate, 16000);
21
- assert.equal(plan.uplink, "identity");
22
- assert.equal(plan.downlink, "identity");
21
+ assert.equal(plan.provider.input.rate, 24000);
22
+ assert.equal(plan.uplink, "pcm16:16000->pcm16:24000");
23
+ assert.equal(plan.downlink, "pcm16:24000->pcm16:16000");
23
24
  });
24
25
 
25
26
  test("exotel 8 kHz and gemini bridge 16 kHz in and 24 kHz out", () => {