Friday, June 11, 2010

Filter rules in Google Voice Callback

Many of you want finer control on when to use Google Voice to call back. I heard ya! The latest version (v0.4 and above) contains the functionality called "filter rule" that hopefully give a flexible way to control when to use Google Voice callback.

I try to make the framework flexible so that I can add other type of rules (such as time-based, network-type based, etc.) later, so how the filter rules work is perhaps not so straight-forward. No fear! Let's walk through some examples.

Before you start following the examples, make sure that you turn on the option to use filter rules. To do so, go to the Setting page and choose "According rules (needs setup)" under the option "Callback is enabled when...". A new button with text "Configure filter rules" should appear, and from there you can configure the rules!

On to the examples...

Example 1: You want to use Google Voice callback almost all the time except for a few friends. In the past you probably use the "Ask me everytime" option, but that's annoying. Now, in the rule configuration page:

  • You should choose "Use GV callback" for the default action
  • then click "Add new rule" and choose "Exclude rules".
  • All the phone numbers in your phonebook should appear, and just check all the numbers that you don't want to route through Google Voice, then click "Done" in the bottom.
  • That's it!

Example 2: You only want to use Google Voice for a few numbers, and other times you want to call through your cell phone provider's network. No problem! Follow the directions in Example 1, but choose "Do not use GV" as default action and pick the "Include rules"

Example 3: You want to use Google Voice only when calling non-local numbers. Suppose the area code for where you live is 406 (if you are in Montana!). The steps are similar. You would want to set "Use GV callback" as default action, then add a "Pattern rule." In the edit page for the rule, choose "Exclude" as the action, then put in "406*" (without the quotes) as the phone number pattern.
Caveat: The pattern "406*" basically matches any phone number that starts with 406 (like 406-123-4567), so if you have "1-406-123-4567" in your phonebook, the pattern will NOT match. So you might want to create a few more rules for patterns "1-406*", "+1406*" etc. It's a bit cumbersome, but it gets the job done. If you know what regular expressions are, I'll add some regex rules in the future to make this matching less painful. As of version v0.4.1, there is a regex rule option! A working regex to match all number from local code 406 is "\+?1?-?406-.*" (without the quotes).

Enjoy! More types of rules are coming in future versions, but these phone number rules would satisfy a few of you, I hope!

29 comments:

Logan said...

Awesome work! Could you add a way to filter on characters in a name? For instance, i made an automated excel sheet which checks the persons number and adds their provider to the end if their name. So if John Doe has Att and Jane Smith has Verizon, the excel script adds to their names: John Doe -A and Jane Smith -VA. Since i have Verizon, i would like to filter out Jane Smith.

Logan said...
This comment has been removed by the author.
Leira said...

How can I setup a rule to use GV callback only for US numbers?

I tried "Do not use GV" for default, and add a rule for patten "+1*" to Include or Ask, but all not working.

x said...

Logan: possibly in the future, after the framework for rules is stable.

Leira: You may need to add another rule for "1*". For which number is it not working?

x said...

Leira: also check out the new US Phone Number rule in the latest v0.4.1 version.

VirTERM said...

Hmm, the regex does not work properly.
If I set 4 rules to exclude my local numbers it will FC on Nexus One with 2.1. ie:
613*
1-613*
+1-613*
+1613*,
I believe that + is causing FC... If I only use one rule:
613*, it does not FC however it will always use Callback even if I dial 6131234567.
Other than that, it seems to work fine. I can dedicate some time to help with Regex portion of the code, if needed.
Wojtek

VirTERM said...

In addition, I would suggest to ignore "-" and "+" while using Regex, this way the set of rules would be much simpler. Also, it would be nice to see a default action for "local numbers", which could be automated base on the number associated with a sim card. Such feature will not work in Europe, as in most cases you will not be able to retrieve the local number (not through Android's API)...

x said...

Wojciech: You probably misunderstood regex. Your rules crash because "+" is a special character in regular expressions. And "613*" will match 613, 6133, 613333, etc. in regex - probably not what you want. As I mentioned in the editing screen, if you don't know what regular expressions are, you should not use that type of rule.

It looks like you should use the "pattern rule" instead of regex rules. Then 613* will behave as you expect.

VirTERM said...

You are absolutely correct ;) I was defining pattern rules as regex rules.
All seems to be working just fine now.
Thanks,

VirTERM said...

One suggestion, you should probably automatically exclude your voicemail number from being called over GV. It can be done using the rule set, but auto rule would be nice.
Thanks

x said...

Wojciech: I personally use Google Voice to call my Voicemail. You can setup a rule to exclude your voicemail number easy enough - an automatic rule will leave other users no choice.

Michael said...

I'm looking forward to the inclusion of network-type rules. If my apn is not verizon (must be wifi) then use gv callback. My goal is to not use 3g for voip

Dave said...

I tried to setup a rule to exclude certain numbers, exactly like you mentioned in example 1, but the screen, that was supposed to list my phone book to select entries, just came up blank. I'm using a Samsung Vibrant running Android 2.1.

Thanks for a great app.

Dave said...

The reason nothing showed up in the screen to select numbers is because all my contacts are either on the SIM card or Google Contacts and not in the phone itself. Solved issue by just using pattern rules for the specific numbers. Would be nice to have, as you mention, day of week/time filters as well. Thanks again for a great app!

Topher Cooper said...

I imported my address book from my Pre & the only entries appearing were those entered since. I'll enter the relevant #s as patterns, of course. Seems like a great app otherwise.

Jack said...

Is there a way to filter out by time of day or by day of the week? Most people in the US has free calls on nights and weekends. So a filter to exclude ALL numbers from 9PM-6AM and all day Sat and Sun would be great.

Anonymous said...

Awesome, could you add an option that lets you exclude mobile phone numbers?
Thanks

Unknown said...

Would be great if you could filter by contacts group. Instead of picking all the people in my "work" contacts list, would be excellent to just pick the group.

Anonymous said...

I see a blank under "pick a phone number" under include/exclude filter...

pak101 said...

i need help with setting up the rules. all US numbers to be routed via GV and non-US numbers to be routed via normal network. how do i achieve this?

Thanks in advance, waiting for an app like this for a long time now.

Mike Fendt said...

Is there a rule for Verizon nights and weekends?

Anonymous said...

Great job!
Is there a way to delete a rule?
Thanks.

Anonymous said...

How about allowing for the use of GV Callback based on group membership...

Used GV when in group xyzzy
Do not use GV when in group abba
Ask about using GV when in group cddc
Default action: use_GV/do_not_use_GV/ask_GV

Anonymous said...

First of all, I love the app. Five stars. I have a suggestion for the rules. How about making a rule that allows users to type a prefix to the phone number to choose when to use GV, but have GV remove that prefix when dialing. For example, If I want to dial 123-456-7890 using GV, I could dial 000 123-456-7890. The filter would recognize that you want to use GV, but it would not dial 000 123-456-7890. It would dial 123-456-7890.

This would allow people to decide to use GV for that specific call without going into settings.

Seiko Watches Chrono
Seiko Chrono Watches
Solar Seiko Watches

Anonymous said...

First of all, I love the app. Five stars. I have a suggestion for the rules. How about making a rule that allows users to type a prefix to the phone number to choose when to use GV, but have GV remove that prefix when dialing. For example, If I want to dial 123-456-7890 using GV, I could dial 000 123-456-7890. The filter would recognize that you want to use GV, but it would not dial 000 123-456-7890. It would dial 123-456-7890.

This would allow people to decide to use GV for that specific call without going into settings.

I'm not a programmer, but I would be willing to help with anything I can. Let me know.

Seiko Watches Chrono, Seiko Chrono Watches, Solar Seiko Watches

Anonymous said...

How about backup and restore of rules and settings?

Unknown said...

Is there a regex rule that can do multiple area codes all in one rule? For example I want to not use gv for 519, 226, 313, 248, 586, 810, 734. and for everything else use gv. Or do I have to create a separate rule for each area code?

Daniel Zen said...

I would love to have a rule that enables GV Callback when I'm on a certain wifi network. I use GV callback with my landline at home, and want it to work automatically when I'm there. This could be done with my geo location too, i suppose.
Thanks!

Anonymous said...

This RegEx will match ALL toll free number:

^(\+?1)?-?(8(00|55|66|77|88)-[2-9]\d{2}-\d{4})$

Slight weirdness is that I have to put in the dashes, since the program seems to parsing them out this way (as it shows in the dialer). However, when you use the test number feature you would not enter any dashes.