mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
allow proxy in dial verb
This commit is contained in:
@@ -83,6 +83,7 @@ class TaskDial extends Task {
|
|||||||
this.confirmHook = this.data.confirmHook;
|
this.confirmHook = this.data.confirmHook;
|
||||||
this.confirmMethod = this.data.confirmMethod;
|
this.confirmMethod = this.data.confirmMethod;
|
||||||
this.dtmfHook = this.data.dtmfHook;
|
this.dtmfHook = this.data.dtmfHook;
|
||||||
|
this.proxy = this.data.proxy;
|
||||||
|
|
||||||
if (this.dtmfHook) {
|
if (this.dtmfHook) {
|
||||||
const {parentDtmfCollector, childDtmfCollector} = parseDtmfOptions(logger, this.data.dtmfCapture || {});
|
const {parentDtmfCollector, childDtmfCollector} = parseDtmfOptions(logger, this.data.dtmfCapture || {});
|
||||||
@@ -245,7 +246,7 @@ class TaskDial extends Task {
|
|||||||
const {req, srf} = cs;
|
const {req, srf} = cs;
|
||||||
const {getSBC} = srf.locals;
|
const {getSBC} = srf.locals;
|
||||||
const {lookupTeamsByAccount} = srf.locals.dbHelpers;
|
const {lookupTeamsByAccount} = srf.locals.dbHelpers;
|
||||||
const sbcAddress = getSBC();
|
const sbcAddress = this.proxy || getSBC();
|
||||||
const teamsInfo = {};
|
const teamsInfo = {};
|
||||||
|
|
||||||
if (!sbcAddress) throw new Error('no SBC found for outbound call');
|
if (!sbcAddress) throw new Error('no SBC found for outbound call');
|
||||||
|
|||||||
@@ -83,6 +83,9 @@ class Dialogflow extends Task {
|
|||||||
this.ep.removeCustomEventListener('dialogflow::end_of_utterance');
|
this.ep.removeCustomEventListener('dialogflow::end_of_utterance');
|
||||||
this.ep.removeCustomEventListener('dialogflow::error');
|
this.ep.removeCustomEventListener('dialogflow::error');
|
||||||
|
|
||||||
|
this.performAction({dialogflowResult: 'caller hungup'})
|
||||||
|
.catch((err) => this.logger.error({err}, 'dialogflow - error w/ action webook'));
|
||||||
|
|
||||||
await this.ep.api('uuid_break', this.ep.uuid).catch((err) => this.logger.info(err, 'Error killing audio'));
|
await this.ep.api('uuid_break', this.ep.uuid).catch((err) => this.logger.info(err, 'Error killing audio'));
|
||||||
}
|
}
|
||||||
this.notifyTaskDone();
|
this.notifyTaskDone();
|
||||||
@@ -97,7 +100,8 @@ class Dialogflow extends Task {
|
|||||||
this.ep.addCustomEventListener('dialogflow::end_of_utterance', this._onEndOfUtterance.bind(this, ep, cs));
|
this.ep.addCustomEventListener('dialogflow::end_of_utterance', this._onEndOfUtterance.bind(this, ep, cs));
|
||||||
this.ep.addCustomEventListener('dialogflow::error', this._onError.bind(this, ep, cs));
|
this.ep.addCustomEventListener('dialogflow::error', this._onError.bind(this, ep, cs));
|
||||||
|
|
||||||
const creds = JSON.stringify(JSON.parse(this.credentials));
|
const obj = typeof this.credentials === 'string' ? JSON.parse(this.credentials) : this.credentials;
|
||||||
|
const creds = JSON.stringify(obj);
|
||||||
await this.ep.set('GOOGLE_APPLICATION_CREDENTIALS', creds);
|
await this.ep.set('GOOGLE_APPLICATION_CREDENTIALS', creds);
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -112,6 +112,7 @@
|
|||||||
"target": ["#target"],
|
"target": ["#target"],
|
||||||
"timeLimit": "number",
|
"timeLimit": "number",
|
||||||
"timeout": "number",
|
"timeout": "number",
|
||||||
|
"proxy": "string",
|
||||||
"transcribe": "#transcribe"
|
"transcribe": "#transcribe"
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@@ -120,7 +121,7 @@
|
|||||||
},
|
},
|
||||||
"dialogflow": {
|
"dialogflow": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"credentials": "string",
|
"credentials": "object|string",
|
||||||
"project": "string",
|
"project": "string",
|
||||||
"lang": "string",
|
"lang": "string",
|
||||||
"actionHook": "object|string",
|
"actionHook": "object|string",
|
||||||
@@ -188,6 +189,7 @@
|
|||||||
"from": "string",
|
"from": "string",
|
||||||
"speech_synthesis_vendor": "string",
|
"speech_synthesis_vendor": "string",
|
||||||
"speech_synthesis_voice": "string",
|
"speech_synthesis_voice": "string",
|
||||||
|
"speech_synthesis_language": "string",
|
||||||
"speech_recognizer_vendor": "string",
|
"speech_recognizer_vendor": "string",
|
||||||
"speech_recognizer_language": "string",
|
"speech_recognizer_language": "string",
|
||||||
"tag": "object",
|
"tag": "object",
|
||||||
|
|||||||
Reference in New Issue
Block a user