@jambonz/node-red-contrib-jambonz 2.4.29 → 2.4.30

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": "@jambonz/node-red-contrib-jambonz",
3
- "version": "2.4.29",
3
+ "version": "2.4.30",
4
4
  "description": "Node-RED nodes for jambonz platform",
5
5
  "keywords": [
6
6
  "node-red"
@@ -156,10 +156,10 @@
156
156
  }
157
157
  }
158
158
 
159
- function prepareSttControls(node) {
160
- var vendorElem = $('#node-input-transcriptionvendor');
161
- var languageElem = $('#node-input-recognizerlang');
162
- var mixtypeElem = $('#node-input-mixtype');
159
+ function prepareSttControls(node, vendor='#node-input-transcriptionvendor', lang='#node-input-recognizerlang', mixType='#node-input-mixtype') {
160
+ var vendorElem = $(vendor);
161
+ var languageElem = $(lang);
162
+ var mixtypeElem = $(mixType);
163
163
 
164
164
  console.log('entering prepareSttControls');
165
165
 
@@ -65,7 +65,16 @@
65
65
  vocabularynameType: {value: 'str'},
66
66
  vocabularyfiltername: {},
67
67
  vocabularyfilternameType: {value: 'str'},
68
- vocabularyfiltermethod: {}
68
+ vocabularyfiltermethod: {},
69
+ amd_actionHook : {},
70
+ amd_actionHookType: {value: 'str'},
71
+ amd_recognizer_vendor: {value: 'default'},
72
+ amd_recognizer_lang: {value: 'default'},
73
+ amd_thresholdWordCount: {},
74
+ amd_timers_decisionTimeoutMs: {},
75
+ amd_timers_greetingCompletionTimeoutMs:{},
76
+ amd_timers_noSpeechTimeoutMs: {},
77
+ amd_timers_toneTimeoutMs: {}
69
78
  },
70
79
  inputs:1,
71
80
  outputs:1,
@@ -147,6 +156,7 @@
147
156
  });
148
157
 
149
158
  prepareSttControls(node);
159
+ prepareSttControls(node, '#node-input-amd_recognizer_vendor', '#node-input-amd_recognizer_lang');
150
160
 
151
161
  $('#node-input-target-container').css('min-height','180px').css('min-width','450px').editableList({
152
162
  addItem: function(container, i, opt) {
@@ -652,6 +662,51 @@
652
662
  <ol id="node-input-headers-container"></ol>
653
663
  </div>
654
664
  </fieldset>
665
+ <fieldset>
666
+ <legend>Answering Machine Detection</legend>
667
+ <div class="form-row">
668
+ <label for="node-input-amd_actionHook">actionHook</label>
669
+ <input type="text" id="node-input-amd_actionHook">
670
+ <input type="hidden" id="node-input-amd_actionHookType">
671
+ </div>
672
+ <div class="form-row">
673
+ <label for="node-input-amd_recognizer_vendor">Vendor</label>
674
+ <select id="node-input-amd_recognizer_vendor">
675
+ <option value="default" selected>--application default--</option>
676
+ <option value="google">Google</option>
677
+ <option value="aws">AWS</option>
678
+ <option value="deepgram">deepgram</option>
679
+ <option value="microsoft">microsoft</option>
680
+ <option value="ibm">ibm</option>
681
+ <option value="nuance">nuance</option>
682
+ </select>
683
+ </div>
684
+ <div class="form-row">
685
+ <label for="node-input-amd_recognizer_lang">Language</label>
686
+ <select id="node-input-amd_recognizer_lang">
687
+ </select>
688
+ </div>
689
+ <div class="form-row">
690
+ <label for="node-input-amd_thresholdWordCount">Threshold Word Count</label>
691
+ <input type="text" id="node-input-amd_thresholdWordCount">
692
+ </div>
693
+ <div class="form-row">
694
+ <label for="node-input-amd_timers_decisionTimeoutMs">Decision Timeout</label>
695
+ <input type="text" id="node-input-amd_timers_decisionTimeoutMs">
696
+ </div>
697
+ <div class="form-row">
698
+ <label for="node-input-amd_timers_greetingCompletionTimeoutMs">Greeting Completion Timeout</label>
699
+ <input type="text" id="node-input-amd_timers_greetingCompletionTimeoutMs">
700
+ </div>
701
+ <div class="form-row">
702
+ <label for="node-input-amd_timers_noSpeechTimeoutMs">No-Speech Timeout</label>
703
+ <input type="text" id="node-input-amd_timers_noSpeechTimeoutMs">
704
+ </div>
705
+ <div class="form-row">
706
+ <label for="node-input-amd_timers_toneTimeoutMs">Tone Timeout</label>
707
+ <input type="text" id="node-input-amd_timers_toneTimeoutMs">
708
+ </div>
709
+ </fieldset>
655
710
  </div>
656
711
  </script>
657
712
 
package/src/nodes/dial.js CHANGED
@@ -49,7 +49,7 @@ module.exports = function(RED) {
49
49
  confirmHook: await new_resolve(RED, config.confirmhook, config.confirmhookType, node, msg),
50
50
  dialMusic: await new_resolve(RED, config.dialmusic, config.dialmusicType, node, msg),
51
51
  referHook: await new_resolve(RED, config.referhook, config.referhookType, node, msg),
52
- dtmfHook: await new_resolve(RED, config.dtmfhook, config.dtmfhookType, node, msg),
52
+ dtmfHook: await new_resolve(RED, config.dtmfhook, config.dtmfhookType, node, msg)
53
53
  };
54
54
 
55
55
  if (config.hasOwnProperty('anchormedia')) {
@@ -132,6 +132,31 @@ module.exports = function(RED) {
132
132
  delete data.dtmfHook;
133
133
  }
134
134
 
135
+ // AMD
136
+ const _amd_actionHook = await new_resolve(RED, config.amd_actionHook, config.amd_actionHookType, node, msg)
137
+ if (_amd_actionHook){
138
+ data.amd = {}
139
+ data.amd.actionHook = _amd_actionHook;
140
+ config.amd_thresholdWordCount && (data.amd.thresholdWordCount = Number(config.amd_thresholdWordCount))
141
+ data.amd.timers = {
142
+ ...(config.amd_timers_decisionTimeoutMs && {decisionTimeoutMs: Number(config.amd_timers_decisionTimeoutMs)}),
143
+ ...(config.amd_timers_greetingCompletionTimeoutMs && {greetingCompletionTimeoutMs: Number(config.amd_timers_greetingCompletionTimeoutMs)}),
144
+ ...(config.amd_timers_noSpeechTimeoutMs && {noSpeechTimeoutMs: Number(config.amd_timers_noSpeechTimeoutMs)}),
145
+ ...(config.amd_timers_toneTimeoutMs && {toneTimeoutMs: Number(config.amd_timers_toneTimeoutMs)}),
146
+ }
147
+ //If none of the timer values are set remove the object
148
+ if (Object.keys(data.amd.timers).length == 0){
149
+ delete(data.amd.timers)
150
+ }
151
+ //If custom recogniser is used
152
+ if (config.amd_recognizer_vendor != 'default'){
153
+ data.amd.recognizer = {
154
+ ...(config.amd_recognizer_vendor && {vendor : config.amd_recognizer_vendor}),
155
+ ...(config.amd_recognizer_lang && {language : config.amd_recognizer_lang})
156
+ }
157
+ }
158
+ }
159
+
135
160
  node.log(`dial verb: ${JSON.stringify(data)}`);
136
161
 
137
162
  appendVerb(msg, data);