Took a quick look at this for the part I saw to be the simplest, emulating the behaviour of a mobile phone.
I already had a hook in extenstions_custom.conf for outbound calls, to disable video calling, which was simply:
; ----- External calls, lock codec to prevent video
exten => _0.,1,Set(__SIP_CODEC=alaw)
same => next,Goto(outbound-allroutes,${EXTEN},1)
So I checked for how inbound calls were handled with regard to looking up the name of the caller, and copied in a couple lines of code, to make it now:
; ----- External calls, lock codec to prevent video
exten => _0.,1,Set(__SIP_CODEC=alaw)
same => next,AGI(/var/www/html/admin/modules/superfecta/agi/superfecta.agi)
same => next,Set(CONNECTEDLINE(name,i)=${lookupcid})
same => next,Goto(outbound-allroutes,${EXTEN},1)
and of course, it didn’t do anything at all. The superfecta code is looking up based on the CNUM value, which for this outbound call is my extension, so that won’t work, I need it to look up the number that I called, not the number I called from. Time for a dirty hack:
; ----- External calls, lock codec to prevent video
exten => _0.,1,Set(__SIP_CODEC=alaw)
same => next,Set(CALLERID(num)=${EXTEN})
same => next,AGI(/var/www/html/admin/modules/superfecta/agi/superfecta.agi)
same => next,Set(CONNECTEDLINE(name,i)=${lookupcid})
same => next,Goto(outbound-allroutes,${EXTEN},1)
So I overwrite the number I’m calling from with the number that I called, then pass that to the superfecta, which does it’s job perfectly and returns a name. The name is then passed back to the phone by updating the Connectedline name, and bingo! Working names appear for recognised outbound numbers. (disclaimer: not actually tested on a phone, looking at asterisk console only for results)
Pretty sure this was a bad idea though, so I checked the CDR data and sure enough, it makes a mess of it. Where it should show “UserName” <exten> it now of course shows “UserName” <dialledNumber>
So I’ll not be keeping it, but as a proof of concept it works and I like the behaviour.
In order to not screw up the CDR, I’ll need to modify the superfecta code so it can understand what I’m trying to do.
It normally is called by an inbound call, and looks up based on the CNUM, I’m wondering if there’s a way for it to detect an outbound call is being make, and look at the DID instead?
Or perhaps it would make more sense to define a different scheme, and call that scheme, but I didnt see a way to specify which scheme I wanted to use via the dialplan.
Either way, this does not address my starting point of ‘naming’ the feature codes, but it’s a start.
Thoughts, comments?