[GUIDE] PBX in a Flash (PIAF) on Amazon EC2 with Free GV calling + SILK codec

Search This thread

acegolfer

Senior Member
Jun 2, 2008
776
221
PIAF (PBX in a flash) + AWS (Amazon Web Service) EC2

If you are making free GV calls using data, then you probably know that setting up an asterisk server is the best but also quite complicated. Thankfully, it just got a little easier because the PIAF team made the PIAF image available on AWS EC2 (a cloud based virtual machine).

Advantages over other asterisk/pbxes methods:
1. very small audio lag. Amazon servers have less latency than any other servers.
2. Since Amazon hosts your server, you don't pay any electricity cost. FYI, a PC running 24/7 costs about $15-20 a month.
3. The PIAF image (AMI) is already optimized: 1000MHZ + pre-installed asterisk and others. If you have used PIAF before, the whole setup process will take less than 30 minutes to complete.
4. You can create a backup image at any time and restore it later.

Disadvantages:
1. EC2 is only free for the 1st year. See the terms carefully to understand what is truly free. Use http://mikekhristo.com/ec2-ondemand-vs-reserved-instance-savings-calculator/ to estimate the cost after the 1st year. After the 1st free year is up, you can port the image to another AWS account.
2. Added security risk. Since EC2 is not in your network, it needs to open 22 (SSH), 80 (WEB) ports for you to access the server to configure. To overcome this issue, restrict who can gain access by known IP addresses from AWS.
3. In addition to some linux knowledge (PIAF runs on CentOS), you also need to learn how AWS works. Personally, I consider this as a plus.


Instructions (estimated minutes to complete in parenthesis, if you have used PIAF before):

1. Launch PIAF image in AWS EC2. (10 minutes)
Detailed instruction: http://nerdvittles.com/?p=5060
updated: there are 2 versions of PIAF: purple uses asterisk 1.8 and green uses asterisk 11 (beta). I am using PIAF-Green which supports silk codec.

2. Configure PIAF using Web GUI. (10 minutes)
Once PIAF is up and running, from your web browser, enter the Elastic IP address (given by AWS) to access web GUI.

2.1. Settings>Asterisk SIP settings>NAT settings. Click "Auto Configure" It will fill out the IP addresses. If you reboot, localnet address may change. You may use "10.0.0.0/8" instead.
* Whenever you make a change in Web GUI, scroll down and click submit. Then "Apply Config" red button will appear at the top. Click it occasionally to reload newly submitted configurations.
2.2. Settings>Asterisk SIP settings>Audio codecs. Select the codecs and reorder. (SILK codec will not show up here.)
2.3. Applications>Extensions. Add new SIP extensions. User extension and the secret are the username and the password you will use in your sip client to register with PIAF. Select nat=yes.
2.4. Other>Google Voice. Fill out your GV information. Asterisk must be restarted to take it into effect. In Web GUI, Admin>Asterisk CLI, execute "core restart gracefully" Once restarted, you can start making outbound GV calls from a registered phone. (Alternatively, you can use "simonics GVGW" service and add it as a sip trunk.)
2.5. Connectivity>Inbound routes. Add your GV number as DID number. Scroll down and set destination as your extension you created in #2.3.
2.6. From Google Voice webpage, confirm that Google Voice forwards all the incoming calls to gchat.
2.7. Register your sip client (such as csipsimple) with your PIAF server. The server address is the "elastic IP" address assigned by AWS.

Test in/out calls before going to the next step.

3. (optional) Add G729 codec. (5 minutes) (See post #2 for adding silk codec, which I'm now using for both wifi/3g.)
G729 codec is one of the best codecs for mobile connection. SSH to your PIAF EC2. In linux CLI, execute

Code:
cd /usr/lib/asterisk/modules
wget http://asterisk.hosting.lv/bin/codec_g729-ast18-icc-glibc-x86_64-core2.so 
amportal restart

To check whether you added G729 properly, execute in asterisk CLI

Code:
core show translation recalc 100

Look for G729 line and check they are not blanks.
Source: http://asterisk.hosting.lv/

4. (optional) Enable TCP transport to save phone battery. (5 minutes)
In my informal testing, TCP battery consumption is half of UDP's.

From Web GUI, asterisk SIP settings>Other SIP settings, add the following 2 lines.

Code:
tcpenable = yes
tcpbindaddr = 0.0.0.0

Go Applications>Extensions and change transport to "TCP."

Next, you need to open TCP port 5060 in both EC2 and linux. For EC2, modify the security group. For linux, SSH to your PIAF

Code:
nano /etc/sysconfig/iptables

add the following line and save (ctrl-o) and exit (ctrl-x).

Code:
iptables -A INPUT -p tcp -m tcp --dport 5060 -j ACCEPT
restart iptables in linux CLI
Code:
service iptables restart

Use TCP transport in your sip client to connect to PIAF.



Tips/Tricks and Troubleshooting will be in the next posts.

If you couldn't understand the installation steps, check out a fellow's post. He provided several installation tips. http://xdaforums.com/showpost.php?p=41412908&postcount=184
 
Last edited:

acegolfer

Senior Member
Jun 2, 2008
776
221
Tips/Tricks

Tips/Tricks

1. Use ring group to ring all the extensions, if you have multiple sip phones.

2. Add more GV numbers
My family have 3 GV numbers + 6 phones. I added all 3 gtalk trunks to PIAF. OTOH, pbxes doesn't allow you to add more than 1 gtalk trunk. Since all 6 phones are in the same PBX, I can call my wife's phone by her extension number (or her ring group) instead of her GV number. If you do this, you need to modify outbound routes such that certain extensions use specific GV trunk. Otherwise, all the phones will use the first GV trunk to make outgoing calls and display the same CID.

3. Call forward to external phones.
In the ring group, you can have PIAF call regular phone number such as your cell phone. Just list the phone number followed by #. One problem is gtalk trunk doesn't allow CID spoofing so the external phone will show your GV# as CID.

4. Delayed call forwarding
Create 2 ring groups and put the number for delay in the 2nd group. Set 1st ring group's destination if no answer as the 2nd group and specify the ring time. I do this for my office phone because it goes to voicemail in 20 seconds (before GV voicemail answers). Now my office phone starts ringing after 7 seconds so it will never answer before GV voicemail does. You can also use this strategy with your cell phone such that your cell number rings after you have a chance to answer internet calls.

5. Secure your PIAF
If you followed pbxinaflash.com guide, then you opened port 80 and 22 to the world. Hackers can brute force using username = root. You should limit who can access these ports by IP address. Additionally, you can disable root SSH login and create a sudoer.
http://www.howtogeek.com/howto/linux/security-tip-disable-root-ssh-login-on-linux/
http://wiki.centos.org/TipsAndTricks/BecomingRoot

6. Add SILK codec
If you are on PIAF-green (asterisk 11), then you can add SILK codec. This is the codec that Skype uses so you may get the same excellent quality as Skype. From linux CLI,

Code:
wget http://downloads.digium.com/pub/telephony/codec_silk/asterisk-11.0/x86-64/codec_silk-11.0_1.0.0-core2_64.tar.gz
tar -zxvf codec_silk-11.0_1.0.0-core2_64.tar.gz
cd codec_silk-11.0_1.0.0-core2_64
cp codec_silk.so /usr/lib/asterisk/modules/codec_silk.so

Restart asterisk and from asterisk CLI, core show codecs and confirm that 4 silk codecs (silk8, silk12, silk16, silk24) are added. If not, read http://xdaforums.com/showpost.php?p=38398737&postcount=71.
To use SILK codec, From extension, set

disallow=all
allow=silk12

7. Eliminate echo
ryuker has posted a method to eliminate the echo.
http://xdaforums.com/showpost.php?p=42740388&postcount=306

Troubleshooting

There are many many reasons why GV calling fails. This means you will probably not get any help, unless you provide more information such as asterisk log. If you want to troubleshoot by yourself, try these first.

1. csip / piaf registration: Try a different sip client or use UDP connection.
2. GV: See whether you can make GV calls using GrooveIP. GV calling may not work for new accounts until you initiate a call from gmail.
3. Restart asterisk. If you add a GV trunk, it must be restarted to take into effect.
2. piaf / GV link: Add simonics GVGW as a sip trunk. https://simonics.com/gvgw/
 
Last edited:

acegolfer

Senior Member
Jun 2, 2008
776
221
If you have been following my iLBC thread, then here's a comparison between the 2 methods (PIAF vs iLBC, hereafter).

1. PIAF supports more codecs such as G722 and G729.
2. Less latency issue because of less call routing. PIAF route: caller>GV>PIAF>phone. iLBC method involves caller>GV>callcentric>pbxes>phone.
3. You can add more than 1 GV trunk w/ PIAF. pbxes only allows 1. This is handy, if your family use several GV numbers.
 
Last edited:
  • Like
Reactions: bige93 and dipole

dipole

Senior Member
Sep 1, 2010
410
74
Google Pixel 7 Pro
Re: [DISCUSSION] Asterisk/FreePBX/PIAF

Good discussion, I was running it on my raspberry pi until I repurposed it for a media center. I may have to look at it again, please post your setup once you have things working....


Thanks

Sent from my Nexus 7 using Tapatalk HD
 

whahn1983

Senior Member
Dec 3, 2010
72
12
Houston
Re: [DISCUSSION] Asterisk/FreePBX/PIAF

Here's basically what I did so far.

1. Follow nerdvittle's guide (link in OP) to install IncrediblePBX on my home PC.
2. Enable TCP and changed TCP signaling port from default 5060.
3. In router, forward signaling port and RTP ports (10000-20000) to PBX.
4. Use csipsimple as Android sip client.

I understand it's too brief. Once I am completely satisfied with my setup, I'll write a detailed instruction.

If you have 0 clue about what these mean, then I'm afraid you should look for an alternative setup such as GrooveIP or http://xdaforums.com/showthread.php?t=2057887

If you have been following my iLBC thread, then here's a comparison between the 2 methods (PIAF vs iLBC, hereafter).

1. PIAF gives you more codec options such as G722 and G729.
2. Less latency issue because of less call routing. If you are at home, it's caller>GV>PBX=phone. iLBC method involves caller>GV>callcentric>pbxes>phone.
3. Hangup issues when ending a call with csip/TCP/3g/SPI firewall combination. If I change one of these 4, I can end a call normally.

I had tried a setup and got through all the nerdvittles guides setting up piaf purple with travelinman 3. Everything worked great with csipsimple when I was on WiFi. As soon as I disconnected from wifi and got on the cell network I could not connect. I ensured my phone ip was in the iptables and all the proper ports were forwarded through the router. I used dyndns for both my router and phone to ensure that ip tables had the right ip addresses. Never figured out the problem. If anyone has any ideas for what the problem could be I'll give it another try.

Sent from my Nexus 4 using xda premium
 

acegolfer

Senior Member
Jun 2, 2008
776
221
I had tried a setup and got through all the nerdvittles guides setting up piaf purple with travelinman 3. Everything worked great with csipsimple when I was on WiFi. As soon as I disconnected from wifi and got on the cell network I could not connect. I ensured my phone ip was in the iptables and all the proper ports were forwarded through the router. I used dyndns for both my router and phone to ensure that ip tables had the right ip addresses. Never figured out the problem. If anyone has any ideas for what the problem could be I'll give it another try.

Sent from my Nexus 4 using xda premium

I think using dyndns for your phone is pointless and can actually pose a great security risk. If you are on Tmobile 3g, your phone is behind NAT. This means the IP of your phone actually belongs to the Tmo's router and not unique to your phone.

So including that IP address in iptables is a huge security risk. All the Tmo phones sharing the same IP address with your phone will have full access to your PBX.

The biggest challenge that you are facing is the fact that both your PBX and your phone are behind 2 different NATs. I know it's crazy. My guess is NAT settings. In nerdvittle's guide, there's an instruction on how to give access to remote clients. In addition, here is another good guide: http://www.freepbx.org/support/documentation/howtos/howto-setup-a-remote-sip-extension
 
Last edited:

acegolfer

Senior Member
Jun 2, 2008
776
221
Here are the instructions on how to enable TCP and change TCP port from default 5060 to something other such as 5055.

1. Settings>Asterisk SIP settings>Other SIP settings
tcpenable = yes
tcpbindaddr = 0.0.0.0:5055
2. Applications>Extensions>your extension, transport = TCP only.
3. From your router, port forward 5055 to PBX machine.
4. From PBX linux command, adjust firewall settings
iptables -A INPUT -p tcp -m tcp –dport 5055 -j ACCEPT
(You can also do this from PIAF linux webmin.)
5. From sip clients, server/proxy = your IP:5055.
 
Last edited:
  • Like
Reactions: cr1_1

whahn1983

Senior Member
Dec 3, 2010
72
12
Houston
Re: [DISCUSSION] Asterisk/FreePBX/PIAF

I think using dyndns for your phone is pointless and can actually pose a great security risk. If you are on Tmobile 3g, your phone is behind NAT. This means the IP of your phone actually belongs to the Tmo's router and not unique to your phone.

So including that IP address in iptables is a huge security risk. All the Tmo phones sharing the same IP address with your phone will have full access to your PBX.

The biggest challenge that you need to solve is both your PBX and your phones are behind 2 different NATs. I know it's crazy.

Yea that sounds like a big problem. The sad thing is when I am on my piaf network the voice quality is pristine. It actually works great but most of my calling is done away from home. I ended up switching off of the tmo $30 plan and onto straight talk tmo until I figure out a better solution. I've tried everything out there from pbxes to groove, almost every available codec and app combo. Just too many complaints from callers about quality and 100 minutes is not enough lol.

Sent from my Nexus 4 using xda premium
 

osi13

Senior Member
Jun 25, 2010
373
127
You can eliminate almost all risks by using Travelin' man; which is basically an IP whitelist. You can read about it over at nerdvittles. That being said, I've been lucky, and I haven't had any attacks on my personal PIAF server. I have banned all of Asia, and Russia using IP tables, and I'm sure that's helped. All ports are closed behind my firewall except for 5060, and a few for RTP. It is also a good idea to run "update-programs" and then "update-fixes" via the CLI periodically. This will install crucial patches.
 
Last edited:
  • Like
Reactions: Jayrod1980

acegolfer

Senior Member
Jun 2, 2008
776
221
Another issue that I found.

Can't use G722 codec over TCP when registered remotely. G722 works if UDP or within LAN.

Not sure whether this is a csip specific issue because I don't know other free sip clients with G722 codec.
 
  • Like
Reactions: bige93

osi13

Senior Member
Jun 25, 2010
373
127
Another issue that I found.

Can't use G722 codec over TCP when registered remotely. G722 works if UDP or within LAN.

Not sure whether this is a csip specific issue because I don't know other free sip clients with G722 codec.

Post your issue on the CSipSimple Google Code page. The dev is normally very helpful. Also, I would look through the Asterisk log to see exactly what's going on. You can do this via FreePBX or you can go to to your server's CLI, and type "asterisk -rvvv" This will give you a debug CLI. Then try to place a call using G722, and view the results. If you post over at the PIAF forums, you will probably need a log, or you may be ignored.
 

bluespire

Senior Member
Feb 26, 2009
123
17
Why not just use a TCP VPN (like Open VPN) to get back to your house, and then run this like you are on your LAN with UDP?
 

bluespire

Senior Member
Feb 26, 2009
123
17
That is an interesting approach. Provided there is no data lag it may work.

Sent from my Nexus 4 using xda premium

Yeah, I always kept wondering why no one mentioned it as a solution. I don't know if it will solve the battery problem, as that may still be problem with using UDP itself. I suppose changing the timeout on UDP to something really high would work, since the VPN will maintain the TCP connection. On the other hand, you could also run the VPN on UDP, and I would bet that it would be better at staying connected than trusting CSS to keep its connection.

What the VPN does do really well, is eliminate all issue of allowing the PBX to face the internet. Just force it to accept connection only on its VPN port, and require a key file. Done.
 
  • Like
Reactions: osi13

osi13

Senior Member
Jun 25, 2010
373
127
You should update the thread. TCP can be used on Asterisk 1.8, and PIAF on 1.8 is very stable.
 

acegolfer

Senior Member
Jun 2, 2008
776
221
You should update the thread. TCP can be used on Asterisk 1.8, and PIAF on 1.8 is very stable.

I didn't say TCP cannot be used in 1.8 in OP. In fact, I have no doubt asterisk 1.8 supports TCP.

I was stating your guide wasn't written for TCP. Let me know if you have updated your guide with TCP.

If there's no hangup issues and G722 works with 1.8 when TCP/remote, then I'll ditch 11 in a heartbeat.
 
Last edited:
  • Like
Reactions: bige93

acegolfer

Senior Member
Jun 2, 2008
776
221
Yeah, I always kept wondering why no one mentioned it as a solution. I don't know if it will solve the battery problem, as that may still be problem with using UDP itself. I suppose changing the timeout on UDP to something really high would work, since the VPN will maintain the TCP connection. On the other hand, you could also run the VPN on UDP, and I would bet that it would be better at staying connected than trusting CSS to keep its connection.

What the VPN does do really well, is eliminate all issue of allowing the PBX to face the internet. Just force it to accept connection only on its VPN port, and require a key file. Done.

I haven't had time to test this. But if my understanding of sip technology is correct, VPN will not solve UDP battery drain issue. For example, even if I use UDP within LAN, I have to set KA interval = 40 or qualifyfreq = 60. Otherwise, my phone will lose connection to the sip server until the next registration (which is less frequent than KA intervals).
 

errorcod3

Senior Member
Nov 2, 2012
80
23
Re: [DISCUSSION] Asterisk/FreePBX/PIAF

I was using my rpi for awhile on my home net. I switched to an amazon ec2 micro instance. much better speeds, reliability, and quality.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 15
    PIAF (PBX in a flash) + AWS (Amazon Web Service) EC2

    If you are making free GV calls using data, then you probably know that setting up an asterisk server is the best but also quite complicated. Thankfully, it just got a little easier because the PIAF team made the PIAF image available on AWS EC2 (a cloud based virtual machine).

    Advantages over other asterisk/pbxes methods:
    1. very small audio lag. Amazon servers have less latency than any other servers.
    2. Since Amazon hosts your server, you don't pay any electricity cost. FYI, a PC running 24/7 costs about $15-20 a month.
    3. The PIAF image (AMI) is already optimized: 1000MHZ + pre-installed asterisk and others. If you have used PIAF before, the whole setup process will take less than 30 minutes to complete.
    4. You can create a backup image at any time and restore it later.

    Disadvantages:
    1. EC2 is only free for the 1st year. See the terms carefully to understand what is truly free. Use http://mikekhristo.com/ec2-ondemand-vs-reserved-instance-savings-calculator/ to estimate the cost after the 1st year. After the 1st free year is up, you can port the image to another AWS account.
    2. Added security risk. Since EC2 is not in your network, it needs to open 22 (SSH), 80 (WEB) ports for you to access the server to configure. To overcome this issue, restrict who can gain access by known IP addresses from AWS.
    3. In addition to some linux knowledge (PIAF runs on CentOS), you also need to learn how AWS works. Personally, I consider this as a plus.


    Instructions (estimated minutes to complete in parenthesis, if you have used PIAF before):

    1. Launch PIAF image in AWS EC2. (10 minutes)
    Detailed instruction: http://nerdvittles.com/?p=5060
    updated: there are 2 versions of PIAF: purple uses asterisk 1.8 and green uses asterisk 11 (beta). I am using PIAF-Green which supports silk codec.

    2. Configure PIAF using Web GUI. (10 minutes)
    Once PIAF is up and running, from your web browser, enter the Elastic IP address (given by AWS) to access web GUI.

    2.1. Settings>Asterisk SIP settings>NAT settings. Click "Auto Configure" It will fill out the IP addresses. If you reboot, localnet address may change. You may use "10.0.0.0/8" instead.
    * Whenever you make a change in Web GUI, scroll down and click submit. Then "Apply Config" red button will appear at the top. Click it occasionally to reload newly submitted configurations.
    2.2. Settings>Asterisk SIP settings>Audio codecs. Select the codecs and reorder. (SILK codec will not show up here.)
    2.3. Applications>Extensions. Add new SIP extensions. User extension and the secret are the username and the password you will use in your sip client to register with PIAF. Select nat=yes.
    2.4. Other>Google Voice. Fill out your GV information. Asterisk must be restarted to take it into effect. In Web GUI, Admin>Asterisk CLI, execute "core restart gracefully" Once restarted, you can start making outbound GV calls from a registered phone. (Alternatively, you can use "simonics GVGW" service and add it as a sip trunk.)
    2.5. Connectivity>Inbound routes. Add your GV number as DID number. Scroll down and set destination as your extension you created in #2.3.
    2.6. From Google Voice webpage, confirm that Google Voice forwards all the incoming calls to gchat.
    2.7. Register your sip client (such as csipsimple) with your PIAF server. The server address is the "elastic IP" address assigned by AWS.

    Test in/out calls before going to the next step.

    3. (optional) Add G729 codec. (5 minutes) (See post #2 for adding silk codec, which I'm now using for both wifi/3g.)
    G729 codec is one of the best codecs for mobile connection. SSH to your PIAF EC2. In linux CLI, execute

    Code:
    cd /usr/lib/asterisk/modules
    wget http://asterisk.hosting.lv/bin/codec_g729-ast18-icc-glibc-x86_64-core2.so 
    amportal restart

    To check whether you added G729 properly, execute in asterisk CLI

    Code:
    core show translation recalc 100

    Look for G729 line and check they are not blanks.
    Source: http://asterisk.hosting.lv/

    4. (optional) Enable TCP transport to save phone battery. (5 minutes)
    In my informal testing, TCP battery consumption is half of UDP's.

    From Web GUI, asterisk SIP settings>Other SIP settings, add the following 2 lines.

    Code:
    tcpenable = yes
    tcpbindaddr = 0.0.0.0

    Go Applications>Extensions and change transport to "TCP."

    Next, you need to open TCP port 5060 in both EC2 and linux. For EC2, modify the security group. For linux, SSH to your PIAF

    Code:
    nano /etc/sysconfig/iptables

    add the following line and save (ctrl-o) and exit (ctrl-x).

    Code:
    iptables -A INPUT -p tcp -m tcp --dport 5060 -j ACCEPT
    restart iptables in linux CLI
    Code:
    service iptables restart

    Use TCP transport in your sip client to connect to PIAF.



    Tips/Tricks and Troubleshooting will be in the next posts.

    If you couldn't understand the installation steps, check out a fellow's post. He provided several installation tips. http://xdaforums.com/showpost.php?p=41412908&postcount=184
    4
    Tips/Tricks

    Tips/Tricks

    1. Use ring group to ring all the extensions, if you have multiple sip phones.

    2. Add more GV numbers
    My family have 3 GV numbers + 6 phones. I added all 3 gtalk trunks to PIAF. OTOH, pbxes doesn't allow you to add more than 1 gtalk trunk. Since all 6 phones are in the same PBX, I can call my wife's phone by her extension number (or her ring group) instead of her GV number. If you do this, you need to modify outbound routes such that certain extensions use specific GV trunk. Otherwise, all the phones will use the first GV trunk to make outgoing calls and display the same CID.

    3. Call forward to external phones.
    In the ring group, you can have PIAF call regular phone number such as your cell phone. Just list the phone number followed by #. One problem is gtalk trunk doesn't allow CID spoofing so the external phone will show your GV# as CID.

    4. Delayed call forwarding
    Create 2 ring groups and put the number for delay in the 2nd group. Set 1st ring group's destination if no answer as the 2nd group and specify the ring time. I do this for my office phone because it goes to voicemail in 20 seconds (before GV voicemail answers). Now my office phone starts ringing after 7 seconds so it will never answer before GV voicemail does. You can also use this strategy with your cell phone such that your cell number rings after you have a chance to answer internet calls.

    5. Secure your PIAF
    If you followed pbxinaflash.com guide, then you opened port 80 and 22 to the world. Hackers can brute force using username = root. You should limit who can access these ports by IP address. Additionally, you can disable root SSH login and create a sudoer.
    http://www.howtogeek.com/howto/linux/security-tip-disable-root-ssh-login-on-linux/
    http://wiki.centos.org/TipsAndTricks/BecomingRoot

    6. Add SILK codec
    If you are on PIAF-green (asterisk 11), then you can add SILK codec. This is the codec that Skype uses so you may get the same excellent quality as Skype. From linux CLI,

    Code:
    wget http://downloads.digium.com/pub/telephony/codec_silk/asterisk-11.0/x86-64/codec_silk-11.0_1.0.0-core2_64.tar.gz
    tar -zxvf codec_silk-11.0_1.0.0-core2_64.tar.gz
    cd codec_silk-11.0_1.0.0-core2_64
    cp codec_silk.so /usr/lib/asterisk/modules/codec_silk.so

    Restart asterisk and from asterisk CLI, core show codecs and confirm that 4 silk codecs (silk8, silk12, silk16, silk24) are added. If not, read http://xdaforums.com/showpost.php?p=38398737&postcount=71.
    To use SILK codec, From extension, set

    disallow=all
    allow=silk12

    7. Eliminate echo
    ryuker has posted a method to eliminate the echo.
    http://xdaforums.com/showpost.php?p=42740388&postcount=306

    Troubleshooting

    There are many many reasons why GV calling fails. This means you will probably not get any help, unless you provide more information such as asterisk log. If you want to troubleshoot by yourself, try these first.

    1. csip / piaf registration: Try a different sip client or use UDP connection.
    2. GV: See whether you can make GV calls using GrooveIP. GV calling may not work for new accounts until you initiate a call from gmail.
    3. Restart asterisk. If you add a GV trunk, it must be restarted to take into effect.
    2. piaf / GV link: Add simonics GVGW as a sip trunk. https://simonics.com/gvgw/
    2
    If you have been following my iLBC thread, then here's a comparison between the 2 methods (PIAF vs iLBC, hereafter).

    1. PIAF supports more codecs such as G722 and G729.
    2. Less latency issue because of less call routing. PIAF route: caller>GV>PIAF>phone. iLBC method involves caller>GV>callcentric>pbxes>phone.
    3. You can add more than 1 GV trunk w/ PIAF. pbxes only allows 1. This is handy, if your family use several GV numbers.
    2
    I did this, just a couple notes in case it's useful for others.

    I used PIAF-green. Figured I might as well test the latest.

    For some reason, the built-in google voice module was flaky. I couldn't get inbound calling to work reliably, it would work for a while, then suddenly stop with nothing in the log to indicate why. I switched to the Simionics gateway and set it up as a SIP trunk, no problems since.

    I'm doing a little better on quality using SILK over g729 and iLBC. I use SILK12 right now with good results. You can download it from diginum. The install is the same as the g729 codec module.

    Interesting to note, SILK supports forward error correction. Unfortunately, CSipSimple can't due to PJSIP not allowing access to the packet buffer. In practice, it doesn't seem to make a big difference. I bought Bria and it does support the error correction, but it doesn't seem to work any better in areas where CSS has issues. After using both, save the money get CSS.

    I'm still experimenting with timeouts, on TMO I'm at 600 keep-alive (CSS) and qualifyfreq=600. I'm playing with them still. I also set qualify to 6000, this gives the phone a little time (6 seconds) to notice that the server is trying to talk to it and reply before the server decides it's not there and times you out. I just watch the asterisk console for the timeout messages to see if I'm going too high. I know you can set qualify=no, but I like being able to monitor the phone's connection via the server logs, and 10 minutes is probably longer than many of the other processes asking for new data in the background.

    Odd issue, I had problems with some gateway trying to "help" me, and mangling my SIP packet headers. So I ended up having to turn on TLS. There's a good HOWTO on the Asterisk site for doing it, don't worry about getting the keys to the phone, you don't need to verify them for the encryption to work. Yes, someone could MITM the connection, but it was wide open before..... If you really want to be paranoid, bring the client and CA certificates down and enter them into the SIP client.

    I also enabled SRTP, I figure if I'm going to have encryption, I might as well encrypt the media streams as well. This requires recompiling Asterisk as they don't include it in PIAF. Building Asterisk on a micro instance is PAINFULLY SLOW. I bumped up to an xlarge for 20min or so and that covered a couple builds. It cost me about 60 cents US. There's a good HOWTO on the PIAF forum for installing libsrtp and recompiling.

    Found out the hard way, PIAF-green /usr/src has 1.8 and 11 sources. Make sure you're in the right one before building and doing a make install. :D Switching to the other and doing the build fixes the broken stuff, but it sure can make you wonder WTF for a minute.
    2
    Just want to give everyone a heads up that the PIAF EC2 AMIs may be discontinued soon:
    http://pbxinaflash.com/community/index.php?threads/aws-ec2-discontinuance-possible.14168/

    For installing PIAF on ANY fresh CentOS 6.5 system (excl. OpenVZ), I wrote up a detailed tutorial on my tech blog:
    https://blog.ls20.com/install-pbx-in-a-flash-piaf-on-digitalocean/

    Also, I wrote a comprehensive HOW-TO on securing your PIAF server with IPTables rules:
    https://blog.ls20.com/securing-your-asterisk-voip-server-with-iptables/

    I hope you will find them helpful!