yashsingh1/xdaforums huggingface dataset:
[Nexus 4 General] acegolfer:
When Csipsimple is registered remotely (obviously is the case for EC2) using TCP, it takes 30 seconds to hangup after pressing the "end" call button. The voice gets transmitted during these 30 seconds.

OTOH, the call hangs up normally, if CSS uses UDP or I use a different client which costs to use G729.
[Nexus 4 General] errorcod3:
No, I haven't tried it. Asterisk 11 supports G722. If anyone is interested in using it just add an allow=g722 to the sip.conf file under [general].

Does Google Voice support G729?
[Nexus 4 General] errorcod3:
I just changed my configuration to TCP and I could not reproduce your problem. My calls terminate normally..
[Nexus 4 General] acegolfer:
gtalk trunk only supports PCMU (g711 ulaw), which is used at PSTN. asterisk will transcode PCMU to other codecs such as G729.
[Nexus 4 General] errorcod3:
Forgot to mention, I'm also using CSS.
[Nexus 4 General] ivan.net:
Oh, I haven't tested SIP to SIP calls~ Let me create two SIP accounts on my server and see what happens for SIP to SIP.

---------- Post added at 03:10 PM ---------- Previous post was at 02:30 PM ----------

You are right. Just tested SIP to SIP with local extensions, it breaks when direct media is used (i.e., SIP instructs the two SIP clients to directly connect with RTP.)

It will work if you disable direct media by adding "directmedia=no" to [general] section of sip.conf. That's of course not going to be as efficient nor as good quality as direct media due to an extra hop and latency for the RTP.

So, yes, it somehow introduces "NAT" problem with direct media. I am not sure how, because the two SIP devices I am using are both on the same WiFi and each with their own public IP!!
[Nexus 4 General] doom5:
Since Google Voice only supports G711ulaw, what's the point of using anything else on WiFI? Whatever audio codec you use that's not G711ulaw will have to be transcoded to it.
[Nexus 4 General] jhax01:
I don't claim to be an expert, but for myself, I'm applying the 'garbage in, garbage out' principle. I'm sure you do slightly reduce latency by choosing ulaw, but that usually isn't a problem on wi-fi anyway. Try both and see what works for you.
[Nexus 4 General] bluespire:
Apparently, even though Amazon told me that I was using my "free year", it charged me. For 598 hours, plus some additional fees that are expected (given that they are charging me now), it was $13.22. That's for 1 month. So, almost double what I expected. Given that, I will be working on getting a home Asterisk solutions running. I suggest most others here do the same, and just use Amazon as a learning tool. Any Virtual Private Server (VPS), or dedicated host, should be able to run this with no problems if you have access to one (and your host doesn't mind).
[Nexus 4 General] errorcod3:
Your cost would be half that if you reserve the instance instead of using on demand.

I've used VPS in the past with horrible results. Connections are not stable. I would tread lightly with VPS.
[Nexus 4 General] jhax01:
Bummer... No issues here, they only charged me for the large instances I used when compiling.
[Nexus 4 General] bluespire:
I did select to have it reserved.

You are probably still in your first year of AWS, where a micro instance is free.
[Nexus 4 General] acegolfer:
I feel sorry for you. They didn't overcharge me.

I like the low latency of Amazon server over my home server.
[Nexus 4 General] jhax01:
Oh, I misunderstood, that's correct, I'm in the free year. BUT, this is my second free year. I signed up with a different email address and it allowed for another free tier year....
[Nexus 4 General] harshadura:
Hi, Thank you very much for the useful guide!
[Nexus 4 General] stingray17:
Got it working - Thanks! Also some tips/updates

Thanks a lot, I got everything working. Free phone system until 2014 and I learned some things along the way! Nice :)

For reference here is my configuration:

* Amazon EC2 t1.micro instance w/ Ubuntu, Linux kernel 3.2.0

* Asterisk 11.3.0

* Google Voice account currently associated with old cancelled landline

* SIP clients used: Twinkle, Ekiga, 3CXPhone for iPhone

One tip - I don't think you need to compile a new kernel yourself to get 1000HZ timing - instead you can install the premade "low latency" kernel which already has this setting ("apt-get install linux-lowlatency"). You need to manually edit /boot/grub/menu.lst so that the first/default entry refers to the new lowlatency kernel.

It also seemed like I could effectively control the 1:1 NAT firewall settings from the EC2 web console and provide adequate security without bothering to configure ufw, although I can see how it might be better to properly configure that too.

One problem I had is that I was getting "Illegal Instruction" errors from Asterisk and it would crash. What was going on is that Asterisk was being compiled to use AVX instructions which GCC thought were supported on the CPU, but the EC2 micro instance did not actually support AVX instructions. I found this is a known issue other people have had with EC2 instances. I worked around it by changing the Asterisk build options ("make menuconfig" / "Compiler Flags") so that "BUILD_NATIVE" was disabled, recompiled and voila, no more crashes!

I still haven't figured out how to make the PPTP VPN work right; with Windows and some other clients it fails to negotiate encryption. I'm sure I'll get that working eventually but meanwhile not too worried about it.

Thanks again to errorcod3 and jhax01 for putting this together!
[Nexus 4 General] codesplice:
Just wanted to chime in and thank errocod3 and jhax01; I decided to tinker a bit with the whole VoIP thing again, and was able to get Asterisk up and running with no problems (thanks to all of the good information posted here).

Thanks guys!
[Nexus 4 General] whiselen:
Forbidden

Hello all,

I've went through the setup but when I try to connect using CSipSimple i get the error: "Error while registering - Forbidden". Below are my configs (I'm using "myusername" and "passwordIMadeUp" in CSipSimple):

sip.conf

[general]

allow=all

allowguest=no

nat=force_rport,comedia

tcpbindaddr=0.0.0.0

tcpenable=yes

externhost=TheElasticIP

localnet=10.0.0.0/8

[myusername] <---I'm assuming this is just a username i make up rather that the google one?

type=peer

secret=passwordIMadeUp

host=dynamic context=local

transport=udp,tcp

extensions.conf

[general]

autofallthrough=yes

[default]

exten => 411,1,Answer()

same => n,Dial(Motif/google/1800.. [MENTION=564339]voice[/MENTION].google.com)

[local]

exten => _1XXXXXXXXXX,1,Dial(Motif/google/${EXTEN [MENTION=564339]voice[/MENTION].google.com,,r)

exten => _XXXXXXXXXX,1,Dial(Motif/google/${EXTEN [MENTION=564339]voice[/MENTION].google.com,,r)

exten => _+1XXXXXXXXXX,1,Dial(Motif/google/${EXTEN [MENTION=564339]voice[/MENTION].google.com,,r)

[incoming-motif]

exten => s,1,NoOp()

same => n,Set(crazygooglecid=${CALLERID(name)})

same => n,Set(stripcrazysuffix=${CUT(crazygooglecid,@,1)})

same => n,Set(CALLERID(all)=${stripcrazysuffix})

same => n,Dial(SIP/myusername,20,D(:1))

xmpp.conf

[general]

[google]

type=client

serverhost=talk.google.com

username=googlevoiceemail

secret=googlepassword

priority=100

port=5222

usetls=yes

usesasl=yes

status=available

statusmessage="VOIP"

timeout=5

Do I seem to be missing anything?
[Nexus 4 General] codesplice:
That all looks good to me, I think I've got mine set up pretty much exactly the same (with a few additional entries for call recording). So I don't think the issue is with your Asterisk configuration.

How are you configured in CSipSimple?

Here's what I've got:

Account Name: Cloudy

Account id: <sip:username@extern.ip>

Registration URI: sip:extern.ip

Make sure that the Username and Passwords match what you configured in sip.conf!

Proxy URI: sip:extern.ip

Hopefully this can be helpful to you.
[Nexus 4 General] seandarcy:
VPN questions

Great thread.

A comment: to set the ipaddress in sip.conf you want to use externaddr, externhost is for FQDN where you have a dynamic address.

It seems the internal AWS dns no longer works:

dig [MENTION=827116]172[/MENTION].16.0.3 google.com

; <<>> DiG 9.9.2-rl.028.23-P2-RedHat-9.9.2-10.P2.fc18 <<>> [MENTION=827116]172[/MENTION].16.0.3 google.com

; (1 server found)

;; global options: +cmd

;; connection timed out; no servers could be reached

And my questions: Are there any restrictions to the ip addresses in the VPN setup:

echo "localip 10.40.1.1" >> /etc/pptpd.conf

echo "remoteip 10.40.1.20-50" >> /etc/pptpd.conf

Will these work for all ec2 instances?

And finally, how do you set up the VPN on your phone?

Thanks again.
[Nexus 4 General] seandarcy:
Got udp working, even got iax working, but not tcp. I'm using css.

The asterisk console shows:

tcptls.c:451 ast_tcptls_client_start: Unable to connect SIP socket to <my phone ip address>:35653: Permission denied

over and over again.

sip.conf:

[general]

context=default

dtmfmode=rfc2833

tcpenable=yes

tcpbinaddr=0.0.0.0

[ng]

transport=tcp,udp

type=friend

secret=newharbor

host=dynamic

context=calls-in

qualify=1000

dtmfmode=auto

insecure=port,invite

disallow=all

allow=silk16

allow=silk24
[Nexus 4 General] nrygpu:
error when trying to start asterisk server

Hello,

I carefully went through the instructions to set this up but when I get to the last step:

#

# Stop/Start asterisk

#

sudo /etc/init.d/asterisk stop

sudo /etc/init.d/asterisk start

I am getting the follow error:

root@ip-10-0-3-32:/usr/src/asterisk-11.4.0# sudo /etc/init.d/asterisk start

* Starting Asterisk PBX: asterisk

Illegal instruction (core dumped)

root@ip-10-0-3-32:/usr/src/asterisk-11.4.0#

asterisk is not running and it seems to not want to start. Not sure what I am doing wrong.

Help is much appreciated! ;)

thank you!
[Nexus 4 General] stingray17:
illegal instruction? recompile without native option.

For an illegal instruction error, I recommend you recompile Asterisk without the BUILD_NATIVE option. See my other post above for instructions and explanation.
[Nexus 4 General] heulenwolf:
Two GV Accounts, Two Phones?

Brilliant guide. Thanks for putting it together and refining it. Like others, I found following the OP instructions precisely built a working server that is far more reliable than any app connecting directly to GV. I also found CSipSimple to be the best way to use it from a Nexus 4. It handles the Nexus 4's microphone arrangement correctly whereas the "Internet Calling" feature of the native dialer can't seem to figure it out.

Hear are my questions:

1) How do I extend asterisk to a second GV account that I want to ring a second phone and to be used by that second phone for outgoing calls? For the incoming side, I suspect there must be a way to parse out the number called and use an if statement to determine the extension.

2) How about handling a call between the two phones? There must be some smarter way to route it through asterisk instead of outbound to Google and back.

3) Is there any reason to believe the micro instance will have trouble keeping up with two simultaneous calls? I suspect the instance is up to the task but wanted to see if anyone had experience with it before I tried it.
[Nexus 4 General] codesplice:
Everything seems to be working brilliantly for me, but every now and then I notice Asterisk logging a bajillion copies of the following error:

[Jun 19 15:37:45] WARNING[831]: res_xmpp.c:3526 xmpp_client_receive: Parsing failure: Invalid XML.

As far as I can tell, everything is still working just fine, and restarting the Asterisk service makes the errors go away. Any ideas on what's causing it though?
[Nexus 4 General] ftherese:
Thanks a lot for the config - "one" lingering issue for me

I am using this set up on my home asterisk setup, connecting with my android phone running sipdroid. Calling out works just fine, but when incoming calls ring my sipdroid, and I answer them I get "no data," while the calling phone just continues ringing until it gets to Google Voice-mail. I finally, today, had the idea of dialing "1" on my sipdroid after answering the call (even though there is no voice prompt or anything) and, voila it works. I thought that was strange because the Dial command under incoming-motif adds a D(:1), and that comes across in the log as well:

-- Executing [s@incoming-motif:1] NoOp("Motif/+XXXXXXXXXXXX", "") in new stack
-- Executing [s@incoming-motif:2] Set("Motif/+XXXXXXXXXX", "crazygooglecid=+XXXXXXXXX@voice.google.com/srvenc-92PWyN+7+//TmnbqAeG1ZyZUOAkykV8i") in new stack
-- Executing [s@incoming-motif:3] Set("Motif/+XXXXXXXXXX", "stripcrazysuffix=+XXXXXXXXXX") in new stack
-- Executing [s@incoming-motif:4] Set("Motif/+XXXXXXXXX", "CALLERID(all)=+XXXXXXXXX") in new stack
-- Executing [s@incoming-motif:5] Dial("Motif/+XXXXXXXXXX", "SIP/ftherese,20,D(:1)") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/ftherese
-- SIP/ftherese-00000000 is ringing
-- SIP/ftherese-00000000 is making progress passing it to Motif/+XXXXXXXXXXX
[Sep 14 22:43:00] NOTICE[19355][C-00000000]: chan_motif.c:1636 jingle_indicate: Don't know how to indicate condition '14'
-- SIP/ftherese-00000000 answered Motif/+XXXXXXXXXXX
-- Sending DTMF '1' to the calling party.
-- Locally bridging Motif/+XXXXXXXXXXXX and SIP/ftherese-00000000
== Spawn extension (incoming-motif, s, 5) exited non-zero on 'Motif/+XXXXXXXXXXX'

Why do I have to dial "1" in my sipdroid to connect the call?
[Nexus 4 General] omegatotal:
So has anyone had any luck figuring out the google voice motif timeout issue where it will not detect the connection status of the chan_motif module??

I am leaning towards just scripting an automated test call to something like 909-390-0003 (loopback audio test?) and if it fails to connect reload the chan-motif module (I can confirm that this call is passed and auto answered :)

-- Called Motif/gmailtunnel/19093900003@voice.google.com
-- Motif/19093900003@voice.google.com-4f30 is proceeding passing it to SIP/5003-00000001
-- Motif/19093900003@voice.google.com-4f30 answered SIP/5003-00000001

but I suck at scripting :/

---------- Post added at 08:36 PM ---------- Previous post was at 08:03 PM ----------

Also a note on the costs

If you are running a regular m1-micro instance without reserving up front, thats $14.64/mo unless you qualify for the free tier which gives you a discount of $-16.84/mo

EBS Volumes, elastic IP's and iop's are extra but trivial, like a few dollars a month for 20GB and 10 iops/sec average over the month

data transfer is stupid cheap too like pennies per gb

if you reserve upfront the m1.micro for 1 year, costs goes down to an effective monthly cost of like 10.71 however you get next to no free tier discount if you choose this and there is a $23 upfront setup fee for 1 year,

REF:

http://calculator.s3.amazonaws.com/calc5.html
[Nexus 4 General] Nick123194:
What do you do with the pem file?
[Nexus 4 General] davidnewton:
I got the same problem as this. Any solution?

I have exactly the same problem. If I use CSipSimple or Linphone, then there is no such problem. Probably SipDroid has some issues?
[Nexus 4 General] jauling:
howdy all.

With the impending XMPP shutdown on May 15h, does this mean this thread basically is kaput? Are there any alternate methods to get SIP working post-shutdown?
[Nexus 4 General] bluespire:
SIP with GV? Probably not. I had good luck with Anveo. They are really cheap. US Phone # + e911 was about $5/month IIRC. I'll be moving back to that when GV quits. They offer Fax and Texting, as well, but last I checked their texting service was provided by a UK company, so no US number for that. If that doesn't both you then I would forge onward. There a number of other providers of course, my preference was Anveo.

I think that it's quite possible that Google will unveil a pay service to keep XMPP enabled on a per account basis, or maybe it will still be available with a business account. I guess we will have to see.
[Nexus 4 General] bananaboat23:
Is this still possible to do with the end of Google's XMPP support?
[Nexus 4 General] acegolfer:
I don't use this method any more. But dslreport ppl say that Google XMPP still works in some cases, and I think this method should work.
[Nexus 4 General] tech128:
It works in all cases. If it doesn't work for you, that means you need to troubleshoot.

It's a setting on google's server and/or your server.

Granted the new Asterisk 11 & 12 seem to be very retarded with respects to GV.

I was able to dial out no problem with it, but calls in wouldn't even get to the asterisk server for some reason. Very odd.

And don't get me started on this "motif" stuff they have now. Very confusing. gtalk and jabber were soooooooooooo much better/easier.

No such issues with 1.8.x
[Nexus 4 General] omegatotal:
The problem with the current setup ( I use it ) is that if you sign into the email account it has a high probability of changing the destination for the incoming calls to the email client and the motif plugin for freepbx does not have a configuration option for timeouts

the best thing you can do is just script an rcon to force a reload if there are no active calls every night (which I have been to lazy to do)
[Nexus 4 General] tech128:
Well if you're having issues with the email client overriding the incoming calls then that's a problem with the priority setting for motif.

It probably sets it below the priority for the email client.

The simonics gateway ran into that problem as well and managed to change the priority higher than the email client's.

Here is the relevant message: https://simonics.com/2012/11/gv-gateway-registration-open-new-features/

So if you can set the priority with motif or whatever they're using atm, then you should be set.
[Nexus 4 General] tarun1188:
Unable to install asterisk

Hi, I followed all the steps but when i try to stop/start the asterisk server it says:

Stopping Asterisk PBX: asterisk

No /usr/sbin/asterisk found running; none killed. [ OK ]​

* Starting Asterisk PBX: asterisk Privilege escalation protection disabled!

Illegal instruction​

Also the contents of /var/run/asterisk is empty.

Can anyone help me setting this up. Let me know if i have to provide any more information.

Thanks in advance
[Nexus 4 General] acegolfer:
Are you using csipsimple as your sip client? Did you select TCP (not UDP) in csipsimple>expert account settings>transport?

If so, this is a great news.

From what you wrote, you enabled TCP connection (transport=udp,tcp). But you didn't specify whether the client is connecting via TCP or UDP.
[Nexus 4 General] errorcod3:
Sorry, forgot to specific. I also use CSS. I changed the connection in expert mode to TCP. I made a phone call and ran the following on the server to ensure i was connected via TCP:

I REDACTED MY IP ADDRESSES

root@asterisk:/etc/asterisk# netstat -an |grep ESTABLISHED
tcp 0 0 1.2.3.4:53094 5.6.7.8:5222 ESTABLISHED
tcp 0 0 1.2.3.4:5060 5.6.7.8:56510 ESTABLISHED
tcp 0 52 1.2.3.4:22 5.6.7.8:50938 ESTABLISHED

I left the phone connected for about 3 minutes, then disconnected. Repeated the process a 2nd time... and still no problems. I didn't specific so that I could leave UDP as my default but still test TCP for you. It will allow both connections, but defaults to UDP if the user doesn't selected TCP.
[Nexus 4 General] acegolfer:
Awesome! I'm sold.

One question. You are using standard 5060 port and I didn't notice any security measures such as fail2ban. Do you plan to include the security measures to OP?
[Nexus 4 General] errorcod3:
Funny that you mention this. fail2ban relies on iptables to deny access. The whole reason I've been using ufw is because I can't seem to get iptables working correctly on this instance. If you manage to get it working please let me know. I got tired of messing with it.
[Nexus 4 General] bluespire:
From the following, it appears the ufw is just a simpler interface to iptables. So, in essence, you are still setting up iptables. Really, I don't believe there is any firewall app that DOESN'T use iptables to manipulate traffic. iptables can do anything, which is why it's so damn hard to configure.

https://help.ubuntu.com/community/UFW
[Nexus 4 General] errorcod3:
Yep, ufw does use iptables. But for whatever reason if I try to change iptables manually -- it does nothing.
[Nexus 4 General] acegolfer:
OP wrote:

#edit /etc/default/ufw and enable forward policy

#DEFAULT_FORWARD_POLICY="ACCEPT"

Shouldn't it be uncomment?
[Nexus 4 General] errorcod3:
Yes. Thanks. I'll fix that.
[Nexus 4 General] errorcod3:
Just a quick shortcut to get the USERNAME replaced everywhere in the files. Make your conf files by copying and pasting exactly what I had in the OP. DON'T PUT THEM IN /etc/asterisk YET -- PUT THEM IN YOUR HOME DIRECTORY. Then run the following command from the directory containing the files:

sed -i 's/USERNAME/insertnamehere/g' *.conf

insertnamehere is whatever you want your SIP username to be, this has nothing to do with your google account.
[Nexus 4 General] errorcod3:
Once you get everything compiled and installed you will notice that you will only have 71mb of space left on your drive. Copy all the deb files out of /usr/src (they are the kernel files that you compiled and save them) delete everything else in /usr/src then you should have about 5.2 GB left...
[Nexus 4 General] acegolfer:
I think you missed

apt-get install linux-headers-$(uname -r)

otherwise,

ln -nsf /usr/src/linux-headers-`uname -r`/include/asm-x86 /usr/src/linux-headers-`uname -r`/include/asm

will say no such file error.
[Nexus 4 General] errorcod3:
Did you load the Ubuntu 10.04 ebs 64 bit AMI?
[Nexus 4 General] errorcod3:
actually I think you must have deleted the contents of /usr/src after you compiled the kernel and before you installed asterisk. you couldn't have compiled the kernel without that directory. And you need that same exact directory to compile asterisk.
[Nexus 4 General] errorcod3:
If you use that apt-get header you just installed you may have problems. One of the deb files you created was your new linux header files, which should have installed when you installed the rest of the deb files. Those deb files you compiled are specific to amazon ec2 instance and 1000HZ timing. The repo version I don't know what's in that one....
[Nexus 4 General] acegolfer:
Perhaps you are right. I skipped compiling the kernel step. Wanted to see it works first. Then compile the kernel later.
[Nexus 4 General] acegolfer:
I skipped compiling the kernel. But I believe I followed all the other steps. Csip is registered and I placed a call to 9093900003(echo test).

Csip reported "404/not found" error

asterisk CLI shows

[Feb 1 15:03:47] NOTICE[1932][C-00000000]: chan_sip.c:25184 handle_request_invite: Call from '201' (XX.XX.XX.XX:5060) to extension '9093900003' rejected because extension not found in context 'google-out'.

any clue?
[Nexus 4 General] errorcod3:
Put a 1 in front of the number and try again
[Nexus 4 General] acegolfer:
Woot! That worked.

I can also confirm that there's no csip hangup issue with TCP.

Next, how do I get rid of 1 in front of 10 digit number when I place calls?
[Nexus 4 General] errorcod3:
look at this reference. Someone in the comments had a work around I think:

https://wiki.asterisk.org/wiki/display/AST/Calling+using+Google
[Nexus 4 General] acegolfer:
Found a simpler solution. Using filters in csip, rewrite all numbers prefix by 1.
[Nexus 4 General] acegolfer:
Spoke too soon. Once I changed TCP sip port from 5060 to some obscure port, hangup issue appeared. Back to square one.
[Nexus 4 General] errorcod3:
Strange, and that's isolated to using CSS only?
[Nexus 4 General] acegolfer:
Yes, it happens when I use all of the following combo

1. CSS

2. asterisk server

3. TCP

4. remote connection

5. non-5060 port

6. SPI firewall

If you want to change the TCP port to something other such as 5055, here are the additional steps.

1. tcpbindaddr=0.0.0.0:5055

2. open port 5055 TCP

3. reload asterisk

You may be able to hangup normally once right after you register. But after a few minutes, it will take 30 seconds to hang up after you press the end button.

I know it's weird.