Skip to content

Commit

Permalink
WTEL-471
Browse files Browse the repository at this point in the history
  • Loading branch information
navrotskyj committed May 17, 2017
1 parent a92cddf commit 4be035f
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/middleware/dialerContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,25 @@ function getAmdSection(channel, amdConfig = {}) {
amdParams[param] = amdConfig[param]
}

const _if = {
"then": [
{
"hangup": "NORMAL_UNSPECIFIED"
},
{
"break": true
}
]
};

if (amdConfig.allowNotSure === true) {
_if.expression = " !(${amd_result} === 'HUMAN' || ${amd_result} === 'NOTSURE')";
_if.sysExpression = "!(sys.getChnVar(\"amd_result\") === 'HUMAN' || sys.getChnVar(\"amd_result\") === 'NOTSURE')";
} else {
_if.expression = "${amd_result} !== 'HUMAN'";
_if.sysExpression = "sys.getChnVar(\"amd_result\") !== 'HUMAN'";
}

return [
{
"setVar": "ignore_early_media=true"
Expand All @@ -111,18 +130,7 @@ function getAmdSection(channel, amdConfig = {}) {
"amd": amdParams
},
{
"if": {
"expression": "${amd_result} !== 'HUMAN'",
"sysExpression" : "sys.getChnVar(\"amd_result\") !== 'HUMAN'",
"then": [
{
"hangup": "NORMAL_UNSPECIFIED"
},
{
"break": true
}
]
}
"if": _if
}
]
}
Expand Down

0 comments on commit 4be035f

Please sign in to comment.