mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-02-15 10:49:07 +00:00
Compare commits
2 Commits
v0.9.6-rc3
...
feat/updat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b72c8316c | ||
|
|
4271a3fe3d |
@@ -1,6 +1,7 @@
|
|||||||
const InboundCallSession = require('./inbound-call-session');
|
const InboundCallSession = require('./inbound-call-session');
|
||||||
const {createSipRecPayload} = require('../utils/siprec-utils');
|
const {createSipRecPayload} = require('../utils/siprec-utils');
|
||||||
const {CallStatus} = require('../utils/constants');
|
const {CallStatus} = require('../utils/constants');
|
||||||
|
const {parseSiprecPayload} = require('../utils/siprec-utils');
|
||||||
/**
|
/**
|
||||||
* @classdesc Subclass of InboundCallSession. This represents a CallSession that is
|
* @classdesc Subclass of InboundCallSession. This represents a CallSession that is
|
||||||
* established for an inbound SIPREC call.
|
* established for an inbound SIPREC call.
|
||||||
@@ -16,6 +17,31 @@ class SipRecCallSession extends InboundCallSession {
|
|||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async _onReinvite(req, res) {
|
||||||
|
try {
|
||||||
|
const {sdp1: reSdp1, sdp2: reSdp2, metadata: reMetadata} = await parseSiprecPayload(req, this.logger);
|
||||||
|
this.sdp1 = reSdp1;
|
||||||
|
this.sdp2 = reSdp2;
|
||||||
|
this.metadata = reMetadata;
|
||||||
|
|
||||||
|
if (this.ep && this.ep2) {
|
||||||
|
let remoteSdp = this.sdp1.replace(/sendonly/, 'sendrecv');
|
||||||
|
const newSdp1 = await this.ep.modify(remoteSdp);
|
||||||
|
remoteSdp = this.sdp2.replace(/sendonly/, 'sendrecv');
|
||||||
|
const newSdp2 = await this.ep2.modify(remoteSdp);
|
||||||
|
const combinedSdp = await createSipRecPayload(newSdp1, newSdp2, this.logger);
|
||||||
|
res.send(200, {body: combinedSdp});
|
||||||
|
this.logger.info({offer: req.body, answer: combinedSdp}, 'handling reINVITE');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.logger.info('got reINVITE but no endpoint and media has not been released');
|
||||||
|
res.send(488);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.logger.error(err, 'Error handling reinvite');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async answerSipRecCall() {
|
async answerSipRecCall() {
|
||||||
try {
|
try {
|
||||||
this.ms = this.getMS();
|
this.ms = this.getMS();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
"@jambonz/db-helpers": "^0.7.4",
|
"@jambonz/db-helpers": "^0.7.4",
|
||||||
"@jambonz/http-health-check": "^0.0.1",
|
"@jambonz/http-health-check": "^0.0.1",
|
||||||
"@jambonz/realtimedb-helpers": "^0.7.0",
|
"@jambonz/realtimedb-helpers": "^0.7.0",
|
||||||
"@jambonz/speech-utils": "^0.0.9",
|
"@jambonz/speech-utils": "^0.0.11",
|
||||||
"@jambonz/stats-collector": "^0.1.6",
|
"@jambonz/stats-collector": "^0.1.6",
|
||||||
"@jambonz/time-series": "^0.2.5",
|
"@jambonz/time-series": "^0.2.5",
|
||||||
"@jambonz/verb-specifications": "^0.0.11",
|
"@jambonz/verb-specifications": "^0.0.11",
|
||||||
|
|||||||
Reference in New Issue
Block a user