Hack-sterisk

From Hackerspace Brussels
Jump to: navigation, search


Hack-sterisk
Fri 26 Nov 2010 19:30
till Sat 27 Nov 2010 6:00
Red-phone.jpg
What:
Friday Hack Night
Tagline:
press 1 to leave a message after the beep
Where:
HSB Brussels,Belgium
Cost:
0
Who:
URL:

Installation of our own asterisk in our hackerspace

we begin about 19h30 - 20h with a hands-on session (nobody of us is an expert, but we'll find out :-)

  • on a linux-box (take your own flavours of un*x if you want to, of course)
  • configuration

we hope we can begin the tests

  • test between softphones
  • phones connected to ATA ? if you have a ATA-box Analog_telephone_adapter bring it !
  • phones connected to the card (or even the real line ?) ? FXO and FXS

+ if all goes well, let's try ?

  • teleconference : multi users conversation
  • answering machine which sends your messages by email

interested ?

write your pseudo here

  • Juliane
  • agnez
  • ptr_
  • zoobab
  • askarel
  • Benwa

docu & good links / configs

books

  • "Asterisk the future of telephony" (ed O'Reilly) 2005 : http://cdn.oreilly.com/books/9780596510480.pdf -- definitely worth a read -- has some inaccuracies in configuration (eg Asterisk trunking config has plenty of small mistakes)

Links

and "the getting started with asterisk" 77 pages ==

installing files

add backports repo

deb http://www.backports.org/debian lenny-backports main contrib non-free

create /etc/apt/preferences

Explanation: La version stable avant les autres
Package: *
Pin: release a=stable
Pin-Priority: 900

Explanation: Backports
Package: *
Pin: release a=lenny-backports
Pin-Priority: 200

Explanation: pour avoir la version 1.6 de asterisk
Package: asterisk*
Pin: release a=lenny-backports
Pin-Priority: 999

packages to install

apt-get install -t lenny-backports asterisk-doc asterisk-sounds-main asterisk-sounds-extra asterisk-h323 asterisk-prompt-fr-proformatique postfix

don't forget to configure postfix


changed config files

All files in /etc/asterisk/

sip.conf

[general]                                                                                                                                        
context=local    ; context par defaut pour les utilisateurs                                                                                      
bindport=5060    ; port UDP du protocole SIP                                                                                                     
bindaddr=0.0.0.0 ; adresse IP de l’interface sur lequel le serveur va ecouter le                                                                 
                 ; trafic 0.0.0.0 pour toutes les interfaces                                                                                     
language=fr      ; messages vocaux en français                                                                                                   
localnet=172.22.33.0/24                                                                                                                          

[wouter]                ; obligatoire ; login SIP
secret=Bach         ; obligatoire ; mot de passe SIP
type=friend           ; obligatoire ; autorise les appels entrant et sortant
host=dynamic          ; obligatoire ; adresse IP du client                  
callerid="wouter" <5002> ; facultatif ; nom affiche et numero affiche sur le                                                                                     
                      ; telephone de l'appeler                                                                                                                   
mailbox=5000@default                                                                                                                                             

[benwa]                ; obligatoire ; login SIP
secret=azerty         ; obligatoire ; mot de passe SIP
type=friend           ; obligatoire ; autorise les appels entrant et sortant
host=dynamic          ; obligatoire ; adresse IP du client                  
callerid="BenWa" <5001> ; facultatif ; nom affiche et numero affiche sur le
                      ; telephone de l'appeler
mailbox=5001@default

[juliane]                ; obligatoire ; login SIP
secret=1234         ; obligatoire ; mot de passe SIP
type=friend           ; obligatoire ; autorise les appels entrant et sortant
host=dynamic          ; obligatoire ; adresse IP du client
callerid="juliane" <5005> ; facultatif ; nom affiche et numero affiche sur le
                      ; telephone de l'appeler
mailbox=5002@default


[agnez]                ; obligatoire ; login SIP
secret=1234         ; obligatoire ; mot de passe SIP
type=friend           ; obligatoire ; autorise les appels entrant et sortant
host=dynamic          ; obligatoire ; adresse IP du client
callerid="agnez" <5003> ; facultatif ; nom affiche et numero affiche sur le
                      ; telephone de l'appeler
mailbox=5003@default



[askarel]                ; obligatoire ; login SIP
secret=9876         ; obligatoire ; mot de passe SIP
type=friend           ; obligatoire ; autorise les appels entrant et sortant
host=dynamic          ; obligatoire ; adresse IP du client
callerid="askarel" <5004> ; facultatif ; nom affiche et numero affiche sur le
                      ; telephone de l'appeler
mailbox=5004@default


[agnezATA]                ; obligatoire ; login SIP
secret=1234         ; obligatoire ; mot de passe SIP
type=friend           ; obligatoire ; autorise les appels entrant et sortant
host=dynamic          ; obligatoire ; adresse IP du client
callerid="agnezATA" <5006> ; facultatif ; nom affiche et numero affiche sur le
                      ; telephone de l'appeler
mailbox=5006@default




extensions.conf



[local]
include => echotest
include => conference
include => messagerie

exten => 5001, 1, Dial(SIP/benwa, 10)
exten => 5001, 2, VoiceMail(5001)    

exten => 5002, 1, Dial(SIP/wouter, 10)
exten => 5002, 2, VoiceMail(5002)

exten => 5003, 1, Dial(SIP/agnez, 10)
exten => 5003, 2, VoiceMail(5003)

exten => 5004, 1, Dial(SIP/askarel, 10)
exten => 5004, 2, VoiceMail(5004)

exten => 5005, 1, Dial(SIP/juliane, 10)
exten => 5005, 2, VoiceMail(5005)

exten => 5006, 1, Dial(SIP/agnezATA, 10)
exten => 5006, 2, VoiceMail(5006)



[echotest]

exten => 500, 1, Answer
exten => 500, n, Playback(demo-echotest)  ; Let them know what's going on
exten => 500, n, Echo                     ; Do the echo test
exten => 500, n, Playback(demo-echodone)  ; Let them know it's over
exten => 500, n, Hangup


[conference]


exten => 666,1,Answer
exten => 666,n,Wait(1)
exten => 666,n,MeetMe(testconf,666)
exten => 666,n,Playback(vm-goodbye)
exten => 666,n,Hangup

;exten => 666,1,MeetMe(666,666)

[messagerie]

exten => 777, 1, VoiceMailMain()
exten => 888, 1, VoiceMailMain(${CALLERIDNUM})  ; consultation de la messagerie login automatique avec le No de l'appelant



voicemail.conf

[general]
format=wav
serveremail=Asterisk-HSB
attach=yes              
skipms=3000             
maxsilence=10
silencethreshold=128
maxlogins=3




charset=ISO-8859-15
emailsubject=[Asterisk-HSB] : Nouveau message de ${VM_CALLERID} dans votre boite.
emailbody=${VM_NAME},\n\n\tvous avez recu un nouveau message de ${VM_CALLERID} dans votre boite.\nDurée du message : ${VM_DUR}\nNumero du message : ${VM_MSGNUM}\nDate du message : ${VM_DATE}.\n\n\t\t\t\t_--* Asterisk-Team@HSB *--_\n

emaildateformat=%A, %d %B %Y at %H:%M:%S





[zonemessages]
eastern=America/New_York|'vm-received' Q 'digits/at' IMp
central=America/Chicago|'vm-received' Q 'digits/at' IMp
central24=America/Chicago|'vm-received' q 'digits/at' H N 'hours'
military=Zulu|'vm-received' q 'digits/at' H N 'hours' 'phonetic/z_p'
european=Europe/Copenhagen|'vm-received' a d b 'digits/at' HM



[default]


5001 = 234, Benwa, benwa@mail.mail
5002 = 234, Wouter, wouter.simons@mail.mail
5003 = 234, Agnez, agnez@mail.mail
5004 = 234, Askarel, askarel@mail.mail
5005 = 234, Juliane, juliane@mail.mail

meetme.conf

[rooms]
;
; Usage is conf => confno[,pin][,adminpin]
; conf => 666    ; simple on   /// but by the way we had a problem with a device - pseudo channel ( so => to do again 
conf => testconf,666


peering and trunking

links on asterisk peering

peer 2 asterisk boxes using IAX2 (easier for firewalling then SIP)


config we tried (later that night, by ptr_)

we have two asterisk boxes:

  • idelix (on 172.22.33.23)
  • obelix (on 172.22.33.75)

i only document the setup on idefix -- obelix is alike...

iax.conf -- each box sets up an account for iax2 peering

[general]
register => idefix:welcome@172.22.33.75

[obelix]
type=friend
host=dynamic
trunk=yes
secret=welcome
context=incoming_obelix


extentions.conf -- we added the [incoming_obelix] context (calls coming in/going out to our obelix-peer) and a dialplan with prefix extention number.

[general]
autofallthrough = yes

[local]
include => echotest
include => remote
include => internal

exten => 6010, 1, Dial(SIP/ptr, 10)
exten => 6010, 2, VoiceMail(6010)

[incoming_obelix]
include => local

[internal]
exten => _2XXXX,1,NoOp()
exten => _2XXXX,n,Dial(SIP/${EXTEN})
exten => _2XXXX,n,Playback(the-party-you-are-calling&is-curntly-unavail)
exten => _2XXXX,n,Hangup()

[remote]
exten => _1XXXX,1,NoOp()
exten => _1XXXX,n,Dial(IAX2/obelix/${EXTEN})
exten => _1XXXX,n,Hangup()

[echotest]
exten => 500, 1, Answer
exten => 500, n, Playback(demo-echotest)  ; Let them know what's going on
exten => 500, n, Echo                     ; Do the echo test
exten => 500, n, Playback(demo-echodone)  ; Let them know it's over
exten => 500, n, Hangup