mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
Use the request from CallSession for cancel (#268)
* Use the req from CallSession for cancel * Check cs is set --------- Co-authored-by: Matt Preskett <matt.preskett@netcall.com>
This commit is contained in:
@@ -27,7 +27,7 @@ class TaskRestDial extends Task {
|
|||||||
*/
|
*/
|
||||||
async exec(cs) {
|
async exec(cs) {
|
||||||
await super.exec(cs);
|
await super.exec(cs);
|
||||||
this.req = cs.req;
|
this.canCancel = true;
|
||||||
|
|
||||||
this._setCallTimer();
|
this._setCallTimer();
|
||||||
await this.awaitTaskDone();
|
await this.awaitTaskDone();
|
||||||
@@ -36,15 +36,15 @@ class TaskRestDial extends Task {
|
|||||||
kill(cs) {
|
kill(cs) {
|
||||||
super.kill(cs);
|
super.kill(cs);
|
||||||
this._clearCallTimer();
|
this._clearCallTimer();
|
||||||
if (this.req) {
|
if (this.canCancel && cs?.req) {
|
||||||
this.req.cancel();
|
this.canCancel = false;
|
||||||
this.req = null;
|
cs.req.cancel();
|
||||||
}
|
}
|
||||||
this.notifyTaskDone();
|
this.notifyTaskDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onConnect(dlg) {
|
async _onConnect(dlg) {
|
||||||
this.req = null;
|
this.canCancel = false;
|
||||||
const cs = this.callSession;
|
const cs = this.callSession;
|
||||||
cs.setDialog(dlg);
|
cs.setDialog(dlg);
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ class TaskRestDial extends Task {
|
|||||||
_onCallStatus(status) {
|
_onCallStatus(status) {
|
||||||
this.logger.debug(`CallStatus: ${status}`);
|
this.logger.debug(`CallStatus: ${status}`);
|
||||||
if (status >= 200) {
|
if (status >= 200) {
|
||||||
this.req = null;
|
this.canCancel = false;
|
||||||
this._clearCallTimer();
|
this._clearCallTimer();
|
||||||
if (status !== 200) this.notifyTaskDone();
|
if (status !== 200) this.notifyTaskDone();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user