mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
support sbcCallId in calling/status hook (#934)
* support sbcCallId in calling/status hook * support sbcCallId in calling/status hook * support sbcCallId in calling/status hook * wip * wip * wip
This commit is contained in:
@@ -293,6 +293,8 @@ router.post('/',
|
|||||||
},
|
},
|
||||||
cbProvisional: (prov) => {
|
cbProvisional: (prov) => {
|
||||||
const callStatus = prov.body ? CallStatus.EarlyMedia : CallStatus.Ringing;
|
const callStatus = prov.body ? CallStatus.EarlyMedia : CallStatus.Ringing;
|
||||||
|
// Update call-id for sbc outbound INVITE
|
||||||
|
cs.callInfo.sbcCallid = prov.get('X-CID');
|
||||||
if ([180, 183].includes(prov.status) && prov.body) connectStream(prov.body);
|
if ([180, 183].includes(prov.status) && prov.body) connectStream(prov.body);
|
||||||
restDial.emit('callStatus', prov.status, !!prov.body);
|
restDial.emit('callStatus', prov.status, !!prov.body);
|
||||||
cs.emit('callStatusChange', {callStatus, sipStatus: prov.status});
|
cs.emit('callStatusChange', {callStatus, sipStatus: prov.status});
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class CallInfo {
|
|||||||
this.sipStatus = 100;
|
this.sipStatus = 100;
|
||||||
this.sipReason = 'Trying';
|
this.sipReason = 'Trying';
|
||||||
this.callStatus = CallStatus.Trying;
|
this.callStatus = CallStatus.Trying;
|
||||||
|
this.sbcCallid = req.get('X-CID');
|
||||||
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;
|
const {siprec} = req.locals;
|
||||||
@@ -129,6 +130,7 @@ class CallInfo {
|
|||||||
from: this.from,
|
from: this.from,
|
||||||
to: this.to,
|
to: this.to,
|
||||||
callId: this.callId,
|
callId: this.callId,
|
||||||
|
sbcCallid: this.sbcCallid,
|
||||||
sipStatus: this.sipStatus,
|
sipStatus: this.sipStatus,
|
||||||
sipReason: this.sipReason,
|
sipReason: this.sipReason,
|
||||||
callStatus: this.callStatus,
|
callStatus: this.callStatus,
|
||||||
|
|||||||
@@ -612,6 +612,7 @@ class TaskDial extends Task {
|
|||||||
dialCallStatus: obj.callStatus,
|
dialCallStatus: obj.callStatus,
|
||||||
dialSipStatus: obj.sipStatus,
|
dialSipStatus: obj.sipStatus,
|
||||||
dialCallSid: sd.callSid,
|
dialCallSid: sd.callSid,
|
||||||
|
dialSbcCallid: sd.callInfo.sbcCallid
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
switch (obj.callStatus) {
|
switch (obj.callStatus) {
|
||||||
|
|||||||
@@ -213,6 +213,8 @@ class SingleDialer extends Emitter {
|
|||||||
},
|
},
|
||||||
cbProvisional: (prov) => {
|
cbProvisional: (prov) => {
|
||||||
const status = {sipStatus: prov.status, sipReason: prov.reason};
|
const status = {sipStatus: prov.status, sipReason: prov.reason};
|
||||||
|
// Update call-id for sbc outbound INVITE
|
||||||
|
this.callInfo.sbcCallid = prov.get('X-CID');
|
||||||
if ([180, 183].includes(prov.status) && prov.body) {
|
if ([180, 183].includes(prov.status) && prov.body) {
|
||||||
if (status.callStatus !== CallStatus.EarlyMedia) {
|
if (status.callStatus !== CallStatus.EarlyMedia) {
|
||||||
status.callStatus = CallStatus.EarlyMedia;
|
status.callStatus = CallStatus.EarlyMedia;
|
||||||
|
|||||||
Reference in New Issue
Block a user