This should be VERY easy... could I please request a couple of added lines in extensions.conf to facilitate an advanced Caller-ID name lookup. The first is in the from-pstn context (to set a flag so that later on in processing we can positively distinguish an external call from an internal one):
[from-pstn]
exten => s,1,Set(extcallflag=1) ;PLEASE ADD THIS FLAG
include => from-pstn-custom ; etc. etc.
The second addition is a one-line #include in the macro-user-callerid context in extensions.conf - the purpose being to allow some advance caller ID lookup processing when the caller ID NAME isn't available (but the number is):
;sets the callerid of the device to that of the logged in user
[macro-user-callerid]
exten => s,1,GotoIf?($["${REALCALLERIDNUM:1:2}" != ""]?start)
exten => s,n,Set(REALCALLERIDNUM=${CALLERID(number)})
exten => s,n(start),NoOp?(REALCALLERIDNUM is ${REALCALLERIDNUM})
exten => s,n,Set(AMPUSER=${DB(DEVICE/${REALCALLERIDNUM}/user)})
exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => s,n,GotoIf?($["${AMPUSERCIDNAME:1:2}" = ""]?report)
exten => s,n,Set(CALLERID(all)=\"${AMPUSERCIDNAME}\" <${AMPUSER}>)
#include => callerid-custom.conf ; THIS IS THE HOOK I'D LIKE TO SEE ADDED
exten => s,n(report),NoOp?(Using CallerID ${CALLERID(all)})
If you wonder why I want this it is to implement an advanced Caller ID name function such that when the call arrives with number but no name, this routine will do a reverse number lookup and try to get the name or alternately will at least try to pull a city and state associated with the area code and number, to do that it needs to be able to determine if Asterisk has already found a name. This is would be based on what's described at http://nerdvittles.com/index.php?p=82 (with some modifications, particularly the use of the previously set extcallflag so that it does NOT try to do lookups on calls between extensions!).
I actually had this working in an earlier version of FreePBX but that was before extensions.conf was one of the files overwritten when the "red bar" is clicked.