Office timings only work asterisk after that voicemail

Home » Asterisk Users » Office timings only work asterisk after that voicemail
Asterisk Users 3 Comments


I have small asterisk pbx. I was made a dialplan like whenever out side
world is dialing to asterisk pbx DID’s it was goes to dial his extension
number. if this extension is not pick the call after 30 sec it will dial
his(user) mobile number. i need to create dialplan only office timings(9:00
am to 19:00, sun to Thu days) needs to dial his mobile number after that
will play like “this is not office time” whatever. after office timing it
should be go voicemail .

exten => 4578901,1,AGI(agi://
exten =>
exten => 4578901,3,Dial(SIP/5001,30,tTo)
exten => 4578901,4,Gotoiftime(09:00-19-00,sun-fri,*,*?default,4578901,5)
exten => 4578901,5,Dial(Zap/g0/0554721368,,tTo)
exten => 4578901,6,VoiceMail(u5001)
exten => 4578901,7,playback(vm-goodbye)
exten => 4578901,8,Hangup
up to hundred did’s have same dialplan

currently I am using above dial plan i need to add my question in this
dialplan . is there any way. please help’

Best Regards,

Mahesh Katta
*BUZZ**WORKS* Business Services Private Limited
201, Crystal Tower, 75 Gundavali Cross Lane, Andheri Kurla Road, Andheri (E)
Mumbai 400069
GSM +91.97029.70779 | Phone +91.22.4229.2634 | Fax +91.22.4229.2634

3 thoughts on - Office timings only work asterisk after that voicemail

  • Hi Mahesh,

    You can use below code for extensions.conf file for time based call flow as
    per your requirement.

    Please, comment your code in extensions.conf and then use below code. You
    can also need recording one sound file “non-working-hrs.gsm” for non working
    hours play file.

    exten => 4578901,3,Dial(SIP/5001,30,tTo)
    exten =>
    exten => 4578901,5,Dial(Zap/g0/0554721368,,tTo)
    exten => 4578901,6,playback(vm-goodbye)
    exten => 4578901,7,Hangup

    exten => s,1,Playback(non-working-hrs)
    exten => s,n,VoiceMail(u5001)
    exten => s,n,playback(vm-goodbye)
    exten => s,n,Hangup

    I hope this is helpful you.

  • Hope following will help you get some idea.


    exten => _45789XX,1,Set(VMNO=${EXTEN:-2})
    same => n,GotoIfTime(9:00-19:00,sun-thu,*,*?:NON-WORKING-HRS,s,1)

    exten => s,1,Playback(non-working-hrs)
    exten => s,n,VoiceMail(50${VMNO})
    exten => s,n,Hangup

    Mumbai, India.

  • The recording should be available for all expected codecs.

    You will need a database (MySQL, astdb) to associate each extension to the
    PSTN number.

    A macro, extension patterns and/or an AGI can all be useful tools to solve
    your problem.