Showing posts with label puppet. Show all posts
Showing posts with label puppet. Show all posts

Wednesday, April 20, 2011

Asterisk recepie for Ubuntu

This guide will show how to install a small asterisk PBX in the cloud on a VPS that you and your friends can use to call each other for free using SIP applications on Android, Iphone and Ipad. I have tested this configuration with Sipdroid(Android) and Acrobits Softphone(Iphone,Ipad).

$ sudo apt-get install puppet

file asterisk.pp, please change node name styx to your hostname, please change secrets
###########
class asterisk
{
package { "asterisk": ensure => installed }
exec { "sip.conf" : command => "/bin/echo '
[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
' > /etc/asterisk/sip.conf"
}

exec { "extensions.conf" :
command => "/bin/echo '
[others]

[internal]
exten => 1000,1,Dial(SIP/1000)
exten => 1001,1,Dial(SIP/1001)
exten => 1002,1,Dial(SIP/1002)
' > /etc/asterisk/extensions.conf"
}
}


node styx
{
include asterisk
}


$ sudo puppet -d asterisk.pp

After this you may need to restart asterisk
$ sudo service asterisk restart