yashsingh1/xdaforums huggingface dataset:
[Nexus 4 General] acegolfer:
I already set it up. Testing it out now.
[Nexus 4 General] bluespire:
I saw. I didn't have updates on at the time. sorry.
[Nexus 4 General] osi13:
I'm pretty sure the GV issue is with Asterisk 11. I have considered running Asterisk on Amazon's platform in the past, but I haven't needed to because everything has been very stable with my server. I haven't rebooted it in 3 months. It also helps that I have a reliable 30Mb/6 internet connection at home, so having access to a gigabit port from Amazon isn't really necessary.

Have you tried using a different client for the G722 hangup problems? I haven't had time to set up TCP transport on my machine, but I will tomorrow. I'll let you know if I have the same problem after trying a different client. It sounds like an issue with CSipSimple.
[Nexus 4 General] bluespire:
Did you check to see if latency is better to your server or amazon from your phone? I would bet the latency will be better on an Amazon server. Residential connections are not known for incredibly low latency.

ETA: As I don't own a RPi, I'm going to try the EC2 instance to see if it even works well. If I don't want to spend the $7/month, then I can pull it back to a home server solution.
[Nexus 4 General] osi13:
I'm sure the latency is better with the Amazon solution, but what I'm currently using works for me. As much as I hate Comcast, the internet connection I have with them is surprisingly good. I also have a Subsonic server running at home, and I can instantly stream music to my phone over T-Mobile.

This is a breakdown of exactly how I use my server. The only time I use my T-Mobile minutes is when I'm driving. However, there are a few areas where I can drive, and use the G729 codec. When I'm at work, or at home, I use G722 over WiFi, and it sounds better than calling over T-Mobile. If I'm stationary, and have at least 2 bars of service, I can reliably call over data with G729. I fully understand the limitations of my set up, and it works very well for me. I also have one of these phones at my house that rings when anyone calls my GV number. I can answer the call on my Nexus 4, or this hardware VoIP phone.

I don't normally have issues with CSipSimple not ringing, but if I do, I'm well aware of it because I have my PIAF server set up to forward the incoming call to my T-Mobile number, if an extension doesn't answer the call. IMO, this is the best method because you won't miss calls, even if there is an issue with CSipSimple, or the data connection. The only caveat is that the callers CID information isn't passed when the call is forwarded because Google doesn't allow CID spoofing.

I will be playing around with TCP transport the next few days, but I don't think it will benefit me very much, because I'm normally around WiFi. However, as acegolfer pointed out, it can help others who predominately use 3g.

Also, the problem with running PIAF on a RPi is you cannot use the G729 codec, because it's not supported for ARM, and if you get accustomed to that set up, you'll be missing out on using that codec in the future. I recommend that you install PIAF 'purple' on an old computer, or in a VM. It's stable, where as Asterisk 11 isn't. I normally never install "experimental" PIAF images because I don't have the time to be dealing with issues. Asterisk 1.8 just "works."
[Nexus 4 General] acegolfer:
Great news!

PIAF team just made PIAF AMI available for AWS EC2.

http://pbxinaflash.com/community/index.php?threads/piaf-purple-ami-for-amazon-ec2.15189/#post-99002
[Nexus 4 General] errorcod3:
Re: [DISCUSSION] Asterisk/FreePBX/PIAF

Let us know how it works
[Nexus 4 General] ziddey:
making it too easy for my lazy ass to play around :victory:
[Nexus 4 General] acegolfer:
It's definitely better than my build :)

I'm about to add G729 codec from http://asterisk.hosting.lv/. But not sure which binary to choose. What is the type of AWS EC2?

codec_g729-ast18-icc-glibc-core2-sse4.so

codec_g729-ast18-icc-glibc-core2.so

codec_g729-ast18-icc-glibc-debug.so

codec_g729-ast18-icc-glibc-pentium.so

codec_g729-ast18-icc-glibc-pentium2.so

codec_g729-ast18-icc-glibc-pentium3.so

codec_g729-ast18-icc-glibc-pentium4-sse3.so

codec_g729-ast18-icc-glibc-pentium4.so

codec_g729-ast18-icc-glibc-x86_64-core2-sse4.so

codec_g729-ast18-icc-glibc-x86_64-core2.so

codec_g729-ast18-icc-glibc-x86_64-pentium4.so
[Nexus 4 General] acegolfer:
codec_g729-ast18-icc-glibc-x86_64-core2.so

This one yielded the fastest transcoding.
[Nexus 4 General] acegolfer:
I have been testing PIAF on EC2 for about 30 minutes and pretty happy with the results.

G729 + amazon server provided the smallest audio lag I have seen on 3g connection.

I'm sure there will be some issues ahead but this is a great start.
[Nexus 4 General] seandarcy:
Re: [DISCUSSION] Asterisk/FreePBX/PIAF

Have try tried silk instead of g729? Seems to work better for me.
[Nexus 4 General] acegolfer:
In asterisk CLI, can you run 'core show translation recalc 100' and post the results? Interested to see the transcoding time using silk.
[Nexus 4 General] errorcod3:
Are these numbers from an Amazon EC2 instance?
[Nexus 4 General] acegolfer:
Re: [DISCUSSION] Asterisk/FreePBX/PIAF

Yes. Piaf + centos6.3
[Nexus 4 General] acegolfer:
If anyone is having trouble with asterisk + GV, try simonics GVGW as a middle man. https://simonics.com/gvgw/ He uses YATE to convert GV's XMPP to sip.

Asterisk can add it as a sip trunk instead of using GV module (which can be flakey). I compared the latency between 1) GV>asterisk>phone and 2) GV>simonics>asterisk>phone side by side using 2 N4's and couldn't tell any difference. No difference in voice quality either.

Or, you can create a new GV number and have your asterisk connected via GVGW in addition to the original GV. If you have trouble with asterisk+GV, then you can fallback on GVGW. For example, you can set up such that 10 digit call will use built in method and 1+10 digit will use GVGW.
[Nexus 4 General] osi13:
I have updated my blog and added how to enable TCP transport on Asterisk 1.8. I will be covering adding G729, and remote access when I have time. Both are a simple process, but I am extremely busy with school. You can check out the post here. I don't have the hang up issues with G722 acegolfer is experiencing, but I'm also using the standard port, which is 5060. If you have a decent home internet connection, my method is definitely viable, and works very well.
[Nexus 4 General] acegolfer:
I read the post. You wrote:

If one follows step 7 in your post, then I think this step 4 is redundant.
[Nexus 4 General] osi13:
From what I've witnessed, it's not 100% necessary to change the transport settings under "Extensions", if you add the extension in "sip_custom_post.conf." However, I could not get TCP transport to work without editing sip_custom_post.conf, and adding those two lines. I mainly wanted to cover turning off qualify in step 7, but I added in the part about selecting TCP as the primary method of transport for good measure. I wrote this in 10 minutes, and I'll clear up a few things later. What are you using for your KA settings? I have both WiFi and mobile data set to 300. I haven't had any issues with missed calls, but I've only been using TCP with qualify=no since Friday.
[Nexus 4 General] acegolfer:
Re: [DISCUSSION] Asterisk/FreePBX/PIAF

My Ka intervals are 600 for both WiFi and 3g.
[Nexus 4 General] acegolfer:
I found 2 cool things with PIAF.

1. I can add another GV # using simonics GVGW as a backup outgoing trunk. If I place a 11 digit # call (1+ 10 digits), then it will be calling out from my other GV number. At least, if something goes wrong, I'll know who is at fault, piaf/GV or csip/piaf.

2. Since all my family phones (6 total) are in the same pbx, I can transfer the call to another phone easily. For example, if I answer a call when at home, I can transfer the call to my wife's fixed LAN phone, which has better sound quality than csipsimple. Press the menu button in csip, during a call. You will see the option to transfer to a number. Of course, calling out from my wife's fixed phone using my GV number is just as easy.
[Nexus 4 General] acegolfer:
Updated OP with full instructions. Thanks everyone for contributing to this guide.
[Nexus 4 General] swaggerwocky:
If I wish to use this for another GV trunk, is it the same procedure (ex. paste another set of the lines under [googlein] with a different gmail username/10-digit number)?
[Nexus 4 General] acegolfer:
Yes. I have 2 GV accounts within [googlein].
[Nexus 4 General] acegolfer:
I found there's something weird with Nexus 4's TCP connection to certain wifi hotspots.

Nexus 4 + TCP + office wifi = registers fine but outgoing call fails (the recipient answers but Nexus4 doesn't know it)

What is strange is the following combos are all fine.

Nexus 7 + TCP + office wifi

Nexus 4 + UDP + office wifi

Nexus 4 + TCP + home wifi

Nexus 4 + TCP + Tmo 3g

This weird behavior is unique to N4 + TCP + some wifi network.
[Nexus 4 General] Angyalka:
Acegolfer,

Thank you so much for the info and hardwork.

I have been trying to set it up but I have been not sucessful.

Can you elaborate about this?

2.2. Settings>Asterisk SIP settings>Audio codecs. Select the codecs and reorder.

Also this:

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

iptables -A INPUT -p tcp -m tcp --dport 5060 -j ACCEPT

Sorry, to ask but my knowledge on linux is very limited.

Thanks again!!!
[Nexus 4 General] acegolfer:
Those 2 items are not critical. You can still connect via UDP connection without them. Try UDP first. If you can successfully make calls, then you can work on TCP later.
[Nexus 4 General] acegolfer:
FYI, PIAF team made PIAF-green (w/ newer asterisk 11) 64bit image available.

I haven't tried it because I'm quite content with PIAF-purple (asterisk 1.8).
[Nexus 4 General] acegolfer:
Re: [GUIDE] PIAF on AWS EC2 (free GV calls with low latency)

I changed the TCP port away from 5060. Everything works now.
[Nexus 4 General] Angyalka:
Hi acegolfer,

Thanks again for your information.

I am able to make calls using CSipSimple; however, when the other person answers it is not audio plus I am still in the "calling" screen.

Any thoughts?

Thanks again!!!
[Nexus 4 General] acegolfer:
Re: [GUIDE] PIAF on AWS EC2 (free GV calls with low latency)

I remember something similar and asked in Piaf forum. Forgot what fixed it.
[Nexus 4 General] kevmegforest:
racking up charges

has anybody been charged by Amazon. I already have more than 6 billion ios . it's 40 cents and it has only been 100 hours of uptime. Am I the only one with these charges? could there be a problem with my setup. I'm using piaf green with a custom dial plan to tropo, another free Web service. I am also using Google voice. thank you
[Nexus 4 General] acegolfer:
My uptime this month (2/1-2/21) is 511 hours with 1.5 million I/O requests. Estimated charge is $0.15.
[Nexus 4 General] kevmegforest:
How many calls have you made?

Do you know a way to track the ios?

Is there an easy way to reduce the ios?

At the rate it's going, i will need to pay at least 2$, and i'm making only 2-3 calls a day. (A lot more at the begining)
[Nexus 4 General] acegolfer:
1. I call about 10-20 times a day.

2. no.

3. Dunno.
[Nexus 4 General] ttabbal:
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.
[Nexus 4 General] acegolfer:
Re: [GUIDE] PIAF on AWS EC2 (free GV calls with low latency)

I have experienced the same GV motif inconsistency with Piaf green. One reason why I'm sticking to purple for now.

But if silk codec offers better quality on WiFi and 3g, then I'm tempted to move to green + simonics. I found simonics routing didn't increase any latency.
[Nexus 4 General] ttabbal:
Re: [GUIDE] PIAF on AWS EC2 (free GV calls with low latency)

At least it's not just me that motif doesn't like. :)

I agree on Simionics. Not sure how he does it, but it works great. And inbound calls get cnam lookups free. Kinda nice.

The cool thing about ec2, you can fire up PIAF green in just a few minutes and know for yourself if you like silk. And it won't cost much. Always a plus.

I migrated my server to the Oregon data center, apparently that's where voip.ms keeps a server as I get an 8ms ping to them from the ec2 instance now. Thanks for the great thread here.
[Nexus 4 General] errorcod3:
Re: [GUIDE] PIAF on AWS EC2 (free GV calls with low latency)

cloudping.info is a good resource to see your ping time to various ec2 servers.
[Nexus 4 General] acegolfer:
I added Silk codec to PIAF-green but it was a little more complicated than g729. I had to add the following lines in codecs.conf.

The call quality was great and there's no added lag.

[silk8]
type=silk
samprate=8000
fec=true
packetloss_percentage=10
maxbitrate=20000
dtx=false

[silk12]
type=silk
samprate=12000
fec=true
packetloss_percentage=10
maxbitrate=25000
dtx=false

[silk16]
type=silk
samprate=16000
fec=true
packetloss_percentage=10
maxbitrate=30000
dtx=false

[silk24]
type=silk
samprate=24000
fec=true
packetloss_percentage=10
maxbitrate=40000
dtx=false
[Nexus 4 General] ttabbal:
Interesting. I have those in codecs.conf, but I didn't add them in. I just dropped the .so in the modules directory.

Glad it's working well for you.
[Nexus 4 General] KyleBS:
Would you mind sharing the setup for Simionics gateway + PIAF Green? I can't for the life of me get it working. At this point I have the following trunk set up with the information given to me from my registration:

host=gvgw4.simonics.com

username=GV11231231234

secret=secretysecret

type=peer

qualify=yes

qualifyfreq=240

insecure=port,invite

However, when I try to make calls out I get a busy tone. Now, if I were never to get this working for outgoing calls, thats fine, as I planned on depending on Motif for that anyway. But like you, I have found that incoming calls had been very unreliable, hence why I would like to get this setup working as you did.

Thanks :)
[Nexus 4 General] acegolfer:
Re: [GUIDE] PIAF on AWS EC2 (free GV calls with low latency)

Does the incoming call work with simonics? If so, then nothing wrong with your sip trunk. It must be incorrect outbound route setting.
[Nexus 4 General] ttabbal:
Re: [GUIDE] PIAF on AWS EC2 (free GV calls with low latency)

I was just wondering that as well. Try ssh to your instance, su root, then asterisk -r. Now do "core set verbose 5" and enter. It should just tell you it did it. Now try the call again. It should spit out some pretty detailed logging about the call progress. I find that very helpful in tracking routing issues. You can also try using the information simonics gave you in a sip client and try working directly against them. If that doesn't work, try emailing them. The guy behind the service seems like he's willing to help out. Post the call progress log from asterisk here, ace or I should be able to help you figure it out.

There are no tricky settings, just your basic sip trunk.
[Nexus 4 General] KyleBS:
As obvious as that sounds, no, I did not. Do'h. Just gave it a go and it worked perfectly incoming! Looking forward to reliable incoming calls :D
[Nexus 4 General] swaggerwocky:
I'm having an odd issue. I'm currently using Simonics trunk and I'm able to receive incoming calls when I'm on WiFi, but I'm not able to receive any when I'm on 3G. CSS is able to register with my PIAF Green server on both connection methods.

Update: seems to work fine if I'm using UDP instead of TCP. Anyone ever run into this issue?
[Nexus 4 General] acegolfer:
Here's a workaround: https://code.google.com/p/csipsimple/issues/detail?id=2001
[Nexus 4 General] swaggerwocky:
That helped! I was actually considering trying another listening port but it was late so I called it a night. I tried the other suggestion of reducing the number of codecs enabled and it worked. I just have ulaw, gsm, silk12 and 24 enabled now under SIP settings.
[Nexus 4 General] ttabbal:
I only have silk12 and ilbc on the slow options, silk24, g722, and ulaw on wifi. Keep it simple. :)
[Nexus 4 General] swaggerwocky:
Oh, I actually just have silk24 enabled under Fast and silk12 under Slow for CSipSimple's enabled codecs settings. I was referring to Asterisk SIP Settings enabled codecs in my previous post :)
[Nexus 4 General] acegolfer:
My biggest problem with VoIP is not the SIP setup. It's the N4 hardware mic being too sensitive as discussed in this thread.

http://xdaforums.com/showthread.php?t=2046613

In short, the N4 mic picks up all the background noise so if you are in a loud place, the other party can't hear you. In addition, if you have echo cancel enabled, CSS will try to manipulate the outgoing audio signal and your voice will be garbled.

I found turning off echo + lowering mic volume to 1/3 works well in a loud place such as shopping malls. (Of course, a headset will help as well.)
[Nexus 4 General] acegolfer:
I have made the following 5 adjustments which helped registration and battery life.

1. Moved TCP port away from 5060

tcpbindaddr=0.0.0.0:6060

externtcpport=6060

2. Enable compact sip header

compactheaders=yes (you also have to enable it from CSS network settings)

3. disallow=all, allow=silk12

I found silk12 codec is excellent on both 3g and wifi. Having just 1 codec will keep the sip packet to minimal.

4. Disable qualify

No matter what I do, the client becomes UNREACHABLE occasionally throughout the day. If so, asterisk will not ring the phone at all. By disabling it, asterisk will attempt to ring it every time. The downside is client is solely responsible to keep the connection alive. I have lowered KA interval from 600 to 300 just to be on the safe side.

5. Use the play store version of CSS

I was a bit annoyed with constant nightly upgrade. The PS version does everything that I need.
[Nexus 4 General] chdloc:
Quality issues

I've been using PIAF-purple for a few weeks now and I have mainly used it for long conference calls to save on mobile minutes. People have been complaining about occasional poor quality (probably related to packet loss). So I decided to look into it. I ran the following experiment:

1. Capture the outgoing stream using Media5 (G.729) by "Shark" (somewhat of a wireshark lite available from the Play Store) on my Nexus One in a poor 3G area

2. Capture the packets going into my cloud instance by using tcpdump on my server (I got G.729 streams to/from my handset and a G.711 stream to/from Google Voice/Talk server)

3. Capture the packets going into my IP phone at work by using wireshark (G.711 from a media gateway from inside the enterprise by way of Google Voice)

The three captures were taken simultaneously and the resulting audio streams are shown in the attached screen shot. The first stream is derived from the decoded G.729 packets leaving my Nexus One. Looks/sounds as expected. The second stream is the decoded G.729 stream arriving at the Amazon microinstance. Looks/sounds good, too (although there was a burst of seven packets being lost [=140ms] at some point). The third stream is the transcoded (G.729->G.711) stream that is being handed off to Google. Still peachy. The last stream is the G.711 stream received by my IP phone at work. There is an about 12 second outage only about 1:20 minutes into the call. Granted, there may be some packets being lost in "my" corporate network, but 12 seconds worth is highly unlikely. This result is (somewhat) in agreement with what people have reported on my conference calls.

Interestingly, though, I have *never* had any issues with receive quality. I have blamed the quality of the 3G network with the occasionally poor transmit quality (due to the typically lower upload bandwidth), but this may actually not be the case.

I will be running a few more tests to try to narrow down where the trouble starts, but at this time I have to say that this setup is currently unusable for my purpose (to conduct some business away from my desk).

Has anyone else observed this kind of intermittent transmit quality issues?
[Nexus 4 General] ttabbal:
I notice glitches more on Google Voice than with other providers. You might try a real VOIP provider, they are quite cheap for testing. I use voip.ms and have my EC2 instance in the same datacenter, apparently, as I have an 8ms ping to them. Most of the time I use GV, but when I need the best quality over voip, I use a prefix to force the call through voip.ms. voip.ms has a minimum $25 topup, but it's about 1 cent per minute, so that $25 lasts a long time for me.

I've had noticeable glitches on GV even when forwarding to GSM voice. They are more rare, but do happen.
[Nexus 4 General] chdloc:
When you say "glitches" do you experience the effects of occasional packet loss, in which case the conversation often can go on, or outages that may last several seconds (even if they occur only occasionally with no "apparent" reason such as zero 3G bars)?