Thursday, April 21, 2011

Asterisk recepie for Openwrt

$ opkg update
$ opkg install asterisk18 asterisk18-codec-ulaw asterisk18-codec-g726 asterisk18-codec-g722 asterisk18-codec-alaw

root@OpenWrt:~# cat /etc/asterisk/sip.conf
[general]
port = 5060
bindaddr = 0.0.0.0
context = default

[1000]
type=friend
secret=1000
#qualify=yes ;latency must be under 2000ms.
nat=yes
host=dynamic ; the devices can be registered with different IPs each time
canreinvite=no ; Asterisk by default redirects
context=internal ; the context of the extensions.conf file

[1001]
type=friend
secret=1001
#qualify=yes ;latency must be under 2000ms.
nat=yes
host=dynamic ; the devices can be registered with different IPs each time
canreinvite=no ; Asterisk by default redirects
context=internal ; the context of the extensions.conf file

[1002]
type=friend
secret=1002
#qualify=yes ;latency must be under 2000ms.
nat=yes
host=dynamic ; the devices can be registered with different IPs each time
canreinvite=no ; Asterisk by default redirects
context=internal ; the context of the extensions.conf file

root@OpenWrt:~# cat /etc/asterisk/extensions.conf
[others]

[internal]
exten => 1000,1,Dial(SIP/1000)
exten => 1001,1,Dial(SIP/1001)
exten => 1002,1,Dial(SIP/1002)

# /etc/init.d/asterisk restart

Firewall

add the following to /etc/config/firewall to allow SIP traffic

config rule
option src wan
opption proto tcp
option dest_port 5060
option target ACCEPT

Reload your firewall rules
# /etc/init.d/firewall reload

Examine firewall rules and check that 5060 is accepted on zone WAN
# iptables -L -v

Install dyndns.org update script
opkg update
opkg install ddns-scripts
vi /etc/config/ddns

No comments:

Post a Comment