Skip to content

Commit

Permalink
Merge pull request #104 from matmurdock/master
Browse files Browse the repository at this point in the history
Added ability for 7 Digit numbers
  • Loading branch information
mackhendricks committed Jan 28, 2019
2 parents f34dc3d + eb6d3af commit 776f17b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions kamailio/kamailio51_dsiprouter.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,9 @@ request_route {

# Reformat US Based RURI's into a canonical format of 10 digits
#route(REFORMATRURI);

# Fix for 7 digit dialing. Adds area code of callee to the front of the number they dial
route(REFORMATRURI7);

# route the call to the next hop
route(NEXTHOP);
Expand Down Expand Up @@ -691,6 +694,30 @@ route[REFORMATRURI] {
}
}

route[REFORMATRURI7] {


#This is to deal with those who are used to dialing 7 digits.
if ($(rU{s.len}) == 7) {

if ($(fU{s.len}) == 10) {

xlog("L_DEBUG", "7 Digit Fix: Orginal: $rU to $(fU{s.substr,0,3})$rU");
$rU = $(fU{s.substr,0,3}) + $rU;

} else {

xlog("L_DEBUG", "7 Digit Fix: Orginal: $rU to $(fU{s.substr,0,4})$rU");
$rU = $(fU{s.substr,0,4}) + $rU;

}

remove_hf("To");
insert_hf("To: sip:$rU@$rd\r\n");

}

}
route[ENRICH_SIPHEADER]
{
if (!strempty($xavp(ra=>sipdomain))) {
Expand Down

0 comments on commit 776f17b

Please sign in to comment.