Handling few International Dialing Formats to support CDRTool :
if ($rU=~"\+[1-9][0-9]+") {
# User Dialed phone number in E164 format
strip(1);
prefix("00");
$avp(can1)= $ru;
$avp(can_uri) = $ru;
} else if($rU=~"^00[1-9]+") {
# User Dialed phone number in UK Int format
xlog("L_INFO","00 UK Format, no need to do any changes");
$avp(can1)= $ru;
$avp(can_uri) = $ru;
} else if($rU=~"^011+") {
#user dialed number in 011 international format
xlog("L_INFO","011 format International Number strip 011, then prefix 00 ");
strip(3);
prefix("00");
$avp(can1)= $ru;
$avp(can_uri) = $ru;
} else if($rU=~"^[2-9]+") {
# user dialed 10 digit US number, so add prefix("1")
xlog("L_INFO"," 10 digit US number add 001 before it ");
prefix("001");
$avp(can1)= $ru;
$avp(can_uri) = $ru;
} else if ($rU=~"^1[2-9]+") {
# user dialed 11 digit US number, so add prefix 00
xlog("L_INFO"," 11 digit US number add 00 before it ");
prefix("00");
$avp(can1)= $ru;
$avp(can_uri) = $ru;
} else {
xlog("L_INFO","What format is this? Lets print rU: $rU");
}
if ($rU=~"\+[1-9][0-9]+") {
# User Dialed phone number in E164 format
strip(1);
prefix("00");
$avp(can1)= $ru;
$avp(can_uri) = $ru;
} else if($rU=~"^00[1-9]+") {
# User Dialed phone number in UK Int format
xlog("L_INFO","00 UK Format, no need to do any changes");
$avp(can1)= $ru;
$avp(can_uri) = $ru;
} else if($rU=~"^011+") {
#user dialed number in 011 international format
xlog("L_INFO","011 format International Number strip 011, then prefix 00 ");
strip(3);
prefix("00");
$avp(can1)= $ru;
$avp(can_uri) = $ru;
} else if($rU=~"^[2-9]+") {
# user dialed 10 digit US number, so add prefix("1")
xlog("L_INFO"," 10 digit US number add 001 before it ");
prefix("001");
$avp(can1)= $ru;
$avp(can_uri) = $ru;
} else if ($rU=~"^1[2-9]+") {
# user dialed 11 digit US number, so add prefix 00
xlog("L_INFO"," 11 digit US number add 00 before it ");
prefix("00");
$avp(can1)= $ru;
$avp(can_uri) = $ru;
} else {
xlog("L_INFO","What format is this? Lets print rU: $rU");
}
0 comments: