Menu

UsingFilters

Anonymous

Introduction

It is often useful to be able to alter certain actions based on the phone number to be dialed. Also, sometimes the contact phone numbers are in a form that cannot be used for SIP calls, and thus need to be rewritten for the needs of the SIP switch/account. These things are handled by filters in the application. Important points:

  • Filters are applied when the application's "outgoing call chooser" appears:
  • Filters are specific to each account.
  • Filters may also be set for the native phone dialer.
  • A filter has a match type and pattern (a rule), plus an action to perform if the phone number matches the rule.
  • A filter operates based on the rule, and if the phone number matches the rule, the selected action occurs.
  • There are several types of matching such as starts-with and ends-with.
  • Multiple filters may be set up for an account or the dialer.
  • If multiple filters are set, they are run in the order listed
  • Mutiple rewriting filters may be set up, and the input to each is the output of the previous rewrite filter, or the original number for the first rewrite filter in the list.
  • The application will automatically remove separators (e.g., spaces, parentheses, and '-') from phone numbers before sending them through the filters.

Filters are a very powerful feature of the application, so use your imagination and creativity and you can probably solve the problem you have. Filters are much more powerful and flexible than the more common "dial plan" features found on other SIP phones.

Creating and Editing Filters

The filters editor is one of the settings categories. We won't give touch-by-touch directions here, it's assumed you'll be able figure the user interface out. It is intuitive and simple. Once you're in the filters main screen, you'll see a list of SIP accounts and, at the bottom, a Dialer entry (which acts like an account but for the native dialer). Touching an account starts the filter editor for that account. Now you can add a new filter or edit an existing one (by touching it in the list). Delete a filter with a long-touch and then touching Delete filter.

Some Common Examples of Filter Use

Most commonly, filters are used for implementing "dial plans" as used on other SIP phones. Let's say you have contacts in your phone which have full international/E.123 format phone numbers, an internal extension number, and a full SIP address:

Let's also say your country code is 1 and you have a SIP account for a provider or company switch and it requires the following number formats for successful (outside) dialing:

  • National calling: 1 followed by the area code and number (14513297452)
  • International calling: 011 followed by the country code, area code, and number (01144632548721)
  • Emergency: 911

See Multiple Filters

International Format Numbers

Your full phone numbers are in E.123 format, so some rewriting will be needed on the account for your provider or company switch:

  • If the number starts with +1 just remove the +
  • Otherwise, remove the + and prepend 011

In the US, mobile phone companies use these same formats, so you will need the same filters applied to the Dialer. By the way, there is a very useful Android application Contacts Cleanup which will format all of your contact phone numbers into the international/E.123 format.

Internal Extensions

For a company SIP switch, internal extensions (usually just three digits) cannot be dialed with the mobile Dialer and must always be dialed via your company SIP switch account. For this, you would use a filter on your company switch account which looks for exactly 3 digits and has an action of direct call. This forces the application to immediately use the company switch account for internal extensions. The outgoing call chooser never appears.

In the US, emergency dialing is also three digits, 911. Let's say you want 911 to always be dialed with your mobile phone and not any SIP account (so the E911 service gets your GPS coordinates). For this, you would use a filter on the mobile dialer that looks for exactly 911 and has an action of direct call. This forces the application to immediately use the mobile dialer for emergency calls. The outgoing call chooser never appears.

SIP Addresses

The application will treat a custom IM address with the label SIP as a phone number. It should be a full SIP URI such as george-mobile@sip.acme.com, so it will contain an '@'. Clearly this cannot be dialed via the mobile dialer, and you probably want to use a specific account to make these direct SIP calls. On that account, use a filter on the account that looks for @ in the "number" and has an action of direct call. This forces the application to immediately use that account for direct SIP calls. The outgoing call chooser never appears.

Multiple Filters

You can create multiple filters on an account. They will be run in the order listed. You can reorder the filters by dragging and dropping. Touch and drag by the gray icon on the left edge of the filter entry in the list. Note that the Can't call and Directly call filter actions happen immediately; any filters listed afterward will not run if these actions occur.

Reference

This section describes the filter rules and the actions that can occur if the phone number matches the rule. A rule consists of a match type and some value you supply such as a match pattern or a numeric value. An action is what happens if the rule is matched. In the filter editor, the action is selected at the top and the rule is specified in the box below that. If the action is Rewrite a third area appears in which you specify some prefix, suffix, or replacement text.

Actions

Can't Call

A matching number will prevent this account from showing in the outgoing call chooser.

Directly Call

A matching number will force this account to be immediately used for calling. The outgoing call chooser will not be shown.

Rewrite

A matching number will be rewritten according to the replacement action. The rewritten number will be passed along to the next filter (if any) as input.

Stop Processing

A matching number will not be passed along to the next filter (if any). Instead, it will be used as-is.

Auto Answer

to be written

Match Types

Numbers can consist of digits, letters, and/or punctuation.

Starts with

The number is matched if it starts with the given text.

Ends with

The number is matched if it ends with the given text.

Contains

The number is matched if it contains the given text anywhere within it.

All

The number is always matched.

Has exactly N digit

The number is matched if it is exactly the given length.

Has more than N digit

The number is matched if it is the given length or longer.

Is exactly

The number is matched if it is exactly the same as the given text.

Custom RegExp

Matching is specified by the given Java regular expression. The regular expression pattern can contain one or more capturing groups, useful for Rewrite filters with the Custom RegExp replacement type.

Replacement Types

This applies only to the Rewrite action.

Prefix by

The given text is put before the beginning of the matched text in the number.

Suffix with

The given text is put at the end of the matched text in the number.

Replace match by

The given text replaces the matched text in the number. The unmatched text in the number remains. Examples:

  • 3451209 starts with 345 replace match with 987 results in 9871209.
  • joe@foo.com contains foo replace match with bar results in joe@bar.com

Replace all by

The given text replaces the entire number.

Custom RegExp

Useful only if the match type is also Custom RegExp, and if the match regular expression pattern contains one or more capturing groups. In this case, the captured text for each group (left to right) can be specified with $1, $2, etc,. and the entire matched string can be specified with $0. For more information see the documentation of java.util.regex.Pattern.

Tips and Tricks

_ to be written_


Related

Wiki: FAQ
Wiki: MainSideBar

Discussion

  • Anonymous

    Anonymous - 2011-03-05

    Originally posted by: rudhra%y...@gtempaccount.com

    What if I have this:

    • 1 account (A) for incoming calls only. This is a Dutch landline number I bought (Budgetphone.nl, 10 euro a year) to use as SIP/VOIP. So it is impossible to use for calling out. Only incoming.
    • 1 account (B) for calling out (Justvoip, a Voipbuster clone), I cannot receive calls on this account since I do not have a number (or someone would have to use full sip address).

    And I want to configure it in such a way:

    • cSipSimple should only show account B in the outgoing call chooser.
    • This account should be the only one being registered when the chooser launches.
    • I only want to use account B when dialling to landlines (not for numbers starting with +316)
    • Account A should only become active when I want to use it occasionally, so if I manually launch cSipSimple.

    The way I do this:

    • Account A is deactivated.
    • Account B has a filter: "Can't Call" if it "Starts with" +316. This way it will not be shown in the outgoing call chooser for these numbers. And since I do not have any other accounts activated, the numbers will dial (with a slight delay) using mobile network.
    • cSipSimple > Settings > Easy Configuration is set to "use for outgoing calls only". This way cSipSimple will only launch when dialling and if I dial a number starting with +316 the app will startup and exit (hopefully).

    This way, it works, but I still have questions:

    • I want to use account A (only incoming) occasionally and only when I have 3G or WiFi?. I just activate account A and should be ready to receive calls. NOT: because csipsimple has been set to "Use for outgoing only" because I do not want it to run in the background.
      So I would have to activate the account and change this setting, later change it back and deactivate the account again..

    What would be the best way to handle this easily? It would be great if there was an option to label an account "incoming only" or something like that.

    I don't want to use account A (incoming) all the time because I want to save battery and people can reach me already on this number when I am at home (I have a DECT phone connected to my router with sip functionality).

     
  • Anonymous

    Anonymous - 2011-03-05

    Originally posted by: rudhra%y...@gtempaccount.com

    OK now I do it like this:

    account A is activated but with a filter "Can't call" if "Custom regxp" "." (star dot) Easy configuration set to "outgoing calls only"

    So if I want to use account A, I start cSipSimple manually, modify Easy Configuration to Always on. Afterwards, set it back to Outgoing only.

    Done!

    Account A is not even registered when the call chooser is launched, nice! And cSipSimple exits automatically afterwards. Great!

     
  • Anonymous

    Anonymous - 2011-03-06

    Originally posted by: taubetap...@gmail.com

    I'm having problems understanding the filtering rules. In my case, I would like to append 148 on all outgoing numbers/calls, whether 10 or 11 digits dialed numbers. How I can do this? Could you walk me through the steps please? Thx.

     
  • Anonymous

    Anonymous - 2011-04-05

    Originally posted by: nortap0@gmail.com

    Create a filter and chose "Rewrite", and then choose "Has exactly N digit", and enter 10 below that, then select "Prefix by" and enter 148. This tells it that if the number has exactly 10 digits, prefix it with 148. Then just add another filter for 11 digits. Hope that helps.

     
  • Anonymous

    Anonymous - 2011-04-22

    Originally posted by: edesk.pr...@gmail.com

    Back up/Restore supports only accounts and filters created for each account. There is no provision of back up for filters created for dialer. Back up/Restore for dialer filters would be very helpful.

     
  • Anonymous

    Anonymous - 2011-06-24

    Originally posted by: djrbmw1...@gmail.com

    I'm new to this "getting a free phone" service and I'm trying really hard to understand it. I've tried to use SipGate? but their website is always telling me that no phone numbers are available. I currently don't have a phone and would like to use VOIP with my old cell phone but it's so damn hard to understand. If somebody could please get back to me with some help, that would be great. djrbmw1982@gmail.com

     
  • Anonymous

    Anonymous - 2011-06-27

    Originally posted by: Eoin.Col...@gmail.com

    CSipSimple seems to work better than Sipdroid for me in every respect except one: on SipDroid?, I can add a + to any dialled number to force it to use VoIP. Is there a way of reproducing that - or something similar - using cSipSimple filters?

     
  • Anonymous

    Anonymous - 2011-06-27

    Originally posted by: r3gis...@gmail.com

    Yeah absolutely. That's even much more complete feature in CSipSimple,

    Just go in settings, and create two filters, one to do action "force call" when start with a "+" (could be start with everything you want). And add one to "rewrite" number that starts with "+" with "". (If you don't want the sip call to contains the "+" sign obviously).

    The filter feature is very very powerful. You can imagine almost everything you want with it.

    You can also for example decide to call all numbers that start with a certain number with a specific SIP account. And others that starts with other numbers (or are exactly other numbers) to never use SIP at all. Normally, it should even allow you to add rules for your call routings seamlessly. And to not have to add manually a additional sign - but if you want to continue to use this way you can using two rules as I described.

     
  • Anonymous

    Anonymous - 2011-07-07

    Originally posted by: grol...@gmail.com

    Hi can You write simple regex ? I want detect if last char is + :-) thanx

     
  • Anonymous

    Anonymous - 2011-08-16

    Originally posted by: vmusa...@gmail.com

    Hi, I am a happy CSipSimple user. I am now starting using simple rules but not working. I need to add a 5511 prefix to any call using 8 digits but the following filter is not working:

    Action: Rewrite Match Type: Has exactly N digit ->8 Replacement Type: Prefix by -> 5511

    What´s wrong?

    Thanks, Victor

     
  • Anonymous

    Anonymous - 2011-08-29

    Originally posted by: to.d...@gmail.com

    How can I change the order of rules applied by accounts and handle rules conflicts/intersections?

    E.g.: 1) I have one ambiguous rule "Dial directly"/ALL for the dialer handling most of the calls. 2) I have several "Dial directly"/RegExp? exception rules for multiple SIP accounts for specific calls. This scheme allows transparent calling with no account selector UI appearing at all.

    What currently happens: the dialer generic rule overrides all the SIP specific rules. I have to create a bogus Dialer "Can't call" rule for EACH specific SIP "Dial directly rule" making the whole rules logic ineffective and duplicated.

    What I expect: more specific rules should take priority OR I must have an option to reorder the way rules are processed by accounts (e.g. making Dialer rules affect last).

     
  • Anonymous

    Anonymous - 2011-09-23

    Originally posted by: lipeng8...@gmail.com

    HI, I do receive a lot Anonymous calls (spam, fax broadcast) since using one account with Csipsimple. I do have FreeSwitch? in home to have those unwanted calls (anonymous,800-advertising,sales,etc) being processed to either VoiceMail? or droped. Like the following rules,

    <condition field="caller_id_number" expression="^(0000000000|(\+?1)?(8(00|55|66|77|88)[2-9]\d{6}))$">

    <action application="voicemail" data="default abc 2000"/> or drop the call.

    Can we develop a basic filer like this dealing with Incoming calls so we can have it filtered and processed the way we want? thanks

     
  • Anonymous

    Anonymous - 2011-12-21

    Originally posted by: w.bar...@gmail.com

    None of these features seems to work in any way.

    Example:

    • SIP account CWU
    • Filter: Can't Call; Has exactly N digit; 1
    • Dialer: CWU selected; dial '1' ; call proceeds to SIP provider
    • Call Log: 1 <sip:1@sip.callwithus.com> 2 mins ago

    I've tried everything - Custom Regex, matching the SIP address instead of the number, etc etc.

    Versions tried: 0.3.0, 0.3.1, nightly r1157

     
  • Anonymous

    Anonymous - 2011-12-21

    Originally posted by: viktor.b...@gmail.com

    Hi all, I've been battling with the custom regexs which I finally got to work. I thought I'd give others an important hint, which wasn't obvious to me. Normally regexs match the search pattern anywhere. e.g. ^# will match #whatever at the beginning of a line. Not here though - the regex needs to match the WHOLE string. So to match #whatever (or anything else starting with hash), you need ^#.* Took me ages to work that out! Maybe I'm dumb :-) In general though, the filters seem to work (I've tried "stop processing", "directly call", "rewrite" and "can't call"), though some experimentation is needed to figure out what works and what doesn't.

    One thing that didn't seem to work properly is that if there is only a single possibility for which SIP account to use in the dialer selector menu (with dialer integration enabled) after you're filtered out other accouts, a final "call directly all" filter for the surviving account doesn't seem to work. I needed to remove a "can't call" filter in the "use mobile" account so the mobile also appeared in the selector menu - then the direct call to my SIP account worked.

    Nice app BTW!!

     
  • Anonymous

    Anonymous - 2012-02-01

    Originally posted by: JoshuaJa...@gmail.com

    I have been a dedicated Google user for years. Using their services for my online experience has been great. The services I have used are always free, and they are constantly updating, integrating across platforms, streamlining settings and passwords all the while keeping my data secure whilst keeping spam, hackers and viruses at bay. Open source code, for what little I understand, has opened up the internet to allow us(the users) to send/receive information via voice/video/text/etc. through multiple and different interfaces seamlessly as possible across all different types of platforms. What I am trying to say is more-so, now that I have an android phone(lg pheonix android v-2.2.2) why am I having so much difficulty integrating my google # so as when placing/receiving calls/txts, why is my dumb ATT GO Phone # have to get in the way. I wish there was an app that, after being downloaded from the android market, would in essence unlock the phones pre-programmed applications, intake all my different account ID/Passwords for each and every account I might have throughout every corner of the internet whether it be bank accounts, credit cards, state id's, student id's, video sharing, social networking, video/txt messaging, music, gaming, routers/modems, and all the above/etc. and streamline it into one online account interface to control access/settings so as to then reprogram the phone's applications and widgets to save energy, money, memory and bandwith accross the network as a whole. That is the world I see. Sorry if I have gone on and on, but, maybe you can help me with just a part of that whole scenario. I guess I don't know enough about SIP to know wether or not I can install your APP and have it intergrate with my google voice # so I can place/receive txts/calls via my phones WIFI connection all the while switching to the ATT GO PHONE service when WIFI not available?

     
  • Anonymous

    Anonymous - 2012-06-04

    Originally posted by: sey...@gmail.com

    I am having trouble understanding how to set the filter.

    I want all calls starting with 0[2-9] or +49[2-9] to go over voip automatically. How do I do that?

     
  • Anonymous

    Anonymous - 2013-01-28

    Originally posted by: hutchinsfairy

    I'd like to echo to.djet and say that it would be really useful to specify which filters take priority. It seems that the "Use Mobile" filters are processed before any SIP ones. It would be easier for me if CSipSimple could process the SIP filters first, then the "Use Mobile" ones.

     
  • Anonymous

    Anonymous - 2014-07-10

    Originally posted by: misbi...@gmail.com

    Great app! Just in case someone else has the same problem I just solved for myself:

    I have two VOIP providers for outgoing calls. I am using the first for mobiles in Hungary and Italy, the second for all other calls. It was easy to set the filter for the 2nd provider: I just used the "Can't call" filter with the "Starts with" condition, and I added 4 filters for +3620, +3630, +3670 and +393.

    Setting the filter for the first provider was much trickier, I ended up using a regexp with negative lookahead. The filter type is "Can't call", with the following "Custom RegExp":

    ^(?!(\+36[237]0|\+393)).*
    

    This way, the dialer always offers the right choice. I hope this might help someone some day.

     
  • Papati Patata

    Papati Patata - 2016-12-17

    It took me a while to get it working the way I want it, and I think that an example could be useful to others. Here are my notes.

    I'm using a data only plan, but calls through Mobile will go through but will be very expensive. I want to keep the possibility to use it by adding a prefix to the number. In my region, a fixed format of 10 digits is used, and I don't need to worry about calling oversees with other dialing formats.

    My objective is to configure CSipSimple to intercept calling attempts from the native dialer, select the proper account and refomat the numbers as required. Once configuration is completed, accessing the user interface of CSipSimple will not be required; all dialing will be done from the native dialer, and a popup screen might show up on screen to select the account if the filters are not explicit enough. In my case, I don't want the popup screen to show up.

    My objectives are:
    Always use Mobile Phone to call 911
    Use SIP account for all other calls
    * Adding a prefix "9" to a complete 10 digits phone number will route the call through Mobile. The filter will delete the prefix before calling.

    Configure CSipSimple as follows:

    Integrate with Android
    Availability Profile: Always Available
    I'm allowed to use mobile
    Network
    For Incoming Calls: Select all
    For Outgoing Calls: Select all
    Dialer Integration
    Call logs integration
    Mobile Phone Integration: AUTO

    Filters:

    SIP account:
    Stop Processing, Starts With, 9
    Directly Call, All

    Use Mobile:
    Directly Call, Is exactly, 911
    Stop Processing, Custom RegExp, ^(?![9][0-9]{10}$).
    Rewrite, Starts With, 9, Replace Match By, [empty!]
    * Directly Call, All

    I'm not completely done with all testing, but initial tests seems to work as intended.
    I'm a total rookie with regex, so don't ask questions! This site was a useful reference:
    https://regex101.com/
    In my case, the intent of the regex is to be TRUE all the time except for the exact fomat that I'm looking for.

    Hope it helps someone.
    I'd like to see your recommendations to improve my setup.
    Thanks.

     

Log in to post a comment.