In some cases, employees should not see the actual phone number of a client. Here is a possible approach to solving this problem: employees will be provided with an alternative number that they can use to call back.
Go to System → System File Customization.
Open the modules.conf configuration file for editing. Set the mode to "Add to end of file".
Connect the module to calculate the hash sum:
load => func_md5.so
Open the extensions.conf configuration file for editing. Set the mode to "Add to end of file".
Define the context for number substitution:
[dial_create_chan-custom]
exten => s,1,NoOp()
; Only for incoming calls
same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local" || "${FROM_DID}x" == "x"]?return)
; No processing required if an internal number is calling
same => n,ExecIf(${DIALPLAN_EXISTS(internal,${CONNECTEDLINE(num)},1)}?return)
; No processing required if the number is not in the list
same => n,ExecIf($[${DIALPLAN_EXISTS(bluring-extensions,${CHANNEL(endpoint)},1)} == 0]?return)
; Retrieve the cached number
same => n,Set(blNumber=${CONNECTEDLINE(num):-4}*${MD5(${CONNECTEDLINE(num)})})
same => n,Set(DB(bluring/${blNumber})=${CONNECTEDLINE(num)})
; Replace the caller ID
same => n,Set(CONNECTEDLINE(num)=${blNumber})
same => n,Set(CONNECTEDLINE(name)=${blNumber})
same => n,return
Describe the context with the numbers for which you need to replace the number:
[bluring-extensions]
; Allow number substitution for extension 201
exten => 201,1,NoOp()
; Allow substitution for all four-digit extensions
exten => _XXXX,1,NoOp()
We will provide the opportunity to call back to a replacement number:
[all_peers](+)
exten => _XXXX*.,1,Set(number=${DB(bluring/${EXTEN})})
same => n,ExecIf($["${number}x" == "x"]?hangup)
same => n,Goto(all_peers,${number},1)