# Asterisk Project : SLA and Voicemail Example

Added by mdavenport , edited by mdavenport on Aug 31, 2010

This is an example of how you could set up a single voicemail box for the phone system. The voicemail box number used in this example is 1234, which would be configured in voicemail.conf.

For this example, assume that there are 2 trunks and 3 stations. The trunks are DAHDI/1 and DAHDI/2. The stations are SIP/station1, SIP/station2, and SIP/station3.

In dahdi.conf, channel 1 has context=line1 and channel 2 has context=line2.

In sip.conf, all three stations are configured with context=sla_stations.

When the stations pick up their phones to dial, they are allowed to dial NANP numbers for outbound calls, or 8500 for checking voicemail.

sla.conf:

    [line1]
    type=trunk
    device=Local/disa@line1_outbound

    [line2]
    type=trunk
    device=Local/disa@line2_outbound

    [station]
    type=station
    trunk=line1
    trunk=line2

    [station1](station)
    device=SIP/station1

    [station2](station)
    device=SIP/station2

    [station3](station)
    device=SIP/station3

extensions.conf:

    [macro-slaline]
    exten => s,1,SLATrunk(${ARG1})
    exten => s,n,Goto(s-${SLATRUNK_STATUS},1)
    exten => s-FAILURE,1,Voicemail(1234,u)
    exten => s-UNANSWERED,1,Voicemail(1234,u)

    [line1]
    exten => s,1,Macro(slaline,line1)

    [line2]
    exten => s,2,Macro(slaline,line2)

    [line1_outbound]
    exten => disa,1,Disa(no-password,line1_outbound)
    exten => _1NXXNXXXXXX,1,Dial(DAHDI/1/${EXTEN})
    exten => 8500,1,VoicemailMain(1234)

    [line2_outbound]
    exten => disa,1,Disa(no-password|line2_outbound)
    exten => _1NXXNXXXXXX,1,Dial(DAHDI/2/${EXTEN})
    exten => 8500,1,VoicemailMain(1234)

    [sla_stations]
    exten => station1,1,SLAStation(station1)
    exten => station1_line1,hint,SLA:station1_line1
    exten => station1_line1,1,SLAStation(station1_line1)
    exten => station1_line2,hint,SLA:station1_line2
    exten => station1_line2,1,SLAStation(station1_line2)
    exten => station2,1,SLAStation(station2)
    exten => station2_line1,hint,SLA:station2_line1
    exten => station2_line1,1,SLAStation(station2_line1)
    exten => station2_line2,hint,SLA:station2_line2
    exten => station2_line2,1,SLAStation(station2_line2)
    exten => station3,1,SLAStation(station3)
    exten => station3_line1,hint,SLA:station3_line1
    exten => station3_line1,1,SLAStation(station3_line1)
    exten => station3_line2,hint,SLA:station3_line2
    exten => station3_line2,1,SLAStation(station3_line2)