From 3568b66aba098a07dd9ea9106f6b9fe182a3dc0e Mon Sep 17 00:00:00 2001 From: Jack Hadrill Date: Sat, 15 Feb 2020 03:33:41 +0000 Subject: [PATCH] Refactored to include Twilio-based SIP trunk. --- asterisk/extensions.conf | 38 ++++++++++++++++++++++++++++++++++++++ asterisk/modules.conf | 2 ++ asterisk/sip.conf | 35 +++++++++++++++++++++++++++++++++++ asterisk/voicemail.conf | 12 ++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 asterisk/extensions.conf create mode 100644 asterisk/modules.conf create mode 100644 asterisk/sip.conf create mode 100644 asterisk/voicemail.conf diff --git a/asterisk/extensions.conf b/asterisk/extensions.conf new file mode 100644 index 0000000..018a4cd --- /dev/null +++ b/asterisk/extensions.conf @@ -0,0 +1,38 @@ +[+441234567890] + ; Redirect incoming calls from trunk with context +441234567890 to internal extension 0. + exten => _+X.,1,Goto(internal,0,1) + +[outgoing] + ; Redirect all calls entering this context via SIP trunk "twilio". + exten => _X.,1,Dial(SIP/twilio/+${EXTEN}) + same => n,Hangup + + +[internal] + ; Dialplan for extension 1000. + ; Dial SIP user 1000. Timeout after 10 seconds. + exten => 1000,1,Dial(SIP/1000,10) + same => n,VoiceMail(${EXTEN}) + same => n,Hangup + + ; Dialplan for extension 1001. + exten => 1001,1,Dial(SIP/1001,10) + same => n,VoiceMail(${EXTEN}) + same => n,Hangup + + + ; Dialgroup "everyone" at extension 0 to ring mulitple extensions. + exten => 0,1,Set(DIALGROUP(everyone,add)=SIP/1000) + same => n,Set(DIALGROUP(everyone,add)=SIP/1001) + same => n,Dial(${DIALGROUP(everyone)},10) + same => n,VoiceMail(${EXTEN}) + same => n,Hangup + + + ; Dialplans for redirecting calls to outgoing context. + ; Redirect international calls in format 00441234567890. + exten => _00X.,1,Goto(outgoing,${EXTEN:2},1) + ; Redirect international calls in format +441234567890. + exten => _+X.,1,Goto(outgoing,${EXTEN:1},1) + ; Redirect outgoing national calls in format 01234567890. + exten => _0ZX.,1,Goto(outgoing,44${EXTEN:1},1) \ No newline at end of file diff --git a/asterisk/modules.conf b/asterisk/modules.conf new file mode 100644 index 0000000..c008fd9 --- /dev/null +++ b/asterisk/modules.conf @@ -0,0 +1,2 @@ +[modules] + autoload=yes \ No newline at end of file diff --git a/asterisk/sip.conf b/asterisk/sip.conf new file mode 100644 index 0000000..63fb2ef --- /dev/null +++ b/asterisk/sip.conf @@ -0,0 +1,35 @@ +[general] + ; Default context for incoming calls. + context=public + ; Determines whether a phone is available before accepting call. + qualify=yes + +; Settings common to all trunks. +[trunk](!) + type=peer + nat=no + qualify=yes + insecure=port,invite + dtmfmode=rfc2833 + allow=ulaw,alaw,G729 + +; Settings common to all internal extensions. +[internal](!) + context=internal + type=friend + host=dynamic + allow=ulaw,alaw,G729 + + +; Twilio trunk. +[twilio](trunk) + context=+441234567890 + fromuser=+441234567890 + host=jacknet-gloucester.pstn.ie1.twilio.com + +; Internal extensions. +[1000](internal) + secret=supersecurepassword + +[1001](internal) + secret=supersecurepassword diff --git a/asterisk/voicemail.conf b/asterisk/voicemail.conf new file mode 100644 index 0000000..96affc6 --- /dev/null +++ b/asterisk/voicemail.conf @@ -0,0 +1,12 @@ +[general] + format=wav + maxsilence=10 + maxmessage=180 + +[default] + ; Voicemail inbox for missed dialgroup calls. + 0 => 0000,0,test@example.com + + ; Voicemail inboxes for individual extensions. + 1000 => 0000,1000,test@example.com + 1001 => 0000,1001,test@example.com \ No newline at end of file