1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. If you had a PIAF Forum account in the vBulletin days, log in with your old credentials. Otherwise, sign up again and we'll get you back in business as soon as we can.
  3. A serious FreePBX vulnerability has been reported. Update your Framework Module immediately. Click here for details.
  4. Critical FreePBX vulnerability! Update your server immediately. Details here.

QUESTION CallerID Superfecta Regular Expressions example?

Discussion in 'Help' started by bobkoure, Jan 20, 2014.

  1. bobkoure Member

    I'm trying to figure out how the regular expressions section of CID Superfecta works.
    Are there any examples out there?I can write regex strings, but then what? How do I get matching strings marked as spam so they can have a nice chat with Lenny.
    Thanks!
  2. lgaetz Pundit

    Are you trying to blacklist calls based on the incoming Caller ID name or Caller ID number? If so there is no module in Superfecta for that. The regular expression input in Superfecta is ONLY to search thru the user provided URL contents and supply a matching Caller ID Name. It will not flag a spam call or redirect the call to alternate destinations. Off the top of my head, the only thing that will do this is the old Swiss Army Knife module which did support blacklisting calls by regular expression. Unfortunately the SAK module won't work for FreePBX versions beyond 2.9 without modification.

    There is nothing to stop us from making a Superfecta module that can flag spam calls though. Describe exactly how you are attempting to flag spammers.
  3. bobkoure Member

    There's a credit card spammer out there who uses a varying caller id in the pattern V\d{15}, although I'd probably use something more like ^\w\d{4,20}
    (most recent was V120111336001201)

    So, If I understand you correctly, if the regex module is activated it
    1) tries to match the Caller ID string in the regexp section, reg ex ops is just for regex modifiers that you'd otherwise put as part of a regex (not clear how anything beyond i would be useful - and one point of my confusion is that the ops section hover doc lists ^ and $ as options, which I'd consider zero width anchors not options)
    2) on a match does a database lookup on the URI in the url section (sounds like it might be looking up the number?)
    3) Then if there's a match it... replaces the callerID (?)
  4. bobkoure Member

    Sorry, I hadn't answered this directly - I'm looking to block based on CallerID name - which is what I thought the Regular Expressions module was for.

    It might make sense to also have a module that can block on CallerIDnumber, but IMO it makes better sense for that one to use asterisk style pattern match rather than regex. If someone's using FreePBX they're IMO much more likely to know that than regex.
  5. lgaetz Pundit

    Regular Expression module is used in conjunction with a reverse number lookup website. Using the http://411.ca website as a working example, the reverse number lookup URL looks like this:
    Code:
    http://411.ca/search/?q=$thenumber&st=reverse
    Note that the string $thenumber is substituted in place of where the actual incoming phone number would be. One possible regular expression for this page would look like this:
    Code:
    itemprop="name">(.*?)</a>
    expression options are not required, tho I would throw the 'i' in there anyway.

    When triggered on an inbound call, Superfecta subs the actual incoming phone number and loads the content of that URL, then searches through the returned content with the regex supplied. Note the parentheses in the regex, this represents a subregex which contains the name portion of the match, and is required for this module to work and is not documented.



    *edit*
    The Regular Expression Superfecta module could be edited to accept different types of input other than a URL, such as an Asterisk channel variable. It would need a drop down menu for users to indicate what type of input, and additional code. File is located at /var/www/html/admin/modules/superfecta/sources/source-Regular_Expression_1.module
    Last edited by lgaetz, Jan 20, 2014
  6. bobkoure Member

    Hmmm... wrote a response but it's gone. My fault, probably.

    Personally I think that functionality belongs in a different module. This one IMO is a bit mis-named, and probably should be something like universal URL query.
    BTW, I ran into a way to blacklist via regex at http://tech.iprock.com/?p=10261
    It's one of those changes you have to track and redo every time there's an upgrade, and I shy away from those - mostly because my memory isn't all that great :)

Share This Page