@jambonz/mrf 0.1.5 → 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.
@@ -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.5",
3
+ "version": "0.1.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "node --test",