=install kernel development env=
sudo apt-get update
sudo apt-get install linux-source
=build/install libpri. = * [https://issues.asterisk.org/jira/browse/PRI-145?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel bug]: apply the patch.
wget http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.13.tar.gz
tar -xzf libpri-1.4.13.tar.gz
cd libpri-1.4.13
wget https://issues.asterisk.org/jira/secure/attachment/44869/fix_unused_write.patch
patch  -i fix_unused_write.patch
make
sudo make install
cd ..
= build/install DAHDI= # refer to [http://wiki.freeswitch.org/wiki/OpenZap_Dahdi link]. similar steps. # refer to [http://wiki.freeswitch.org/wiki/FreeTDM link] for general introducing about freetdm. # refer to [http://wiki.freeswitch.org/wiki/Freetdm.conf_Examples#Digium_TDM400 sample conf] for Digium TDM400 sample conf.
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-2.6.1+2.6.1.tar.gz
tar -zxvf dahdi-linux-complete-2.6.1+2.6.1.tar.gz
cd dahdi-linux-complete-2.6.1+2.6.1
make
sudo make install
sudo make config
dahdi_genconf modules
edit /etc/udev/rules.d/dahdi.rules to enable freeswitch access.
edit /usr/local/freeswitch/auto*/modules* to allow freetdm to be loaded at start.
cd ..
=== sample dahdi rules ===
# udev rules to generate the /dev/dahdi device files (if not yet provided 
# by your distribution):
KERNEL=="dahdictl", NAME="dahdi/ctl"
KERNEL=="dahditranscode", NAME="dahdi/transcode"
KERNEL=="dahditimer", NAME="dahdi/timer"
KERNEL=="dahdichannel", NAME="dahdi/channel"
KERNEL=="dahdipseudo", NAME="dahdi/pseudo"
KERNEL=="dahdi[0-9]*", NAME="dahdi/%n"

# DAHDI devices with ownership/permissions for running as non-root
# SUBSYSTEM=="dahdi",  OWNER="asterisk", GROUP="asterisk", MODE="0660"
SUBSYSTEM=="dahdi",  OWNER="luna", GROUP="luna", MODE="0660"
==some hints on dialplan, configuration== * freetdm.conf: copy conf from [http://wiki.freeswitch.org/wiki/Freetdm.conf_Examples#Digium_TDM400 sample].
[span zt FXS1]
fxs-channel => 3

[span zt FXS2]
fxs-channel => 4

[span zt FXO1]
fxo-channel => 1

[span zt FXO2]
fxo-channel => 2
; comment all other span
* autoload_configs/freetdm.conf.xml
 
    
    
    
 
* dialplan sample:
    
    
      
        
      
    

  
  
  
  
    
    
        
    
  


=build freeswitch= *# edit modules.conf to allow mod_freetdm.
./bootstrap
./configure
make
make install
make cd-sounds-install cd-moh-install