@jambonz/mrf 0.1.4 → 0.1.6

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/lib/endpoint.js CHANGED
@@ -541,13 +541,23 @@ class Endpoint extends EventEmitter {
541
541
  */
542
542
  function ttsVars(tts) {
543
543
  if (!tts) return {};
544
- return {
544
+ const out = {
545
545
  ...(tts.playbackId && {variable_tts_playback_id: tts.playbackId}),
546
546
  ...(tts.ttfbMs !== undefined && {variable_tts_time_to_first_byte_ms: String(tts.ttfbMs)}),
547
547
  ...(tts.cacheFilename && {variable_tts_cache_filename: tts.cacheFilename}),
548
548
  ...(tts.error && {variable_tts_error: tts.error}),
549
549
  ...(tts.responseCode !== undefined && {variable_tts_response_code: String(tts.responseCode)}),
550
550
  };
551
+ /* vendor dial/response metadata (request id, connect timings, voice):
552
+ * FS modules exposed these as tts_<vendor>_<field> channel variables
553
+ * and the feature-server turns every variable_tts_* into an otel span
554
+ * attribute */
555
+ if (tts.vendor && tts.info) {
556
+ for (const [k, v] of Object.entries(tts.info)) {
557
+ out[`variable_tts_${tts.vendor}_${k}`] = String(v);
558
+ }
559
+ }
560
+ return out;
551
561
  }
552
562
 
553
563
  module.exports = Endpoint;
@@ -136,7 +136,9 @@ class MediaServer extends EventEmitter {
136
136
  const data = {};
137
137
  if (opts.remoteSdp) data.remoteSdp = opts.remoteSdp;
138
138
  if (opts.codecs) data.codecs = Array.isArray(opts.codecs) ? opts.codecs : [opts.codecs];
139
- if (opts.tags) data.tags = opts.tags;
139
+ /* direction tag for session accounting (mediajam-cli subtotals):
140
+ * connectCaller marks inbound; everything else defaults outbound */
141
+ data.tags = { direction: 'outbound', ...(opts.tags || {}) };
140
142
  const options = {};
141
143
  if (opts.media_timeout) options.mediaTimeoutMs = parseInt(opts.media_timeout, 10);
142
144
  if (opts.media_hold_timeout) options.holdTimeoutMs = parseInt(opts.media_hold_timeout, 10);
@@ -154,7 +156,11 @@ class MediaServer extends EventEmitter {
154
156
  * it. Works with drachtio req/res objects (duck-typed).
155
157
  */
156
158
  async connectCaller(req, res, opts = {}) {
157
- const endpoint = await this.createEndpoint({ ...opts, remoteSdp: req.body });
159
+ const endpoint = await this.createEndpoint({
160
+ ...opts,
161
+ remoteSdp: req.body,
162
+ tags: { direction: 'inbound', ...(opts.tags || {}) }
163
+ });
158
164
  const dialog = await res.send(200, { body: endpoint.local.sdp });
159
165
  return { endpoint, dialog };
160
166
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/mrf",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "node --test",