ansible/dhall/asterisk.dhall

107 lines
2.6 KiB
Text
Raw Normal View History

2024-11-26 05:55:44 +00:00
let Text/concatMapSep = ./Prelude/Text/concatMapSep
2024-11-26 05:47:18 +00:00
let Mailbox =
{ Type = { id : Text, context : Text, name : Text, email : Text }
, default = { name = "", email = "" }
}
let Endpoint =
{ Type =
{ id : Text
, context : Text
, password : Text
, callerid : Text
, mailboxes : List Mailbox.Type
}
, default = { callerid = "", mailboxes = [] : List Mailbox.Type }
}
let mailboxes =
{ correl = Mailbox::{
, id = "100"
, context = "sailmaker"
, name = "Correl Roush"
}
}
let endpoints =
{ correl = Endpoint::{
, id = "100"
, context = "from-internal"
, password = "mJzTGkXdh02OVXGOaxcH8V3To"
, mailboxes = [ mailboxes.correl ]
}
, correl_softphone = Endpoint::{
, id = "101"
, context = "from-internal"
, password = "5KVzU5Ez77lIIv4SAyzDOnMWo"
, mailboxes = [ mailboxes.correl ]
}
, correl_conference = Endpoint::{
, id = "102"
, context = "from-internal"
, password = "mpHoQ29k2AiH4EN7IXL9vnE9j"
, mailboxes = [ mailboxes.correl ]
}
}
let mailbox/conf =
\(mailbox : Mailbox.Type) ->
"${mailbox.id} => ${mailbox.id},${mailbox.name},${mailbox.email}"
let mailbox/address =
\(mailbox : Mailbox.Type) -> "${mailbox.id}@${mailbox.context}"
let pjsip/endpoint =
\(endpoint : Endpoint.Type) ->
''
[${endpoint.id}]
type=endpoint
context=${endpoint.context}
callerid='${endpoint.callerid}'
disallow=all
allow=ulaw
auth=${endpoint.id}
aors=${endpoint.id}
mailboxes=${Text/concatMapSep
","
Mailbox.Type
mailbox/address
endpoint.mailboxes}''
let pjsip/auth =
\(endpoint : Endpoint.Type) ->
''
[${endpoint.id}]
type=auth
auth_type=userpass
password=${endpoint.password}
username=${endpoint.id}''
let pjsip/aor =
\(endpoint : Endpoint.Type) ->
''
[${endpoint.id}]
type=aor
max_contacts=1
remove_existing=yes''
let pjsip/all =
\(endpoint : Endpoint.Type) ->
''
${pjsip/endpoint endpoint}
${pjsip/auth endpoint}
${pjsip/aor endpoint}
''
in Text/concatMapSep
"\n"
Endpoint.Type
pjsip/all
[ endpoints.correl
, endpoints.correl_softphone
, endpoints.correl_conference
]