User:Bruno/Using Asterisk with Fedora Talk

From FedoraProject

Jump to: navigation, search

Contents

Motivation

Why Asterisk?

I have an analog tdm card that needs the dahdi driver as the zaptel driver will not work on the recent kernels. Callweaver in Fedora does not yet work with dahdi. I am not aware of other software that will work with my hardware, though there are some other choices if you are just going to use SIP.

Prerequisites

What I learned while getting this to work

Config files

When you install asterisk a bunch of config files get created in /etc/asterisk. The main ones I played with in getting this to work were sip.conf, extensions.conf and chan_dahdi.conf (with the dahdi ATMrpms for F11 this config file is now named dahdi_channels.conf and should be a copy of chan_dahdi.conf). I simplified these files greatly in the hope of not accidentally leaving some feature enabled that could easily be abused from the outside. And by including just the simplified files, it makes it easier to see what needs to be done to make things work with Fedora Talk.

sip.conf

[general]
pedantic=no ; This uses a less careful loop checking method needed for loopback testing
allowoverlap=no
allowtransfer=no
udpbindaddr=0.0.0.0
tcpenable=yes
tlsenable=no
tcpbindaddr=0.0.0.0
transport=udp,tcp
defaultexpiry=3600 ; The default of 120 is kind of short
register => bruno:password_goes_here@fedoraproject.org

[fedora]
context=fedora
type=peer
host=fedoraproject.org
fromuser=bruno
fromdomain=fedoraproject.org
auth=bruno:password_goes_here@fedoraproject.org ; Don't use 'secret' as it breaks calling fedora talk extensions

[home]
context=home
type=peer
host=bruno.wolff.to
fromuser=bruno
fromhost=bruno.wolff.to

extensions.conf

[general]
static=yes
writeprotect=no
clearglobalvars=no
[globals]
[upstairs]
exten => s,1,answer
exten => s,2,dial(dahdi/2) ; pickup to call downstairs
exten => s,3,hangup

[downstairs]
exten => _#,1,answer
exten => _#,2,dial(dahdi/1) ; # to call upstairs
exten => _#,3,hangup
exten => _X.,1,answer
exten => _X.,2,dial(sip/${EXTEN}@fedora) ; Connect to fedora project extension
exten => _X.,3,hangup
exten => _1*!,1,answer
exten => _1*!,2,dial(sip/bruno@fedora) ; Loop back through fedora
exten => _1*!,3,hangup
exten => _2*!,1,answer
exten => _2*!,2,dial(sip/home) ; Loop back through home
exten => _2*!,3,hangup

[test] ; Test phone usually not plugged in
exten => s,1,answer
;exten => s,2,dial(sip/bruno@fedora)
;exten => s,2,dial(sip/home)
exten => s,2,dial(dahdi/2)
exten => s,3,hangup

[fedora]
exten => s,1,answer
exten => s,2,dial(dahdi/1r4&dahdi/2r4) ; Inbound fedora calls ring upstairs and downstairs with distinctive ring
exten => s,3,hangup

[home]
exten => _!,1,answer
exten => _!,2,dial(dahdi/1r4&dahdi/2r4) ;Inbound calls direct to my sip server ring upstairs and downstairs with distinctive ring
exten => _!,3,hangup

chan_dahdi.conf / dahdi_channels.conf

[channels]
;
echocancel=yes
group=1
callgroup=1
pickupgroup=1

context=upstairs
immediate=yes ; Upstairs phone works in bat phone mode
channel => 1

context=downstairs
immediate=no ; Downstairs phone gets a dial tone
channel => 2

context=test
immediate=yes ; Test phone works in bat phone mode
channel => 3