Skip to content

Commit

Permalink
fix sipRedirect
Browse files Browse the repository at this point in the history
  • Loading branch information
navrotskyj committed Aug 29, 2017
1 parent f31575c commit acf9087
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/middleware/callRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,7 @@ CallRouter.prototype.__bridge = function (app, cb) {
case "sip":
_data = _data.concat('[', 'webitel_call_uuid=${create_uuid()},sip_invite_domain=${domain_name},' +
'presence_id=', endpoint['name'], '@${domain_name}');

if (endpoint.hasOwnProperty('parameters') && endpoint['parameters'] instanceof Array) {
_data = _data.concat(',', endpoint['parameters'].join(','));
};
Expand All @@ -1601,9 +1602,11 @@ CallRouter.prototype.__bridge = function (app, cb) {
case "webrtc":
_data = _data.concat('[', 'webitel_call_uuid=${create_uuid()},sip_invite_domain=${domain_name},' +
'presence_id=', endpoint['name'], '@${domain_name}');

if (endpoint.hasOwnProperty('parameters') && endpoint['parameters'] instanceof Array) {
_data = _data.concat(',', endpoint['parameters'].join(','));
};

_data = _data.concat(']${verto_contact(', endpoint['name'], '@${domain_name})}');
break;
default :
Expand All @@ -1621,7 +1624,7 @@ CallRouter.prototype.__bridge = function (app, cb) {
});

var pickup = '';
if (prop['pickup'] && prop['strategy'] != 'failover') {
if (prop['pickup'] && prop['strategy'] !== 'failover') {
if (prop['pickup'] instanceof Array) {
prop['pickup'].forEach(function (item) {
pickup += ',pickup/' + item + '@${domain_name}'
Expand Down Expand Up @@ -2581,7 +2584,7 @@ CallRouter.prototype.__eavesdrop = function (app, cb) {
CallRouter.prototype.__sipRedirect = function (app, cb) {
var prop = app[OPERATION.SIP_REDIRECT],
app = FS_COMMAND.REDIRECT;
if (+this.getChnVar('answer_epoch') > 0)
if (+this.getChnVar('Caller-Channel-Answered-Time') > 0)
app = FS_COMMAND.DEFLECT;

this.execApp({
Expand Down

0 comments on commit acf9087

Please sign in to comment.