Ringgroup CID name prefix problem


CID name prefixes on ringgroups works, just not quite how I would have liked it to work.
I’m using 2.1.3 and would like to use a prefix on ringgroups to identify how calls are coming in.
For calls originating from PSTN numbers no “name” is sent with the caller id, just the number.
Without a CID name prefix set the originating number is displayed on the phone, but with a CID name prefix set only the prefix is displayed.

Would it be possible to combine the caller id number and CID prefix if the name is blank?


OK, so this is my first time editing a real asterisk config…


exten => 1,n,GotoIf($["${CALLERID(name)}" = “”]?COPYNUM)
exten => 1,n(COPYNUM),Set(CALLERID(name)=${CALLERIDNUM})
right before

exten => 1,n,GotoIf($["${CALLERID(name):0:${LEN(${RGPREFIX})}}" != “${RGPREFIX}”]?NEWPREFIX)
in extensions_additional.conf [ext-group] results in setting CallerID to “prefix CALLERID” when CALLERID(name) is empty, it also probably sets CALLERID(name) to CALLERIDNUM even if CALLERID(name) is set, however I barely understand the syntax.