Skip to content

Commit

Permalink
Merge branch 'bugfix/FREEPBX-11712' of ssh://git.freepbx.org/freepbx/…
Browse files Browse the repository at this point in the history
…superfecta into release/13.0
  • Loading branch information
tm1000 committed Mar 1, 2016
2 parents 4bc17ad + 0ae0fd4 commit d631b0c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sources/source-OpenCNAM.module
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ 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 ... ");

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);
Expand All @@ -58,4 +59,4 @@ class OpenCNAM extends superfecta_base {
return($caller_id);
}

}
}

0 comments on commit d631b0c

Please sign in to comment.