more rest-dial testing

This commit is contained in:
Dave Horton
2020-02-02 15:58:33 -05:00
parent 3df8b2d940
commit a697840de7
4 changed files with 24 additions and 9 deletions

View File

@@ -27,8 +27,8 @@ class CallInfo {
this.accountSid = parentCallInfo.accountSid;
this.applicationSid = parentCallInfo.applicationSid;
this.from = req.callingNumber;
this.to = to || req.calledNumber;
this.callerName = this.from.name || req.callingNumber;
this.to = to;
this.callerId = this.from.name || req.callingNumber;
this.callId = req.get('Call-ID');
this.callStatus = CallStatus.Trying,
this.sipStatus = 100;
@@ -70,7 +70,7 @@ class CallInfo {
callId: this.callId,
sipStatus: this.sipStatus,
callStatus: this.callStatus,
callerId: this.callId,
callerId: this.callerId,
accountSid: this.accountSid,
applicationSid: this.applicationSid
};

View File

@@ -223,7 +223,7 @@ class CallSession extends Emitter {
this.callInfo.updateCallStatus(callStatus, sipStatus);
if (typeof duration === 'number') this.callInfo.duration = duration;
try {
this.notifyHook(call_status_hook);
if (call_status_hook) this.notifyHook(call_status_hook);
} catch (err) {
this.logger.info(err, `CallSession:_notifyCallStatusChange error sending ${callStatus} ${sipStatus}`);
}

View File

@@ -14,6 +14,9 @@ class RestCallSession extends CallSession {
});
this.req = req;
this.ep = ep;
this.on('callStatusChange', this._notifyCallStatusChange.bind(this));
this._notifyCallStatusChange({callStatus: CallStatus.Trying, sipStatus: 100});
}
setDialog(dlg) {