Incoming Dial Patterns
You know the way you can set dial patterns for outbound routes (i.e. it helps trixbox decide which trunk to use depeding on the number dialed), is there a way to do this for incoming routes?
I would like callers from different areas of the country to be connected to different ring groups if this is possible whistle still using the same DID number.
Cheers
I have done something very similar, but I didn't do it manually.
I wrote a perl script that generates the code for me based on a CSV input, then I stuffed it in extensions_custom.conf.
#!/usr/bin/perl
# makeroutes.pl
#
# used for mass creation of inbound routes, meant for inclusion in the
# [ext-did-custom] context in extensions_custom.conf
#
# Written by Jason "KodaK" Balicki, April 10th, 2008
# <a href="mailto:sakodak@gmail.com">sakodak@gmail.com</a>
use strict;
use warnings;
use Text::CSV;
use Switch;
# csv file format is:
# did,prefix,areacode,routedest
my $file = 'routelist.csv';
# create the csv instance
my $csv = Text::CSV->new();
open (CSV, "<", $file) or die $!;
while (<CSV>) {
if ($csv->parse($_)) {
# columns should be obvious
my @columns = $csv->fields();
my $did = $columns[0];
my $prefix = $columns[1];
my $areacode = $columns[2];
my $routedest = $columns[3];
# $confdest is the destination in the format required
# by the config files
my $confdest='timeconditions,1,1';
# These are my local time condition names, you may have to change
# up this section to suit your requirements
#
# ORDER MATTERS HERE. Since I'm just doing pattern matching,
# perl will match the WeekdayCalls in KCWeekdayCalls, so my
# quick and dirty solution is to match KCWeekdayCalls first.
# You may want to put more thought into this than I did.
switch ($routedest) {
case /KCWeekdayCalls/ { $confdest='timeconditions,3,1' }
case /WeekdayCalls/ { $confdest='timeconditions,1,1' }
}
# yeah, yeah, I know I can use EOF, but I started it this way, shut up
print "exten => " . $did . "\/_" . $areacode . "XXXXXXX,1,Set(__FROM_DID=\${EXTEN})\n";
print "exten => " . $did . "\/_" . $areacode . "XXXXXXX,n,Gosub(app-blacklist-check,s,1)\n";
print "exten => " . $did . "\/_" . $areacode . "XXXXXXX,n,GotoIf(\$[ \"\${CALLERID(name)}\" != \"\" ] ?cidok)\n";
print "exten => " . $did . "\/_" . $areacode . "XXXXXXX,n,Set(CALLERID(name)=\${CALLERID(num)})\n";
print "exten => " . $did . "\/_" . $areacode . "XXXXXXX,n(cidok),Noop(CallerID is \${CALLERID(all)})\n";
print "exten => " . $did . "\/_" . $areacode . "XXXXXXX,n,Set(_RGPREFIX=" . $prefix . ":)\n";
print "exten => " . $did . "\/_" . $areacode . "XXXXXXX,n,Set(CALLERID(name)=\${RGPREFIX}\${CALLERID(name)})\n";
print "exten => " . $did . "\/_" . $areacode . "XXXXXXX,n,Goto(" . $confdest . ")\n";
}
}
CSV files take the form of:
2900,STL,636,WeekdayCalls 2900,STL,573,WeekdayCalls 2900,STL,618,WeekdayCalls 2900,STL,217,WeekdayCalls 2900,STL,314,WeekdayCalls 6670,STL,636,WeekdayCalls 6670,STL,573,WeekdayCalls 6670,STL,618,WeekdayCalls 6670,STL,217,WeekdayCalls 6670,STL,314,WeekdayCalls 6671,STL,636,WeekdayCalls 6671,STL,573,WeekdayCalls 6671,STL,618,WeekdayCalls 6671,STL,217,WeekdayCalls 6671,STL,314,WeekdayCalls 6671,KC,816,KCWeekdayCalls 6671,KC,660,KCWeekdayCalls 6671,KC,975,KCWeekdayCalls 6671,KC,417,KCWeekdayCalls 6671,KC,913,KCWeekdayCalls 6671,KC,785,KCWeekdayCalls 6671,KC,620,KCWeekdayCalls 6671,KC,316,KCWeekdayCalls 6670,KC,816,KCWeekdayCalls 6670,KC,660,KCWeekdayCalls 6670,KC,975,KCWeekdayCalls 6670,KC,417,KCWeekdayCalls 6670,KC,913,KCWeekdayCalls 6670,KC,785,KCWeekdayCalls 6670,KC,620,KCWeekdayCalls 6670,KC,316,KCWeekdayCalls etc...
Obviously you would need to make changes, specifically to the logic that decides the destinations, but this code does 99% of what you want it to do.
If you are not capable of modifying this code yourself, I can do it for an hourly fee, contact me via my paypal address if you're interested in that.
some time ago i was involved in a commercail solution in Australia , it basically is an AGI script with a MySQL backend , and a web interface - the AGI reads the incomming DID and then looks at teh MySQL db to see who is assigned to that DID it does patten matching so it looks for matches at 10digits , then 9digits , then 8digits etc etc
so you can configure a route to "08345XXXXX" or "083XXXXXXX"
the system has a web fround end so the geographical areas can be monitors/administered
the application was originally written to handle toll free numbers so that if you owned teh number 1800FLOWERS you could divide your "number" geographically and sell the rights of use to other flower companies . an example is if you owned 1800FLOWERS and you business was in Melbourne Australia , and you did not have a store in Sydney Australia you could "rent" the right to use your clever phone number to another flower company in Sydney. Geographical routing is the basis of the phoneword business this is usually done at a telco carrier level at a significant charge. we spend $50K and wrote our own Gregraphical routing engine and populated it with the australian dial prefix codes and mapped these to postcodes. it was all very involved , we also wrote a billing engine that creates usage bills based on the CDR records. at its peek we had about 100 channels open at one time
The FLowers example above is excatly what my business is. I franchise out my business same to other IT engineers however my trixbox handles the calls.
Do I need something as complicated as above? I'm willing to type it in manually but WHERE do I do this?
Many Thanks
If you want to do it manually you just set up an inbound route based on CID.
You can match on a pattern, for example _314XXXXXXX will match any CID that starts with 314, so on and so forth.
So, what you do is:
1) go to inbound routes
2) create an inbound route for the NPA you want, ie, _317XXXXXXX and route it where you want it to go.
3) enjoy your brand new route.
Doing it by hand is painful, but it's probably better in the long run, as stuff in extensions_custom.conf don't show up in the GUI, so if someone comes along later to admin the system they'll be a little more lost than they need to be.



Member Since:
2007-03-21