Showing posts with label Asterisk. Show all posts
Showing posts with label Asterisk. Show all posts

Saturday, May 10, 2008

Sendmail for GMX communication

I configured the system to send the emails with the WAV attachments to an GMX email address.
Thats my sendmail.mc:

root@home-nas:~# cat /etc/mail/sendmail.mc
include(`/usr/share/sendmail/cf/m4/cf.m4')dnl
VERSIONID(`setup debian Linux')dnl
OSTYPE(`linux')dnl
dnl# DOMAIN(`debian-mta')dnl
dnl#
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`SMART_HOST',`mail.gmx.net')dnl
define(`confTO_IDENT', `0')dnl
define(`confCW_FILE', `-o /etc/mail/local-host-names')dnl
define(`confBIND_OPTS', `WorkAroundBrokenAAAA')dnl
define(`confNO_RCPT_ACTION', `add-to-undisclosed')dnl
define(`confPRIVACY_FLAGS', `authwarnings,noexpn,novrfy')dnl
define(`confLOG_LEVEL',15)dnl
FEATURE(`genericstable')dnl
FEATURE(`generics_entire_domain')dnl
FEATURE(`relay_hosts_only')dnl
FEATURE(`authinfo',`hash -o /etc/mail/auth/client-info')dnl
FEATURE(`use_cw_file')dnl
FEATURE(`access_db', `hash -T /etc/mail/access')dnl
FEATURE(`local_procmail',`',`procmail -t -Y -a $h -d $u')dnl
FEATURE(`redirect')dnl
FEATURE(`masquerade_entire_domain')dnl
FEATURE(`masquerade_envelope')dnl
FEATURE(`allmasquerade')dnl
FEATURE(`always_add_domain',`gmx.net')dnl
EXPOSED_USER(`root')dnl
GENERICS_DOMAIN(`home-nas.lab.test')dnl
MASQUERADE_AS(`asterisk1.local')dnl
MASQUERADE_DOMAIN(`lab.test')dnl
LOCAL_DOMAIN(`localhost.localdomain')dnl
MAILER(local)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
root@home-nas:~#


My submit.mc:

root@home-nas:~# cat /etc/mail/submit.mc
divert(-1)dnl
#-----------------------------------------------------------------------------
# $Sendmail: submit.mc,v 8.13.8 2006-09-30 07:18:48 cowboy Exp $
#
# Copyright (c) 2000-2005 Richard Nelson. All Rights Reserved.
#
# cf/debian/submit.mc. Generated from submit.mc.in by configure.
#
# submit.mc prototype config file for building Sendmail 8.13.8
#
# Note: the .in file supports 8.7.6 - 9.0.0, but the generated
# file is customized to the version noted above.
#
# This file is used to configure Sendmail for use with Debian systems.
#
# If you modify this file, you will have to regenerate /etc/mail/submit.cf
# by running this file through the m4 preprocessor via one of the following:
# * `sendmailconfig`
# * `make`
# * `m4 /etc/mail/submit.mc > /etc/mail/submit.cf`
# The first two options are preferred as they will also update other files
# that depend upon the contents of this file.
#
# The best documentation for this .mc file is:
# /usr/share/doc/sendmail-doc/cf.README.gz
#
#-----------------------------------------------------------------------------
divert(0)dnl
#
# Copyright (c) 2000-2002 Richard Nelson. All Rights Reserved.
#
# This file is used to configure Sendmail for use with Debian systems.
#
define(`_USE_ETC_MAIL_')dnl
include(`/usr/share/sendmail/cf/m4/cf.m4')dnl
VERSIONID(`$Id: submit.mc, v 8.13.8-2 2006-09-30 07:18:48 cowboy Exp $')
OSTYPE(`debian')dnl
DOMAIN(`debian-msp')dnl
dnl #
dnl #---------------------------------------------------------------------
dnl # Masquerading information, if needed, should go here
dnl # You likely will not need this, as the MTA will do it
dnl #---------------------------------------------------------------------
dnl MASQUERADE_AS()dnl
dnl FEATURE(`masquerade_envelope')dnl
dnl #
dnl #---------------------------------------------------------------------
dnl # The real reason we're here: the FEATURE(msp)
dnl #---------------------------------------------------------------------
FEATURE(`msp', `[127.0.0.1]', `MSA')dnl
dnl #
dnl #---------------------------------------------------------------------
dnl # Some minor cleanup from FEATURE(msp)
dnl #---------------------------------------------------------------------
dnl #
dnl #---------------------------------------------------------------------
root@home-nas:~#


My client-info:

root@home-nas:~# cat /etc/mail/auth/client-info
Authinfo:mail.gmx.net "U:yaya@gmx.net" "I:yaya@gmx.net" "P:xxx" "R:gmx.net" "M:CRAM-MD5"
root@home-nas:~#


My access:

root@home-nas:~# cat /etc/mail/access
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
home-nas.lab.test RELAY

root@home-nas:~#


As mentioned before, I don't claim this to be an optimized configuration, but it works. Comments welcome.

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:~#