Applicable Device
Device Model: S series
Firmware Version: 30.15.0.102
Description
Only the secretary can make a call or consult transfer a call to boss
All calls to the boss will be redirected to secretary
Code
In the code example, boss extension number is 4000, secretary extension number is 4002
[macro-stdexten]
exten = s,1,Set(IsFromOutside=0)
exten = s,n,Set(PBXDIALNUM=${ARG1})
exten = s,n,Gosub(check_boss_internal_calls,boss,1)
exten = s,n,Gotoif($[${LEN(${FromSystemAlert})}>0]?sys-dial,1)
exten = s,n,Gotoif($[${LEN(${BCBTYPE})}>0]?set:noset)
exten = s,n(set),Set(CALLERID(num)=${SRCEXTENSION})
exten = s,n,Set(CALLERID(name)=${SRCEXTENSION})
exten = s,n(noset),Set(CHECKCALLERNUM=${CALLERID(num)})
exten = s,n,ExecIf($[x${TYPE_OF_EXTEN${CALLERID(num)}}=xFXS]?Set(FAXOPT(gateway)=${IF($[${LEN(${T38SUPPORT_OF_EXTEN${PBXDIALNUM}})}>0]?${T38SUPPORT_OF_EXTEN${PBXDIALNUM}}:no)}):Noop(Not set faxopt))
exten = s,n,Set(TMPDIALOPT=${IF($[x${BUSYCP_CONTROL}=x${PBXDIALNUM}]?${DIALOPTIONS}A(record/ls_builtin_busy_camp_on_connected):${DIALOPTIONS})})
exten = s,n,Macro(realstexten,${PBXDIALNUM},${DIALPARAM_OF_EXTEN${PBXDIALNUM}},${TMPDIALOPT})
exten = sys-dial,1,Set(CHECKCALLERNUM=${CALLERID(num)})
exten = sys-dial,2,Macro(sysdial,${DIALPARAM_OF_EXTEN${PBXDIALNUM}},${RINGTIME},${DIALOPTIONS})
[check_boss_internal_calls]
exten = boss,1,Noop(modify boss call destination)
exten = boss,n,Gosub(check_boss_incoming,check_incoming,1)
exten = boss,n,Return()
[check_boss_incoming]
exten = check_incoming,1,Noop(check incoming call)
exten = check_incoming,n,ExecIf($[${PBXDIALNUM}!=4000]?Return())
exten = check_incoming,n,Set(REACHABLE=0)
exten = check_incoming,n,ExecIf($[(${CALLERID(num)}==4002)&(${PBXDIALNUM}==4000)]?Set(REACHABLE=1))
exten = check_incoming,n,ExecIf($[${REACHABLE}<1]?Set(PBXDIALNUM=4002))
exten = check_incoming,n,Return()
2 Comments