Script for simple boss secretary feature

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()

Have more questions? Submit a request

2 Comments

  • 0
    Avatar

    This is an inadequate solution. There are requests for use especially in government institutions and it is a specification item. Therefore, this should not be considered as a feature, but as a configuration requirement and should be added to the menus.
    1- More than one secretary should be able to be appointed to a manager.
    2- A secretary can have more than one manager.
    3- The secretary should be able to make and cancel call forward when necessary.
    4- Managers should be able to be grouped so that they can call each other. Managers who are assigned the same level of authority should call each other, those with a high level of authority should call the lower one, and those with a low level of authority should not call the higher one.

    As a result, it will be more successful if these functions are provided.

    Thank you for your co-operation

    Edited by Devrim DAGBAKAN
  • 2
    Avatar

    Greetings everyone.
    I made the configuration as follows, it was easier to use.

    Find [macro-stdexten] part from  /etc/asterisk/extensions.conf file with cat.

    cat /etc/asterisk/extensions.conf

    In the example below, we add the bolded part.

    And Add all these lines to customcfg/extensions_support.conf file

    [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})

     

    ;here we define people who can call bosses

    [check_boss_internal_calls]  
    exten = boss,1,Noop(modify boss call destination)
    exten = boss,n,ExecIf($[${CALLERID(num)}==1302]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1303]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1304]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1306]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1398]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1802]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1803]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1805]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1808]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1843]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1856]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1909]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1919]?Return())
    exten = boss,n,ExecIf($[${CALLERID(num)}==1923]?Return())
    exten = boss,n,Gosub(check_boss_incoming,check_incoming,1)
    exten = boss,n,Return()

     

    ;here we arrange the secretaries of the bosses.

    [check_boss_incoming] 
    exten = check_incoming,1,Noop(check incoming call)
    exten = check_incoming,n,ExecIf($[${PBXDIALNUM}==1302]?Set(PBXDIALNUM=1805))
    exten = check_incoming,n,ExecIf($[${PBXDIALNUM}==1303]?Set(PBXDIALNUM=1805))
    exten = check_incoming,n,ExecIf($[${PBXDIALNUM}==1304]?Set(PBXDIALNUM=1808))
    exten = check_incoming,n,ExecIf($[${PBXDIALNUM}==1306]?Set(PBXDIALNUM=1808))
    exten = check_incoming,n,ExecIf($[${PBXDIALNUM}==1802]?Set(PBXDIALNUM=1808))
    exten = check_incoming,n,ExecIf($[${PBXDIALNUM}==1803]?Set(PBXDIALNUM=1808))
    exten = check_incoming,n,ExecIf($[${PBXDIALNUM}==1843]?Set(PBXDIALNUM=1805))
    exten = check_incoming,n,Return()

     

Please sign in to leave a comment.