Hi, I’m using Asterisk 11.0.1 compiled from source. My Google voice configuration works properly when Asterisk is started. But after the connection has been unused for some period, Google voice calls (inbound & outbound) stop working. Restarting Asterisk always fixes the problem.
I’ve mostly been trying to debug the outbound direction, since that’s the easiest to control and reproduce. The symptom is that the callee’s phone never rings. The caller hears ringing until the Dial command times out. The call appears in the Google voice history log. The Asterisk console shows that there’s a valid xmpp connection:
pbx*CLI> xmpp show connections
Jabber Users and their status:
[google] myusername@gmail.com - Connected
----
Number of clients: 1
With xmpp debugging on, here’s a “broken” call:
== Using SIP RTP CoS mark 5
-- Executing [18004337300@c470_ob:1] Macro("SIP/c470-00000004", "vz_dial,8004337300") in new stack
-- Executing [s@macro-vz_dial:1] Dial("SIP/c470-00000004", "Motif/google/18004337300@voice.google.com,30,r") in new stack
<--- XMPP sent to 'google' --->
<iq from='myusername@gmail.com/asterisk-xE772E28D' to='18004337300@voice.google.com' type='set' id='aaaif'><session type='initiate' id='4d48ae625bcc17d6' xmlns='http://www.google.com/session' initiator='myusername@gmail.com/asterisk-xE772E28D'><description xmlns='http://www.google.com/session/phone'><payload-type xmlns='http://www.google.com/session/phone' id='0' name='PCMU' channels='1' clockrate='8000'/><payload-type xmlns='http://www.google.com/session/phone' id='101' name='telephone-event' channels='1' clockrate='8000'/></description></session></iq>
<------------->
-- Called Motif/google/18004337300@voice.google.com
<--- XMPP received from 'google' --->
<iq from="18004337300@voice.google.com" to="myusername@gmail.com/asterisk-xE772E28D" type="error" id="aaaif"><session type="initiate" id="4d48ae625bcc17d6" initiator="myusername@gmail.com/asterisk-xE772E28D" xmlns="http://www.google.com/session"><description xmlns="http://www.google.com/session/phone"><payload-type id="0" name="PCMU" channels="1" clockrate="8000"/><payload-type id="101" name="telephone-event" channels="1" clockrate="8000"/></description></session><error code="302" type="modify"><redirect xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">xmpp:18004337300@voice.google.com/srvres-MTAuMjIxLjkuMTQ1Ojk4MTQ=</redirect><ses:redirect xmlns:ses="http://www.google.com/session">xmpp:18004337300@voice.google.com/srvres-MTAuMjIxLjkuMTQ1Ojk4MTQ=</ses:redirect></error></iq>
<------------->
<--- XMPP sent to 'google' --->
<iq from='myusername@gmail.com/asterisk-xE772E28D' to='18004337300@voice.google.com/srvres-MTAuMjIxLjkuMTQ1Ojk4MTQ=' type='set' id='aaaig'><session type='initiate' id='4d48ae625bcc17d6' xmlns='http://www.google.com/session' initiator='myusername@gmail.com/asterisk-xE772E28D'><description xmlns='http://www.google.com/session/phone'><payload-type xmlns='http://www.google.com/session/phone' id='0' name='PCMU' channels='1' clockrate='8000'/><payload-type xmlns='http://www.google.com/session/phone' id='101' name='telephone-event' channels='1' clockrate='8000'/></description></session></iq>
<------------->
<--- XMPP received from 'google' --->
<iq to="myusername@gmail.com/asterisk-xE772E28D" from="18004337300@voice.google.com/srvres-MTAuMjIxLjkuMTQ1Ojk4MTQ=" id="aaaig" type="result"/>
<------------->
<--- XMPP sent to 'google' --->
<iq from='myusername@gmail.com/asterisk-xE772E28D' to='18004337300@voice.google.com/srvres-MTAuMjIxLjkuMTQ1Ojk4MTQ=' type='set' id='aaaih'><session type='candidates' id='4d48ae625bcc17d6' xmlns='http://www.google.com/session' initiator='myusername@gmail.com/asterisk-xE772E28D'><candidate name='rtp' address='192.168.0.101' port='50008' preference='0.95' type='local' protocol='udp' network='0' username='11b7f933630bcfb7' generation='0' password='' foundation='0' component='1'/><candidate name='rtcp' address='192.168.0.101' port='50009' preference='0.95' type='local' protocol='udp' network='0' username='11b7f933630bcfb7' generation='0' password='' foundation='0' component='1'/></session></iq>
<------------->
-- Motif/18004337300@voice.google.com-d233 is proceeding passing it to SIP/c470-00000004
<--- XMPP received from 'google' --->
<iq to="myusername@gmail.com/asterisk-xE772E28D" from="18004337300@voice.google.com/srvres-MTAuMjIxLjkuMTQ1Ojk4MTQ=" id="aaaih" type="result"/>
<------------->
<--- XMPP received from 'google' --->
<iq from="18004337300@voice.google.com/srvres-MTAuMjIxLjkuMTQ1Ojk4MTQ=" to="myusername@gmail.com/asterisk-xE772E28D" id="jingle:10.221.9.145-32458319:1:43431D84" type="set"><ses:session type="candidates" id="4d48ae625bcc17d6" initiator="myusername@gmail.com/asterisk-xE772E28D" xmlns:ses="http://www.google.com/session"><ses:candidate name="rtp" address="74.125.128.127" port="19305" username="1F3295BE327D8CA1" preference="3.0" protocol="udp" network="mediaproxy" generation="0" password="" type="relay"/><ses:candidate name="rtp" address="74.125.128.127" port="19305" username="1F3295BE327D8CA1" preference="2.0" protocol="tcp" network="mediaproxy" generation="0" password="" type="relay"/><ses:candidate name="rtp" address="74.125.128.127" port="443" username="1F3295BE327D8CA1" preference="1.0" protocol="ssltcp" network="mediaproxy" generation="0" password="" type="relay"/></ses:session></iq>
<------------->
NB: Working and broken calls seem the same to this point
<--- XMPP received from 'google' --->
<iq from="18004337300@voice.google.com/srvres-MTAuMjIxLjkuMTQ1Ojk4MTQ=" to="myusername@gmail.com/asterisk-xE772E28D" id="jingle:10.221.9.145-32458319:1:43431D8B" type="set"><ses:session type="accept" id="4d48ae625bcc17d6" initiator="myusername@gmail.com/asterisk-xE772E28D" xmlns:ses="http://www.google.com/session"><pho:description xmlns:pho="http://www.google.com/session/phone"><pho:payload-type id="0" name="PCMU" clockrate="8000"/><pho:payload-type id="101" name="telephone-event"/></pho:description></ses:session></iq>
<------------->
<--- XMPP sent to 'google' --->
<iq to='18004337300@voice.google.com/srvres-MTAuMjIxLjkuMTQ1Ojk4MTQ=' type='set' id='aaaii'><session type='terminate' id='4d48ae625bcc17d6' xmlns='http://www.google.com/session' initiator='myusername@gmail.com/asterisk-xE772E28D'><reason><success/></reason></session></iq>
<------------->
== Spawn extension (macro-vz_dial, s, 1) exited non-zero on 'SIP/c470-00000004' in macro 'vz_dial'
== Spawn extension (c470_ob, 18004337300, 1) exited non-zero on 'SIP/c470-00000004'
<--- XMPP received from 'google' --->
<iq to="myusername@gmail.com/asterisk-xE772E28D" from="18004337300@voice.google.com/srvres-MTAuMjIxLjkuMTQ1Ojk4MTQ=" id="aaaii" type="result"/>
<------------->
pbx*CLI>
If I restart Asterisk and repeat the exact same call, it works perfectly:
== Using SIP RTP CoS mark 5
-- Executing [18004337300@c470_ob:1] Macro("SIP/c470-00000000", "vz_dial,8004337300") in new stack
-- Executing [s@macro-vz_dial:1] Dial("SIP/c470-00000000", "Motif/google/18004337300@voice.google.com,30,r") in new stack
<--- XMPP sent to 'google' --->
<iq from='myusername@gmail.com/asterisk-x9132EABD' to='18004337300@voice.google.com' type='set' id='aaaac'><session type='initiate' id='01f2ab0467682df3' xmlns='http://www.google.com/session' initiator='myusername@gmail.com/asterisk-x9132EABD'><description xmlns='http://www.google.com/session/phone'><payload-type xmlns='http://www.google.com/session/phone' id='0' name='PCMU' channels='1' clockrate='8000'/><payload-type xmlns='http://www.google.com/session/phone' id='101' name='telephone-event' channels='1' clockrate='8000'/></description></session></iq>
<------------->
-- Called Motif/google/18004337300@voice.google.com
<--- XMPP received from 'google' --->
<iq from="18004337300@voice.google.com" to="myusername@gmail.com/asterisk-x9132EABD" type="error" id="aaaac"><session type="initiate" id="01f2ab0467682df3" initiator="myusername@gmail.com/asterisk-x9132EABD" xmlns="http://www.google.com/session"><description xmlns="http://www.google.com/session/phone"><payload-type id="0" name="PCMU" channels="1" clockrate="8000"/><payload-type id="101" name="telephone-event" channels="1" clockrate="8000"/></description></session><error code="302" type="modify"><redirect xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">xmpp:18004337300@voice.google.com/srvres-MTAuMjIwLjU0LjE5ODo5ODk0</redirect><ses:redirect xmlns:ses="http://www.google.com/session">xmpp:18004337300@voice.google.com/srvres-MTAuMjIwLjU0LjE5ODo5ODk0</ses:redirect></error></iq>
<------------->
<--- XMPP sent to 'google' --->
<iq from='myusername@gmail.com/asterisk-x9132EABD' to='18004337300@voice.google.com/srvres-MTAuMjIwLjU0LjE5ODo5ODk0' type='set' id='aaaad'><session type='initiate' id='01f2ab0467682df3' xmlns='http://www.google.com/session' initiator='myusername@gmail.com/asterisk-x9132EABD'><description xmlns='http://www.google.com/session/phone'><payload-type xmlns='http://www.google.com/session/phone' id='0' name='PCMU' channels='1' clockrate='8000'/><payload-type xmlns='http://www.google.com/session/phone' id='101' name='telephone-event' channels='1' clockrate='8000'/></description></session></iq>
<------------->
<--- XMPP received from 'google' --->
<iq to="myusername@gmail.com/asterisk-x9132EABD" from="18004337300@voice.google.com/srvres-MTAuMjIwLjU0LjE5ODo5ODk0" id="aaaad" type="result"/>
<------------->
<--- XMPP sent to 'google' --->
<iq from='myusername@gmail.com/asterisk-x9132EABD' to='18004337300@voice.google.com/srvres-MTAuMjIwLjU0LjE5ODo5ODk0' type='set' id='aaaae'><session type='candidates' id='01f2ab0467682df3' xmlns='http://www.google.com/session' initiator='myusername@gmail.com/asterisk-x9132EABD'><candidate name='rtp' address='192.168.0.101' port='50046' preference='0.95' type='local' protocol='udp' network='0' username='04e867b8230cad40' generation='0' password='' foundation='0' component='1'/><candidate name='rtcp' address='192.168.0.101' port='50047' preference='0.95' type='local' protocol='udp' network='0' username='04e867b8230cad40' generation='0' password='' foundation='0' component='1'/></session></iq>
<------------->
-- Motif/18004337300@voice.google.com-f832 is proceeding passing it to SIP/c470-00000000
<--- XMPP received from 'google' --->
<iq to="myusername@gmail.com/asterisk-x9132EABD" from="18004337300@voice.google.com/srvres-MTAuMjIwLjU0LjE5ODo5ODk0" id="aaaae" type="result"/>
<------------->
<--- XMPP received from 'google' --->
<iq from="18004337300@voice.google.com/srvres-MTAuMjIwLjU0LjE5ODo5ODk0" to="myusername@gmail.com/asterisk-x9132EABD" id="jingle:10.220.54.198-19994760:1:428448FA" type="set"><ses:session type="candidates" id="01f2ab0467682df3" initiator="myusername@gmail.com/asterisk-x9132EABD" xmlns:ses="http://www.google.com/session"><ses:candidate name="rtp" address="74.125.128.127" port="19305" username="9A6D9D7F509BD831" preference="3.0" protocol="udp" network="mediaproxy" generation="0" password="" type="relay"/><ses:candidate name="rtp" address="74.125.128.127" port="19305" username="9A6D9D7F509BD831" preference="2.0" protocol="tcp" network="mediaproxy" generation="0" password="" type="relay"/><ses:candidate name="rtp" address="74.125.128.127" port="443" username="9A6D9D7F509BD831" preference="1.0" protocol="ssltcp" network="mediaproxy" generation="0" password="" type="relay"/></ses:session></iq>
<------------->
NB: Working and broken calls seem the same to this point
<--- XMPP sent to 'google' --->
<iq type='result' from='myusername@gmail.com/asterisk-x9132EABD' to='18004337300@voice.google.com/srvres-MTAuMjIwLjU0LjE5ODo5ODk0' id='jingle:10.220.54.198-19994760:1:428448FA'/>
<------------->
<--- XMPP received from 'google' --->
<iq from="18004337300@voice.google.com/srvres-MTAuMjIwLjU0LjE5ODo5ODk0" to="myusername@gmail.com/asterisk-x9132EABD" id="jingle:10.220.54.198-19994760:1:42844900" type="set"><ses:session type="accept" id="01f2ab0467682df3" initiator="myusername@gmail.com/asterisk-x9132EABD" xmlns:ses="http://www.google.com/session"><pho:description xmlns:pho="http://www.google.com/session/phone"><pho:payload-type id="0" name="PCMU" clockrate="8000"/><pho:payload-type id="101" name="telephone-event"/></pho:description></ses:session></iq>
<------------->
-- Motif/18004337300@voice.google.com-f832 answered SIP/c470-00000000
<--- XMPP sent to 'google' --->
<iq type='result' from='myusername@gmail.com/asterisk-x9132EABD' to='18004337300@voice.google.com/srvres-MTAuMjIwLjU0LjE5ODo5ODk0' id='jingle:10.220.54.198-19994760:1:42844900'/>
<------------->
-- Locally bridging SIP/c470-00000000 and Motif/18004337300@voice.google.com-f832
pbx*CLI>
I’m not an expert on Jingle, but it appears to me that the working and non-working calls diverge after a certain point, which I’ve tried to identify in the above debug logs.
Here is my motif.conf:
[google]
transport=google-v1
context=gv_in
disallow=all
allow=ulaw
connection=google
Here is my xmpp.conf:
[general]
[google]
type=client
serverhost=talk.google.com
username=myusername@gmail.com
secret=mypassword
priority=1
port=5222
usetls=yes
usesasl=yes
status=available
statusmessage="Unavailable"
keepalive=yes
timeout=5
The relevant Dial string:
exten => s,1,Dial(Motif/google/1${ARG1}@voice.google.com,30,r)
I’ve tried creating a cron job which places a call every 12 hours, but this didn’t solve the problem. It seems I’m either barking up the wrong tree about the relationship with idle time, or it is less than 12 hours.
The Asterisk server is behind a NAT, but I don’t think this is causing the problem for two reasons. First, I put the Asterisk server in the DMZ and the problem still occurred. Second, it seems to be a Jingle issue where Asterisk doesn’t SEND an expected message TO the Google voice server, not the other way around. Once the call is connected, audio always works properly.
Any ideas would be welcome!
JR