Friday, March 1, 2013

Sip Configuration of Asterisk on Amazon AWS EC2

Inorder for asterisk to work well in Amazon EC2, you need to do some tweaks in your asterisk configuration files. If you don't do this, you'll end up with no sound / no audio during your call.




1. Login to your instance.
$ ssh -i asterlui.pem root@ec2-123-456-789-101.ap-southeast-1.compute.amazonaws.com

2. Enter this command to get you external IP. 
$ curl -s http://169.254.169.254/latest/meta-data/public-ipv4

example output. 123.456.789.101

3. Edit your "sip.conf" and add the following settings.

$ nano /etc/asterisk/sip.conf

#add the two lines in your sip.conf
localnet=10.0.0.0/255.0.0.0
externip=123.456.789.101

4. Edit your extension/user config in your sip.conf / users.conf and change the value of nat to yes.


[asterlui]
secret=password
alwaysauthreject=yes
disallow=all
;allow=g722
;allow=g729
allow=ulaw
;allow=alaw
type=friend
nat=yes



5. Don't forget to reload asterisk. 

$ asterisk -rvvvvvvvvvvvvvvvvnc

ip-10-100-955-102*CLI>reload


Note: The settings you've added in your sip.conf is applicable to any Asterisk Server with Public IP.


No comments:

Post a Comment