Flexible table-controlled dialplan, Version 2

Catalog of dial plans
MikeTelis
Posts: 1581
Joined: Wed Jul 30, 2008 6:48 am

Re: Flexible table-controlled dialplan, Version 2

Post by MikeTelis » Mon Jul 26, 2010 3:32 pm

You're getting "Wrong number" because I used to_ENUM to convert white-listed numbers into ENUM format (that's why you could write '(408) 454-4455' instead of must less attractive '14084544455'). '(403) 222-*' is not what to_ENUM expects (refer to my so-called "manual"), that's why you end up with "wrong number" exception.

I understand your question but the best idea I have at the moment is to use the same format as in ExcludedPrefixes table. It means that you won't be able to write 7-digit or 10-digit number and automatically have it converted into ENUM. You'll have to write white-listed numbers in full ENUM format, starting with country code.

Do you have a better idea?

nozyczek
Posts: 8
Joined: Sun Jul 25, 2010 1:26 pm

Re: Flexible table-controlled dialplan, Version 2

Post by nozyczek » Mon Jul 26, 2010 4:28 pm

OK, I see it now

Code: Select all

      num.gsub!(/[^0-9*+]/,'') # Delete all fancy chars (only digits, '+' and '*' allowed)


This is not a problem, I can always list all allowed numbers. Your dial plan is more than I expected.
Thanks again
nozyczek

Ps. It is time for me to learn some ruby

MikeTelis
Posts: 1581
Joined: Wed Jul 30, 2008 6:48 am

Re: Flexible table-controlled dialplan, Version 2

Post by MikeTelis » Mon Jul 26, 2010 5:30 pm

So, did you want to make the changes yourself? It could make a good training task... ;-)

nozyczek
Posts: 8
Joined: Sun Jul 25, 2010 1:26 pm

Re: Flexible table-controlled dialplan, Version 2

Post by nozyczek » Mon Jul 26, 2010 5:33 pm

I would like to make changes but I don't think I'm capable to do it myself.

MikeTelis
Posts: 1581
Joined: Wed Jul 30, 2008 6:48 am

Re: Flexible table-controlled dialplan, Version 2

Post by MikeTelis » Mon Jul 26, 2010 6:29 pm

Okay, let's work on the specs. Do you want white list entries to match the beginning of number and that's it?

'+1 (403) 222' will match all numbers beginning with 1403222
'+1 (403) 223-1234' will match only this particular number

Or you want a full-fledged regular expression?

nozyczek
Posts: 8
Joined: Sun Jul 25, 2010 1:26 pm

Re: Flexible table-controlled dialplan, Version 2

Post by nozyczek » Mon Jul 26, 2010 6:47 pm

I would like to use both

specified number
'+1 (403) 223-1234'

and match all numbers that begins with 1403222xxxx
'+1 (403) 222'

MikeTelis
Posts: 1581
Joined: Wed Jul 30, 2008 6:48 am

Re: Flexible table-controlled dialplan, Version 2

Post by MikeTelis » Mon Jul 26, 2010 7:16 pm

Code: Select all

  rexp = WhiteList.map {|n| n.gsub(/\D/,'')}.join('|')
  if !((30..745) === @t.hour*100 + @t.min) or (@cid =~ /^(#{rexp})/)
     callswitch("#{@user}@local[fu=#{@cid}]",45)
  end

This code check if @cid begins with one of the entries in your white list. White list entries may contain spaces, brackets, dashes - they will be ignored. Note you'll need to use ENUM format. Example:

Code: Select all

WhiteList = [
  '+1 (403) 222',
  '+1 (403) 223-1234',
]

Note there's no * (star) after 222. If you wish, you can enter it there

'+1 (403) 222-*',

but it will be ignored, as any other non-digit. Hope it's what you wanted.

BTW, check out the update (opening post in this thread).

nozyczek
Posts: 8
Joined: Sun Jul 25, 2010 1:26 pm

Re: Flexible table-controlled dialplan, Version 2

Post by nozyczek » Tue Jul 27, 2010 1:42 am

Great :) I will give it a try tomorrow and will report back
Thx

MikeTelis
Posts: 1581
Joined: Wed Jul 30, 2008 6:48 am

Re: Flexible table-controlled dialplan, Version 2

Post by MikeTelis » Tue Jul 27, 2010 3:56 am

Could you satisfy my curiosity? I'm wondering why would one need wildcards in the WhiteList... typically WhiteList is quite short (a few relatives and, probably, the boss). I can't imagine why would one need to include 1000 numbers beginning with 1-403-222 ...

nozyczek
Posts: 8
Joined: Sun Jul 25, 2010 1:26 pm

Re: Flexible table-controlled dialplan, Version 2

Post by nozyczek » Tue Jul 27, 2010 2:25 pm

MikeTelis wrote:Could you satisfy my curiosity? I'm wondering why would one need wildcards in the WhiteList... typically WhiteList is quite short (a few relatives and, probably, the boss). I can't imagine why would one need to include 1000 numbers beginning with 1-403-222 ...


I'm providing 24/7 support for the company that I work for and they have allocated hundreds of 1-403-222-xxxx phone numbers. I never know who and from what building will call me so I was looking for this functionality.

I was able to test all of the changes you provided. Everything is working great. I also incorporated 7/26 dial plan updates with no problems. I will need to do more testing when I get home but everything looks good so far.

Thanks again for your help and this great dial plan
nozyczek

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest