Integrating Asterisk Voicemail with CME

I am attempting to integrate Cisco Call Manager Express with Asterisk. I y I would like to use the features such as voicemail, conference calling, etc.

Yes I have been searching on the internet for configuration examples, and I came across the web page “Asterisk cisco call manager express integration”

OK here is the current setup:
3 extensions configured on Cisco CME 2851
111 - Cisco 7912
222 - Cisco 7970
333 - Cisco 7920

Asterisk extensions:
2121

I have setup a sip trunk from the asterisk server to the router and it works fine. I can call from any of the 3 cisco extensions to the asterisk number, and vice-versa. I would like to utilize the asterisk voicemail for the phones registered with CME. Here R my configs:

Asterisk server ip - 192.168.1.77
Cisco router ip - 192.168.1.200

! this dial-peer dials into asterisk voicemail.
dial-peer voice 100 voip
destination-pattern 10.
redirect ip2ip
session protocol sipv2
session target ipv4:192.168.1.77
dtmf-relay rtp-nte
codec g711alaw
no vad

! Example of one phone config:
!
ephone-dn 12 dual-line
number 222
description 222
call-forward busy 107
call-forward noan 106 timeout 15

The problem is that I get a busy, every time I test by calling a phone attempting to get the voicemail.

The asterisk configs are in the post below.

I realize that there is some ‘unneeded’ configuration here, but I hate to take anything out until I know for sure what exactly I need.

extensions.conf
; Asterisk Management Portal (AMP)
; Copyright © 2004 Coalescent Systems Inc

; dialparties.agi (sprackett.com/asterisk/)
; Asterisk::AGI (asterisk.gnuinter.net/)
; gsm (ibiblio.org/pub/Linux/utils/ … short.html)
; loligo sounds (loligo.com/asterisk/sounds/)
; mpg123 (voip-info.org/wiki-Asterisk+conf … nhold.conf)

; include extension contexts generated from AMP
#include extensions_additional.conf

; Customizations to this dialplan should be made in extensions_custom.conf
; See extensions_custom.conf.sample for an example
#include extensions_custom.conf

[from-trunk] ; just an alias since VoIP shouldn’t be called PSTN
include => from-pstn

[from-pstn]
include => from-pstn-custom ; create this context in extensions_custom.conf to include customizations
include => ext-did-direct ; MODIFICATOIN (PL) put before ext-did to take precedence
include => ext-did
include => ext-findmefollow ; MODIFICATOIN (PL) for findmefollow if enabled, should be bofore ext-local
exten => fax,1,Goto(ext-fax,in_fax,1)

; MODIFICATION (PL)
;
; Required to assure that direct dids go to personal ring group before local extension.
; This could be auto-generated however I it is prefered to be put here and hard coded
; so that it can be modified if ext-local should take precedence in certain situations.
; will have to decide what to do later.
;
[from-did-direct]
include => ext-findmefollow
include => ext-local

; ############################################################################
; Macros [macro]
; ############################################################################

; Rings one or more extensions. Handles things like call forwarding and DND
; We don’t call dial directly for anything internal anymore.
; ARGS: $TIMER, $OPTIONS, $EXT1, $EXT2, $EXT3, …
; Use a Macro call such as the following:
; Macro(dial,$DIAL_TIMER,$DIAL_OPTIONS,$EXT1,$EXT2,$EXT3,…)
;[macro-std_ext]
; exten => s,1,Dial(${ARG1},20,t)
; exten => s,2,Voicemail2(u${MACRO_EXTEN})
; exten => s,3,Hangup
; exten => s,102,Voicemail2(b${MACRO_EXTEN})
; exten => s,103,Hangup
;
[macro-dial]
exten => s,1,AGI,dialparties.agi
exten => s,2,NoOp(Returned from dialparties with no extensions to call)
exten => s,3,NoOp(DIALSTATUS is ‘${DIALSTATUS}’)

exten => s,10,Dial(${ds}) ; dialparties will set the priority to 10 if $ds is not null

exten => s,20,NoOp(Returned from dialparties with hunt groups to dial )
exten => s,21,Set(HuntLoop=0)
exten => s,22,GotoIf($[${HuntMembers} >= 1]?30 ) ; if this is from rg-group, don’t strip prefix
exten => s,23,NoOp(Returning there are no members left in the hunt group to ring)

exten => s,30,Set(HuntMember=HuntMember${HuntLoop})
exten => s,31,GotoIf($[$["${CALLTRACE_HUNT}" != “” ] & $["${RingGroupMethod}" = “hunt” ]]?32:35 ) ; Set CAll Trace for Hunt member we are going to call
exten => s,32,Set(CT_EXTEN=${CUT(ARG3,$[${HuntLoop} + 1])})
exten => s,33,Set(DB(CALLTRACE/${CT_EXTEN})=${CALLTRACE_HUNT})
exten => s,34,Goto(s,42)

exten => s,35,GotoIf($[$["${CALLTRACE_HUNT}" != “” ] & $["${RingGroupMethod}" = “memoryhunt” ]]?36:50 ) ;Set Call Trace for each hunt member we are going to call "Memory groups have multiple members to set CALL TRACE For hence the loop
exten => s,36,Set(CTLoop=0)
exten => s,37,GotoIf($[${CTLoop} > ${HuntLoop}]?42 ) ; if this is from rg-group, don’t strip prefix
exten => s,38,Set(CT_EXTEN=${CUT(ARG3,$[${CTLoop} + 1])})
exten => s,39,Set(DB(CALLTRACE/${CT_EXTEN})=${CALLTRACE_HUNT})
exten => s,40,Set(CTLoop=$[1 + ${CTLoop}])
exten => s,41,Goto(s,37)

exten => s,42,Dial(${${HuntMember}}${ds} ) ; dialparties will set the priority to 20 if $ds is not null and its a hunt group
exten => s,43,Set(HuntLoop=$[1 + ${HuntLoop}])
exten => s,44,Set(HuntMembers=$[${HuntMembers} - 1])
exten => s,45,Goto(s,22)
exten => s,50,DBdel(CALLTRACE/${CT_EXTEN})
exten => s,51,Goto(s,42)

; Ring an extension, if the extension is busy or there is no answer send it
; to voicemail
; ARGS: $VMBOX, $EXT
[macro-exten-vm]
exten => s,1,Macro(user-callerid)
exten => s,n,Set(FROMCONTEXT=exten-vm)
exten => s,n,Set(VMBOX=${ARG1})
exten => s,n,Set(EXTTOCALL=${ARG2})
exten => s,n,Set(CFUEXT=${DB(CFU/${EXTTOCALL})})
exten => s,n,Set(RT=${IF($[$["${VMBOX}"!=“novm”] | $[“foo${CFUEXT}”!=“foo”]]?${RINGTIMER}:"")})
exten => s,n,Macro(record-enable,${EXTTOCALL},IN)
exten => s,n,GotoIf($["${CHANNEL:0:5}" = “Local”]?dolocaldial,1) ; if the channel is Local
exten => s,n,Macro(dial,${RT},${DIAL_OPTIONS},${EXTTOCALL})
exten => s,n,GosubIf($[$["${DIALSTATUS}"=“NOANSWER”] & $[“foo${CFUEXT}”!=“foo”]]?docfu,1) ; check for CFU in use on no answer
exten => s,n,NoOp(Voicemail is ‘${VMBOX}’)
exten => s,n,GotoIf($["${VMBOX}" = “novm”]?s-${DIALSTATUS},1) ; no voicemail in use for this extension
exten => s,n,NoOp(Sending to Voicemail box ${EXTTOCALL})
exten => s,n,Macro(vm,${VMBOX},${DIALSTATUS})

; Local channel should try to ring the phone only then come back out
; i.e. it’s wrong for it to Answer the call in any way (including Congestion
; and stop the initiating dialplan from being returned to)
exten => dolocaldial,1,Macro(dial,${DIAL_OPTIONS},${EXTTOCALL})
exten => dolocaldial,n,NoOp(Returned to dolocaldial with DIALSTATUS ‘${DIALSTATUS}’)

; Try the Call Forward on No Answer / Unavailable number
exten => docfu,1,Set(RTCFU=${IF($["${VMBOX}"!=“novm”]?${RINGTIMER}:"")})
exten => docfu,n,Dial(Local/${CFUEXT}@from-internal/n,${RTCFU},${DIAL_OPTIONS})
exten => docfu,n,Return

; Extensions with no Voicemail box reporting BUSY come here
exten => s-BUSY,1,NoOp(Extension is reporting BUSY and not passing to Voicemail)
exten => s-BUSY,n,Busy()
exten => s-BUSY,n,Wait(60)
exten => s-BUSY,n,Congestion()

; Anything but BUSY comes here
exten => _s-.,1,Congestion()

[macro-vm]
exten => s,1,Macro(user-callerid)
exten => s,n,Set(VMGAIN=${IF($[“foo${VM_GAIN}”!=“foo”]?“g(${VM_GAIN})”:"")})
exten => s,n,Goto(s-${ARG2},1)

exten => s-BUSY,1,NoOp(BUSY voicemail)
exten => s-BUSY,n,Macro(get-vmcontext,${ARG1})
exten => s-BUSY,n,Voicemail(${ARG1}@${VMCONTEXT}|b${VMGAIN}) ; Voicemail Busy message
exten => s-BUSY,n,Goto(exit-${VMSTATUS},1)

exten => s-DIRECTDIAL,1,NoOp(DIRECTDIAL voicemail)
exten => s-DIRECTDIAL,n,Macro(get-vmcontext,${ARG1})
exten => s-DIRECTDIAL,n,Voicemail(${ARG1}@${VMCONTEXT}|${VM_DDTYPE}${VMGAIN})
exten => s-DIRECTDIAL,n,Goto(exit-${VMSTATUS},1)

exten => _s-.,1,Macro(get-vmcontext,${ARG1})
exten => _s-.,n,Voicemail(${ARG1}@${VMCONTEXT}|u${VMGAIN}) ; Voicemail Unavailable message
exten => _s-.,n,Goto(exit-${VMSTATUS},1)

exten => o,1,Background(one-moment-please) ; 0 during vm message will hangup
exten => o,n,GotoIf($[“foo${FROM_DID}” = “foo”]?from-pstn,s,1:from-pstn,${FROM_DID},1)

exten => a,1,Macro(get-vmcontext,${ARG1})
exten => a,n,VoiceMailMain(${ARG1}@${VMCONTEXT})
exten => a,n,Hangup

[vm]
;Standard voicemail login prompt
exten => 101,1,VoicemailMain
exten => 101,2,Hangup

;CCME Specific VM
;Voice mail Key on 79xx - need to use the last 3 digits of the CallerID. See notes on “calling-number local secondary” in the telephony-service section
;of the cisco config
exten => 105,1,NoOp,${CALLERIDNUM}
exten => 105,2,Background(silence/1)
exten => 105,3,Voicemail(s${CALLERIDNUM})
exten => 105,4,Hangup
exten => 105,104,Hangup

;Transfer on unavailable.
; I playback 1 second of silence to allow the call to establish correctly else the start of the audio gets cut off, if you have silence suppression or something
; I guess you could play a beep.
; Because the call is being transfered the variable ${CALLERIDNUM} contains the number of the calling device not the divice they were calling
; This would mean you would end up in your own or a non existant mailbox, the variable ${RDNIS} contains the number
; the call was redirected from and therefore can be used to specify the correct mailbox number.
exten => 106,1,NoOp,${CALLERIDNUM}
exten => 106,2,NoOp,${RDNIS}
exten => 106,3,Playback(silence/1)
exten => 106,4,Voicemail(u${RDNIS})
exten => 106,5,Hangup
exten => 106,106,Hangup

;Transfer on busy.
;see notes above, just sets the b flag for the voicemail application to stat the call was busy (as apposed to unavailable).
exten => 107,1,NoOp,${CALLERIDNUM}
exten => 107,2,NoOp,${RDNIS}
exten => 107,3,Playback(silence/1)
exten => 107,4,Voicemail(b${RDNIS})
exten => 107,5,Hangup
exten => 107,106,Hangup

exten => exit-FAILED,1,Playback(im-sorry&an-error-has-occured)
exten => exit-FAILED,n,Hangup()

exten => exit-SUCCESS,1,Playback(goodbye)
exten => exit-SUCCESS,n,Hangup()

exten => exit-USEREXIT,1,Playback(goodbye)
exten => exit-USEREXIT,n,Hangup()

exten => t,1,Hangup()

; get the voicemail context for the user in ARG1
[macro-get-vmcontext]
exten => s,1,Set(VMCONTEXT=${DB(AMPUSER/${ARG1}/voicemail)})
exten => s,2,GotoIf($[“foo${VMCONTEXT}” = “foo”]?200:300)
exten => s,200,Set(VMCONTEXT=default)
exten => s,300,NoOp()

; For some reason, if I don’t run setCIDname, CALLERID(name) will be blank in my AGI
; ARGS: none
[macro-fixcid]
exten => s,1,Set(CALLERID(name)=${CALLERID(name)})

; Ring groups of phones
; ARGS: comma separated extension list
; 1 - Ring Group Strategy
; 2 - ringtimer
; 3 - prefix
; 4 - extension list
[macro-rg-group]
exten => s,1,Macro(user-callerid)
exten => s,2,GotoIf($["${CALLERID(name):0:${LEN(${RGPREFIX})}}" != “${RGPREFIX}”]?4:3) ; check for old prefix
exten => s,3,Set(CALLERID(name)=${CALLERID(name):${LEN(${RGPREFIX})}}) ; strip off old prefix
exten => s,4,Set(RGPREFIX=${ARG3}) ; set new prefix
exten => s,5,Set(CALLERID(name)=${RGPREFIX}${CALLERID(name)}) ; add prefix to callerid name
exten => s,6,Set(RecordMethod=Group) ; set new prefix
exten => s,7,Macro(record-enable,${MACRO_EXTEN},${RecordMethod})
exten => s,8,Set(RingGroupMethod=${ARG1}) ;
exten => s,9,Macro(dial,${ARG2},${DIAL_OPTIONS},${ARG4})
exten => s,10,Set(RingGroupMethod=’’) ;

[ccme]
; The host declaration for your Cisco router should include the statement “context = cme” meaning incoming calls from the source will be contained within this ;(ccme) context.
include => vm
include => phones
include => did
;
; Outgoing channel(s) are busy … inform the client
; but use noanswer features like ringgroups don’t break by being answered
; just to play the message.
;
[macro-outisbusy]
exten => s,1,Playback(all-circuits-busy-now,noanswer)
exten => s,n,Playback(pls-try-call-later,noanswer)
exten => s,n,Macro(hangupcall)

; What to do on hangup.
[macro-hangupcall]
exten => s,1,ResetCDR(w)
exten => s,2,NoCDR()
exten => s,3,Wait(5)
exten => s,4,Hangup

[macro-faxreceive]
exten => s,1,Set(FAXFILE=/var/spool/asterisk/fax/${UNIQUEID}.tif)
exten => s,2,Set(EMAILADDR=${FAX_RX_EMAIL})
exten => s,3,rxfax(${FAXFILE})
exten => s,103,Set(EMAILADDR=${FAX_RX_EMAIL})
exten => s,104,Goto(3)

; dialout and strip the prefix
[macro-dialout]
exten => s,1,Macro(user-callerid)
exten => s,2,GotoIf($["${ECID${CALLERID(number)}}" = “”]?5) ;check for CID override for exten
exten => s,3,Set(CALLERID(all)=${ECID${CALLERID(number)}})
exten => s,4,Goto(7)
exten => s,5,GotoIf($["${OUTCID_${ARG1}}" = “”]?7) ;check for CID override for trunk
exten => s,6,Set(CALLERID(all)=${OUTCID_${ARG1}})
exten => s,7,Set(length=${LEN(${DIAL_OUT_${ARG1}})})
exten => s,8,Dial(${OUT_${ARG1}}/${ARG2:${length}})
exten => s,9,Congestion
exten => s,109,Macro(outisbusy)

; dialout using default OUT trunk - no prefix
[macro-dialout-default]
exten => s,1,Macro(user-callerid)
exten => s,2,Macro(record-enable,${CALLERID(number)},OUT)
exten => s,3,Macro(outbound-callerid,${ARG1})
exten => s,4,Dial(${OUT}/${ARG1})
exten => s,5,Congestion
exten => s,105,Macro(outisbusy)

; dialout using a trunk, using pattern matching (don’t strip any prefix)
; arg1 = trunk number, arg2 = number, arg3 = route password
;
; MODIFIED (PL)
;
; Modified both Dial() commands to include the new TRUNK_OPTIONS from the general
; screen of AMP
;
[macro-dialout-trunk]
exten => s,1,Set(DIAL_TRUNK=${ARG1})
exten => s,n,Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(ROUTE_PASSWD=${ARG3})
exten => s,n,GotoIf($["${ROUTE_PASSWD}" = “”]?noauth) ; arg3 is pattern password
exten => s,n(auth),Authenticate(${ROUTE_PASSWD})
exten => s,n(noauth),Set(GROUP()=OUT_${DIAL_TRUNK})
exten => s,n,Macro(user-callerid)
exten => s,n,Macro(record-enable,${CALLERID(number)},OUT)
exten => s,n,Macro(outbound-callerid,${DIAL_TRUNK})
exten => s,n,GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = “foo”]?nomax)
exten => s,n(checkmax),GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull)
exten => s,n(nomax),AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk
exten => s,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER}) ; OUTNUM is the final dial number
exten => s,n,Set(custom=${CUT(OUT_${DIAL_TRUNK},:,1)}) ; Custom trunks are prefixed with “AMP:“
exten => s,n,GotoIf($[”${custom}” = “AMP”]?customtrunk)
exten => s,n,Dial(${OUT_${DIAL_TRUNK}}/${OUTNUM},120,${TRUNK_OPTIONS}) ; Regular Trunk Dial
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(customtrunk),Set(pre_num=${CUT(OUT_${DIAL_TRUNK},$,1)})
exten => s,n,Set(the_num=${CUT(OUT_${DIAL_TRUNK},$,2)}) ; this is where we expect to find string OUTNUM
exten => s,n,Set(post_num=${CUT(OUT_${DIAL_TRUNK},$,3)})
exten => s,n,GotoIf($["${the_num}" = “OUTNUM”]?outnum:skipoutnum) ; if we didn’t find “OUTNUM”, then skip to Dial
exten => s,n(outnum),Set(the_num=${OUTNUM}) ; replace “OUTNUM” with the actual number to dial
exten => s,n(skipoutnum),Dial(${pre_num:4}${the_num}${post_num},120,${TRUNK_OPTIONS})
exten => s,n,Goto(s-${DIALSTATUS},1)

exten => s,n(chanfull),Noop(max channels used up)

exten => s-BUSY,1,NoOp(Trunk is reporting BUSY)
exten => s-BUSY,2,Busy()
exten => s-BUSY,3,Wait(60)
exten => s-BUSY,4,NoOp()

exten => _s-.,1,NoOp(Dial failed due to ${DIALSTATUS})

exten => h,1,Macro(hangupcall)

; Adds a dynamic agent/member to a Queue
; Prompts for call-back number - in not entered, uses CIDNum
[macro-agent-add]
exten => s,1,Wait(1)
exten => s,2,Macro(user-callerid)
exten => s,3,Read(CALLBACKNUM,agent-user) ; get callback number from user
exten => s,4,GotoIf($["${CALLBACKNUM}" = “”]?5:7) ; if user just pressed # or timed out, use cidnum
exten => s,5,Set(CALLBACKNUM=${CALLERID(number)})
exten => s,6,GotoIf($["${CALLBACKNUM}" = “”]?2) ; if still no number, start over
exten => s,7,GotoIf($["${ARG2}" = “”]?9:8) ; arg2 is queue password
exten => s,8,Authenticate(${ARG2})
exten => s,9,AddQueueMember(${ARG1}|Local/${CALLBACKNUM}@from-internal/n) ; using chan_local allows us to have agents over trunks
exten => s,10,UserEvent(Agentlogin|Agent: ${CALLBACKNUM})
exten => s,11,Wait(1)
exten => s,12,Playback(agent-loginok)
exten => s,13,Hangup()

; Removes a dynamic agent/member from a Queue
; Prompts for call-back number - in not entered, uses CIDNum
[macro-agent-del]
exten => s,1,Wait(1)
exten => s,2,Macro(user-callerid)
exten => s,3,Read(CALLBACKNUM,agent-user) ; get callback number from user
exten => s,4,GotoIf($["${CALLBACKNUM}" = “”]?5:7) ; if user just pressed # or timed out, use cidnum
exten => s,5,Set(CALLBACKNUM=${CALLERID(number)})
exten => s,6,GotoIf($["${CALLBACKNUM}" = “”]?2) ; if still no number, start over
exten => s,7,RemoveQueueMember(${ARG1}|Local/${CALLBACKNUM}@from-internal/n)
exten => s,8,UserEvent(RefreshQueue)
exten => s,9,Wait(1)
exten => s,10,Playback(agent-loggedoff)
exten => s,11,Hangup()

; arg1 = trunk number, arg2 = number
[macro-dialout-enum]
; This has been violently beaten upon by Rob Thomas, xrobau@gmail.com
; to 1: Be compliant with all the depreciated bits in asterisk 1.2 and
; above, and 2: to give a good shot at attempting to be compliant with
; RFC3761 by honouring the order in which records are returned.
exten => s,1,GotoIf($["${ARG3}" = “”]PASSWD?NOPASSWD); arg3 is pattern password
exten => s,n(PASSWD),Authenticate(${ARG3})
exten => s,n(NOPASSWD),Macro(user-callerid)
exten => s,n,Macro(record-enable,${CALLERID(number)},OUT)
exten => s,n,Macro(outbound-callerid,${ARG1})
exten => s,n,Set(GROUP()=OUT_${ARG1})
exten => s,n,GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${ARG1}} ]?nochans)
exten => s,n,Set(DIAL_NUMBER=${ARG2})
exten => s,n,Set(DIAL_TRUNK=${ARG1})
exten => s,n,AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk
exten => s,n,Set(E164NETWORKS=e164.arpa-e164.info-e164.org) ; enum networks to check
exten => s,n,GotoIf($["${DIAL_NUMBER:0:1}" = “+”]?begin) ; Skip next line if it already is prefixed by a plus
exten => s,n,Set(DIAL_NUMBER=+${DIAL_NUMBER}) ; Add a plus to the start, becasue ENUMLOOKUP needs it.

; start of main network loop
exten => s,n(begin),NoOp(E164NETWORKS is ${E164NETWORKS})
exten => s,n,GotoIf($["${E164NETWORKS:1:2}"=""]?failedtotally)
exten => s,n,Set(ENUMNET=${CUT(E164NETWORKS,-,1)})
exten => s,n,Set(E164NETWORKS=${CUT(E164NETWORKS,-,2-)})

exten => s,n,NoOp(E164NETWORKS is now ${E164NETWORKS})
exten => s,n,NoOp(ENUMNET is ${ENUMNET})

exten => s,n,Set(ENUMCOUNT=${ENUMLOOKUP(${DIAL_NUMBER},all,c,${ENUMNET})})
exten => s,n,Set(ENUMPTR=0)
exten => s,n,Set(LOOKUPBUG=0)

; start of main lookup loop
exten => s,n(startloop),GotoIf($["${ENUMPTR}"<"${ENUMCOUNT}"]?continue:failed)

; Now, let’s start through them.
exten => s,n(continue),Set(ENUMPTR=$[${ENUMPTR}+1])
exten => s,n,NoOp(Doing ENUMLOOKUP(${DIAL_NUMBER},all,${ENUMPTR},${ENUMNET}))
exten => s,n,Set(ENUM=${ENUMLOOKUP(${DIAL_NUMBER},all,${ENUMPTR},${ENUMNET})})

; Deal with reponse
exten => s,n,GotoIf($["${ENUM:0:3}" = “sip” ]?sipuri)
exten => s,n,GotoIf($["${ENUM:0:3}" = “iax” ]?iaxuri)
; It doesn’t matter if you don’t have h323 enabled, as when it tries to dial, it cares
; about dialstatus and retries if there are any enum results left.
exten => s,n,GotoIf($["${ENUM:0:3}" = “h32” ]?h323uri)

; e164.org can return ‘ADDRESS’ lines. Because of *'s poor handling of Enum
; lookups, we want to DECREMENT the enum pointer. Yes. That means we try more
; times than there actually exists entries.
exten => s,n,GotoIf($["${ENUM:0:3}" = “ADD” ]?enumbug)

; OK. If we’re here, we’ve still got some enum entries to go through. Back to
; the start with you!
exten => s,n,Goto(startloop)

; We’re here because of the poor implementation of ENUMLOOKUP in Asterisk. It
; is quite possible to do three ENUMLOOKUPS and get the same entry each time.
; The only workaround I can think of is when we hit an invalid entry, do a
; DECREMENT of the pointer, and keep trying.
exten => s,n(enumbug),Set(ENUMPTR=$[${ENUMPTR}-1])
exten => s,n,NoOp(If this is looping with the same ENUM value, The ENUMLOOKUP function is fixed!)
exten => s,n,Set(LOOKUPBUG=$[${LOOKUPBUG}+1])
; If we’ve done this more than, ooh, 5 times, then give up on this network. Sorry.
exten => s,n,GotoIf($["${LOOKUPBUG}" > 5 ]?failed)
exten => s,n,Goto(continue)

; If the prefix is ‘sip:’…
exten => s,n(sipuri),Set(DIALSTR=SIP/${ENUM:4})
exten => s,n,Goto(dodial)

; If it’s IAX2…
exten => s,n(iaxuri),Set(DIALSTR=IAX2/${ENUM:5})
exten => s,n,Goto(dodial)

; Or even if it’s H323.
exten => s,n(h323uri),Set(DIALSTR=H323/${ENUM:5})

exten => s,n(dodial),Dial(${DIALSTR})
exten => s,n,NoOp(Dial exited in macro-enum-dialout with ${DIALSTATUS})

; Now, if we’re still here, that means the Dial failed for some reason.
; If it’s CONGESTION or CHANUNAVAIL we probably want to try again on a
; different channel. However, if it’s the last one, we don’t have any
; left, and I didn’t keep any previous dialstatuses, so hopefully
; someone looking throught the logs would have seen the NoOp’s
exten => s,n,GotoIf($["${ENUMPTR}"<"${ENUMCOUNT}"]?maybemore:dialfailed)
exten => s,n(maybemore),GotoIf($[ $[ “${DIALSTATUS}” = “CHANUNAVAIL” ] | $[ “${DIALSTATUS}” = “CONGESTION” ] ]?continue)

; If we’re here, then it’s BUSY or NOANSWER or something and well, deal with it.
exten => s,n(dialfailed),Goto(s-${DIALSTATUS},1)

; Here are the exit points for the macro.
exten => s,n(failed),NoOp(EnumLookup failed on network ${ENUMNET})
exten => s,n,Goto(begin)

exten => s,n(failedtotally),NoOp(EnumLookup failed – no more networks to try)
exten => s,n,Goto(end)

exten => s,n(nochans),NoOp(max channels used up)

exten => s,n(end),NoOp(Exiting macro-dialout-enum)

exten => s-BUSY,1,NoOp(Trunk is reporting BUSY)
exten => s-BUSY,2,Busy()
exten => s-BUSY,3,Wait(60)
exten => s-BUSY,4,NoOp()

exten => _s-.,1,NoOp(Dial failed due to ${DIALSTATUS})

[macro-record-enable]
exten => s,1,GotoIf(${LEN(${BLINDTRANSFER})} > 0?2:4)
exten => s,2,ResetCDR(w)
exten => s,3,StopMonitor()
exten => s,4,AGI(recordingcheck,${TIMESTAMP},${UNIQUEID})
exten => s,5,Noop(No recording needed)
exten => s,999,MixMonitor(${CALLFILENAME}.wav)

;exten => s,3,BackGround(for-quality-purposes)
;exten => s,4,BackGround(this-call-may-be)
;exten => s,5,BackGround(recorded)

; This macro is for dev purposes and just dumps channel/app variables. Useful when designing new contexts.
[macro-dumpvars]
exten => s,1,Noop(ACCOUNTCODE=${ACCOUNTCODE})
exten => s,2,Noop(ANSWEREDTIME=${ANSWEREDTIME})
exten => s,3,Noop(BLINDTRANSFER=${BLINDTRANSFER})
exten => s,4,Noop(CALLERID=${CALLERID(all)})
exten => s,5,Noop(CALLERID(name)=${CALLERID(name)})
exten => s,6,Noop(CALLERID(number)=${CALLERID(number)})
exten => s,7,Noop(CALLINGPRES=${CALLINGPRES})
exten => s,8,Noop(CHANNEL=${CHANNEL})
exten => s,9,Noop(CONTEXT=${CONTEXT})
exten => s,10,Noop(DATETIME=${DATETIME})
exten => s,11,Noop(DIALEDPEERNAME=${DIALEDPEERNAME})
exten => s,12,Noop(DIALEDPEERNUMBER=${DIALEDPEERNUMBER})
exten => s,13,Noop(DIALEDTIME=${DIALEDTIME})
exten => s,14,Noop(DIALSTATUS=${DIALSTATUS})
exten => s,15,Noop(DNID=${DNID})
exten => s,16,Noop(EPOCH=${EPOCH})
exten => s,17,Noop(EXTEN=${EXTEN})
exten => s,18,Noop(HANGUPCAUSE=${HANGUPCAUSE})
exten => s,19,Noop(INVALID_EXTEN=${INVALID_EXTEN})
exten => s,20,Noop(LANGUAGE=${LANGUAGE})
exten => s,21,Noop(MEETMESECS=${MEETMESECS})
exten => s,22,Noop(PRIORITY=${PRIORITY})
exten => s,23,Noop(RDNIS=${RDNIS})
exten => s,24,Noop(SIPDOMAIN=${SIPDOMAIN})
exten => s,25,Noop(SIP_CODEC=${SIP_CODEC})
exten => s,26,Noop(SIPCALLID=${SIPCALLID})
exten => s,27,Noop(SIPUSERAGENT=${SIPUSERAGENT})
exten => s,28,Noop(TIMESTAMP=${TIMESTAMP})
exten => s,29,Noop(TXTCIDNAME=${TXTCIDNAME})
exten => s,30,Noop(UNIQUEID=${UNIQUEID})
exten => s,31,Noop(TOUCH_MONITOR=${TOUCH_MONITOR})
exten => s,32,Noop(MACRO_CONTEXT=${MACRO_CONTEXT})
exten => s,33,Noop(MACRO_EXTEN=${MACRO_EXTEN})
exten => s,34,Noop(MACRO_PRIORITY=${MACRO_PRIORITY})

[macro-user-logon]
; check device type
exten => s,1,Set(DEVICETYPE=${DB(DEVICE/${CALLERID(number)}/type)})
exten => s,2,GotoIf($["${DEVICETYPE}" = “fixed”]?s-FIXED,1)
; get user’s extension
exten => s,3,Set(AMPUSER=${ARG1})
exten => s,4,GotoIf($["${AMPUSER}" = “”]?5:9)
exten => s,5,BackGround(please-enter-your)
exten => s,6,Playback(extension)
exten => s,7,Read(AMPUSER,then-press-pound)
; get user’s password and authenticate
exten => s,8,Wait(1)
exten => s,9,Set(AMPUSERPASS=${DB(AMPUSER/${AMPUSER}/password)})
exten => s,10,GotoIf($[${LEN(${AMPUSERPASS})} = 0]?s-NOPASSWORD,1)
; do not continue if the user has already logged onto this device
exten => s,11,Set(DEVICEUSER=${DB(DEVICE/${CALLERID(number)}/user)})
exten => s,12,GotoIf($["${DEVICEUSER}" = “${AMPUSER}”]?s-ALREADYLOGGEDON,1)
exten => s,13,Authenticate(${AMPUSERPASS})
; devices can only be mapped to one user - loggoff anyone else who is here
exten => s,14,Macro(user-logoff)
; map user to device
exten => s,15,Set(AMPUSERDEVICES=${DB(AMPUSER/${AMPUSER}/device)})
exten => s,16,GotoIf($[${LEN(${AMPUSERDEVICES})} = 0]?18)
exten => s,17,Set(AMPUSERDEVICES=${AMPUSERDEVICES}&)
exten => s,18,Set(AMPUSERDEVICES=${AMPUSERDEVICES}${CALLERID(number)})
exten => s,19,Set(DB(AMPUSER/${AMPUSER}/device)=${AMPUSERDEVICES})
; map device to user
exten => s,20,Set(DB(DEVICE/${CALLERID(number)}/user)=${AMPUSER})
; create symlink from dummy device mailbox to user’s mailbox
exten => s,21,System(/bin/ln -s /var/spool/asterisk/voicemail/default/${AMPUSER}/ /var/spool/asterisk/voicemail/device/${CALLERID(number)})

exten => s-FIXED,1,NoOp(Device is FIXED and cannot be logged into)
exten => s-FIXED,2,Playback(ha/phone)
exten => s-FIXED,3,SayDigits(${CALLERID(number)})
exten => s-FIXED,4,Playback(is-curntly-unavail)
exten => s-FIXED,5,Playback(vm-goodbye)
exten => s-FIXED,6,Hangup ;TODO should play msg indicated device cannot be logged into

exten => s-ALREADYLOGGEDON,1,NoOp(This device has already been logged into by this user)
exten => s-ALREADYLOGGEDON,2,Playback(vm-goodbye)
exten => s-ALREADYLOGGEDON,3,Hangup ;TODO should play msg indicated device is already logged into

exten => s-NOPASSWORD,1,NoOp(This extension does not exist or no password is set)
exten => s-NOPASSWORD,2,Playback(an-error-has-occured)
exten => s-NOPASSWORD,3,Playback(vm-goodbye)
exten => s-NOPASSWORD,4,Hangup ;TODO should play msg indicated device is already logged into

[macro-user-logoff]
; check device type
exten => s,1,Set(DEVICETYPE=${DB(DEVICE/${CALLERID(number)}/type)})
exten => s,2,GotoIf($["${DEVICETYPE}" = “fixed”]?s-FIXED,1)
; remove entry from user’s DEVICE key
; delete the symlink to user’s voicemail box
exten => s,3,System(rm -f /var/spool/asterisk/voicemail/device/${CALLERID(number)})
exten => s,4,Set(DEVAMPUSER=${DB(DEVICE/${CALLERID(number)}/user)})
exten => s,5,Set(AMPUSERDEVICES=${DB(AMPUSER/${DEVAMPUSER}/device)})
exten => s,6,AGI(list-item-remove.php,${AMPUSERDEVICES},${CALLERID(number)},AMPUSERDEVICES,&)
; reset user -> device mapping
; users can log onto multiple devices, need to just remove device from value
exten => s,7,Set(DB(AMPUSER/${DEVAMPUSER}/device)=${AMPUSERDEVICES})
; reset device -> user mapping
exten => s,8,Set(DB(DEVICE/${CALLERID(number)}/user)=none)
exten => s,9,Playback(vm-goodbye)

exten => s-FIXED,1,NoOp(Device is FIXED and cannot be logged out of)
exten => s-FIXED,2,Playback(an-error-has-occured)
exten => s-FIXED,3,Playback(vm-goodbye)
exten => s-FIXED,4,Hangup ;TODO should play msg indicated device cannot be logged into

[macro-systemrecording]
exten => s,1,Goto(${ARG1},1)

exten => dorecord,1,Record(/tmp/${CALLERID(number)}-ivrrecording:wav)
exten => dorecord,n,Wait(1)
exten => dorecord,n,Goto(confmenu,1)

exten => docheck,1,Playback(/tmp/${CALLERID(number)}-ivrrecording)
exten => docheck,n,Wait(1)
exten => docheck,n,Goto(confmenu,1)

exten => confmenu,1,Background(to-listen-to-it&press-1&to-rerecord-it&press-star|m||macro-systemrecording)
exten => confmenu,n,Read(RECRESULT||1|||4)
exten => confmenu,n,GotoIf($[“x${RECRESULT}”=“x*”]?dorecord,1)
exten => confmenu,n,GotoIf($[“x${RECRESULT}”=“x1”]?docheck,1)
exten => confmenu,n,Goto(1)

exten => 1,1,Goto(docheck,1)
exten => *,1,Goto(dorecord,1)

exten => t,1,Playback(goodbye)
exten => t,n,Hangup

exten => i,1,Playback(pm-invalid-option)
exten => i,n,Goto(confmenu,1)

exten => h,1,Hangup

;
; ############################################################################
; CallerID Handling
; ############################################################################

;sets the callerid of the device to that of the logged in user
[macro-user-callerid]
exten => s,1,GotoIf($["${CHANNEL:0:5}" = “Local”]?report)
exten => s,n,GotoIf($["${REALCALLERIDNUM:1:2}" != “”]?start)
exten => s,n,Set(REALCALLERIDNUM=${CALLERID(number)})
exten => s,n(start),NoOp(REALCALLERIDNUM is ${REALCALLERIDNUM})
exten => s,n,Set(AMPUSER=${DB(DEVICE/${REALCALLERIDNUM}/user)})
exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => s,n,GotoIf($[“x${AMPUSERCIDNAME:1:2}” = “x”]?chknamelen)
exten => s,n,Set(CALLERID(all)=${AMPUSERCIDNAME} <${AMPUSER}>)
exten => s,n(chknamelen),GotoIf($[${LEN(${CALLERID(name)})} > 0]?report)
exten => s,n,AGI(calleridname.agi)
exten => s,n(report),NoOp(Using CallerID ${CALLERID(all)})

; overrides callerid out trunks
; arg1 is trunk
; macro-user-callerid should be called before using this macro
[macro-outbound-callerid]
exten => s,1,GotoIf($["${REALCALLERIDNUM:1:2}" != “”]?start)
exten => s,n,Set(REALCALLERIDNUM=${CALLERID(number)})
exten => s,n(start),NoOp(REALCALLERIDNUM is ${REALCALLERIDNUM})
exten => s,n,Set(USEROUTCID=${DB(AMPUSER/${REALCALLERIDNUM}/outboundcid)})
exten => s,n,Set(EMERGENCYCID=${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)})
exten => s,n,Set(TRUNKOUTCID=${OUTCID_${ARG1}})
exten => s,n,GotoIf($["${EMERGENCYROUTE:1:2}" = “”]?trunkcid) ; check EMERGENCY ROUTE
exten => s,n,GotoIf($["${EMERGENCYCID:1:2}" = “”]?trunkcid) ; empty EMERGENCY CID, so default back to trunk
exten => s,n,Set(CALLERID(all)=${EMERGENCYCID}) ; emergency cid for device
exten => s,n,Goto(report)
exten => s,n(trunkcid),GotoIf($["${TRUNKOUTCID:1:2}" = “”]?usercid) ;check for CID override for trunk (global var)
exten => s,n,Set(CALLERID(all)=${TRUNKOUTCID})
exten => s,n(usercid),GotoIf($["${USEROUTCID:1:2}" = “”]?report) ; check CID override for extension
exten => s,n,Set(CALLERID(all)=${USEROUTCID})
exten => s,n,GotoIf($[“x${USEROUTCID}” = “xhidden”]?hidecid:report) ; check CID blocking for extension
exten => s,n(hidecid),SetCallerPres(prohib_passed_screen) ; Only works with ISDN (T1/E1/BRI)
exten => s,n(report),NoOp(CallerID set to ${CALLERID(all)})

; Privacy Manager Macro makes sure that any calls that don’t pass the privacy manager are presented
; with congestion since there have been observed cases of the call continuing if not stopped with a
; congestion, and this provides a slightly more friendly ‘sorry’ message in case the user is
; legitamately trying to be cooperative.
;
; Note: the following options are configurable in privacy.conf:
;
; maxretries = 3 ; default value, number of retries before failing
; minlength = 10 ; default value, number of digits to be accepted as valid CID
;
[macro-privacy-mgr]
exten => s,1,Set(KEEPCID=${CALLERID(num)})
exten => s,n,GotoIf($[“foo${CALLERID(num):0:1}”=“foo+”]?CIDTEST2:CIDTEST1)
exten => s,n(CIDTEST1),Set(TESTCID=${MATH(1+${CALLERID(num)})})
exten => s,n,Goto(TESTRESULT)
exten => s,n(CIDTEST2),Set(TESTCID=${MATH(1+${CALLERID(num):1})})
exten => s,n(TESTRESULT),GotoIf($[“foo${TESTCID}”=“foo”]?CLEARCID:PRIVMGR)
exten => s,n(CLEARCID),Set(CALLERID(num)=)
exten => s,n(PRIVMGR),PrivacyManager()
exten => s,n,SetCallerPres(allowed_passed_screen); stop gap until app_privacy.c clears unavailble bit
exten => s,PRIVMGR+101,Noop(STATUS: ${PRIVACYMGRSTATUS} CID: ${CALLERID(num)} ${CALLERID(name)} CALLPRES: ${CALLLINGPRES})
exten => s,n,Playback(sorry-youre-having-problems)
exten => s,n,Playback(goodbye)
exten => s,n,Congestion()
exten => s,n,Hangup

;
; ############################################################################
; Inbound Contexts [from]
; ############################################################################

[from-sip-external]
;give external sip users congestion and hangup
; Yes. This is really meant to be _. - I know asterisk whinges about it, but
; I do know what I’m doing. This is correct.
exten => _.,1,NoOp(Received incoming SIP connection from unknown peer to ${EXTEN})
exten => _.,n,Set(DID=${IF($["${EXTEN:1:2}"=""]?s:${EXTEN})})
exten => _.,n,Goto(s,1)
exten => s,1,GotoIf($["${ALLOW_SIP_ANON}"=“yes”]?from-trunk,${DID},1)
exten => s,n,Set(TIMEOUT(absolute)=15)
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(ss-noservice)
exten => s,n,Congestion
exten => s,n,Hangup
exten => h,1,NoOp(Hangup)
exten => i,1,NoOp(Invalid)
exten => t,1,NoOp(Timeout)

[from-internal]
; applications are now mostly all found in from-internal-additional in _custom.conf
include => parkedcalls
include => from-internal-custom
;allow phones to dial other extensions
include => ext-fax
;allow phones to access generated contexts
;
; MODIFIED (PL)
;
; Currently the include for findmefollow is being auto-generated before ext-local which is the desired behavior.
; However, I haven’t been able to do anything that I know of to force this. We need to determine if it should
; be hardcoded into here to make sure it doesn’t change with some configuration. For now I will leave it out
; until we can discuss this.
;
include => from-internal-additional
exten => s,1,Macro(hangupcall)
exten => h,1,Macro(hangupcall)

[from-zaptel]
exten => _X.,1,Set(DID=${EXTEN})
exten => _X.,n,Goto(s,1)
exten => s,1,NoOp(Entering from-zaptel with DID == ${DID})
; If ($did == “”) { $did = “s”; }
exten => s,n,Set(DID=${IF($["${DID}"= “”]?s:${DID})})
exten => s,n,NoOp(DID is now ${DID})
exten => s,n,GotoIf($["${CHANNEL:0:3}"=“Zap”]?zapok:notzap)
exten => s,n(notzap),Goto(ext-did,${DID},1)
; If there’s no ext-did,s,1, that means there’s not a no did/no cid route. Hangup.
exten => s,n,Macro(hangup)
exten => s,n(zapok),NoOp(Is a Zaptel Channel)
exten => s,n,Set(CHAN=${CHANNEL:4})
exten => s,n,Set(CHAN=${CUT(CHAN,-,1)})
exten => s,n,Macro(from-zaptel-${CHAN},${DID},1)
; If nothing there, then treat it as a DID
exten => s,n,NoOp(Returned from Macro from-zaptel-${CHAN})
exten => s,n,Goto(ext-did,${DID},1)

; ############################################################################
; Extension Contexts [ext]
; ############################################################################

[ext-fax]
exten => s,1,Answer
exten => s,2,Goto(in_fax,1)
exten => in_fax,1,StopPlayTones
exten => in_fax,2,GotoIf($["${FAX_RX}" = “system”]?3:analog_fax,1)
exten => in_fax,3,Macro(faxreceive)
exten => in_fax,4,Hangup
exten => analog_fax,1,GotoIf($["${FAX_RX}" = “disabled”]?4:2) ;if fax is disabled, just hang up
exten => analog_fax,2,Set(DIAL=${DB(DEVICE/${FAX_RX}/dial)});
exten => analog_fax,3,Dial(${DIAL},20,d)
exten => analog_fax,4,Hangup
;exten => out_fax,1,wait(7)
exten => out_fax,1,txfax(${TXFAX_NAME}|caller)
exten => out_fax,2,Hangup
exten => h,1,system(/var/lib/asterisk/bin/fax-process.pl --to ${EMAILADDR} --from ${FAX_RX_FROM} --subject “Fax from ${URIENCODE(${CALLERID(number)})} ${URIENCODE(${CALLERID(name)})}” --attachment ${URIENCODE(${CALLERID(number)})}.pdf --type application/pdf --file ${FAXFILE});
exten => h,2,Hangup()

;this is where parked calls go if they time-out. Should probably re-ring
[default]
include => ext-local
exten => s,1,Playback(vm-goodbye)
exten => s,2,Macro(hangupcall)

[ccme]
; The host declaration for your Cisco router should include the statement “context = cme” meaning incoming calls from the source will be contained within this ;(ccme) context.
include => vm
include => phones
include => did

[vm]
;Standard voicemail login prompt
exten => 101,1,VoicemailMain
exten => 101,2,Hangup

;CCME Specific VM
;Voice mail Key on 79xx - need to use the last 3 digits of the CallerID. See notes on “calling-number local secondary” in the telephony-service section
;of the cisco config
exten => 105,1,NoOp,${CALLERIDNUM}
exten => 105,2,Background(silence/1)
exten => 105,3,VoicemailMain(s${CALLERIDNUM})
exten => 105,4,Hangup
exten => 105,104,Hangup

;Transfer on unavailable.
; I playback 1 second of silence to allow the call to establish correctly else the start of the audio gets cut off, if you have silence suppression or something
; I guess you could play a beep.
; Because the call is being transfered the variable ${CALLERIDNUM} contains the number of the calling device not the divice they were calling
; This would mean you would end up in your own or a non existant mailbox, the variable ${RDNIS} contains the number
; the call was redirected from and therefore can be used to specify the correct mailbox number.
exten => 106,1,NoOp,${CALLERIDNUM}
exten => 106,2,NoOp,${RDNIS}
exten => 106,3,Playback(silence/1)
exten => 106,4,Voicemail2(u${RDNIS})
exten => 106,5,Hangup
exten => 106,106,Hangup

;Transfer on busy.
;see notes above, just sets the b flag for the voicemail application to stat the call was busy (as apposed to unavailable).
exten => 107,1,NoOp,${CALLERIDNUM}
exten => 107,2,NoOp,${RDNIS}
exten => 107,3,Playback(silence/1)
exten => 107,4,Voicemail2(b${RDNIS})
exten => 107,5,Hangup
exten => 107,106,Hangup

;The macro referenced in above is something similar to
;
;[macro-std_ext]
; exten => s,1,Dial(${ARG1},20,t)
; exten => s,2,Voicemail2(u${MACRO_EXTEN})
; exten => s,3,Hangup
; exten => s,102,Voicemail2(b${MACRO_EXTEN})
; exten => s,103,Hangup

Other configs:
voicemail.conf

[xlite]
2121 => 12345,Test X LITE,attach=no|saycid=no|envelope=no|delete=no
[cme]
111 => 12345,testa,attach=no|saycid=no|envelope=no|delete=no
[cme]
222 => 12345,testb,attach=no|saycid=no|envelope=no|delete=no
[cme]
333 => 12345,testc,attach=no|saycid=no|envelope=no|delete=no

Fusion1,

Did you get success with this integration? I am looking at trying the same thing, CME with AsteriskNOW voicemail. I am good on the Cisco side but really green with Asterisk and I am not a Linux person.

Anything you could point me to would be great.

Joe

Hi,

I am trying to integrate AsteriskBetaNOW6 with CME 3.3 but I am unable to call from one side ot the othr. Please, could you help me with thsi matter. Bellow I include the configuration of both equipments. Thanks in advance.

2xxx --> Asterisk Phones
1xxx --> Cisco phones
3xxx --> Mail box
3005 --> RETRIEVAL
3006 --> UNAVAILABLE
3007 --> BUSY


CME


voice translation-rule 1
rule 1 /^2(…)/ /55552\1/
voice translation-profile 4Digits2E164
translate called 1

'; Dial plan for 55552xx via SIP to host 192.50.20.228’
dial-peer voice 100 voip
destination-pattern 55552…
monitor probe icmp-ping
session protocol sipv2
session target ipv4:192.50.20.228
dtmf-relay rtp-nte
codec g711alaw
(no vad)

; Dial Plan for voicemail extentions 300x via sip to host 192.50.20.228
; ip2ip redirects for hairpin calls from Asterisk back to Asterisk voicemail via a 1xxx redirect on busy/no answer
; Compatable DTMF for voicemail
dial-peer voice 101 voip
destination-pattern 300.
redirect ip2ip
session protocol sipv2
session target ipv4:192.50.20.228
dtmf-relay rtp-nte
codec g711alaw
no vad

; Dial-peer to allow the calling of the 2xxx range of extentions, the number is expanded to the full e164 number via the 4Digits2E164 translation-profile.
; See notes on e164 numbers.
dial-peer voice 102 voip
translation-profile outgoing 4Digits2E164
destination-pattern 2…
monitor probe icmp-ping
session protocol sipv2
session target ipv4:192.50.20.228
dtmf-relay rtp-nte
codec g711alaw

; Incoming calls to 55551xxx range via SIP.
dial-peer voice 200 voip
session protocol sipv2
incoming called-number 55551…
dtmf-relay rtp-nte
codec g711alaw
telephony-service
calling-number local

;calling-number local secondary may make life easier, because they are dule line phones you can choose which number is used for caller-id, My choice is to use
;the full number which can then be chomped down to the local extention numbers.

dialplan-pattern 1 55551… extension-length 4
voicemail 3005
transfer-system full-blind

ephone-dn 1 dual-line
number 1001 no-reg primary
name Amaia
description 555-51001
call-forward busy 3007
call-forward noan 3006 timeout 15

ephone-dn 2 dual-line
name Carlos
number 1002 no-reg primary
description 555-51002
call-forward busy 3007
call-forward noan 3006 timeout 15

ephone-dn 3 dual-line
name Susana
number 1003 no-reg primary
description 555-51003
call-forward busy 3007
call-forward noan 3006 timeout 15


ASTERISK


;!
;! Automatically generated configuration file
;! Filename: extensions.conf (/etc/asterisk/extensions.conf)
;! Generator: Manager
;! Creation Date: Thu Sep 6 09:08:32 2007
;!
[general]
;
; If static is set to no, or omitted, then the pbx_config will rewrite
; this file when extensions are modified. Remember that all comments
; made in the file will be lost when that happens.
;
; XXX Not yet implemented XXX
;
static = yes
;
; if static=yes and writeprotect=no, you can save dialplan by
; CLI command ‘save dialplan’ too
;
writeprotect = no
;
; If autofallthrough is set, then if an extension runs out of
; things to do, it will terminate the call with BUSY, CONGESTION
; or HANGUP depending on Asterisk’s best guess. This is the default.
;
; If autofallthrough is not set, then if an extension runs out of
; things to do, Asterisk will wait for a new extension to be dialed
; (this is the original behavior of Asterisk 1.0 and earlier).
;
;autofallthrough=no
;
; If clearglobalvars is set, global variables will be cleared
; and reparsed on an extensions reload, or Asterisk reload.
;
; If clearglobalvars is not set, then global variables will persist
; through reloads, and even if deleted from the extensions.conf or
; one of its included files, will remain set to the previous value.
;
; NOTE: A complication sets in, if you put your global variables into
; the AEL file, instead of the extensions.conf file. With clearglobalvars
; set, a ‘reload’ will often leave the globals vars cleared, because it
; is not unusual to have extensions.conf (which will have no globals)
; load after the extensions.ael file (where the global vars are stored).
; So, with ‘reload’ in this particular situation, first the AEL file will
; clear and then set all the global vars, then, later, when the extensions.conf
; file is loaded, the global vars are all cleared, and then not set, because
; they are not stored in the extensions.conf file.
;
clearglobalvars = no
;
; If priorityjumping is set to ‘yes’, then applications that support
; ‘jumping’ to a different priority based on the result of their operations
; will do so (this is backwards compatible behavior with pre-1.2 releases
; of Asterisk). Individual applications can also be requested to do this
; by passing a ‘j’ option in their arguments.
;
;priorityjumping=yes
;
; User context is where entries from users.conf are registered. The
; default value is ‘default’
;
;userscontext=default
;
; You can include other config files, use the #include command
; (without the ‘;’). Note that this is different from the “include” command
; that includes contexts within other contexts. The #include command works
; in all asterisk configuration files.
;#include “filename.conf”
; The “Globals” category contains global variables that can be referenced
; in the dialplan with the GLOBAL dialplan function:
; ${GLOBAL(VARIABLE)}
; ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid
; Unix/Linux environmental variables can be reached with the ENV dialplan
; function: ${ENV(VARIABLE)}
;
[globals]
CONSOLE = Console/dsp ; Console interface for demo
;CONSOLE=Zap/1
;CONSOLE=Phone/phone0
IAXINFO = guest ; IAXtel username/password
;IAXINFO=myuser:mypass
TRUNK = Zap/g2 ; Trunk interface
;
; Note the ‘g2’ in the TRUNK variable above. It specifies which group (defined
; in zapata.conf) to dial, i.e. group 2, and how to choose a channel to use in
; the specified group. The four possible options are:
;
; g: select the lowest-numbered non-busy Zap channel
; (aka. ascending sequential hunt group).
; G: select the highest-numbered non-busy Zap channel
; (aka. descending sequential hunt group).
; r: use a round-robin search, starting at the next highest channel than last
; time (aka. ascending rotary hunt group).
; R: use a round-robin search, starting at the next lowest channel than last
; time (aka. descending rotary hunt group).
;
TRUNKMSD = 1 ; MSD digits to strip (usually 1 or 0)
;TRUNK=IAX2/user:pass@provider
;
; Any category other than “General” and “Globals” represent
; extension contexts, which are collections of extensions.
;
; Extension names may be numbers, letters, or combinations
; thereof. If an extension name is prefixed by a ‘_’
; character, it is interpreted as a pattern rather than a
; literal. In patterns, some characters have special meanings:
;
; X - any digit from 0-9
; Z - any digit from 1-9
; N - any digit from 2-9
; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
; . - wildcard, matches anything remaining (e.g. _9011. matches
; anything starting with 9011 excluding 9011 itself)
; ! - wildcard, causes the matching process to complete as soon as
; it can unambiguously determine that no other matches are possible
;
; For example the extension _NXXXXXX would match normal 7 digit dialings,
; while _1NXXNXXXXXX would represent an area code plus phone number
; preceded by a one.
;
; Each step of an extension is ordered by priority, which must
; always start with 1 to be considered a valid extension. The priority
; “next” or “n” means the previous priority plus one, regardless of whether
; the previous priority was associated with the current extension or not.
; The priority “same” or “s” means the same as the previously specified
; priority, again regardless of whether the previous entry was for the
; same extension. Priorities may be immediately followed by a plus sign
; and another integer to add that amount (most useful with ‘s’ or ‘n’).
; Priorities may then also have an alias, or label, in
; parenthesis after their name which can be used in goto situations
;
; Contexts contain several lines, one for each step of each
; extension, which can take one of two forms as listed below,
; with the first form being preferred.
;
;[context]
;exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,…)
;exten => someexten,{priority|label{+|-}offset}[(alias)],application,arg1|arg2…
;
; Included Contexts
;
; One may include another context in the current one as well, optionally with a
; date and time. Included contexts are included in the order
; they are listed.
; The reason a context would include other contexts is for their
; extensions.
; The algorithm to find an extension is recursive, and works in this
; fashion:
; first, given a stack on which to store context references,
; push the context to find the extension onto the stack…
; a) Try to find a matching extension in the context at the top of
; the stack, and, if found, begin executing the priorities
; there in sequence.
; b) If not found, Search the switches, if any declared, in
; sequence.
; c) If still not found, for each include, push that context onto
; the top of the context stack, and recurse to a).
; d) If still not found, pop the entry from the top of the stack;
; if the stack is empty, the search has failed. If it’s not,
; continue with the next context in c).
; This is a depth-first traversal, and stops with the first context
; that provides a matching extension. As usual, if more than one
; pattern in a context will match, the ‘best’ match will win.
; Please note that that extensions found in an included context are
; treated as if they were in the context from which the search began.
; The PBX’s notion of the “current context” is not changed.
; Please note that in a context, it does not matter where an include
; directive occurs. Whether at the top, or near the bottom, the effect
; will be the same. The only thing that matters is that if there is
; more than one include directive, they will be searched for extensions
; in order, first to last.
; Also please note that pattern matches (like _9XX) are not treated
; any differently than exact matches (like 987). Also note that the
; order of extensions in a context have no affect on the outcome.
;
; Timing list for includes is
;
; |||
;
; Note that ranges may be specified to wrap around the ends. Also, minutes are
; fine-grained only down to the closest even minute.
;
;include => daytime|9:00-17:00|mon-fri||
;include => weekend||sat-sun||*
;include => weeknights|17:02-8:58|mon-fri||
;
; ignorepat can be used to instruct drivers to not cancel dialtone upon
; receipt of a particular pattern. The most commonly used example is
; of course ‘9’ like this:
;
;ignorepat => 9
;
; so that dialtone remains even after dialing a 9.
;
;
; Sample entries for extensions.conf
;
;
[dundi-e164-canonical]
;
; List canonical entries here
;
;exten => 12564286000,1,Macro(stdexten,6000,IAX2/foo)
;exten => _125642860XX,1,Dial(IAX2/otherbox/${EXTEN:7})
[dundi-e164-customers]
;
; If you are an ITSP or Reseller, list your customers here.
;
;exten => _12564286000,1,Dial(SIP/customer1)
;exten => _12564286001,1,Dial(IAX2/customer2)
[dundi-e164-via-pstn]
;
; If you are freely delivering calls to the PSTN, list them here
;
;exten => _1256428XXXX,1,Dial(Zap/g2/${EXTEN:7}) ; Expose all of 256-428
;exten => _1256325XXXX,1,Dial(Zap/g2/${EXTEN:7}) ; Ditto for 256-325
[dundi-e164-local]
;
; Context to put your dundi IAX2 or SIP user in for
; full access
;
include => dundi-e164-canonical
include => dundi-e164-customers
include => dundi-e164-via-pstn

[dundi-e164-switch]
;
; Just a wrapper for the switch
;
switch => DUNDi/e164

[dundi-e164-lookup]
;
; Locally to lookup, try looking for a local E.164 solution
; then try DUNDi if we don’t have one.
;
include => dundi-e164-local
include => dundi-e164-switch
;
; DUNDi can also be implemented as a Macro instead of using
; the Local channel driver.
;
[macro-dundi-e164]
;
; ARG1 is the extension to Dial
;
; Extension “s” is not a wildcard extension that matches “anything”.
; In macros, it is the start extension. In most other cases,
; you have to goto “s” to execute that extension.
;
; For wildcard matches, see above - all pattern matches start with
; an underscore.
exten => s,1,Goto(${ARG1},1)
include => dundi-e164-lookup
;
; Here are the entries you need to participate in the IAXTEL
; call routing system. Most IAXTEL numbers begin with 1-700, but
; there are exceptions. For more information, and to sign
; up, please go to www.iaxtel.com
;
[iaxtel700]
exten => _91700XXXXXXX,1,Dial(IAX2/${GLOBAL(IAXINFO)}@iaxtel.com/${EXTEN:1}@iaxtel)
;
; The SWITCH statement permits a server to share the dialplan with
; another server. Use with care: Reciprocal switch statements are not
; allowed (e.g. both A -> B and B -> A), and the switched server needs
; to be on-line or else dialing can be severly delayed.
;
[iaxprovider]
;switch => IAX2/user:[key]@myserver/mycontext
[trunkint]
;
; International long distance through trunk
;
exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})

[trunkld]
;
; Long distance context accessed through trunk
;
exten => _91NXXNXXXXXX,1,Macro(dundi-e164,${EXTEN:1})
exten => _91NXXNXXXXXX,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})

[trunklocal]
;
; Local seven-digit dialing accessed through trunk interface
;
exten => _9NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})

[trunktollfree]
;
; Long distance context accessed through trunk interface
;
exten => _91800NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91888NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91877NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91866NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})

[international]
;
; Master context for international long distance
;
ignorepat => 9
include => longdistance
include => trunkint

[longdistance]
;
; Master context for long distance
;
ignorepat => 9
include => local
include => trunkld

[local]
;
; Master context for local, toll-free, and iaxtel calls only
;
ignorepat => 9
include => default
include => trunklocal
include => iaxtel700
include => trunktollfree
include => iaxprovider
;Include parkedcalls (or the context you define in features conf)
;to enable call parking.
include => parkedcalls
;
; You can use an alternative switch type as well, to resolve
; extensions that are not known here, for example with remote
; IAX switching you transparently get access to the remote
; Asterisk PBX
;
; switch => IAX2/user:password@bigserver/local
;
; An “lswitch” is like a switch but is literal, in that
; variable substitution is not performed at load time
; but is passed to the switch directly (presumably to
; be substituted in the switch routine itself)
;
; lswitch => Loopback/12${EXTEN}@othercontext
;
; An “eswitch” is like a switch but the evaluation of
; variable substitution is performed at runtime before
; being passed to the switch routine.
;
; eswitch => IAX2/context@${CURSERVER}
[macro-trunkdial]
;
; Standard trunk dial macro (hangs up on a dialstatus that should
; terminate call)
; ${ARG1} - What to dial
;
exten => s,1,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Hangup
exten => _s-.,1,NoOp

[macro-stdexten];
;
; Standard extension macro:
; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
; ${ARG2} - Device(s) to ring
;
exten => s,1,Dial(${ARG2},20) ; Ring the interface, 20 seconds maximum
exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail w/ unavail announce
exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start
exten => s-BUSY,1,Voicemail(${ARG1},b) ; If busy, send to voicemail w/ busy announce
exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start
exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user into VoicemailMain

[macro-stdPrivacyexten];
;
; Standard extension macro:
; ${ARG1} - Extension (we could have used ${MACRO_EXTEN} here as well
; ${ARG2} - Device(s) to ring
; ${ARG3} - Optional DONTCALL context name to jump to (assumes the s,1 extension-priority)
; ${ARG4} - Optional TORTURE context name to jump to (assumes the s,1 extension-priority)`
;
exten => s,1,Dial(${ARG2},20|p) ; Ring the interface, 20 seconds maximum, call screening
; option (or use P for databased call screening)
exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail w/ unavail announce
exten => s-NOANSWER,2,Goto(default,s,1) ; If they press #, return to start
exten => s-BUSY,1,Voicemail(${ARG1},b) ; If busy, send to voicemail w/ busy announce
exten => s-BUSY,2,Goto(default,s,1) ; If they press #, return to start
exten => s-DONTCALL,1,Goto(${ARG3},s,1) ; Callee chose to send this call to a polite “Don’t call again” script.
exten => s-TORTURE,1,Goto(${ARG4},s,1) ; Callee chose to send this call to a telemarketer torture script.
exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
exten => a,1,VoicemailMain(${ARG1}) ; If they press *, send the user into VoicemailMain

[macro-page];
;
; Paging macro:
;
; Check to see if SIP device is in use and DO NOT PAGE if they are
;
; ${ARG1} - Device to page
exten => s,1,ChanIsAvail(${ARG1}|js) ; j is for Jump and s is for ANY call
exten => s,n,GoToIf([${AVAILSTATUS} = “1”]?autoanswer:fail)
exten => s,n(autoanswer),Set(_ALERT_INFO=“RA”) ; This is for the PolyComs
exten => s,n,SIPAddHeader(Call-Info: Answer-After=0) ; This is for the Grandstream, Snoms, and Others
exten => s,n,NoOp() ; Add others here and Post on the Wiki!!!
exten => s,n,Dial(${ARG1}||)
exten => s,n(fail),Hangup

[demo]
;
; We start with what to do when a call first comes in.
;
exten => s,1,Wait(1) ; Wait a second, just for fun
exten => s,n,Answer ; Answer the line
exten => s,n,Set(TIMEOUT(digit)=5) ; Set Digit Timeout to 5 seconds
exten => s,n,Set(TIMEOUT(response)=10) ; Set Response Timeout to 10 seconds
exten => s,n(restart),BackGround(demo-congrats) ; Play a congratulatory message
exten => s,n(instruct),BackGround(demo-instruct) ; Play some instructions
exten => s,n,WaitExten ; Wait for an extension to be dialed.
exten => 2,1,BackGround(demo-moreinfo) ; Give some more information.
exten => 2,n,Goto(s,instruct)
exten => 3,1,Set(LANGUAGE()=fr) ; Set language to french
exten => 3,n,Goto(s,restart) ; Start with the congratulations
exten => 1000,1,Goto(default,s,1)
;
; We also create an example user, 1234, who is on the console and has
; voicemail, etc.
;
exten => 1234,1,Playback(transfer,skip) ; “Please hold while…”
; (but skip if channel is not up)
exten => 1234,n,Macro(stdexten,1234,${GLOBAL(CONSOLE)})
exten => 1235,1,Voicemail(1234,u) ; Right to voicemail
exten => 1236,1,Dial(Console/dsp) ; Ring forever
exten => 1236,n,Voicemail(1234,b) ; Unless busy
;
; # for when they’re done with the demo
;
exten => #,1,Playback(demo-thanks) ; “Thanks for trying the demo"
exten => #,n,Hangup ; Hang them up.
;
; A timeout and “invalid extension rule”
;
exten => t,1,Goto(#,1) ; If they take too long, give up
exten => i,1,Playback(invalid) ; “That’s not valid, try again”
;
; Create an extension, 500, for dialing the
; Asterisk demo.
;
exten => 500,1,Playback(demo-abouttotry) ; Let them know what’s going on
exten => 500,n,Dial(IAX2/guest@misery.digium.com/s@default) ; Call the Asterisk demo
exten => 500,n,Playback(demo-nogo) ; Couldn’t connect to the demo site
exten => 500,n,Goto(s,6) ; Return to the start over message.
;
; Create an extension, 600, for evaluating echo latency.
;
exten => 600,1,Playback(demo-echotest) ; Let them know what’s going on
exten => 600,n,Echo ; Do the echo test
exten => 600,n,Playback(demo-echodone) ; Let them know it’s over
exten => 600,n,Goto(s,6) ; Start over
;
; You can use the Macro Page to intercom a individual user
exten => 76245,1,Macro(page,SIP/Grandstream1)
; or if your peernames are the same as extensions
exten => _7XXX,1,Macro(page,SIP/${EXTEN})
;
;
; System Wide Page at extension 7999
;
exten => 7999,1,Set(TIMEOUT(absolute)=60)
exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n|d)
; Give voicemail at extension 8500
;
exten => 8500,1,VoicemailMain
exten => 8500,n,Goto(s,6)
;
; Here’s what a phone entry would look like (IXJ for example)
;
;exten => 1265,1,Dial(Phone/phone0,15)
;exten => 1265,n,Goto(s,5)
;
; The page context calls up the page macro that sets variables needed for auto-answer
; It is in is own context to make calling it from the Page() application as simple as
; Local/{peername}@page
;
[page]
exten => _X.,1,Macro(page,SIP/${EXTEN})
;[mainmenu]
;
; Example “main menu” context with submenu
;
;exten => s,1,Answer
;exten => s,n,Background(thanks) ; “Thanks for calling press 1 for sales, 2 for support, …”
;exten => s,n,WaitExten
;exten => 1,1,Goto(submenu,s,1)
;exten => 2,1,Hangup
;include => default
;
;[submenu]
;exten => s,1,Ringing ; Make them comfortable with 2 seconds of ringback
;exten => s,n,Wait,2
;exten => s,n,Background(submenuopts) ; “Thanks for calling the sales department. Press 1 for steve, 2 for…”
;exten => s,n,WaitExten
;exten => 1,1,Goto(default,steve,1)
;exten => 2,1,Goto(default,mark,2)
[default]
exten => 3005,1,VoiceMailMain
exten => 8500,n,Hangup
;
; Or a conference room (you’ll need to edit meetme.conf to enable this room)
;
;exten => 8600,1,Meetme(1234)
;
; Or playing an announcement to the called party, as soon it answers
;
;exten = 8700,1,Dial(${MARK},30,A(/path/to/my/announcemsg))
;
; For more information on applications, just type “show applications” at your
; friendly Asterisk CLI prompt.
;
; 'show application ’ will show details of how you
; use that particular application in this file, the dial plan.
; 'show functions” will list all dialplan functions
; 'show function ’ will show you more information about
; one function. Remember that function names are UPPER CASE.
; Including the voicemenu in default context
;
include => voicemenu-custom-1
exten = 00001,1,Goto(ringroups-custom-1|s|1)
exten = 00011,1,Queue(${EXTEN})

[voicemenu-custom-1]
comment = mainmenu
exten = s,1,Answer
exten = s,2,Background(thank-you-for-calling)
exten = s,3,Background(if-u-know-ext-dial)
exten = s,4,Background(otherwise)
exten = s,5,Background(pls-hold-while-try)
exten = s,6,Background(to-reach-operator)
include = default

[numberplan-custom-1]
plancomment = DialPlan1
include = default

[asterisk_guitools]
exten = executecommand,1,System(${command})
exten = executecommand,n,Hangup()
exten = record_vmenu,1,Answer
exten = record_vmenu,n,Playback(vm-intro)
exten = record_vmenu,n,Record(${var1})
exten = record_vmenu,n,Playback(vm-saved)
exten = record_vmenu,n,Playback(vm-goodbye)
exten = record_vmenu,n,Hangup
exten = play_file,1,Answer
exten = play_file,n,Playback(${var1})
exten = play_file,n,Hangup
hasbeensetup = Y

[timebasedrules]

[ringroups-custom-1]
gui_ring_groupname = grupo1
exten = s,1,NoOp(RINGGROUP)
exten = s,n,Dial(SIP/10001&SIP/10002&SIP/10003,5)
exten = s,n,Hangup

[numberplan-custom-2]
include = default
plancomment = DialPlan2
exten = _9XXXXXXXX,1,Macro(trunkdial,${trunk_1}/9${EXTEN:0})
comment = _9XXXXXXXX,1,Externas,standard

[0ut-ccme]
exten => _5555XXXX,1,Dial(SIP/8${EXTEN}@192.50.20.229,60,t)
;Just a guess but this should work…
exten => _1xXX,1,Dial(SIP/5555${EXTEN}@192.50.20.229,60,t)

[ccme]
; The host declaration for your Cisco router should include the statement “context = cme” meaning incoming calls from the source will be contained within this ;(ccme) context.
include => vm
include => phones
include => did

[vm]
;Standard voicemail login prompt
exten => 3001,1,VoicemailMain
exten => 3001,2,Hangup

;CCME Specific VM
;Voice mail Key on 79xx - need to use the last 4 digits of the CallerID. See notes on “calling-number local secondary” in the telephony-service section
;of the cisco config
exten => 3005,1,NoOp,${CALLERIDNUM}
exten => 3005,2,Background(silence/1)
exten => 3005,3,VoicemailMain(s${CALLERIDNUM:-4})
exten => 3005,4,Hangup
exten => 3005,104,Hangup

;Transfer on unavailable.
; I playback 1 second of silence to allow the call to establish correctly else the start of the audio gets cut off, if you have silence suppression or something
; I guess you could play a beep.
; Because the call is being transfered the variable ${CALLERIDNUM} contains the number of the calling device not the divice they were calling
; This would mean you would end up in your own or a non existant mailbox, the variable ${RDNIS} contains the number
; the call was redirected from and therefore can be used to specify the correct mailbox number.
exten => 3006,1,NoOp,${CALLERIDNUM}
exten => 3006,2,NoOp,${RDNIS}
exten => 3006,3,Playback(silence/1)
exten => 3006,4,Voicemail2(u${RDNIS})
exten => 3006,5,Hangup
exten => 3006,106,Hangup

;Transfer on busy.
;see notes above, just sets the b flag for the voicemail application to stat the call was busy (as apposed to unavailable).
exten => 3007,1,NoOp,${CALLERIDNUM}
exten => 3007,2,NoOp,${RDNIS}
exten => 3007,3,Playback(silence/1)
exten => 3007,4,Voicemail2(b${RDNIS})
exten => 3007,5,Hangup
exten => 3007,106,Hangup

[phones]
; Internal Extentions
exten => 2001,1,Macro(std_ext,SIP/2001)
exten => 2002,1,Macro(std_ext,SIP/2002)

;The macro referenced in above is something similar to
;
;[macro-std_ext]
; exten => s,1,Dial(${ARG1},20,t)
; exten => s,2,Voicemail2(u${MACRO_EXTEN})
; exten => s,3,Hangup
; exten => s,102,Voicemail2(b${MACRO_EXTEN})
; exten => s,103,Hangup

[did]
;The referenced macro just does some caller_id lookups and modification, it could just as easily be a direct sip channel or the std_ext macro above.
exten => 55552000,1,Macro(did,SIP/3001) ; Added for convenience/ external voice mail access
exten => 55552001,1,Macro(did,SIP/2001) ; Extention 301’s DID
exten => 55552002,1,Macro(did,SIP/2002) ; Extention 302’s DID

I am trying to integrate cme with asterisk i created the sip trunks but they can not talk or each. any help with config is appreciated. if you can post your cme sip and asterisk sip it would be appreciated.

thanks

after taking a break from the config for an hour i was able to get calls through to the cisco box. * can call cisco but not the other way around. any help please.