yashsingh1/xdaforums huggingface dataset:
[Nexus 4 General] acegolfer:
Over the last long weekend, I have installed an asterisk server (PIAF) in VM and tested it out. I have mixed results and haven't decided between PIAF and pbxes.

I followed this guide: http://nerdvittles.com/?p=4525

Here are my findings.

Pros of PIAF

1. flexible/configurable so you have more control.

2. you can use G722 codec (great for wifi) and G729 (great for 3g).

3. you can add more than 1 gtalk trunk. For example, if you have 2 family members using 2 GVs, you can add both gtalk trunks in the same account and route the calls accordingly.

Cons of PIAF

1. TCP set up is a pain. Most PIAF (asterisk) users are not cellphone users so they use UDP connection. With lots of research, I manage to get TCP working to certain extent.

2. security risk: you will need extra steps to secure your network against hackers. SIP was designed for LAN so it uses a lot of different ports. You need to move around the ports (ie, avoid port 5060) and selectively open it to the internet.

3. electricity cost.

4. Here's my biggest turnoff. When I press "end" button using csip/TCP/3g, it takes 30 seconds to hang up the call. It doesn't happen with other sip clients but I haven't found a free sip client that supports both G722 and G729.

Conclusion: To take advantage of G722/G729 codecs, either I pay for media5 or use UDP connection, which will drain the battery 2 times faster.
[Nexus 4 General] tsuda:
Thanks for sharing. I also have the same setup, PIAF running in VMware at home. I haven't turned on TCP yet but thought it's as simple as turning on TCP in sip.conf, device configuration, and opening the firewall?

I also have problems with CSS from time to time not hanging up properly. One time, after I couldn't hang up in CSS and killed it from task manager, I got charged for the call for 2 hours in duration!

Have you tried using Lumicall over 3G? It supports G729 and is free. I use it with Pbxes.org because I'm concerned about opening my own Asterisk to the internet without an SBC.

---------- Post added at 12:47 PM ---------- Previous post was at 12:39 PM ----------

Interesting, what's your keep alive timeout setting for each of the above protocol/connection combos?

I found no battery drain at all with Sipdroid/Lumicall when connected to Pbxes.org, and receiving call is immediate and reliable.
[Nexus 4 General] acegolfer:
Thanks for the suggestions.

1. The challenge with TCP is changing the port from 5060. And then allow the port from both router and iptables.

2. I couldn't get Lumicall to register, even though it seems very similar to Sipdroid. Sipdroid registers without problem. Any tips?

3. For TCP, KA interval = 600s. As for UDP, the PBX checks connection every 60s (qualifyfreq = 60).
[Nexus 4 General] tsuda:
1. To access your home pbx, do you go through pbxes.org and only allow pbxes.org IP to connect? Or do you connect directly from your mobile phone through dynamic dns?

2. Here are my Lumicall settings and configuration:

- Create a new sip identity for pbxes.org

- Profile enabled: Check

- Security Mode: None (important to choose None because Pbxes does not support TLS)

- Gateway to PSTN: Check

- Authorization Username: your pbxes extension name

- Register server name: pbxes.org

- Register server port: 5061

- Register protocol: TCP

- Outbound proxy: pbxes.org

- OUtbound proxy port: 5061

- Use STUN/TURN: Uncheck

Looking forward to hear if it works with your home PBX.

3. The more frequent KA interval definitely drains more battery, but Csipsimple drains significantly more battery than Sipdroid
[Nexus 4 General] acegolfer:
1. I use dyndns to access my PIAF directly. No middle man.

2. Finally got lumicall to work. It looks like sipdroid but behaves very different. There's no registration notification and the codec conditions don't work. For example, I can't set up such that wifi uses g722 and 3g uses g729 codec. And how do I get rid of "choose destination" pop up when I dial a number from the stock dialer?

3. I agree that sipdroid/pbxes combo is the most batter friendly. I cannot replicate it with CSS.
[Nexus 4 General] mtwow789:
I followed this set up and it works well under good WIFI and really good 3g (12mpbs down 2 mbps up).

But at work I get average 3g (1.4~3.0 mpbs down, 0.3~0.5 mpbs up) so I am having poor call quality using iLBC while on 3g.

Problem is, I can hear just fine, but my words are frequently mumbled. For example, if I say "important" in echo test, I hear back "impor~nnnn".

I noticed that this problem is more prevalent on long words/sentence. So I have to spit out one word at a time to successfully talk with other person.

This kind of audio problem is unreliable for me. I am willing to sacrifice the call quality for better reliability (ie. sound quality is poor but still understandable)

So, I tried changing the codec to speex 8Hz but it is not working. When I call *43, I can hear the computer voice fine, but not a word is being echoed back, just noise.

When I changed back to iLBC, I can hear words again but, any long sentence, it will get mumbled up to the point of unrecognizable.

I am wondering how to make speex working? Or is there more reliable set up for slower 3g?
[Nexus 4 General] ziddey:
If you're testing speex try sipdroid
[Nexus 4 General] csaket:
I am having the same issues where the party on the other end will hear broken words but I can hear them fine.

I am using ILBC codec.

The issue is there on both 4G and WiFi for me.

I am also using TCP.

Is there any setting that will help resolve this issue?
[Nexus 4 General] acegolfer:
Call (408) 647-4636 and experiment with settings>media.

osi posted his settings earlier. Have you tried it? It may help.
[Nexus 4 General] csaket:
I am unable to use compact sip, registration will fail with service unavailable.
[Nexus 4 General] acegolfer:
pbxes can't use compact sip. FYI, osi is using his own PIAF server.
[Nexus 4 General] Demonic240:
Just downloaded Zoiper from the market. The free version doesn't have any adds and supports iLBC (paid supports G729). Has anyone else experimented with this app?

edit: in the normal tests, I've noticed that the mic picks up a lot of background sound and my voice is very loud. Is this an issue with the N4 mic or just the VoIP apps?
[Nexus 4 General] osi13:
I'm really surprised that you're seeing such a huge difference between UDP and TCP. Can you post what you had to do to get TCP transport to work on Asterisk 11? I'm using Asterisk 1.8, UDP transport, and battery drain is very minimal. Im also on WiFi a lot. Also, I've never had those hang up problems you're describing. Maybe it is something with Asterisk 11. Thanks for the tests. I haven't had any hack attempts, or anonymous calls in the log, but changing ports is probably a good idea.

Edit: has anyone tried using Bria? It costs like $18, if you also purchase the G729 codec, but it may be worth it. Any feedback? I've been very happy with audio quality and CSipSimple. Plus, the dev is very helpful. acegolfer: you may want to try installing PIAF purple. It uses Asterisk 1.8 and seems to be more stable than Asterisk 11. Especially with Google Voice.
[Nexus 4 General] tsuda:
As discussed in the last few posts, I think it's mostly because the TCP KA interval is set to 10 times the UDP KA interval.

I tried BRIA, sucks battery like crazy when Incoming call is enabled.

---------- Post added at 08:43 PM ---------- Previous post was at 08:42 PM ----------

I tried zoiper. It doesn't switch between wifi and 3G properly. It crashes from time to time.

---------- Post added at 08:55 PM ---------- Previous post was at 08:43 PM ----------

I have been trying Talkatone again, latest version Oct 20, 2012. It seems to be much better than one year ago, esp. if you set Connection keep alive setting to 10 minutes. It seems to be pretty easy on the battery.

Might be a good option to avoid all the complicated setup with CSS and Pbxes.

Anyone else tried it recently?
[Nexus 4 General] osi13:
I don't think so. On the latest CSipSimple nightly the default keep alive, or 'qualify', for UDP transport over mobile data is set to 40. I have adjusted mine to 60 seconds. The default keep alive for TCP transport over mobile data, from what I'm seeing, is set to 120. I don't think it's 10 times more, and I don't think using UDP over TCP translates into over 10 times better battery life, from real world use.

To be honest, I'm connected remotely via CSipSimple 24/7, and when I'm on mobile data, for a majority of the day, CSipSimple may use 2% of battery life, and I can still receive all of my calls. Most of the time CSipSimple isn't listed under battery stats, and that's when I'm at work with WiFi enabled. I still receive anywhere from 4-5 hours of screen time on Franco kernel, and I always have an extension connected remotely.

Honestly, all of the other VoIP clients I've used, except for Media5 phone, have been pretty bad. Especially when you compare them to CSipSimple. A properly configured CSipSimple client works very well. Pretty close to my expensive hardware VoIP phones. You need to play with the mic gain, and earpiece volume. I cannot stress this enough. There are some Cisco ATA devices at work, and I always need to adjust the mic gain, and earpiece volume to kill the echo (FXS input and output gain is the actual setting). Once they're adjusted correctly, they sound exactly how they should.

Also, here is my guide for installing PBX in a flash. I recommend that you install PIAF Purple.
[Nexus 4 General] ziddey:
I think people have been setting the KA for TCP to 600s from the stock 120s and reporting no problems with dropouts.
[Nexus 4 General] whahn1983:
Re: [GUIDE] Free VOIP calls w/ iLBC codec (better than G729?)

I set UDP to 300 with no issues.
[Nexus 4 General] Demonic240:
When I have csipsimple running, my android os goes through the roof.
[Nexus 4 General] osi13:
I'm fairly certain that you're doing it wrong.

http://i.imgur.com/hsHPm6e.png

http://i.imgur.com/07ylIPz.png
[Nexus 4 General] Demonic240:
Yeah.. I can never get my screen on time to look like that =/
[Nexus 4 General] csaket:
I still get bad outgoing audio. I tested with (408) 647-4636 and followed osi's post about the settings.

Only on a good signal with PCMU I am able to get good quality for a while ... until the signal speed drops.

Not at all able to get usable quality for iLBC.

I have tried nightlies from 2063 to 2093.
[Nexus 4 General] ziddey:
Have you tried the GSM codec? I've been using sipdroid and speex for the better part of half a year now, and it's been pretty great, except DTMF just about never goes through properly. I just switched to GSM and things seem to be working very well. Was able to call my TMO number and delete all my GV "to accept press 1" messages. For some reason TMO visual voicemail stopped working for me. I really should just call TMO and disable voicemail, but I get a new account every other month or so ;)

Figure speex is a pretty cpu intensive codec, so GSM helps there too
[Nexus 4 General] zoiper:
Zoiper support here, when was the last time you tried Zoiper ? recent Zoiper versions should be really stable. (latest version is 1.11, our first release was only 6 months ago - our acra crash reports indicate a 2 crashes per 1000 zoipers per day - most of them not even due to zoiper)

I am not aware of any issues switching fro 3G to wifi, if you do please contact us at support AT zoiper.com to investigate the issue.

Regardless of the softphone or the mobile platform you use, only use TCP!! Battery usage is a lot lower with TCP because the wifi and software can go into low power mode.

(TCP timeouts on wifi routers are usually also a lot higher than with UDP, which means your reregistration / qualify time can be higher without closing the nat mappings, which means more sleepy time).

When you really have no choice but to use UDP, experiment to see how high you can go without running into NAT issues.

Keep in mind that timers on android are not very reliable, if you need to reregister after 30s and the phone doesn't wake up until 45s, the registration will expire.).

Z.

---------- Post added at 04:52 PM ---------- Previous post was at 04:48 PM ----------

Zoiper here, the sound volume is increased / reduced with automatic gain control. After a few seconds of training the volume on the microphone should be exactly the volume as expected by the pstn lines.
[Nexus 4 General] Demonic240:
Thanks! I'll have to try it out again.
[Nexus 4 General] tsuda:
Good response time Zoiper support!

I tried zoiper last week, on wife's iPhone and my Galaxy S2, downloaded both from the App store and Play store respectively. Is there a newer version?

I used it to connect to pbxes.org over TCP on port 5061, same settings as Sipdroid. I also tried TCP connection to sip2sip.info, same results.

On the iPhone: After configuration, it crashed right away. I had to restart it to connect to pbxes. Then I turned off wifi to see if it switches to 3G, and it crashed silently and had to restart it.

On the Android: again I switched off wifi and it did not switch over to 3G, also got random crashes, so I gave up.

Conclusion: It's a little more stable on Android than iPhone, but overall I did not get a good experience due to the crashes and unreliable connections.
[Nexus 4 General] zoiper:
Can you contact us directly on support AT zoiper.com for some testing and more info on your phone type and OS version ?

I'd be really interested to see if we can reproduce this. I'm using the iphone version myself and haven't seen a crash with public release in a very long time. (I use wifi at office and home and 3g everywhere else, switches over without any issues).

Could you send us the crash dumps ? Is this a jailbroken phone ?

I just checked for the android version, last release was done on Jan 18, 2013. Is your phone identifier GT-9100 ?

I'm using TCP on asterisk, kamailio/opensips and repro, but on port 5060, (5061 is the standard port for TLS). Are you sure you are not trying to connect to a TLS port? Still should not crash but i haven't tried it.

Z.
[Nexus 4 General] acegolfer:
If you want to know more about battery consumption between UDP/TCP, read this: http://code.google.com/p/sipdroid/wiki/NewStandbyTechnique

The key is UDP times out every 40s+ but TCP times out every 30min+. I believe Sipdroid's KA intervals are 30s for UDP and 600s for TCP (intervals are hardcoded). These KA packets are initiated from the sip clients.

In addition, you should also consider the packets initiated by the PBX server to see whether the client is alive This is called "qualify" setting in asterisk. The default qualifyfreq in asterisk is 60s. If you use TCP, you can increase it to more than 600s and still maintain the connection. I checked the pbxes setting and found that pbxes has disabled this by "qualify=no" in the source code. So clients are responsible to KA.

I checked osi's battery screen shot and conclude that his UDP connection is indeed consuming a lot of battery. The sip battery consumption is under android OS not csipsimple. csipsimple battery only includes actual phone conversation. You can halve the sip battery consumption by half, if you switch to TCP as I posted my results earlier.
[Nexus 4 General] tsuda:
Next time I try it I will contact support directly. Just FYI here, I was using an iPhone 4 on iOS 6 stock (not jailbroken). My S2 is a T989 model running CM10 nightly. I probably tried the version before Jan 18. Pbxes does not support TLS, so 5061 is its standard port for TCP.

It's nice to hear that Zoiper supports TLS. Maybe it's more of a Lumicall for iPhone.

thanks.

---------- Post added at 12:43 PM ---------- Previous post was at 12:39 PM ----------

I agree with acegolfer. It seems that user osi is connected to wifi at home and work, so most of the time he is on wifi where TCP/UDP does not make much difference. The question is what's his battery life if he's on 3G for an entire day.
[Nexus 4 General] acegolfer:
If I'm on UDP, I don't have the hang up problems in asterisk 11. It only happens over TCP + remote connection. (TCP/LAN works fine.)

Enabling TCP transport in asterisk is easy but changing the port to something other than 5060 is hard. This is because most asterisk users don't use smartphones to connect remotely. In asterisk's support sites, there are not many smartphone users who want to connect remotely over TCP to save battery. It took me 2 days to figure out howto.

Here are the basic procedure to get it done. Suppose you want to change TCP port to 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 router, port forward 5055 to PBX

4. From PBX linux, adjust firewall

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.
[Nexus 4 General] zoiper:
[QUOTE I agree with acegolfer. It seems that user osi is connected to wifi at home and work, so most of the time he is on wifi where TCP/UDP does not make much difference. The question is what's his battery life if he's on 3G for an entire day.[/QUOTE]

It should still matter if you are on TCP or UDP. In the case of iOS you can even see the phone stop replying to pings when the wifi goes into low power mode.
[Nexus 4 General] ziddey:
Judging by wakeups as reported by BetterBatteryStats, Sipdroid's TCP KA interval is 60s--- 81 wakeups in 1h19m43s, or 4783s, 4783/81=59.049
[Nexus 4 General] acegolfer:
Is that connected to pbxes?

If yes, then what is the secret behind the low battery consumption?

If no, then remember that an asterisk server also wakes up the cell every 60s be default.
[Nexus 4 General] ziddey:
Yes, that's pbxes

Not sure either but battery life is pretty decent. 28 hours with 3 hours of screen time left me at 35%. That's with an hour of cell radio time, the rest airplanemode+wifi+sipdroid. About 10 minutes of sip airtime.

edit to respond to demonic's post below:

Yes, I have full syncing. I believe in using a smartphone as a smartphone. So that's gmail, gtalk, facebook, facebook messenger, scramble, xda, gvoice, and whatever else. I generally have it on autobrightness although I'm waiting for cm to implement custom auto levels in 10.1 since I generally go dimmer than stock values (for now, I only go min brightness when in bed with the lights out so that's not much screen time). I just got this phone a few days ago finally so don't have too much data yet. So far, it seems the screen consumed far less power than my old HTC Sensation. Sensation could probably beat the N4 if I never turned the screen on (pesky msm_hsic wakelock), but otherwise, screen-on time is unparalleled with the N4. Sorry to go OT. Just a happy observation
[Nexus 4 General] Demonic240:
Do y'all have any accounts that sync, and what's your brightness set to? I'm attaching some screenshots of my battery usage.. It's horrible compared to some of y'alls.
[Nexus 4 General] shiv81:
Re: [GUIDE] Free VOIP calls w/ iLBC codec (better than G729?)

Hey guys I had a quick question. What is your recommendation for using text messaging? Is there a way to use the stock messaging app with your Google voice number? I understand that MMS will not work, but my major concern is getting a text from a random number instead of a person's real number since I heard Google assigns different numbers to people. How would I go about being able to see the real numbers in my messaging app? Thank you in advance.

Sent from my Nexus 7
[Nexus 4 General] ziddey:
Yes, search earlier in the thread. There's an app, GV SMS Integration, that can achieve that. I believe you need to change out your mms.apk on the N4 if stock. There's a free version for you to see if it works to your liking.

On another note, I tried pulling the sources for sipdroid, possibly changing the KA interval, and compiling, but for some reason, only alaw/ulaw are available. Didn't experiment with it after that. Don't have much android experience.. Maybe I'll try decompiling an apk and working from that direction.
[Nexus 4 General] tsuda:
Re: [GUIDE] Free VOIP calls w/ iLBC codec (better than G729?)

You needed to build the native libraries for the other codecs using android ndk.
[Nexus 4 General] acegolfer:
http://xdaforums.com/showthread.php?p=37168879#post37168879

I created another thread to discuss PIAF so that we can stick to iLBC discussion here.

(I have been testing a PIAF solution for 7 days but not 100% satisfied yet. It's a toss up between OP and PIAF now.)
[Nexus 4 General] bon_bon:
Thanks everyone who has contributed. My setup is pretty much similar to the first post setup, with some small tweaks based on other posts. Things work generally. However, there are 2 issues:

1) If I disable UDP Transport and/or enable Use compact SIP in Media, I will get a registering error with my PXEs.org account. Note that I already used the Expert Wizard to be able to check "Use TCP (not UDP)".

2) I get inbound calls fine. WIth outbound calls, it's just not consistent. Many times in the day I'd get a "404 / not found" error and the calls do not go through. It happens with both Wifi and 3G. But the funny thing is that it doesn't happen all the time. It happens often enough (everyday) to be frustrating though.

Any idea to help me out here? Thanks!
[Nexus 4 General] Pkt_Lnt:
PBXes does not support Compact SIP.
[Nexus 4 General] bon_bon:
Thanks. That explains it. Though question 1 is more out of curiosity because it's 'fixable'.

Can anyone please help with question 2 as well? Inbound calls always work but outbound calls get 404 / not found often, but not always.

Again, my setup is similar to the OP: GV -> callcentric -> pbxes -> CSipSimple. I use a Samsung Galaxy S3 with Android 4.1.1, but I doubt that it matters.
[Nexus 4 General] acegolfer:
Can you post the call monitor log for failed GV calls?
[Nexus 4 General] bon_bon:
Do you mean to go into CSipSimple, turn on the log function, write it to file and then post it? What level of verbosity do you like to see? How is it some other log that you want to see? Please let me know.

Also, how come I cannot uncheck the UDP Transport in Media? If I do so then registering process will surely fail until I check that again.
[Nexus 4 General] acegolfer:
Go to pbxes.org>call monitor.
[Nexus 4 General] Demonic240:
I get something very similar to #1. So far, any client other than sipdroid will register fine. But then registration will fail and I'll have to exit and re-launch the app.
[Nexus 4 General] acegolfer:
As stated right after the post you quoted, you can't use compact sip with pbxes.
[Nexus 4 General] bon_bon:
I thought that referred only to the box "Use compact SIP" and not "UDP Transport". The OP has "UDP Transport" unchecked and also uses pbxes, I thought?
[Nexus 4 General] acegolfer:
PBXes fully supports TCP only connection.

If you can't register with PBXes via TCP (no matter what your sip client is), your setup is wrong.