@fonoster/common 0.22.3 → 0.24.0

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.
@@ -81,6 +81,29 @@ message CallDetailRecord {
81
81
  int32 duration = 9;
82
82
  // The call direction
83
83
  CallDirection direction = 10;
84
+
85
+ // Answering Machine Detection verdict for the call. Mirrors
86
+ // fonoster.voice.v1beta2.Amd.Status; duplicated here (nested, like
87
+ // TrackCallResponse.Status below) because calls.proto does not import
88
+ // voice.proto and a top-level enum's values would collide with CallStatus's.
89
+ enum AmdStatus {
90
+ AMD_STATUS_UNSPECIFIED = 0;
91
+ HUMAN = 1;
92
+ MACHINE = 2;
93
+ VOICEMAIL = 3;
94
+ IVR = 4;
95
+ UNKNOWN = 5;
96
+ }
97
+ // Answering Machine Detection verdict, absent when AMD did not run
98
+ AmdStatus amd_status = 11;
99
+ // Confidence for the reported amd_status, 0..1
100
+ float amd_confidence = 12;
101
+ // Identifier of the detector that produced the verdict (e.g. "asterisk-amd@1")
102
+ string amd_detector = 13;
103
+ // Wall-clock time spent producing the verdict, in milliseconds
104
+ int32 amd_latency_ms = 14;
105
+ // Detector-specific cause code (e.g. Asterisk's AMDCAUSE), useful for tuning
106
+ string amd_cause = 15;
84
107
  }
85
108
 
86
109
  // The request message for Calls.Call
@@ -67,6 +67,40 @@ message CreateSessionRequest {
67
67
 
68
68
  // Metadata associated with the session
69
69
  map<string, string> metadata = 10;
70
+
71
+ // Answering Machine Detection result, computed on early call audio before
72
+ // this session is dispatched. Absent/UNSPECIFIED when the probe is disabled.
73
+ Amd amd = 12;
74
+ }
75
+
76
+ // Answering Machine Detection verdict for the answered call
77
+ message Amd {
78
+ enum Status {
79
+ // The probe was disabled or did not run
80
+ AMD_STATUS_UNSPECIFIED = 0;
81
+ // A live person answered
82
+ HUMAN = 1;
83
+ // A generic answering machine answered
84
+ MACHINE = 2;
85
+ // A personal or carrier voicemail greeting answered
86
+ VOICEMAIL = 3;
87
+ // An auto-attendant / IVR menu answered
88
+ IVR = 4;
89
+ // The probe ran but was inconclusive (low confidence, silence, or timeout)
90
+ UNKNOWN = 5;
91
+ }
92
+
93
+ // The detected class of answerer
94
+ Status status = 1;
95
+
96
+ // Model confidence for the reported status, 0..1
97
+ float confidence = 2;
98
+
99
+ // Identifier of the detector that produced the verdict (e.g. "asterisk-amd@1")
100
+ string detector = 3;
101
+
102
+ // Wall-clock time spent producing the verdict, in milliseconds
103
+ int32 latency_ms = 4;
70
104
  }
71
105
 
72
106
  // Common request for verbs
@@ -73,6 +73,20 @@ declare enum StreamContent {
73
73
  STOP_STREAM_GATHER_RESPONSE = "stopStreamGatherResponse",
74
74
  STREAM_GATHER_PAYLOAD = "streamGatherPayload"
75
75
  }
76
+ declare enum AmdStatus {
77
+ UNSPECIFIED = "AMD_STATUS_UNSPECIFIED",
78
+ HUMAN = "HUMAN",
79
+ MACHINE = "MACHINE",
80
+ VOICEMAIL = "VOICEMAIL",
81
+ IVR = "IVR",
82
+ UNKNOWN = "UNKNOWN"
83
+ }
84
+ type Amd = {
85
+ status: AmdStatus;
86
+ confidence: number;
87
+ detector: string;
88
+ latencyMs: number;
89
+ };
76
90
  type VoiceClientConfig = {
77
91
  appRef: string;
78
92
  accessKeyId: string;
@@ -85,6 +99,7 @@ type VoiceClientConfig = {
85
99
  sessionToken: string;
86
100
  callDirection: CallDirection;
87
101
  metadata?: Record<string, string>;
102
+ amd?: Amd;
88
103
  };
89
104
  type VoiceIn = {
90
105
  request?: VoiceRequest;
@@ -137,4 +152,4 @@ type BaseVoiceStream<T, W> = {
137
152
  };
138
153
  type VoiceSessionStreamServer = BaseVoiceStream<VoiceIn, VoiceOut>;
139
154
  type VoiceSessionStreamClient = BaseVoiceStream<VoiceOut | GrpcError, VoiceIn | GrpcError>;
140
- export { DATA, END, ERROR, StreamContent, StreamEvent, VoiceClientConfig, VoiceIn, VoiceOut, VoiceSessionStreamClient, VoiceSessionStreamServer };
155
+ export { Amd, AmdStatus, DATA, END, ERROR, StreamContent, StreamEvent, VoiceClientConfig, VoiceIn, VoiceOut, VoiceSessionStreamClient, VoiceSessionStreamServer };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamEvent = exports.StreamContent = exports.ERROR = exports.END = exports.DATA = void 0;
3
+ exports.StreamEvent = exports.StreamContent = exports.ERROR = exports.END = exports.DATA = exports.AmdStatus = void 0;
4
4
  const DATA = "data";
5
5
  exports.DATA = DATA;
6
6
  const END = "end";
@@ -50,3 +50,14 @@ var StreamContent;
50
50
  StreamContent["STOP_STREAM_GATHER_RESPONSE"] = "stopStreamGatherResponse";
51
51
  StreamContent["STREAM_GATHER_PAYLOAD"] = "streamGatherPayload";
52
52
  })(StreamContent || (exports.StreamContent = StreamContent = {}));
53
+ // Answering Machine Detection verdict. String values match the proto enum value
54
+ // names so the object round-trips through @grpc/proto-loader (enums: String).
55
+ var AmdStatus;
56
+ (function (AmdStatus) {
57
+ AmdStatus["UNSPECIFIED"] = "AMD_STATUS_UNSPECIFIED";
58
+ AmdStatus["HUMAN"] = "HUMAN";
59
+ AmdStatus["MACHINE"] = "MACHINE";
60
+ AmdStatus["VOICEMAIL"] = "VOICEMAIL";
61
+ AmdStatus["IVR"] = "IVR";
62
+ AmdStatus["UNKNOWN"] = "UNKNOWN";
63
+ })(AmdStatus || (exports.AmdStatus = AmdStatus = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/common",
3
- "version": "0.22.3",
3
+ "version": "0.24.0",
4
4
  "description": "Common library for Fonoster projects",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -18,7 +18,7 @@
18
18
  "clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo"
19
19
  },
20
20
  "dependencies": {
21
- "@fonoster/logger": "^0.22.0",
21
+ "@fonoster/logger": "^0.24.0",
22
22
  "@grpc/grpc-js": "~1.10.11",
23
23
  "@grpc/proto-loader": "^0.7.15",
24
24
  "@influxdata/influxdb-client": "^1.35.0",
@@ -49,5 +49,5 @@
49
49
  "devDependencies": {
50
50
  "@types/nodemailer": "^6.4.21"
51
51
  },
52
- "gitHead": "2123e04933b54d78c9e93e64102ec89dc6fb79b6"
52
+ "gitHead": "36670cb30dbc0604029b2d49a59153c53f69fe1b"
53
53
  }