From 6926168fb32275069e940f23daad7f6ff90de095 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Tue, 26 Nov 2024 00:47:18 -0500 Subject: [PATCH] [dhall] Add asterisk --- dhall/asterisk.dhall | 106 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 dhall/asterisk.dhall diff --git a/dhall/asterisk.dhall b/dhall/asterisk.dhall new file mode 100644 index 0000000..8571bbe --- /dev/null +++ b/dhall/asterisk.dhall @@ -0,0 +1,106 @@ +let Text/concatMapSep = https://prelude.dhall-lang.org/Text/concatMapSep + +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 + ]