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..037ec5f --- /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=example.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 diff --git a/extensions.conf b/extensions.conf deleted file mode 100644 index 36f6fd5..0000000 --- a/extensions.conf +++ /dev/null @@ -1,12 +0,0 @@ -[general] -autofallthrough=yes - -[globals] - -[nexmo-trunk] -exten => _X.,1,Dial(SIP/${EXTEN},30) - -[internal] -exten => 666,1,Dial(SIP/666) -exten => 777,1,Dial(SIP/777) -exten => _X.,1,Dial(SIP/${EXTEN}@nexmo-) \ No newline at end of file diff --git a/modules.conf b/modules.conf deleted file mode 100644 index c02e8ff..0000000 --- a/modules.conf +++ /dev/null @@ -1,2 +0,0 @@ -[modules] -autoload=yes \ No newline at end of file diff --git a/nexmo.conf b/nexmo.conf deleted file mode 100644 index 76c1892..0000000 --- a/nexmo.conf +++ /dev/null @@ -1,51 +0,0 @@ -[general] -context=nexmo-trunk -register => :@sip.nexmo.com -nat=yes - -[nexmo] -context=nexmo-trunk -fromdomain=sip.nexmo.com -type=peer -insecure=port,invite -nat=no -dtmfmode=rfc2833 -allow=ulaw -allow=alaw -allow=G729 - -[nexmo-sip-01](nexmo) -host=5.10.112.121 - -[nexmo-sip-02](nexmo) -host=5.10.112.122 - -[nexmo-sip-03](nexmo) -host=119.81.44.6 - -[nexmo-sip-04](nexmo) -host=119.81.44.7 - -[nexmo-sip-05](nexmo) -host=169.60.141.29 - -[nexmo-sip-06](nexmo) -host=169.60.141.30 - - -[nexmo-] -context=nexmo-trunk -username= -defaultuser= -secret= -fromuser= -fromdomain=sip.nexmo.com -host=sip.nexmo.com -type=peer -insecure=very -qualify=yes -nat=no -dtmfmode=rfc2833 -allow=ulaw -allow=alaw -allow=G729 \ No newline at end of file diff --git a/sip.conf b/sip.conf deleted file mode 100644 index 59958ba..0000000 --- a/sip.conf +++ /dev/null @@ -1,13 +0,0 @@ -#include nexmo.conf - -[666] -type=friend -host=dynamic -secret=123 -context=internal - -[777] -type=friend -host=dynamic -secret=456 -context=internal \ No newline at end of file