yashsingh1/xdaforums huggingface dataset:
[Nexus 4 General] jhax01:
Here's the changes needed for multiple GV numbers on the same phone.

motif.conf

[google]
context=incoming-motif
disallow=all
allow=ulaw
connection=google

[google2]
context=incoming-motif
disallow=all
allow=ulaw
connection=google2

So all we do with motif.conf is define another google account using the same context

Then in xmpp.conf, we add the GV login info:

xmpp.conf

[general]
[google]
type=client
serverhost=talk.google.com
username=YOURGMAILADDRESS
secret=YOUREMAILPASSWORD
priority=100
port=5222
usetls=yes
usesasl=yes
status=available
statusmessage="VOIP"
timeout=5

[google2]
type=client
serverhost=talk.google.com
username=YOURGMAILADDRESS
secret=YOUREMAILPASSWORD
priority=100
port=5222
usetls=yes
usesasl=yes
status=available
statusmessage="VOIP"
timeout=5

Just changing motif.conf and xmpp.conf will start the inbound calls ringing the same SIP and or IAX account as defined in sip.conf or iax.conf. If you would like the ability to select the outbound call line, then modify extensions.conf like so:

extensions.conf

[general]
autofallthrough=yes

; If an authenticated request some how gets through, send them to free 411.
[default]
exten => 411,1,Answer()
same => n,Dial(Motif/google/1800...@voice.google.com)

[local]
exten => _1XXXXXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)
exten => _XXXXXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)
exten => _+1XXXXXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)
exten => _*1XXXXXXXXXX,1,Dial(Motif/google2/${EXTEN}@voice.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/SIPUSERNAME,20,D(:1))
same => n,Dial(IAX2/IAXUSERNAME,20,D(:1))

Note that under the local section, the last line accepts dial conditions of *1-xxx-xxx-xxxx. Adding the star to the front of the number will direct Asterisk to use "google2" as the outbound line for placing the call. In my testing, Asterisk will ignore + and * singly, as well as in combination, such as ++1-xxx-xxx-xxxx. So you can add quite a few lines of service with the ability to place calls individually from different lines right from the dialer without changing any settings, etc. As I previously stated, the only issue is parsing an inbound call -- the caller ID displays the inbound caller's number, but not the GV number used. Hopefully someone has a method for parsing this info in a way that will be accepted by the SIP or IAX client??
[Nexus 4 General] bluespire:
I only have the default setup specified in the first post, but sometimes when I call out from CSS, I get a double call trying to go through. Any ideas?
[Nexus 4 General] errorcod3:
double call?
[Nexus 4 General] bluespire:
Yeah, so CSS will actually call the same number twice simultaneously. I get two CSS calling GUIs, only they are shrunk horizontally to fit in my screen. It's really weird. Neither of the calls works even when I hit "end call" on one or the other.
[Nexus 4 General] errorcod3:
Are you using the play store version or nightly build?
[Nexus 4 General] jhax01:
You might also just try the Zoiper client in the market. Seems to work pretty well, just not as configurable as CSS. Additionally, Zoiper will allow you to set it as the default with the native dialer so you don't always get the pop up.
[Nexus 4 General] korgmotif:
According to Amazon's EC2 cost calculator, http://calculator.s3.amazonaws.com/calc5.html, it costs $14.64 a month to run a micro Linux server full time. Is this the cost we should be expecting after the free year runs out?
[Nexus 4 General] bluespire:
I calculated $7/month. What did you use for your calculations?
[Nexus 4 General] inc188:
WOW. thanks
[Nexus 4 General] errorcod3:
This should be the cost. don't use on demand. reserve an instance for a whole year and it's cheaper.
[Nexus 4 General] Antebios:
I tried it using the mentioned configs and it still doesn't work. I think a more detailed guide is needed for those with home Ubuntu servers pointing to the internet. Otherwise, can you point me to someplace else so I can help myself?

A few months ago I was trying to get FreePBX to work, but the guides didn't help, and I eventually gave up.
[Nexus 4 General] acegolfer:
It's possible that you have asterisk 1.8 installed. OP's conf works for asterisk 11. The way it interacts with GV has changed between the 2 versions.
[Nexus 4 General] Antebios:
Funny you mentioned that. So after I sent the message I checked what version I have, and sure thing, I'm running 1.8. I don't remembered how I installed it (repository?), but I'll remove the old Asterisk and install the newest version.
[Nexus 4 General] acegolfer:
Does anyone use G729 codec with asterisk 11? If so, which codec_g729.so file do you use?
[Nexus 4 General] jhax01:
http://asterisk.hosting.lv/bin/codec_g729-ast110-gcc4-glibc-x86_64-core2.so

That's the one I'm using with the EC2 server. Just got back from Europe and it worked like a champ over3G and Wi-Fi using both IAX and SIP clients...
[Nexus 4 General] googleme1:
Hey Errorcod3, thanks for the guide. So far i have set up eveything just how you have it on the OP and outgoing calls work very nicely. The only problem is that incoming calls don't work. It isn't dialing the sip extension (softphone/csipsimple). If anyone would like to help me out on this one it would be much appreciated.
[Nexus 4 General] errorcod3:
Do you have Google voice configured to forward calls to Google chat ?
[Nexus 4 General] googleme1:
Yes,i do. That's why i am concerned.
[Nexus 4 General] errorcod3:
And in extensions.conf the last line, you changed USERNAME to your sip extension? So if in sip.conf my extension was 100 then it would look like this

[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/100,20,D(:1))

The last line is the one you need to ensure is correct:

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

If that's correct then you need to type asterisk -rvvvv as root. Then call your google number and paste the results here.
[Nexus 4 General] googleme1:
This is what i get, which means that it is calling my extension, it's just not ringing on the softphone...

-- Executing [s@incoming-motif:1] NoOp("Motif/+17607058888-d7a8", "") in new stack
-- Executing [s@incoming-motif:2] Set("Motif/+17607058888-d7a8", "crazygooglecid=+17607058888@voice.google.com/srvenc-1ZzORMUOVhQxloZy647WGtqxYlzG9kL6") in new stack
-- Executing [s@incoming-motif:3] Set("Motif/+17607058888-d7a8", "stripcrazysuffix=+17607058888") in new stack
-- Executing [s@incoming-motif:4] Set("Motif/+17607058888-d7a8", "CALLERID(all)=+17607058888") in new stack
-- Executing [s@incoming-motif:5] Dial("Motif/+17607058888-d7a8", "SIP/**MYUSERNAMEHERE**,20,D(:1)") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/**MYUSERNAMEHERE**
-- Nobody picked up in 20000 ms
-- Auto fallthrough, channel 'Motif/+17607058888-d7a8' status is 'NOANSWER'
[Nexus 4 General] errorcod3:
Ok, so you got the server configured properly. Couple things you need to troubleshoot, because this sounds like a NAT issue. I'll assume your SIP extension is on your phone connected to your wifi. Disconnect from wifi and register the sip extension over your 3G/4G connection. Does the problem persist?

Change your sip extension back and forth between UDP and TCP. Does the problem happen on both protocols?

Double check your port settings on the EC2 Security Group, make sure you have the 10000-20000 UDP ports open.

check status of firewall on your server, "ufw status" -- make sure you have the same 10000-20000 ports allowed.

Sometimes the simplest answer, is the right one: make sure your sip client is configured to receive calls :)
[Nexus 4 General] jhax01:
I'll also add that, at least for me, sometimes when I had fiddled with the settings quite a bit, merely restarting Asterisk didn't have the desired effect and I had to reboot the entire server. Shouldn't be the case, but....
[Nexus 4 General] googleme1:
Now the asterisk server isn't even seeing the call come in... *sigh*
[Nexus 4 General] jhax01:
That could be a priority issue in your sip.conf file. When I had mine set to 1, the calls would never leave Google chat. When I set it to 100, it has worked every time.

---------- Post added at 11:08 AM ---------- Previous post was at 11:06 AM ----------

Scratch that... I meant your xmpp.conf file...
[Nexus 4 General] googleme1:
Thanks that isn't the problem, it is set to 100 at the moment and still nothing even after restarting asterisk

---------------------------------------------------------

Edit - Back to square one, Asterisk sees the calls. I have made sure my sip client is willing to accept calls, i have tried TCP and UDP connections to asterisk on mobile data and i have even tried enabling STUN. But, sometimes what i do get is this after about a minute after calling:

[Feb 15 16:48:09] WARNING[1635]: chan_sip.c:4164 retrans_pkt:
Retransmission timeout reached on transmission 2badd9c00f1dd7b20853c77537156326@54.235.152.246:5060 for seqno 102 (Critical Request) --
See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions

and when it goes to voicemail it rings once on the client sometimes.
[Nexus 4 General] jhax01:
Then almost surely a NAT issue as errorcod3 suggested, I think... Wish I had a good suggestion, but I'm an utter n00b when it comes to Linux....
[Nexus 4 General] chdloc:
Not sure whether this is your issue, but:

Are you using your main Google account in your setup?

I was running into the same issue as you (no incoming calls). I have read in a few forums that you really should create a secondary Google account (and associated DID number) to avoid routing issues. My theory is that you are likely logged into your main Google account from several locations (your smartphone, your tablet, Gmail in a browser etc.) and one of the other connections keeps the trunk hostage. In that case, Google likely routes the call someplace else and Asterisk remains dark.

If this all applies to you, run the following experiment: Establish an outbound call, hang up and immediately establish an inbound call. In my case, only then I could see the Google trunk to be active in Asterisk. I never took a real deep dive into the issue, but after a few minutes (ten, maybe) the trunk remained dead for incoming calls unless I establish an outbound call again.

Long story short, I gave up on trying to get a reliable GTalk trunk working that uses my main Google account. I never had an issue with a dedicated Google account...
[Nexus 4 General] jhax01:
I just reproduced your problem. It is not mentioned in the guide, but you need to set the rtp start and end points in /etc/asterisk/rtp.conf

rtp.conf

rtpstart=10000
rtpend=20000
[Nexus 4 General] googleme1:
This code was already in my rtp.conf thanks. I have managed to get my sip client to ring under UDP (I'm assuming that settings on the sip client caused some trouble). I am just not able to get calls under TCP now.

Here are my firewall rules:

22/tcp ALLOW Anywhere
1723/tcp ALLOW Anywhere
5060/tcp ALLOW Anywhere
5060/udp ALLOW Anywhere
10000:20000/udp ALLOW Anywhere
80/udp ALLOW Anywhere

also im positive that these ports are opened through my Security Groups under the aws console. What else could be the problem?
[Nexus 4 General] bluespire:
Can you double check that your security policy is for the same server enclave as your EC2 instance. I think it is, since it works at all, but still worth a check. When I first started to build the EC2 instance, I accidentally selected the north-east Ubuntu instance to build, which of course had me build a NE policy, but my login automatically took me to just the EAST enclave. I noticed my mistake and started over.
[Nexus 4 General] googleme1:
Thanks, but that's not the problem. Everything works correctly on UDP, it's just that on TCP it tries calling the registered client (and does), the client just does not ring.
[Nexus 4 General] Antebios:
I have followed directions, used my expertise on Google-Fu, but I have yet to solve this error:

No channel type registered for Motif
Unable to create channel of type 'Motif' (cause 66 - Channel not implemented)

I can see that chan_motif was compiled with Asterisk 11, but how do I see if it was loaded within Asterisk?
[Nexus 4 General] jhax01:
log into console with "asterisk -r"

then try "module load chan_motif.so"

It will either load or point you at an error.

---------- Post added at 09:45 PM ---------- Previous post was at 09:42 PM ----------

I still believe it to be a NAT issue, but a workaround may be to set type=friend in sip.conf instead of type=peer. It is less secure according to what I've read, but it may work for you.
[Nexus 4 General] paincorp:
I'm getting a "Account registration unsuccessful: (transaction terminated)" I've double checked everything, can can't figure out why. I'm about ready to just start over and see if something compiled wrong. I've double checked all my logins and I know they're correct
[Nexus 4 General] Antebios:
A few hours ago I tried loading the driver and I go this message from the asterisk console:

sdf-1*CLI> module load chan_motif.so
Unable to load module chan_motif.so
Command 'module load chan_motif.so ' failed.
== Parsing '/etc/asterisk/motif.conf': Found
[Feb 16 20:29:25] ERROR[26138]: chan_motif.c:2499 custom_connection_handler: Connection 'local-jabber-account' configured on endpoint 'jingle-endpoint' could not be found
[Feb 16 20:29:25] ERROR[26138]: config_options.c:580 aco_process_var: Error parsing connection=local-jabber-account at line 81 of
[Feb 16 20:29:25] ERROR[26138]: config_options.c:405 process_category: In motif.conf: Processing options for jingle-endpoint failed
[Feb 16 20:29:25] ERROR[26138]: chan_motif.c:2565 load_module: Unable to read config file motif.conf. Not loading module.

I ran "core show moduletypes" and Motif is not there. I know I compiled it, I found the file in /usr/lib64/asterisk/modules/chan_motif.so, so I'm getting close. Google results aren't helping. I feel like I'm soooooo close and I'm sure I'm one stupid command or config setting away from getting it working. I told myself if I can't get it fixed by the end of the month then I'm going to buy the bullet and use regular cell minutes. I also want to see if I can move my land line number (to cell phone, then from cell to GV).
[Nexus 4 General] acegolfer:
Try Piaf on ec2. Everything is already compiled.
[Nexus 4 General] jhax01:
There's errata in your xmpp.conf or motif.conf. Every line needs to mean something to Asterisk or it will prevent it from loading. Also, res_xmpp.so has to load before chan_motif -- you can edit modules.conf and put in preload=res_xmpp.so. But my money is on syntax in xmpp.conf.
[Nexus 4 General] Antebios:
Well, adding 'preload=res_xmpp.so' to modules.conf at the beginning helped, but I'm still getting the error message of

Connection local-jabber-account configured on endpoint jingle-endpoint could not be found

So, when I fix that I think that will be it. I cleaned up my config files one more time and started from scratch, but no go. I did apply this patch: https://issues.asterisk.org/jira/browse/ASTERISK-21108 because of some messages I got, recompiled, but it didn't help with my issue, just made the error message more accurate.

Grrr... I'm so close. I do have Asterisk-GUI installed and working. Could that help me keep my configs cleaner and valid?

---------- Post added at 12:24 AM ---------- Previous post was at 12:22 AM ----------

I'm using my home Ubuntu server that's already facing the world.

---------- Post added at 12:29 AM ---------- Previous post was at 12:24 AM ----------

FYI - this is my motif.conf contents:

[default](!)
disallow=all
allow=ulaw
allow=h264
context=incoming-motif ; Default context that incoming sessions will land in

; Sample configuration entry for Jingle
[jingle-endpoint](default)
transport=ice-udp ; Change the default protocol of outgoing sessions to Jingle ICE-UDP
allow=g722 ; Add G.722 as an allowed format since the other side may support it
connection=local-jabber-account ; Connection to accept traffic on and send traffic out
accountcode=jingle ; Account code for CDR purposes

; Sample configuration entry for Google Talk
[gtalk-endpoint](default)
transport=google ; Since this is a Google Talk endpoint we want to offer Google Jingle for outgoing sessions
connection=gtalk-account

; Sample configuration entry for Google Voice
[gvoice](default)
transport=google-v1 ; Google Voice uses the original Google Talk protocol
connection=gvoice-account

[google]
context=incoming-motif
disallow=all
allow=ulaw
connection=google
[Nexus 4 General] errorcod3:
I wish I could help you, my asterisk knowledge is limited. Hopefully someone will step up and get you straightened out.
[Nexus 4 General] errorcod3:
An unusual project

Today I put together something a little odd. Thought I'd share. When I'm at home I like for my google voice number to forward to my 'home sip phone' and when I'm gone I want it to forward it to my cell phone sip client.

So, I wanted to automate this process. I decided to use twitter to accomplish this. The first thing I did was setup a new twitter account for my EC2 server. I used a command line client called ttytter (http://www.floodgap.com/software/ttytter/). It's very simple to use.

The next thing I did was create a new twitter account for my phone and tied my REAL cell phone number to it (not my google voice -- which is what I use for everything). This allows Tasker to send sms messages to 40404 (which is twitter) that become tweets.

Then I made the two accounts follow each other and made the timelines private.

Then I created a Tasker that sens a SMS to 40404 when the phone connects to my home wifi. The SMS it sends for home wifi is "home 1001"

The end task for that Tasker is "gone 1004".

So so far I have my phone tweeting two lines depending if it's connected to my home wifi or not.

On the server, I set the following to run every five minutes (as root):

#location HOME=1001 AWAY=1004
#status HOME=1002 AWAY=1007

#check status
echo "/r" | /home/ubuntu/.ttytter/ttytter -script |tail -1| sed 's/^.*\(....\)$/\1/' > /home/ubuntu/.location
sleep 5

location=`cat /home/ubuntu/.location`
status=`cat /home/ubuntu/.currentstatus`
statusid=$(($location + $status))

#no changes
if [ "$statusid" == 2003 ]
then
exit

elif [ "$statusid" == 2011 ]
then
exit

#leaving home. set as away. forward to cell phone only.
#status=1002 location=1004
#HOME and CELL are the SIP extension names this changes the last line of the incoming calls for extensions.conf

elif [ "$statusid" == 2006 ]
then
echo "1007" > /home/ubuntu/.currentstatus
sed -i.bak 's/HOME/CELL/g' /etc/asterisk/extensions.conf
asterisk -rx "dialplan reload"
echo "/dm CELLTWITTERACCOUNT all calls forwarded to cell" | /home/ubuntu/.ttytter/ttytter -script
exit

#returning home. set as home. forward to home phone.
#status=1007 location=1001
elif [ "$statusid" == 2008 ]
then
echo "1002" > /home/ubuntu/.currentstatus
sed -i.bak 's/CELL/HOME/g' /etc/asterisk/extensions.conf
asterisk -rx "dialplan reload"
echo "/dm CELLTWITTERACCOUNT Welcome Home!" | /home/ubuntu/.ttytter/ttytter -script
exit
fi

echo "/dm CELLTWITTERACCOUNT Something went wrong with asterisk! away 1004 home 1001 0000" | /home/ubuntu/.ttytter/ttytter -script
[Nexus 4 General] jhax01:
Oh, I see what you're doing... Make a backup of the original motif.conf if you like, but start with a blank file and add the items from the guide in post #1. Same goes for sip.conf, xmpp.conf, extensions.conf... All the garbage in the samples is mostly just there as a syntax reference.
[Nexus 4 General] Antebios:
I DID IT!!!! I DID IT!!!! IT'S WORKING!!!! This morning I fiddled with the configs again and cleaned them out. I no longer had the error messages, but my SipDroid client was timing out trying to log in. I gave up and removed the /etc/asterisk directory, then went back to my source directory (/usr/src/asterisk*) and did a 'make samples' to put all the original sample config in place. I then followed the config instructions exactly, but this time deleting the original configs and creating the files from scratch. I viewed the log file with: tail -f /var/log/asterisk/messages so I could see what's happening in real time. IT WORKED! My wife was always complaining about the call quality. I was using Pbxes.org, as most people use too. This opens up a lot of possibilities. Maybe I can move my home number to my Asterisk system, and also have a dedicated fax line? Ohhh, then create my own "company" pbx system so people think I have a big company along with extensions and such. I think Asterisk is going to suck a lot of my time. THANK YOU ALL!!!

One more question: which client has the better codecs? CSipSimple or SipDroid? Also, which codecs are better or in what order should they be used? I tried SipDroid's G722 HD exclusively and it was great.
[Nexus 4 General] acegolfer:
Awesome.

I use csip with g722 for WiFi and g729 for 3g.
[Nexus 4 General] Vrekk:
Set this up this morning and I am loving it so far. I love being able to turn just about any internet connected device into a phone and with this it actually works reliably.

EDIT: Also what are the advantages to using something like csip vs the SIP accounts built into Android? Better codec choices?
[Nexus 4 General] Antebios:
Well, I'm having some success. With SipDroid I can make calls, but for an incoming call: I answer and they can't hear me and I can't hear them. With CSipSimple I'm can make and receive calls, but either we can't hear each other or they can hear me, but they are garbled. I think I just have to find the right codec to use for each separate app (CSipSimple and SipDroid).
[Nexus 4 General] acegolfer:
It's a well known issue that sipdroid doesn't work well with asterisk servers behind NAT.
[Nexus 4 General] Antebios:
Now you tell me. About 1-2 hours ago I gave up on SipDroid and finally got CSipSimple to make and receive calls. I find the right set of codecs, it's working great for Wi-Fi, making and receiving calls. I've found that CSipSimple app will crash internally, but not let the user know. I've had to go and kill the app in Android and then it's back to working great again.

Now, notice that I said it's working great for Wi-Fi. I'm at home and I get a strong HSPA+ signal, I just did a speedtest and I got 47ms, 8,369 kbps down, and 1,563 kbps up. That's some might good speed for home. When I'm at work I get 46ms, 17,089 kbps down, and 2,329 kbps up. That's damn fast and not even LTE speeds. So, my cell phone data connection is not a problem. I can make calls and receive calls on Cell Data, but either party cannot hear nor speak to each other. I'm off to see the Wizard, the wonderful Wizard of Google. Thanks for your help so far!
[Nexus 4 General] jhax01:
That's most likely a codec issue... If you specify a codec that asterisk doesn't understand, it will just pass it through rather than attempt to translate it, which is fine if it's another client on the other end. But if you're going through Google Voice, it has to be translated to ulaw or there will be no audio for either party. If one side has audio and not the other, that is generally a firewall or NAT issue...

What codec are you trying to use for your 3G connection?
[Nexus 4 General] errorcod3:
I've found that the nightly build of css works much better for the N4