Google Voice Wait for RTP


#1

I have been testing the Google Voice setup on Asterisk for some time now and I have been consistently having problems with answering calls reliably. Outbound appears to work fine.

I have tried the wait(8) and dial(1,1500) options that work for some time but also fail if google takes more then 8 seconds to setup the RTP session. On the off chance google takes less then 8 seconds the end caller is waiting for no reason.

I was wondering if it would be possible to modify the Answer() function to return after a successful RTP session has been established? I do not know exactly what answer does but it seems logical for it to check that the call was actually answered or it should fail instead of blindly moving to the next instruction that might fail such as sending DTMF to a RTP session that may not be established yet. I noticed this by turning RTP debugging on and watching while I adjusted the wait timer.

Or is their a function that can already do this?

Thanks,

-Cabel


#2

Answer already does this. The parameter is the number of ms to wait for the start of media (floored at 500ms). The help text seems to miss that it is cut short by the arrival of media.

As far as I can see, this is one of the few valid uses of Answer. For most purposes it is better to let the answer be inferred.


#3

So I tried setting my answer to answer(10000)
I see the RTP stream come up at about 8 second but answer still appears to wait out the whole 10 seconds before moving to the next item in my extensions.conf

So am I misunderstanding the meaning of arrival of media?


#4

Looking further down the code, it does wait the full delay if one is explicitly specified, but will stop on media if the default, of 500ms is used.

Changing this should be an easy and safe source code change as the code specifically checks for an explicit delay after having confirmed the presence of media, so it will mainly be a case of removing code.


#5

I tried modifying the default of 500ms to 10 seconds just to see if it would work.
Sure enough, works perfectly in the limited tests that I have tried so far. I will report back after some more testing. If google sends RTP right away then the user does not need to wait out the whole delay. But if they are running slower then 500ms then your inbound calls won’t fail like before. It might be safe to move this number higher, but i think if you wait much longer the call gets automatically routed to voicemail. I will check to see what that number is.


#6

Looks like its 14 seconds max then to voicemail you go.


#7

After some debugging and some tcpdumps it looks like some times the RTP stream never comes though from Google.

So looks like there is nothing we can do about that in Asterisk.

Thanks for your help.

-Cabel


#8

Posting patches here will not get them into the official code. To be accepted, they have to be attached by the original author, after they have electronically signed a licence grant. This is so that Digium have clear evidence of the permission to include them in their products.

The patches here would be considered feature requests, so would have to be submitted relative to the SVN trunk version.

If anything, posting them here could poison them, as there is a risk that someone else would try to falsely claim ownership then submit them using the proper mechanism.


#9

I submitted a patch for this issue.
issues.asterisk.org/jira/browse/ASTERISK-18971

It fixes the intermittent answer issues for me on a few different Asterisk Implementations that I have tested it on.

Works great with either of the following methods
exten => _[a-z].@gmail.com, 1, Answer()
exten => _[a-z].@gmail.com, n, SendDTMF(w1w)
or
exten => _[a-z].@gmail.com, 1, Dial(SIP/SIPUSER, 20, tTamKkD(:1))

I have also observed that if you are logged into gmail it takes the calls over asterisk. If you want to override this you need to set the priority to > 24 in your jabber.conf file.

I am using a priority of 50 to force asterisk to always get the calls. It would be nice if you could both use 24 and get calls at both places but it appears that google only uses the last highest priority to register for calls.
[google-username]
priority=25