mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
initial support for conference and queues
This commit is contained in:
@@ -204,6 +204,8 @@ class CallSession extends Emitter {
|
||||
}
|
||||
|
||||
trackTmpFile(path) {
|
||||
// TODO: don't add if its already in the list (should we make it a set?)
|
||||
this.logger.debug(`adding tmp file to track ${path}`);
|
||||
this.tmpFiles.add(path);
|
||||
}
|
||||
|
||||
@@ -477,6 +479,7 @@ class CallSession extends Emitter {
|
||||
const ep = await this.ms.createEndpoint({remoteSdp: this.req.body});
|
||||
ep.cs = this;
|
||||
this.ep = ep;
|
||||
await ep.set('hangup_after_bridge', false);
|
||||
|
||||
this.logger.debug('allocated endpoint');
|
||||
|
||||
@@ -534,6 +537,8 @@ class CallSession extends Emitter {
|
||||
return;
|
||||
}
|
||||
this.ep = await this.ms.createEndpoint({remoteSdp: this.dlg.remote.sdp});
|
||||
await this.ep.set('hangup_after_bridge', false);
|
||||
|
||||
await this.dlg.modify(this.ep.local.sdp);
|
||||
this.logger.debug('CallSession:replaceEndpoint completed');
|
||||
return this.ep;
|
||||
@@ -631,6 +636,7 @@ class CallSession extends Emitter {
|
||||
}
|
||||
if (!this.ep) {
|
||||
this.ep = await this.ms.createEndpoint({remoteSdp: this.req.body});
|
||||
await this.ep.set('hangup_after_bridge', false);
|
||||
}
|
||||
return {ms: this.ms, ep: this.ep};
|
||||
}
|
||||
@@ -639,12 +645,32 @@ class CallSession extends Emitter {
|
||||
* A conference that the current task is waiting on has just started
|
||||
* @param {*} opts
|
||||
*/
|
||||
notifyStartConference(opts) {
|
||||
notifyConferenceEvent(opts) {
|
||||
if (this.currentTask && typeof this.currentTask.notifyStartConference === 'function') {
|
||||
this.currentTask.notifyStartConference(this, opts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify a session in an Enqueue task of an event
|
||||
* @param {*} opts
|
||||
*/
|
||||
notifyEnqueueEvent(opts) {
|
||||
if (this.currentTask && typeof this.currentTask.notifyQueueEvent === 'function') {
|
||||
this.currentTask.notifyQueueEvent(this, opts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify a session in a Dequeue task of an event
|
||||
* @param {*} opts
|
||||
*/
|
||||
notifyDequeueEvent(opts) {
|
||||
if (this.currentTask && typeof this.currentTask.notifyQueueEvent === 'function') {
|
||||
this.currentTask.notifyQueueEvent(this, opts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer the call to another feature server
|
||||
* @param {uri} sip uri to refer the call to
|
||||
@@ -656,7 +682,8 @@ class CallSession extends Emitter {
|
||||
method: 'REFER',
|
||||
headers: {
|
||||
'Refer-To': referTo,
|
||||
'Referred-By': `sip:${this.srf.locals.localSipAddress}`
|
||||
'Referred-By': `sip:${this.srf.locals.localSipAddress}`,
|
||||
'X-Retain-Call-Sid': this.callSid
|
||||
}
|
||||
});
|
||||
return [200, 202].includes(res.status);
|
||||
|
||||
Reference in New Issue
Block a user