mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
rest:dial: Support sipindialog hook (#531)
* support sipindialog hook * rename sipindialog method
This commit is contained in:
@@ -16,6 +16,7 @@ class TaskRestDial extends Task {
|
|||||||
this.to = this.data.to;
|
this.to = this.data.to;
|
||||||
this.call_hook = this.data.call_hook;
|
this.call_hook = this.data.call_hook;
|
||||||
this.timeout = this.data.timeout || 60;
|
this.timeout = this.data.timeout || 60;
|
||||||
|
this.sipRequestWithinDialogHook = this.data.sipRequestWithinDialogHook;
|
||||||
|
|
||||||
this.on('connect', this._onConnect.bind(this));
|
this.on('connect', this._onConnect.bind(this));
|
||||||
this.on('callStatus', this._onCallStatus.bind(this));
|
this.on('callStatus', this._onCallStatus.bind(this));
|
||||||
@@ -64,7 +65,7 @@ class TaskRestDial extends Task {
|
|||||||
const cs = this.callSession;
|
const cs = this.callSession;
|
||||||
cs.setDialog(dlg);
|
cs.setDialog(dlg);
|
||||||
this.logger.debug('TaskRestDial:_onConnect - call connected');
|
this.logger.debug('TaskRestDial:_onConnect - call connected');
|
||||||
|
if (this.sipRequestWithinDialogHook) this._initSipRequestWithinDialogHandler(cs, dlg);
|
||||||
try {
|
try {
|
||||||
const b3 = this.getTracingPropagation();
|
const b3 = this.getTracingPropagation();
|
||||||
const httpHeaders = b3 && {b3};
|
const httpHeaders = b3 && {b3};
|
||||||
@@ -142,6 +143,16 @@ class TaskRestDial extends Task {
|
|||||||
this.logger.error({err}, 'Rest:dial:_onAmdEvent - error calling actionHook');
|
this.logger.error({err}, 'Rest:dial:_onAmdEvent - error calling actionHook');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_initSipRequestWithinDialogHandler(cs, dlg) {
|
||||||
|
cs.sipRequestWithinDialogHook = this.sipRequestWithinDialogHook;
|
||||||
|
dlg.on('info', this._onRequestWithinDialog.bind(this, cs));
|
||||||
|
dlg.on('message', this._onRequestWithinDialog.bind(this, cs));
|
||||||
|
}
|
||||||
|
|
||||||
|
async _onRequestWithinDialog(cs, req, res) {
|
||||||
|
cs._onRequestWithinDialog(req, res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = TaskRestDial;
|
module.exports = TaskRestDial;
|
||||||
|
|||||||
Reference in New Issue
Block a user