From eab166f9514a824544719ff4cd1c18a6602d4d86 Mon Sep 17 00:00:00 2001 From: James Finstrom Date: Mon, 29 Feb 2016 10:41:32 -0700 Subject: [PATCH 1/2] FREEPBX-11712 validate variables, fix whoops errors --- sources/source-OpenCNAM.module | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/source-OpenCNAM.module b/sources/source-OpenCNAM.module index 6d37027e..db05fbaa 100644 --- a/sources/source-OpenCNAM.module +++ b/sources/source-OpenCNAM.module @@ -21,7 +21,8 @@ class OpenCNAM extends superfecta_base { ); function get_caller_id($thenumber, $run_param=array()) { - + $run_param['Account_SID'] = isset($run_param['Account_SID'])?$run_param['Account_SID']:null; + $run_param['Auth_Token'] = isset($run_param['Auth_Token'])?$run_param['Auth_Token']:null; $caller_id = null; $this->DebugPrint("Searching OpenCNAM ... "); @@ -58,4 +59,4 @@ class OpenCNAM extends superfecta_base { return($caller_id); } -} \ No newline at end of file +} From 0ae0fd43c83d9cd09c45476e10447f8ad3fa093f Mon Sep 17 00:00:00 2001 From: James Finstrom Date: Mon, 29 Feb 2016 10:44:53 -0700 Subject: [PATCH 2/2] FREEPBX-11702 switch to v3 api --- sources/source-OpenCNAM.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/source-OpenCNAM.module b/sources/source-OpenCNAM.module index db05fbaa..469a63db 100644 --- a/sources/source-OpenCNAM.module +++ b/sources/source-OpenCNAM.module @@ -28,11 +28,11 @@ class OpenCNAM extends superfecta_base { if ($run_param['Account_SID'] == null or $run_param['Auth_Token'] == null) { // Hobbyist Tier URL (limited to 60 cached lookups per hour) - $url = "https://api.opencnam.com/v2/phone/" . $thenumber . "?format=pbx"; + $url = "https://api.opencnam.com/v3/phone/" . $thenumber . "?format=pbx"; } else { // Professional Tier URL (unlimited real-time CNAM lookups) - $url = "https://api.opencnam.com/v2/phone/" . $thenumber . "?format=pbx&ref=possa&account_sid=".$run_param['Account_SID']."&auth_token=".$run_param['Auth_Token']; + $url = "https://api.opencnam.com/v3/phone/" . $thenumber . "?format=pbx&ref=possa&account_sid=".$run_param['Account_SID']."&auth_token=".$run_param['Auth_Token']; } $sname = $this->get_url_contents($url);