-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sensible default values for the sip config
- Loading branch information
Showing
3 changed files
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
const sipConfig = require('../config').sip | ||
const utils = require('./utils') | ||
const sipbundle = require('./sip/sip-bundle') | ||
|
||
let sipOptions = function sipOptions() { | ||
const from = sipConfig.from | ||
const to = sipConfig.to | ||
const model = utils.model() | ||
const from = sipConfig.from || '[email protected]' | ||
const to = sipConfig.to || (model === 'unknown' ? undefined : model + '@127.0.0.1') // For development, specify the sip.to config value | ||
const localIp = from?.split(':')[0].split('@')[1] | ||
const localPort = parseInt(from?.split(':')[1]) || 5060 | ||
const domain = sipConfig.domain | ||
const domain = sipConfig.domain || utils.domain() // For development, specify the sip.domain config value | ||
const expire = sipConfig.expire || 600 | ||
const sipdebug = sipConfig.debug | ||
|
||
if (!from || !to || !localIp || !localPort || !domain || !expire ) { | ||
console.error('Error: SIP From/To/Domain URIs not specified!') | ||
console.error('Error: SIP From/To/Domain URIs not specified! Current sip config: ') | ||
console.info(JSON.stringify(config.sip)) | ||
throw new Error('SIP From/To/Domain URIs not specified!') | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters