Page 1 of 1

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

Posted: Wed Jul 06, 2016 2:17 am
by domob
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;
}