StephanK
(Stephan Koenig)
1
(Is this the right place to ask such a question?)
I have a phone number in $from
How do I query superfecta for the cnam information?
I tried
$curl = curl_init();
$maintpw = “xxxxx”;
curl_setopt ($curl, CURLOPT_URL, “http://maint:${maintpw}@localhost/admin/modules/superfecta/bin/callerid.php?thenumber=$from”);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
curl_close ($curl);
and also
curl_setopt ($curl, CURLOPT_URL, “localhost/admin/modules/superfecta/bin/callerid.php?thenumber=$from”);
$result is always empty.
This was all I could find searching the internet.
tm1000
(Andrew Nagy)
2
Anything in the modules folder is specifically denied from the webserver for security reasons.
cynjut
(Dave Burgess)
3
Should that be “specifically no longer allowed” since I’m pretty sure it wasn’t as tight a rule once upon a dinosaur’s age?
tm1000
(Andrew Nagy)
4
It’s been a rule for a very long time. 3 years.
cynjut
(Dave Burgess)
5
Ah, kids these days. LOL.
Three years is not a long time.
StephanK
(Stephan Koenig)
6
So, is there any way to get a cnam from superfecta from my addon?
tm1000
(Andrew Nagy)
8
Superfecta is not written in a way that would allow it to do what you want. This may work however,
<?php
include '/etc/freepbx.conf';
$data = array(
"callerid" => 555555
);
FreePBX::Superfecta()->setAgi("w");
FreePBX::Superfecta()->execute('ALL',$data);
StephanK
(Stephan Koenig)
9
Thank you everybody! Great help!
Andrew, where would I find the result?
(I was searching for code where this is used, but I could not find any.)
StephanK
(Stephan Koenig)
10
Does anybody know where to find the result returned from superfecta or can tell me where to find a piece of code that I can look at?
tm1000
(Andrew Nagy)
11
It’s returned from execute.
StephanK
(Stephan Koenig)
12
unfortunately this gives no result. (empty on debug.)
Any idea?
Is there a piece of code that uses Superfecta that I could look at?
Thank you for you help! I really appreciate it!
tm1000
(Andrew Nagy)
13
Execute returns data. Did you do anything with it or just run it and expect it to output. Add echo to the front of it.
StephanK
(Stephan Koenig)
14
My code:
dbug($from);
include ‘/etc/freepbx.conf’;
$data = array(
“callerid” => 5555555555
);
$retu = FreePBX::Superfecta()->setAgi(“w”);
dbug($retu);
$retu = FreePBX::Superfecta()->execute(‘ALL’,$data);
dbug($retu);
Freepbx_dbug:
2017-Jan-08 14:17:44 /var/lib/asterisk/agi-bin/sms2email.php:47
1727xxxxxxx
2017-Jan-08 14:17:44 /var/lib/asterisk/agi-bin/sms2email.php:53
2017-Jan-08 14:17:45 /var/lib/asterisk/agi-bin/sms2email.php:55
(replaced numbers with xxxxxx)
StephanK
(Stephan Koenig)
15
I am aware that I am not querying $from but 5555555555, but that was for testing only.
I expected some kind of result …