Wednesday, April 23, 2008

Asterisk & Cisco Callmanager Express (CME)

I decided to add some voicemail functionality to the lab. The Open Source Project Asterisk came to my mind. The goal was to get the voicemail forwarded, with an audio file, to a public email account at GMX. I also wanted to use the MWI function of the SCCP phones. And surprisingly, after "a little bit" of testing it worked. Remember, this is only a proof of concept, I don't claim that to be the perfect solution. Suggestions welcome.

With help from:http://www.voip-info.org/wiki/view/Asterisk+Cisco+CallManager+Express+Integration
Here is my extensions.conf:


root@home-nas:~# cat /etc/asterisk/extensions.conf
[general]

[cme]
exten => 105,1,VoiceMailMain(),p
exten => 106,1,NoOp,${CALLERID(num)}
exten => 106,2,NoOp,${CALLERID(rdnis)}
exten => 106,3,Playback(silence/1)
exten => 106,4,Voicemail(${CALLERID(rdnis)},b)
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,${CALLERID(num)}
exten => 107,2,NoOp,${CALLERID(rdnis)}
exten => 107,3,Playback(silence/1)
exten => 107,4,Voicemail(${CALLERID(rdnis)},u)
exten => 107,5,Hangup
exten => 107,106,Hangup

[vm]

;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,${CALLERID(num)}
;exten => 105,2,Background(silence/1)
;exten => 105,3,VoicemailMain(${CALLERID(num)}@default)
;exten => 105,4,Hangup
;exten => 105,104,Hangup
exten => 105,1,VoiceMailMain(${CALLERID(num)})

;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,${CALLERID(num)}
exten => 106,2,NoOp,${CALLERID(rdnis)}
exten => 106,3,Playback(silence/1)
exten => 106,4,Voicemail(${CALLERID(rdnis)},b)
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,${CALLERID(num)}
exten => 107,2,NoOp,${CALLERID(rdnis)}
exten => 107,3,Playback(silence/1)
exten => 107,4,Voicemail(${CALLERID(rdnis)},u)
exten => 107,5,Hangup
exten => 107,106,Hangup

root@home-nas:~#

My sip.conf:

root@home-nas:~# cat /etc/asterisk/sip.conf
[general]
insecure=port,invite
bindport=5060 ; Port to bind to (SIP is 5060)
bindaddr=0.0.0.0 ; Address to bind to (all addresses on machine)
disallow=all
allow=alaw
context=cme
host=172.20.29.90
type=peer
;callerid=Unknown

[10]
insecure=port,invite
context=vm
type=friend
qualify=yes
mailbox=10
host=172.20.29.90
;ipaddr=172.20.29.90
dtmfmode=auto
dial=SIP/10
canreinvite=no
callerid=device <10>
subscribemwi=no
nat=no
fromuser=105
vmexten=105
username=10

[53]
insecure=port,invite
context=vm
type=friend
qualify=yes
mailbox=53
host=172.20.29.90
;ipaddr=172.20.29.90
dtmfmode=auto
dial=SIP/53
canreinvite=no
callerid=device <53>
subscribemwi=no
nat=no
fromuser=105
vmexten=105
username=53

root@home-nas:~#

I forwad the emails to a public mail service from GMX.
My voicemail.conf:

root@home-nas:~# cat /etc/asterisk/voicemail.conf
[general]
emailbody=${VM_NAME},\n\New message in mailbox!! ${VM_MAILBOX}\n\n\tVon:\t${VM_CALLERID}\n\tLaenge:\t${VM_DUR} Sekunden\n\tDate:\t${VM_DATE}\n\Dial 105 to access your voicemail.\n\You can also listen at http://172.20.29.88/html/recordings/index.php , to your messages.\n\nAsterisk Rulez!!\n
serveremail=yaya@gmx.net ; Who the e-mail notification should appear to come from
fromstring=Voicemail System
nextaftercmd=yes
externnotify=chmod -R a+rw /var/spool/asterisk/voicemail/default/
[default]
10 => 1234,AJ10 Mailbox,aj10@gmx.de,,attach=yes|saycid=yes|envelope=yes|delete=no
53 => 1234,Andre Mailbox,andre@gmx.de,,attach=yes|saycid=no|envelope=yes|delete=no


root@home-nas:~#


5 comments:

Unknown said...

I've been trying to pick through this and I'm confused by the use of the 105 extension. Where's that in the CME config? Or am I missing something more fundamental?

cflux said...

Sorry, my fault. It is an edited config and I forgot to add the Voip dial-peer 100. I corrected this now. 105 is used to check your voicemail. 106 is the number calls are forwarded to if you are unavailable and 107 is used for forwarding in the case that the phone is busy. So it is possible to play different announcements for this two cases. Regards Andre

Unknown said...

beste Andre, dit is wybe siedsma ik ben al een tijdje op zoek naar andre janssen de accountant die ik 10 jaar geleden had ben jij dat ? ik wil graag weer in contact komen

vrgr Wybe Siedsma

cflux said...

Sorry, I don't think that I'm the person you are searching for. Good luck! ;)

Unknown said...

and what is the required configuration from the cisco cme side ?