Problem with builtin phonebook and asterisk 1.6

I had to fire up 1.6 last night? Reason: my VOIP provider (which doesn’t officially support BYOD) made a change that causes calls to adapters not provided by them to disconnect after 30 minutes into a call (this is not malicious, but is RFC-4028, session timers, which are not supported by most ATAs, and not by asterisk 1.4 or earlier). Anyway, it seems to work okay, and after causing freepbx 2.5 to refresh the configs, I notice it’s now doing Gosub() [new syntax in 1.6?] in various places. Cool. However, when my inbound DID was set to use a CID source of ‘internal’ (astdb phonebook?), the incoming call is botched when it goes off to cidlookup_5. The symptom is that the caller is sent straight to voicemail prompt as if ‘*’ were pressed (weird, yes.) This is most likely something that didn’t get updated correctly, so assuming I can track this down, I will post the resolution.

The builtin phonebook in the pull-down menu generates this:

exten => cidlookup_5,1,LookupCIDName
exten => cidlookup_5,n,Return()

Per the docs, LookupCIDName is deprecated in 1.4 and (apparently) removed outright in 1.6, so trying to invoke it blew up the script. The docs recommend this instead:

exten => cidlookup_5,1,Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})})
exten => cidlookup_5,n,Return()

I did this, but obviously this is not acceptable other than as a short-term workaround, since I had to edit extensions_additional.conf.

Added ticket #3145