From Fedora Project Wiki
(more on change)
(fedora talk has been shut down)
 
Line 1: Line 1:
== Motivation ==
* Being able to have developers call me with my fedoraproject.org SIP address.
* Being able to call developers using my normal phones, without a land line.
* Being able to have other people call me using POTS through Fedora Talk. (Note: I asked about the policy on this and for now it's OK if it doesn't get abused. But there is no promise that this service will continue in the future.)


== 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 ==
* You need to have [http://talk.fedoraproject.org/faq set up your VOIP account].
* If you are using special hardware, the dahdi drivers are not part of Fedora. Currently for Fedora F11 you need to build them from source. But in many cases 3rd party repos carry them. The issue is the drivers have not been upstreamed.
* You need to have [http://www.asterisk.org Asterisk] installed. Though a lot of this information will also apply to [http://www.callweaver.org/blog Callweaver], which is a fork of Asterisk.
== What I learned while getting this to work ==
* Even to make inbound SIP calls to Fedora Talk, you must be authenticated.
** I am not sure if this is to prevent VOIP spam, just an oversight or something else.
** When using SIP clients you can do this by setting up fedoraproject.org as an outbound proxy.
* That your password is supplied differently when using it in an <code>auth</code> command as opposed to a <code>secret</code> command. Using the <code>secret</code> command will work when registering (to have calls directed to your server) with the fedoraproject.org server, but not when using it as a proxy (to make calls to other developers).
* Unless you turn off <code>pedantic</code>, the extra checking detects harmless loops and that breaks some loopback testing.
* The default registration time is only 2 minutes. For long time connections you can set this to an hour to reduce pinging the fedoraproject.org server.
* If you run asterisk as root you create some log files owned by the wrong account that will break running it as a service. So use the <code>service asterisk</code> commands to start and stop the service during testing.
* You can do interactive debugging using the <code>asterisk -r</code> command to attach to a running asterisk daemon. This you can run as root. <code>help</code> will give you a list of commands to play with. <code>sip show registry</code> was particularly useful.
* If you use a peer name instead of a hostname in the <code>register</code> command, this seems to cause dns lookups of the peer name under some circumstances, which generates some warnings.
* For inbound calls from a server you have registered at, the extension will be the default start extension, <code>s</code>. If you have inbound SIP calls directly to your server the start extension will be the username or the empty string if no username was given.
* To match an empty string in a dial plan you can use <code>_!</code> (though that really matches any string, so you need to be careful).
* SIP uses port 5060 (udp or tcp) by default. And if you play with TLS, then tcp port 5061 is used by default. Make sure your firewall doesn't block these.
== Config files ==
When you install asterisk a bunch of config files get created in <code>/etc/asterisk</code>. The main ones I played with in getting this to work were <code>sip.conf</code>, <code>extensions.conf</code> and <code>chan_dahdi.conf</code> (with the dahdi ATMrpms for F11 this config file is now named <code>dahdi_channels.conf</code> and should be a copy of <code>chan_dahdi.conf</code>). 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.
=== <code>sip.conf</code> ===
<pre>
[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
</pre>
=== <code>extensions.conf</code> ===
<pre>
[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
</pre>
=== <code>chan_dahdi.conf / dahdi_channels.conf</code> ===
<pre>
[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
</pre>
----
[[Category:Draft_documentation]]

Latest revision as of 12:53, 8 May 2011