Update for classes/modules/core/Misc.class.php parseCallerID

Discussion for TimeTrex open source community developers.
Post Reply
domob
Posts: 2
Joined: Mon Dec 01, 2014 7:12 am

Update for classes/modules/core/Misc.class.php parseCallerID

Post by domob » Wed Jul 06, 2016 2:17 am

As given below this currently onyl works for the North Americal numbering plan:

Code: Select all

//Caller ID numbers can come in in all sorts of forms:
// 2505551234
// 12505551234
// +12505551234
// (250) 555-1234
//Parse out just the digits, and use only the last 10 digits.
//Currently this will not support international numbers
static function parseCallerID( $number ) {
	$validator = new Validator();
	$retval = substr( $validator->stripNonNumeric( $number ), -10, 10 );
	return $retval;
}
Per the following:
http://stackoverflow.com/questions/7235 ... n-sql-varc
http://www.itu.int/ITU-T/recommendation ... ?rec=E.164
this worked for me:

Code: Select all

static function parseCallerID( $number ) {
	$validator = new Validator();
	$retval = substr( $validator->stripNonNumeric( $number ), -15);
	return $retval;
}

Post Reply