Some phones do not show any names, when you call somebody, e.g. cisco phones. I just recently found this
http://incrediblepbx.com/dialout-cnam.txt
and this
I created a scheme in CID-Superfecta (CID-match X.) with the name “outgoing”, created a new superfecta.agi in admin/modules/superfecta/agi (rights!) and added most of the code from the link above to extensions_override_freepbx.conf.
It works on a Cisco 8961. It doesnt work on my Cisco 7975 though.
Once connected the Cisco shows me the name and the number. Finally I have names in my outgoing-calls list on my Cisco 8961!!! The lookup sources you can adjust in Superfecta.
CDR reports shows the name of outgoing calls too.
I am no pro…so it might be a terrible solution…yet, if there comes no solution with freePBX…it is the only solution
It might work with most (newer) IP phones. My Sangoma 705s displays the name, yet it has a built-in LDAP-lookup anyway. So this dirty workaround is required for non-Sangoma-phones only.
superfecta-out.agi
<?php
$restrict_mods = true;
include '/etc/freepbx.conf';
$agidir = FreePBX::Config()->get('ASTAGIDIR');
require_once $agidir."/phpagi.php";
$base_dir = dirname(dirname(__FILE__));
$agi = new AGI();
$scheme_return = $agi->get_variable("CIDSFSCHEME");
if (($scheme_return['result']) && (trim(base64_decode($scheme_return['data'])) != '')) {
$scheme = base64_decode($scheme_return['data']);
} else {
$scheme = 'base_outgoing';
}
if ($scheme == 'ALL|ALL') {
$sn[1] = 'ALL';
} else {
$sn = explode("_", $scheme, 2);
}
if (!empty($agi->request['agi_callerid'])) {
$agi->verbose("Executing Scheme..");
$superfecta = FreePBX::Superfecta();
$superfecta->setAgi($agi);
$callerid = $superfecta->execute($sn[1], $agi->request);
$dest = $superfecta->getDest();
if(!empty($dest)) {
$agi->verbose("CID Determined to be: '" . trim($callerid) . "'");
$agi->verbose("SPAM Score was ".$superfecta->getSpamScore());
$agi->verbose("Sending call to ".$dest[0]);
$agi->set_variable("CALLERID(name)", trim($callerid));
$agi->set_variable("lookupcid", trim($callerid));//because we could bounce back here
$agi->goto_dest($dest[0], $dest[1], $dest[2]);
exit();
}
if(!empty($callerid)) {
$agi->verbose("CID Determined to be: '" . trim($callerid) . "'");
$agi->verbose("Attempting to set lookupcid");
$agi->set_variable("lookupcid", trim($callerid));
exit();
}
} else {
$agi->verbose("Not a valid number");
}
extensions_override_freepbx.conf
[macro-dialout-trunk-predial-hook]
exten => s,1,Noop(*** ${DIAL_NUMBER} ***)
exten => s,n,Set(num2find=${DIAL_NUMBER})
exten => s,n,Set(OrigCID=${CALLERID(num)})
exten => s,n,Set(OrigCNAM=${CALLERID(name)})
exten => s,n,Set(CALLERID(num)=${num2find})
exten => s,n,Set(CURLOPT(httptimeout)=7)
exten => s,n,Set(lookupcid=${num2find})
exten => s,n,Set(CALLERID(name)=${OrigCNAM})
exten => s,n,AGI(/var/www/html/admin/modules/superfecta/agi/superfecta-out.agi)
exten => s,n,Set(CALLERID(name)=${lookupcid})
exten => s,n,NoOp(*** ${CALLERID(name)} ***)
exten => s,n,Set(CDR(accountcode,r)=${CALLERID(name)})
exten => s,n,Set(CONNECTEDLINE(num,i)=${DIAL_NUMBER})
exten => s,n,Set(CONNECTEDLINE(name,i)=${lookupcid}) ; for CallerID Superfecta
exten => s,n,Set(CALLERID(num)=${OrigCID})
exten => s,n,Set(CALLERID(name)=${OrigCNAM})
exten => s,n,MacroExit()