mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
minor logging
This commit is contained in:
@@ -9,25 +9,29 @@ const {CallStatus, CallDirection} = require('../../utils/constants');
|
||||
*/
|
||||
function retrieveCallSession(callSid, opts) {
|
||||
if (opts.call_status_hook && !opts.call_hook) {
|
||||
throw new DbErrorBadRequest('call_status_hook can be updated only when call_hook is also being updated');
|
||||
throw new DbErrorBadRequest(
|
||||
`call_status_hook can be updated only when call_hook is also being updated for call_sid ${callSid}`);
|
||||
}
|
||||
const cs = sessionTracker.get(callSid);
|
||||
if (!cs) {
|
||||
throw new DbErrorUnprocessableRequest('call session is gone');
|
||||
throw new DbErrorUnprocessableRequest(`call session is gone for call_sid ${callSid}`);
|
||||
}
|
||||
|
||||
if (opts.call_status === CallStatus.Completed && !cs.hasStableDialog) {
|
||||
throw new DbErrorUnprocessableRequest('current call state is incompatible with requested action');
|
||||
throw new DbErrorUnprocessableRequest(
|
||||
`current call state is incompatible with requested action for call_sid ${callSid}`);
|
||||
}
|
||||
else if (opts.call_status === CallStatus.NoAnswer) {
|
||||
if (cs.direction === CallDirection.Outbound) {
|
||||
if (!cs.isOutboundCallRinging) {
|
||||
throw new DbErrorUnprocessableRequest('current call state is incompatible with requested action');
|
||||
throw new DbErrorUnprocessableRequest(
|
||||
`current call state is incompatible with requested action for call_sid ${callSid}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (cs.isInboundCallAnswered) {
|
||||
throw new DbErrorUnprocessableRequest('current call state is incompatible with requested action');
|
||||
throw new DbErrorUnprocessableRequest(
|
||||
`current call state is incompatible with requested action for call_sid ${callSid}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user