Changes

From SME Server
Jump to navigationJump to search
Updated for latest Sail ACL security
Line 1: Line 1: −
{{Incomplete}}
+
==IAXModem for SME Server==
{{Warning box|This has only been tested with Asterisk 1.4.25.1-78, Sail 2.4.1-2 and the Hylafax Contrib from Dungog (smeserver-hylafax-0.9.6 with hylafax-4.4.4-1)
+
{{Level|Advanced}}
No other asterisk implementations have been used or tested.
  −
It is assumed that you have a working Sail/asterisk installation}}
     −
==Introduction==
+
===Introduction===
This Howto is aimed at the installation of IAXModem in conjunction with Asterisk, SAIL and HylaFax in order to provide a fax over VOIP solution. It is based on information from various forum posts [http://forums.contribs.org/index.php/topic,39258.msg179460.html] [http://forums.contribs.org/index.php/topic,41256.msg219493.html]
+
This Howto is for the installation of IAXModem in conjunction with Asterisk, SAIL and HylaFax in order to provide a fax over VOIP solution. It is based on information from various forum posts [http://forums.contribs.org/index.php/topic,39258.msg179460.html] [http://forums.contribs.org/index.php/topic,41256.msg219493.html]
   −
==Sail and Asterisk Setup==
+
For further info see also
===Global Settings===
+
 
 +
*[http://sarkpbx.com/twiki/bin/view Selintra SarkPBX]
 +
 
 +
*[http://iaxmodem.sourceforge.net/ IaxModem]
 +
 
 +
*[http://www.hylafax.org/content/Main_Page Hylafax]
 +
 
 +
*[[Asterisk]] and [[HylaFax]] Contribs Wiki entries
 +
 
 +
This Howto has only been tested with
 +
 
 +
*Asterisk - 1.4
 +
 
 +
*Sail - 2.4.1
 +
 
 +
*Hylafax Contrib from Dungog - smeserver-hylafax-0.9.6 with hylafax-4.4.4-1
 +
 
 +
No other asterisk contribs or implementations have been used or tested.
 +
 
 +
It is assumed that you have a working Sail/asterisk installation before you start.
 +
 
 +
YMMV
 +
 
 +
===Sail and Asterisk Setup===
 +
====Global Settings====
 
In ''Global Settings''
 
In ''Global Settings''
 
*Make sure that ''Late Termination'' is set to 'No'.
 
*Make sure that ''Late Termination'' is set to 'No'.
Line 14: Line 36:  
*The ''Fax Delay'' setting defaults to 2 seconds. You may need to adjust this later to make sure faxes get detected before asterisk attempts to terminate somewhere other than the FAX.  
 
*The ''Fax Delay'' setting defaults to 2 seconds. You may need to adjust this later to make sure faxes get detected before asterisk attempts to terminate somewhere other than the FAX.  
   −
===Trunklines===
+
====Trunklines====
 
For each Trunk under ''Trunklines'' that you want to be able to detect incoming Faxes on
 
For each Trunk under ''Trunklines'' that you want to be able to detect incoming Faxes on
 
*Make sure that the ''Fax'' detection tick box is ticked
 
*Make sure that the ''Fax'' detection tick box is ticked
*Include a ''Transformation String'' of
+
*Include a ''Transformation String'' of '95:' at the beginning
99:
+
{{Tip box|We will configure HylaFax later to prefix dialled numbers with 95 so we can identify them as an outgoing fax and route them as desired.
{{Note box|We will configure HylaFax later to prefix dialled numbers with 99 so we can identify them as an outgoing fax and route them as desired.
+
You can use any prefix you want, not just 95 as long as you use it consistently.
You can use any prefix you want, not just 99 as long as you use it consistently.
   
See Fax Route and HylaFax sections later}}
 
See Fax Route and HylaFax sections later}}
   −
===Fax Route===
+
====Fax Route====
Create a new Route for faxes with dialplan(s) starting with 99.  
+
Create a new Route for faxes with dialplan(s) starting with 95.  
  example: 99X.
+
  example: 95X.
 
and with ''Paths'' pointing to the Trunks on which you wish to receive faxes - those with ''Fax'' detection ticked as above
 
and with ''Paths'' pointing to the Trunks on which you wish to receive faxes - those with ''Fax'' detection ticked as above
   −
===Fax Extension===
+
====Fax Extension====
 
Create a new Extension with the same number as set in the ''Autosense FAX Extension'' as above. The ''Device'' should be 'IAXModem'.
 
Create a new Extension with the same number as set in the ''Autosense FAX Extension'' as above. The ''Device'' should be 'IAXModem'.
{{Note box|We will assume an ''Extension Number'' of '2000', a ''Password'' (secret) of 'asterisk' and a ''Display Name'' of 'FaxModem'}}
+
{{Note box|We will assume an ''Extension Number'' of '2000' (the iaxmodem rpm installed later defaults to this), a ''Password'' (secret) of 'asterisk' and a ''Display Name'' of 'FaxModem'}}
 
Once created check the stanza generally conforms to the following and change as necessary:
 
Once created check the stanza generally conforms to the following and change as necessary:
 
  [2000]
 
  [2000]
 
  type=friend
 
  type=friend
 
  username=FaxModem
 
  username=FaxModem
  secret=asterisk
+
  secret=xYz3aB45
 
  host=dynamic
 
  host=dynamic
 
  qualify=3000
 
  qualify=3000
 
  context=internal
 
  context=internal
 
  callerid="Faxmodem" <2000>
 
  callerid="Faxmodem" <2000>
 +
mailbox=2000
 +
pickupgroup=1
 +
callgroup=1
 +
call-limit=99
 +
subscribecontext=extensions
 +
deny=0.0.0.0/0.0.0.0
 +
permit=127.0.0.1/255.255.255.0
 
  disallow=all
 
  disallow=all
 
  allow=slin
 
  allow=slin
 +
requirecalltoken=no
   −
==IAXModem==
+
{{Note box| The 'secret' is a strong extension password generated automatically by Sail. It should not be changed, other than to another strong password. The value shown above is a dummy example.}}
===Installation===
+
{{Note box| The latest revisions of Sail generate ACL deny/permit security in the stanza. The <nowiki>permit=</nowiki> ACL will default to allow access on the local IP. You will need to change this to 127.0.0.1 as above}}
{{Note box|Sail installs /etc/rc.d/rc7.d/S93iaxmodem but does not install /etc/rc.d/init.d/iaxmodem}}
+
{{Note box| After updating to Asterisk14-1.4.28-88, the fax extension fails to register, and gives the following error in the asterisk cli,
Download the iaxmodem rpm from Aelintra and install
+
<nowiki>chan_iax2.c:4322 handle_call_token: Call rejected, CallToken Support required. If unexpected, resolve by placing address 127.0.0.1 in the calltokenoptional list or setting user 2000 requirecalltoken=no </nowiki>
 +
Add <nowiki>requirecalltoken=no</nowiki> to stanza for fax extension and it will register OK again}}
 +
 
 +
===IAXModem===
 +
====Installation====
 +
{{Note box|Sail installs /etc/rc.d/rc7.d/S93iaxmodem but does not install /etc/rc.d/init.d/iaxmodem
 +
 
 +
Current version of iaxmodem is 1.2 but there doesn't appear to be a Centos 4 package for it anywhere}}
 +
Download the iaxmodem rpm from Selintra and install
 
  wget http://sarkpbx.com/sail/iaxmodem/iaxmodem-1.0.0-1.noarch.rpm
 
  wget http://sarkpbx.com/sail/iaxmodem/iaxmodem-1.0.0-1.noarch.rpm
 
  yum localinstall iaxmodem-1.0.0-1.noarch.rpm
 
  yum localinstall iaxmodem-1.0.0-1.noarch.rpm
{{Note box|Current version of iaxmodem is 1.2 but there doesn't appear to a Centos 4 package for it anywhere}}
+
{{Warning box|The rpm from Selintra does not install an /etc/rc.d/init.d/iaxmodem script. This version of iaxmodem apparently relied upon an inittab entry for starting but we are going to start it as a service so will need to create the required script. A copy of the current version 1.2 code is reproduced at the end of this Howto. You may need to set the permissions and ownership.}}
{{Warning box|The rpm from Aelintra does not install /etc/rc.d/init.d/iaxmodem so you will need to create one. A copy of the current version 1.2 code is reproduced at the end of this Howto. You may need to set the permissions and ownership
+
 
chmod 766 iaxmodem
+
====Configuration====
chown root:root iaxmodem}}
+
Use a template fragment to generate the required Iaxmodem configuration file ''ttyIAX0'' in /etc/iaxmodem so that changes survive a reconfiguration and reboot etc.
===Configuration===
+
*Create the template directory
Check and edit /etc/iaxmodem/ttyIAX0 as necessary:
+
mkdir -p /etc/e-smith/templates-custom/etc/iaxmodem/ttyIAX0
  device          /dev/ttyIAX
+
cd /etc/e-smith/templates-custom/etc/iaxmodem/ttyIAX0
owner          uucp:uucp
+
*Now create and edit a new file called ''modem'' with the following content
mode            660
+
{
port            4570
+
    use esmith::DB::db;
refresh        60
+
   
server          127.0.0.1
+
    $OUT = "";
peername        2000
+
    my $db = esmith::DB::db->open_ro('/home/e-smith/db/selintra');
secret          asterisk
+
   
cidname        YourCompany
+
    unless ($db)
cidnumber      0123456789
+
    {
codec          slinear
+
        warn "Couldn't open Selintra DB in Iaxmodem ttyIAX0 template fragment. Using Defaults\n";
===Check and Run===
+
    }
 +
   
 +
    my $extension = $db->get_prop('global','FAX')        || "2000";
 +
    my $pass      = $db->get_prop($extension,'passwd')  || "asterisk";
 +
    my $cidname  = $db->get_prop($extension,'desc')    || "Noname";
 +
    my $cidnumber = $db->get_prop($extension,'callerid') || "0123456789";
 +
   
 +
    $OUT .= "device          /dev/ttyIAX\n";
 +
    $OUT .= "owner          uucp:uucp\n";
 +
    $OUT .= "mode            660\n";
 +
    $OUT .= "port            4570\n";
 +
    $OUT .= "refresh        60\n";
 +
    $OUT .= "server          127.0.0.1\n";
 +
    $OUT .= "peername        $extension\n";
 +
    $OUT .= "secret          $pass\n";
 +
    $OUT .= "cidname        $cidname\n";
 +
    $OUT .= "cidnumber      $cidnumber\n";
 +
    $OUT .= "codec          slinear\n";
 +
}
 +
*Save and close the file.
 +
*Now expand the template
 +
/sbin/e-smith/expand-template /etc/iaxmodem/ttyIAX0
 +
*This will create the necessary ttyIAX0 file, using the settings from Sail/Asterisk. It assumes you have set the Fax extension in ''globals'' and have created a valid ''extension'' of type ''IAXModem''.
 +
{{Note box|If the required settings are not available in Sail/asterisk then it defaults to an extension of ''2000'', a secret/password of ''asterisk'', a CID Name of ''NoName'' and Caller ID of ''0123456789''. The default password of 'asterisk' is not secure and both this and the 'secret' value of the extension in Sail should be changed to a strong password. If the extension has been created in Sail then a strong password will have been generated automatically}}
 +
 
 +
====Check and Run====
 
Check the modem registers with Sail and Asterisk
 
Check the modem registers with Sail and Asterisk
  /usr/local/sbin/iaxmodem ttyIAX
+
  /usr/local/sbin/iaxmodem ttyIAX0
 
should give an output similar to
 
should give an output similar to
 
  Modem started
 
  Modem started
Line 91: Line 153:  
  /etc/rc.d/rc7.d/S93iaxmodem start
 
  /etc/rc.d/rc7.d/S93iaxmodem start
   −
==HylaFax==
+
====Modifications====
Install the [[HylaFax|smeserver-hylafax]] contrib.
+
If you make any changes within Sail/asterisk such as the fax number, or fax extension details, don't forget to update Iaxmodem
When you run faxsetup, at the end it will ask to continue and run faxaddmodem to setup a modem. Choose ttyIAX as the modem port and continue and set other values as required. Do not reboot or start HylaFax yet.
+
/sbin/e-smith/expand-templates /etc/iaxmodem/ttyIAX0
 +
/etc/rc.d/rc7.d/S93iaxmodem restart
 +
 
 +
===HylaFax===
 +
Install the [[HylaFax]] contrib.
 +
When you run faxsetup, at the end it will ask to continue and run faxaddmodem to setup a modem.  
 +
Enter 'ttyIAX' as the modem port and continue and set other values as required. The IAXModem should be discovered if it was working OK, is started and running as above.
 +
Do not reboot or start HylaFax yet.
 
Edit /etc/hylafax/etc/config.ttyIAX and add
 
Edit /etc/hylafax/etc/config.ttyIAX and add
  ModemDialCmd:        ATDT99%s
+
  ModemDialCmd:        ATDT95%s
This will prefix all numbers dialled by HylaFax with 99 so they can be identified and routed by SAIL
+
{{Note box|This will prefix all numbers dialled by HylaFax with 95 so they can be identified and routed by SAIL}}
 
Also check
 
Also check
 
  # make attachments readable
 
  # make attachments readable
Line 110: Line 179:  
  /etc/hylafax/etc/FaxDispatch
 
  /etc/hylafax/etc/FaxDispatch
 
Finally set the modem port in the database
 
Finally set the modem port in the database
  db configuration setprop hylafax port=ttyIAX
+
  db configuration setprop hylafax port ttyIAX
 
  /sbin/e-smith/expand-template /etc/inittab
 
  /sbin/e-smith/expand-template /etc/inittab
 +
/sbin/init q
 
Now continue with the contrib setup for Hylafax
 
Now continue with the contrib setup for Hylafax
   −
==iaxmodem Startup Script==
+
===Operation===
The following is the code for the /etc/rc.d/init.d/iaxmodem script from the current iaxmodem-1.2.0.tar.gz source.
+
Incoming faxes on a Trunkline with detection enabled should be detected by asterisk. You may need to increase the ''Fax Detect Delay'' in ''Global Settings'' of SAIL to ensure the fax is detected and routed to the fax extension before the call is routed anywhere else.
 +
Once detected the incoming fax should be routed to the ''Autosense FAX Extension'', where IAXModem will answer and pass the fax to Hylafax.
 +
 
 +
Outgoing faxes emailed to 'user@0123987654.fax' will be sent by Hylafax to IAXModem with a dial string prefixed by 95, for example 950123987654. This will initiate a call in asterisk. The 95 prefix will be recognised as the fax route and the call passed to the relevant outgoing Trunk, where the 95 is stripped off and the real number dialled.
 +
 
 +
===iaxmodem Startup Script===
 +
The following is the code for the /etc/rc.d/init.d/iaxmodem script from the current iaxmodem-1.2.0.tar.gz source. You will need to create this file and add the code below in order for iaxmodem to be automatically started as a service and controlled by the SME Server configuration database settings. Alternatively download the iaxmodem-1.2.0.tar.gz source file and extract it yourself (iaxmodem.fedora)
 
  #!/bin/sh
 
  #!/bin/sh
 
  # Startup script for iaxmodem
 
  # Startup script for iaxmodem
Line 185: Line 261:  
   
 
   
 
  exit $RETVAL
 
  exit $RETVAL
 
+
Don't forget to change the ownership and permissions if necessary
 
+
chown root:root /etc/rc.d/init.d/iaxmodem
 
+
chmod 766 /etc/rc.d/init.d/iaxmodem
 
  −
 
      
----
 
----
 +
[[Category:Howto]]
 +
[[Category:Asterisk]]

Navigation menu