Here's an extensions.conf and sip.conf for use with Asterisk and Sipgate.
Tip: Lisp syntax highlighting seems to work quite well in Vim.
TODO: need to get a way to map a known incoming number to an alphanumeric
name to be transmitted to the phone.
TODO: need to get a way to map unknown incoming numbers to an alphanumeric
name to be transmitted to the phone, either by doing a reverse lookup on
the internet somehow, or just sending the geographical origin of the call,
ie the city or the region.
---extensions.conf---
[general]
static=yes
writeprotect=no
[default]
; the reason i break these out in to separate [sections]
; is so that they can be excluded/included by commenting out
; one line. Makes debugging a lot easier.
include => external_sip
include => util_numbers
include => internal_phones
include => voicemailboxes
[internal_phones]
;My internal phones
exten => 5010,1,Dial(SIP/5010,30)
exten => 5010,2,Voicemail(u5010)
; SIP Hardphone 5010: rings for 30 seconds, then
; goes to voicemailbox 5010
exten => 5012,1,Dial(SIP/5012,30)
exten => 5012,2,Voicemail(u5012)
; SIP ATA 5012: rings for 30 seconds, then
; goes to voicemailbox 5012
[voicemailboxes]
;main mailbox menu
exten => 5000,1,VoicemailMain
exten => 5000,2,Hangup
; dial 5000 for voicemail
[outgoing_sipgate]
include => default
; dial 9 for an outside line (via Sipgate)
; needs to be in its own context for security porpoises
exten => _9.,1,Dial(SIP/${EXTEN:1}@sipgate,30,tr)
exten => _9.,2,Playback(invalid)
exten => _9.,3,Hangup
[external_sip]
; dial 5014 to speak to Jasper Ragworth, over SIP
exten => 5014,1,Dial(SIP/jasrag@examplename.plus.com)
exten => 5014,2,Playback(invalid)
exten => 5014,3,Hangup
;sipgate stuff...
[daytime_sipgate]
; replace 1234567 with your sipgate ID
exten => 1234567,1,NoOp(--- ${CALLERID} calling on sipgate (${EXTEN}) ---)
exten => 1234567,2,Dial(SIP/5010&SIP/5012,30)
; extensions 5010 and 5012 ring on incoming calls from sipgate.
; Goes to voicemail after 30 seconds
exten => 1234567,3,Answer
exten => 1234567,4,Wait,1
exten => 1234567,5,Voicemail(u5010)
; voicemail goes to 5010's mailbox
exten => 1234567,6,hangup
[night_sipgate]
; diverts all calls to voicemail
exten => 1234567,1,NoOp(--- ${CALLERID} calling on sipgate (${EXTEN}) ---)
exten => 1234567,2,Answer
exten => 1234567,3,Wait,1
; need to record night message and play here
exten => 1234567,4,Voicemail(u5010)
exten => 1234567,5,hangup
[incoming_sipgate]
include => daytime_sipgate|7:00-23:00
; between 0700 and 2300, uses daytime_sipgate
include => night_sipgate|23:01-6:59
; between 2301 and 0659, use night_sipgate.
; Can specify days/weeks/months also.
; Extension for handling SMS.
[smsdial]
exten => _X.,1,SMS(${CALLERIDNUM},s,${EXTEN},${CALLERIDNAME })
exten => _X.,2,SMS(${CALLERIDNUM},s)
exten => _X.,3,Hangup
; I have a small CGI page that lets me send SMS to one of the external
; extensions
; utility numbers
; various utilities, as a demo of asterisk's capabilities.
; Probably irrelevant in this digital telephony age.
[util_numbers]
include => onesevenohsevenoh
include => onetwothree
; this bit is here so that one only has to include => one thing
; up in [default] ^
[onesevenohsevenoh]
; 17070 is bt's line test facility, reads out your number
; we don't need line test, but this is here to say what extension is calling
; pointless but nice
exten => 17070,1,Answer
exten => 17070,2,Wait(1)
exten => 17070,3,SayDigits(${CALLERIDNUM})
exten => 17070,4,Hangup
[onetwothree]
; 123 is the uk speaking clock
exten => 123,1,Answer
exten => 123,2,Wait(1)
exten => 123,3,SayUnixTime( | | k)
exten => 123,4,SayUnixTime( | | M)
exten => 123,5,Playback(vm-and)
exten => 123,6,SayUnixTime( | | S)
exten => 123,7,Playback(seconds)
; downloaded seconds.gsm [amongst others] from
;
http://www.loligo.com/asterisk/sounds/
; tip: search google with filetype:gsm to find .gsm files
exten => 123,8,Hangup
---sip.conf---
[general]
; all comments refer to lines above them.
context = default
port = 5060
bindaddr = 0.0.0.0
; bind to all addresses - allows registration to Sipgate via
; internet-facing interface, and phones to register on
; LAN-facing interface. YMMV, depending on network topology
disallow=all
allow=ulaw
allow=alaw
allow=ilbc
allow=g729
allow=gsm
allow=all
; allowed codecs
localnet=192.168.1.0/255.255.255.0
; Just yer standard LAN interface
externip=82.39.34.125
; manually entered ISP IP address here
register => 1234567:SECRET@sipgate.co.uk/1234567
; replace 1234567 with your sipgate ID
[sipgate]
type=peer
context=incoming_sipgate
fromuser=1234567
username=1234567
authuser=1234567
; not sure if its really necessary 3 times?
secret=SECRET
host=sipgate.co.uk
fromdomain=sipgate.co.uk
dtmfmode=info
insecure=very
;qualify=yes
canreinvite=no
nat=yes
disallow=all
allow=ulaw
allow=alaw
[5010]
type=friend
context=outgoing_sipgate
; this extension can make calls via outgoing_sipgate in extensions.conf.
; Just comment it out to disable outgoing calls from this extension.
username=5010
secret=9876
dtmfmode=rfc2833
callerid=Loft <5010>
mailbox=5010
disallow=all
allow=ulaw
allow=alaw
qualify=yes
host=dynamic
[5012]
type=friend
context=outgoing_sipgate
; can place calls via outgoing_sipgate
username=5012
secret=9876
dtmfmode=rfc2833
callerid=Cordless <5012>
mailbox=5012
; note they're all sharing one mailbox
disallow=all
allow=ulaw
allow=alaw
qualify=yes
host=dynamic
EOF
Any comments, ideas or suggestions?
--
<http://ale.cx/> (AIM:troffasky) (gebssnfxl@ubgznvy.pbz)
21:11:44 up 5 days, 2:19, 3 users, load average: 0.07, 0.09, 0.10
This is my BOOOOOOOOOOOOOOOOOOOOOMSTICK