wiki.ipfire.org

The community-maintained documentation platform of IPFire

User Tools

Site Tools


addons:asterisk:start

Asterisk Addon

Asterisk is a PBX-software, thus a software- telephone system. It can be used for calling via the landline but also with appropriate hardware using VoIP. As phones SIP devices are suitable, or normal phones which are connected with ATA adapter or an ISDN card in NT mode, to the Asterisk.

Asterisk is very powerful, and therefore the configuration is complicated.

NOTE:This howto is not finished and it probably never will be. There are many pages for Asterisk, DAHDI, mISDNv1/CHAN_MISDN, mISDNv2 und LCR/CHAN_LCR. For deeper details you should read for each case the documentation. This should only be considered a overview, or how it could work - without the requirement to be complete.

Overview - What is needed for what ?

Dahdi: From the Asterisk developer “Digium” developed drivers for special proprietary phone plug-in card. For one example the “Authentic X100P SE FXO PCI interface card” is called, which one receives an analog connection for less money in our PBX. The rest of the hardware is then already in other price areas. Even it is important to know that “Dahdi” provides an dummy driver to emulate a time-device - which is required to operate by the conference-room module “meetme”.

mISDNv1 and CHAN_MISDN: The first generation of the mISDN-driver for ISDN-cards. To use cards which are connected with mISDNv1 to Asterisk, the module chan_mISDN must be used. Attention: CHAN_mISDN not being further developed since years !

mISDNv2 and LCR/CHAN_LCR: The first generation of the mISDN-driver for ISDN-cards. To use cards which are connected with mISDNv2 to Asterisk, you have to go the detour via LCR / CHAN_LCR. LCR is a “low cost router”-project and it uses directly mISDNv2 and it haves the opportunity to forward incoming/outgoing calls to Asterisk.

Since version IPFire 2.5 mISDNv2 is targeted. Therefore it is not possible with mISDNv1-instructions on IPFire 2.5 and higher, to get that to work.

Hardware and the operation modes

ISDN hardware is required if you want to route calls to the landlines (TE-Modus), or conventional non-VoIP phones to make phone calls (NT-mode).

In order to route calls to landlines, any mISDN supported ISDN hardware is enough.

But if you wants to connect phones to Asterisk, you need an ISDN card with HFC chipset (to detect at the Cologne Cathedral on the chip), since these cards can be switched to NT mode.

Asterisk on IPFire

Currently, no webinterface is provided, the configuration must be done by hand.

Packages

The Asterisk-Addon should be installed over Pakfire. All necessary hardware must be “installed and connected”. Since IPFire 2.5 the addon “LCR” and, if present, “Dahdi” is still needed. The Addons install required dependencies automatically.

Settings on IPFire

Set the autostart

Asterisk can not currently be configured via the webinterface, the following steps must be performed to load Asterisk and mISDN at the startup.

ln -s ../init.d/mISDN /etc/rc.d/rc3.d/S61mISDN
ln -s ../init.d/asterisk /etc/rc.d/rc3.d/S62asterisk
ln -s ../init.d/mISDN /etc/rc.d/rc0.d/K32mISDN
ln -s ../init.d/asterisk /etc/rc.d/rc3.d/K31asterisk
ln -s ../init.d/mISDN /etc/rc.d/rc6.d/K32mISDN
ln -s ../init.d/asterisk /etc/rc.d/rc6.d/K31asterisk

Configure the QoS

So that simultaneous surfing and phone calls are possible, the SIP packets need to have a preferential treatment. This can achieved with QoS. I created the configuration from the template, and have added only for the class 102 the Layer 7 protocol “sip”.

Language configuration

Watch out! The language is in “sip.conf” per “language=de” configured in German. However, in “asterisk.conf” by “languageprefix=yes” was the new directory structure for sound files activated. But the installed sound-files are present on the old structure, so that you should set it to “no”

MISDNv2 - Connect Asterisk to the outside world (TE-mode)

Not complete

The basic configuration on IPFire is now quite good, you don´t have to adjust that much to make it work.

  • “/etc/asterisk/misdn.conf” is redundant and was made by the mISDNv1-variation.
  • mISDNv2 - the service “/etc/init.d/misdn” must only be started - a invocation of “misdn_info” should now list all installed ISDN cards.
  • Now you have to setup LCR and let forward all calls to Asterisk - how this works can be read in here
File: /var/ipfire/lcr/interfaces.conf
  [misdnextern]
  portnum 0
  screen-in national % 0%
  screen-in international % 00%

Especially the “screen-in” statements are very important, otherwise the incoming caller IDs are passed shortened (without the leading 0´s). This to finding has cost me a couple of hours.

MISDNv1 - To run an ISDN phone on Asterisk (NT-mode)

With mISDNv1 is it possible to operate for example Fritz!-ISDN-cards in TE-mode or HFC-ISDN-cards in NT- and TE-mode. In the following example a ISDN-card in NT-mode should be operate.

This section refers to the Asterisk Addon version 1.4.8-1 and IPFire 2.4 or younger ! Until this version was included mISDNv1.

I can and will here only describe my own configuration. I run asterisk with a SIP account and HFC-card connected ISDN telephone.I have “no” landline connection

Configuration

Hardware Configuration

I can only enter by the way of this example to a HFC card in NT-mode, as I have no other hardware.

The configuration of the hardware takes place in the “<misdn.conf>”, where only the lower part of “<mISDNconf>” is relevant. The things overhead should remain unchanged, unless you know what you are doing.

File: /etc/mISDN.conf
  <mISDNconf>
          <module poll="128" debug="0" timer="no">hfcmulti</module>
          <module debug="0" options="0">mISDN_dsp</module>
          <devnode user="root" group="root" mode="644">mISDN</devnode>
          <card type="hfcpci">
                  <port mode="nt" link="ptmp">1</port>
          </card>
  </mISDNconf>

The configuration shown here initializes a HFC card in NT mode and the Point-to-Multipoint-Protokoll.

To acquire the configuration, a

/etc/init.d/mISDN start

must be executed.

If everything is fine, you can check with a

misdnportinfo

It should get a output similar to this:

Port  1: NT-mode BRI S/T interface port (for phones)
-> Interface can be Poin-To-Point/Multipoint.
 
mISDN_close: fid(3) isize(131072) inbuf(0x804c060) irp(0x804c060) iend(0x804c060)

mISDN in Asterisk

So that Asterisk communicates with the card, it must be said to him in the misdn.conf.

My configuration looks like this:

green|File: /var/ipfire/asterisk/misdn.conf
  [general]
  misdn_init=/var/ipfire/asterisk/misdn-init.conf ; 1)
  debug=0
  ntdebugflags=0
  ntdebugfile=/var/log/misdn-nt.log
  bridging=no
  stop_tone_after_first_digit=yes
  append_digits2exten=yes
  dynamic_crypt=no
  crypt_prefix=**
  crypt_keys=test,muh
 
  [default]
  context=misdn
  language=de
  musicclass=default
  senddtmf=yes
  far_alerting=no
  allowed_bearers=all
  nationalprefix=0
  internationalprefix=00
  rxgain=0
  txgain=0
  te_choose_channel=no
  pmp_l1_check=no
  reject_cause=16
  need_more_infos=no
  nttimeout=no
  method=standard
  dialplan=0
  localdialplan=0
  cpndialplan=0
  early_bconnect=yes
  incoming_early_audio=no
  nodialtone=no
  presentation=-1
  screen=-1
  jitterbuffer=4000
  jitterbuffer_upper_threshold=0
  hdlc=no
  max_incoming=-1
  max_outgoing=-1
 
  [NT] ; 2)
  ports=1
  context=intern
  overlapdial=yes
  echocancel=yes
To 1.

“chan_misdn” searches for the mISDN configuration in the now obsolete syntax. Therefore a “fake”-configuration must be created in the Asterisk-directory.

File: /var/ipfire/asterisk/misdn-init.conf
  <pre>card=1,hfcpci
  nt_ptmp=1
To 2.

The card is called NT, and will be set in the context “intern”. These designations are also needed in other configuration files.

Asterisk-Configuration

  • modules.conf - All necessary modules (and felt 1000 not needed) will be loaded automatically. Thus, no adjustments are necessary in here. If everything works, you can exclude modules “noload ⇒ modul.so” to purify Asterisk a little.
  • codecs.conf - There are no adjustments necessary. If necessary, vbr can be set to false, since the variable bit rate often has a worse voice quality. This is at the expense of the required traffic.
  • sip.conf -
File: /var/ipfire/asterisk/sip.conf
  [general]
  context=sip-in                  ; Default context for incoming calls
  allowoverlap=no                 ; Disable overlap dialing support. (Default is yes)
  bindport=5060                   ; UDP Port to bind to (SIP standard port is 5060)
  bindaddr=0.0.0.0                ; IP address to bind to (0.0.0.0 binds to all)
  srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
 
  register => 1234567e0:XXXX@sipgate.de/033112345670
 
  [authentication]
 
  [sipgate]
  type=peer
  secret=XXXXX
  username=1234567e0
  host=sipgate.de
  fromuser=1234567e0
  fromdomain=sipgate.de
  ;context=incoming
  insecure=port,invite
  disallow=all
  ;allow=g729
  allow=ulaw
  nat=no
  canreinvite=no

The example shown here registers a SIP account at Sipgate. It is important that a row appears in the [general] area with “register ⇒ username:passwort@host/Tel.-Nr”.

  • extensions.conf - One of the most important configurations, here is created also the dialplan.
File: /var/ipfire/asterisk/extension.conf
  [general]
  static=yes
  writeprotect=no
  clearglobalvars=no
 
  [globals]
  CONSOLE=Console/dsp                             ; Console interface for demo
  IAXINFO=guest                                   ; IAXtel username/password
  TRUNK=Zap/g2                                    ; Trunk interface
  TRUNKMSD=1                                      ; MSD digits to strip (usually 1 or 0)
 
  [sip-in]
  exten => 033112345670,1,Ringing()
  ;exten => 033112345670,2,Dial(misdn/g:NT/10&misdn/g:NT/11,60,Ttr)
  exten => 033112345670,2,Dial(misdn/g:NT/10)
  exten => 033112345670,3,Congestion()
  exten => 033112345670,4,Wait(10)
  exten => 033112345670,5,Hangup
 
  [intern]
  exten => 10,1,Dial(misdn/g:NT/10,60,Ttr) ; Nebenstelle 10
  exten => 10,2,Hangup
 
  exten => _X.,1,Dial(SIP/sipgate/${EXTEN}) ; raus via sipgate
  exten => _X.,2,Hangup

I will not explain everything, but respond to the most important. In the area [globals] global variables can be declared. The present here are from the sample configuration and are not required.

[sip-in] is a self-created area that will route calls that come in via sipgate. The out-commented line is an example when 2 substations should ring on mISDN hardware.

The first 2 rows are used [intern] to the substation 10 to call internally. The other 2 lines routes out all (other) outgoing calls via sipgate.

The Nr. of the substation 10 is arbitrary selectable, and must be connected to the ISDN device configured as a MSN.

.. to be continued

Interference in parallel processes

  • Problem - The conversation are short chopped up when IPFire just doing something else, for example the webinterface comes up, or cronjobs (for example makegraph) are in execution. I have yet to test if this can somehow be resolved (for example increase the process priority from Asterisk), or if my hardware is simply too weak.
  • Solution - Asterisk must be started to run as a real-time process with parameter “-p”. Look in here.
addons/asterisk/start.txt · Last modified: 2018/09/23 02:58 by Jon