support OPTIONS ping to SBCs

This commit is contained in:
Dave Horton
2020-02-17 21:41:35 -05:00
parent 3c89b7fd76
commit 162dfff5a3
9 changed files with 109 additions and 77 deletions

View File

@@ -238,10 +238,11 @@ class TaskDial extends Task {
async _attemptCalls(cs) {
const {req, srf} = cs;
const {getSBC} = srf;
const sbcAddress = cs.direction === CallDirection.Inbound ?
`${req.source_address}:${req.source_port}` :
srf.locals.sbcs[0];
getSBC();
if (!sbcAddress) throw new Error('no SBC found for outbound call');
const opts = {
headers: req && req.has('X-CID') ? Object.assign(this.headers, {'X-CID': req.get('X-CID')}) : this.headers,
proxy: `sip:${sbcAddress}`,