VoIP Cookbook: Configure Asterisk to talk to Linksys SPA400
On Asterisk /etc/asterisk/sip.conf, you need to configure the account exactly similar to User ID of SPA400
The entries in sip.conf to enable Asterisk register to SPA400 are as follow:
[general] register => 9000@192.168.0.6/9000
Replace 9000 with the value you entered in the User ID of SPA400, and replace 192.168.0.2 with the IP address of the SPA400.
Create a SIP entry for SPA400, with the following information:
901 user: User ID of SPA400 902 host: IP address of SPA400 903 context: the context that will be used to handle inbound calls from SPA400
SIP entry to receive calls from SPA400 are as the following:
[9000] type=friend user=9000 host=192.168.0.6 dtmfmode=rfc2833 canreinvite=no context=from-trunk insecure=very
To see whether you are registered to Asterisk or not, you can carry out the following command:
localhost*CLI> sip show registry Host Username Refresh State 192.168.0.6:5060 9000 105 Registered
In Extension.conf file we can configure the routing for dial-out using SPA400. An example of a generic configuration for dial-out route by pressing 9 and enter SPA400 FXO trunk is as follows:
[general] Trunk=SIP/9000 TRUNKMSD = 1 [trunkint] ; ; International long distance through trunk ; exten => _9011.,1,Macro(dundi-e164,${EXTEN:4}) exten => _9011.,n,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [trunkld] ; ; Long distance context accessed through trunk ; exten => _91NXXNXXXXXX,1,Macro(dundi-e164,${EXTEN:1}) exten => _91NXXNXXXXXX,n,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [trunklocal] ; ; Local seven-digit dialing accessed through trunk interface ; exten => _9NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [trunktollfree] ; ; Long distance context accessed through trunk interface ; exten => _91800NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) exten => _91888NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) exten => _91877NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) exten => _91866NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
Note that the SPA400's account number in Asterisk is 9000, the number we are using as an example.
Incoming call routing is more complex. If we assume the incoming call will be connected to extension 200, then the configuration is approximately as follows:
[from-trunk] include => from-pstn ... [from-pstn] include=> from-pstn-custom ... [from-pstn-custom] exten =>9000,1,Goto(ext-local,200,1)