mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
Support for Cisco NBR for Agentassist (#303)
* NBR Support * NBR Support * NBR Support * re-invite Ok sdp should be sendonly * NBR Support * sendrecv sdp correction * Update siprec-utils.js * Updated comments * Siprec participants details added to hook * Bugfix siprec * Update call-info.js
This commit is contained in:
@@ -46,7 +46,16 @@ module.exports = function(srf, logger) {
|
|||||||
}
|
}
|
||||||
if (req.has('X-Authenticated-User')) req.locals.originatingUser = req.get('X-Authenticated-User');
|
if (req.has('X-Authenticated-User')) req.locals.originatingUser = req.get('X-Authenticated-User');
|
||||||
if (req.has('X-MS-Teams-Tenant-FQDN')) req.locals.msTeamsTenant = req.get('X-MS-Teams-Tenant-FQDN');
|
if (req.has('X-MS-Teams-Tenant-FQDN')) req.locals.msTeamsTenant = req.get('X-MS-Teams-Tenant-FQDN');
|
||||||
|
if (req.has('X-Cisco-Recording-Participant')) {
|
||||||
|
const ciscoParticipants = req.get('X-Cisco-Recording-Participant');
|
||||||
|
const regex = /sip:[\d]+@[\d]+\.[\d]+\.[\d]+\.[\d]+/g;
|
||||||
|
const sipURIs = ciscoParticipants.match(regex);
|
||||||
|
logger.info(`X-Cisco-Recording-Participant : ${sipURIs} `);
|
||||||
|
if (sipURIs && sipURIs.length > 0) {
|
||||||
|
req.locals.calledNumber = sipURIs[0];
|
||||||
|
req.locals.callingNumber = sipURIs[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,8 +103,10 @@ module.exports = function(srf, logger) {
|
|||||||
.find((p) => p.type === 'application/sdp')
|
.find((p) => p.type === 'application/sdp')
|
||||||
.content;
|
.content;
|
||||||
const {sdp1, sdp2, ...metadata} = await parseSiprecPayload(req, logger);
|
const {sdp1, sdp2, ...metadata} = await parseSiprecPayload(req, logger);
|
||||||
req.locals.calledNumber = metadata.caller.number;
|
if (!req.locals.calledNumber && !req.locals.calledNumber) {
|
||||||
req.locals.callingNumber = metadata.callee.number;
|
req.locals.calledNumber = metadata.caller.number;
|
||||||
|
req.locals.callingNumber = metadata.callee.number;
|
||||||
|
}
|
||||||
req.locals = {
|
req.locals = {
|
||||||
...req.locals,
|
...req.locals,
|
||||||
siprec: {
|
siprec: {
|
||||||
|
|||||||
@@ -33,6 +33,23 @@ class CallInfo {
|
|||||||
this.callStatus = CallStatus.Trying;
|
this.callStatus = CallStatus.Trying;
|
||||||
this.originatingSipIp = req.get('X-Forwarded-For');
|
this.originatingSipIp = req.get('X-Forwarded-For');
|
||||||
this.originatingSipTrunkName = req.get('X-Originating-Carrier');
|
this.originatingSipTrunkName = req.get('X-Originating-Carrier');
|
||||||
|
const {siprec} = req.locals;
|
||||||
|
if (siprec) {
|
||||||
|
const caller = parseUri(req.locals.callingNumber);
|
||||||
|
const callee = parseUri(req.locals.calledNumber);
|
||||||
|
this.participants = [
|
||||||
|
{
|
||||||
|
participant: 'caller',
|
||||||
|
uriUser: caller.user,
|
||||||
|
uriHost: caller.host
|
||||||
|
},
|
||||||
|
{
|
||||||
|
participant: 'callee',
|
||||||
|
uriUser: callee.user,
|
||||||
|
uriHost: callee.host
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (opts.parentCallInfo) {
|
else if (opts.parentCallInfo) {
|
||||||
// outbound call that is a child of an existing call
|
// outbound call that is a child of an existing call
|
||||||
|
|||||||
@@ -47,8 +47,16 @@ const parseSiprecPayload = (req, logger) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sdp || !meta) {
|
|
||||||
logger.info({payload: req.payload}, 'invalid SIPREC payload');
|
if (!meta && sdp) {
|
||||||
|
const arr = /^([^]+)(m=[^]+?)(m=[^]+?)$/.exec(sdp);
|
||||||
|
opts.sdp1 = `${arr[1]}${arr[2]}`;
|
||||||
|
opts.sdp2 = `${arr[1]}${arr[3]}\r\n`;
|
||||||
|
opts.sessionId = uuidv4();
|
||||||
|
logger.info({ payload: req.payload }, 'SIPREC payload with no metadata (e.g. Cisco NBR)');
|
||||||
|
resolve(opts);
|
||||||
|
} else if (!sdp || !meta) {
|
||||||
|
logger.info({ payload: req.payload }, 'invalid SIPREC payload');
|
||||||
return reject(new Error('expected multipart SIPREC body'));
|
return reject(new Error('expected multipart SIPREC body'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user