Mod h323

From FreeSWITCH Wiki
Jump to: navigation, search

Contents

mod_h323

Warning

This module is still in development, so be aware not all features will work as expected

 

Version

This module was originally build by Georgiewski Yuriy and it is available since ~ svn revision 15226.

Introduction

mod_h323 is an endpoint module based on the H.323plus telephony library.

Status

In development

Installation

  1. Method 1:
    1. Use the script provided with FreeSWITCH by running the buildopal.sh script in the build directory.
  2. Method 2:

Ptlib and H323plus need to be installed before you can build mod_h323. You must be sure to install the exact working combination of ptlib / h323plus in order to make this work smoothly.

Working combinations:

# ptlib-2.8.2 + h323plus-trunk 
# ptlib-2.8.2 + h323plus-20100525 
# ptlib-2.8.1 + h323plus-20100525 


You'll need development tools. If in Debian, run:

apt-get install build-essential bison

ptlib (trunk from trunk) (NOT WORKING AS OF 10/05/2010. USE VERSION 2.8.2 THAT FOLLOWS INSTEAD) :

In your home, create a directory e.g. h323
mkdir -p ~/h323
cd ~/h323

svn co http://svn.code.sf.net/p/opalvoip/code/ptlib/trunk ptlib

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/local/lib
cd ptlib
./configure
make
sudo make install
cd ..


ptlib (version 2.8.2): (Works on Debian 6 but not 7 AS OF 11/12/2013. For Debian 7, use trunk above)

In your home, create a directory e.g. h323
mkdir -p ~/h323
cd ~/h323

svn co http://svn.code.sf.net/p/opalvoip/code/ptlib/tags/v2_8_2/ ptlib

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/local/lib
cd ptlib
./configure
make
sudo make install

If you recieve error: configure: error: PTLib needs the GNU Project fast lexical analyzer generator flex then:

yum install flex


install h323plus (trunk):

cd ~/h323
cvs -d:pserver:anonymous@h323plus.cvs.sourceforge.net:/cvsroot/h323plus checkout h323plus

export PTLIBDIR=~/h323/ptlib
cd h323plus
./configure
make
sudo make install


or install 20100525 version if you like:

cd ~/h323
wget http://waix.dl.sourceforge.net/project/openh323gk/Sources/2.3.2/h323plus-20100525.tar.gz

tar xzvf h323plus-20100525.tar.gz
cd h323plus-20100525
export PTLIBDIR=~/h323/ptlib
./configure
make
sudo make install

March 2012: It turned out that a good way to make h323plus running is ptlib-2.8.2 with h323plus 1.22.0 (tested under Ubuntu 10.04 64bit and Debian 6)

cd ~/h323
wget http://www.h323plus.org/source/download/h323plus-1.22.0.tar.gz
tar xzvf h323plus-1.22.0
cd h323plus-1.22.0
export PTLIBDIR=~/h323/ptlib
./configure
make
sudo make install


If you get an error: ERROR: you must first run 'aclocal' in ~/h323plus-20100525/plugins than just do it:

cd ~/h323plus-20100525/plugins
$ aclocal
cd ..


build mod_h323:

assuming you have FreeSWITCH source in your home
cd ~/freeswitch-trunk

make mod_h323-clean
make mod_h323
sudo make mod_h323-install


If you get an error like this: '/usr/include/openh323/h323caps.h:289:31: error: ../include/codecs.h: No such file or directory' most probably you don't have codecs.h in the correct path or you don't have it at all.

Simply:

cp ~/h323/h323plus-20100525/include/codecs.h /usr/include/

And make the mod_h323 again.

If you get an error like this: '/usr/src/freeswitch/src/mod/endpoints/mod_h323/mod_h323.h:43:18: error: h323.h: No such file or directory' then try doing this:

ln -s /usr/local/include/openh323 /usr/include/openh323

If you got errors like "error: 'BOOL' has not been declared" or something like that. Just do following and then do make mod_h323 again.

chmod +w /usr/include/openh323/*
sed -i "s/BOOL/PBoolean/g" /usr/include/openh323/*
chmod -w /usr/include/openh323/*

Configuration

The configuration is almost the same as for mod_opal so no big surprises here.

h323.conf.xml:

<configuration name="h323.conf" description="H323 Endpoints">
 <settings>
   <param name="trace-level" value="6"/>
   <param name="context" value="default"/>
   <param name="dialplan" value="XML"/>
   <param name="codec-prefs" value="PCMA,PCMU,GSM,G729"/>
   <param name="use-rtp-timer" value="true"/> <!-- enable RTP timer - should always be enabled -->
   <param name="rtp-timer-name" value="soft"/> <!-- Timer name, soft is default -->
   <!-- <param name="ptime-override-value" value="20"/> --> <!-- Override negotiated ptime value with this value -->
   <param name="gk-address" value=""/>    <!-- empty to disable, "*" to search LAN -->
   <param name="gk-identifer" value=""/>  <!-- optional name of gk (BUG: this parameter is currently mandatory)-->
   <param name="gk-interface" value=""/>  <!-- mandatory listener interface name -->
   <param name="gk-retry" value="30"/>  <!-- optional GK register retry timer -->
   <param name="gk-prefix" value="777"/>  <!-- optional register with this prefix -->
   <param name="gk-prefix" value="779"/>  <!-- optional register with this prefix -->
   <param name="faststart" value="true"/>  <!-- optional -->
   <param name="h245tunneling" value="true"/>  <!-- optional -->
   <param name="h245insetup" value="true"/>  <!-- optional -->
   <param name="dtmfinband" value="false"/>  <!-- optional -->
   <param name="jitter-size" value="60"/>  <!-- optional -->
   <param name="progress-indication" value="8"/> <!-- optional - PI value in progress message-->
   <param name="alerting-indication" value="8"/> <!-- optional - PI value in alerting message-->
   <param name="endpoint-name" value="fs"/>
   <param name="fax-old-asn" value="true"/>
 </settings>
 <listeners>
   <listener name="default">
     <param name="h323-ip" value="$${local_ip_v4}"/>
     <param name="h323-port" value="1720"/>
   </listener>
 </listeners>
</configuration>

settings

  • trace-level: it is the level of logging you will get on console (0-4, default 0)
  • context: context the incoming call through mod_h323 will fall in (default set to public)
  • dialplan: the type of dialplan used (default XML)
  • codec-prefs: comma separated list of supported codecs (Note: the order of the codecs won't be used. It will only enable or disable them. Codecs are always sent in the same order: PCMA, PCMU, GSM, G723, G729b, G729, G729a, , G729ab, G723.1. Check in mod_h323.cpp for a table called h323_formats).


listeners (you can have more than one listener)

  • name: just a name
  • h323-ip: an ip address for mod_h323 to bind
  • h323-port: a port for mod_h323 to bind


Add this into vars.xml files to allow incoming calls to extensions (this needs to be tested!!!):

<X-PRE-PROCESS cmd="set" data="domain_name=$${local_ip_v4}"/>

Usage

create a file in $FS_DIR/conf/dialplan/default/ (e.g. 10_outgoing_via_h323.xml) and add the something like this:

<include>
  <extension name="OUTGOING_VIA_H323">
    <condition field="destination_number" expression="^([2-8]\d{6,7}|0[1-9]\d{7,8}|00[1-9]\d{8,16})$">
      <action application="set" data="effective_caller_id_number=385${ani}"/>
      <action application="set" data="PEER_IP=10.1.1.1"/>
      <action application="set" data="call_timeout=30"/>
      <action application="set" data="hangup_after_bridge=true"/>
      <action application="bridge" data="h323/$1@${PEER_IP}"/>
    </condition>
  </extension>
</include>


In your $FS_DIR/conf/dialplan/public.xml make sure you have:

  <extension name="public_extensions">
    <condition field="destination_number" expression="^(10[01][0-9])$">
      <action application="transfer" data="$1 XML default"/>
    </condition>
  </extension>

All incoming calls via mod_h323 will be transferred to context default.



Applications

needs to be updated!

API commands

needs to be updated!

Events

needs to be updated!

Channel Variables

needs to be updated!

Known Bugs

faststart and codecs v CallProceeding due to h323plus, grep "Very Frustrating - S.H." in h323plus source and uncomment commented lines. (should be fixed in H323Plus as of 2011-05-17)

missing features.


Troubleshooting

freeswitch@nemesis> load mod_h323
2010-10-02 20:16:37.660670 [INFO] mod_enum.c:808 ENUM Reloaded
2010-10-02 20:16:37.660670 [INFO] switch_time.c:950 Timezone reloaded 530 definitions
2010-10-02 20:16:37.717932 [CRIT] switch_loadable_module.c:928 Error Loading module /usr/local/freeswitch/mod/mod_h323.so
**libpt.so.2.8.2: cannot open shared object file: No such file or directory**

+OK Reloading XML
-ERR [module load file routine returned an error]

This is a common problem when libpt.so is not in path. Simply:

ln -sf /usr/local/lib/libpt.so.2.8.2 /usr/local/freeswitch/lib/libpt.so.2.8.2


freeswitch@fs01> load mod_h323
2012-03-20 12:45:25.826535 [CRIT] switch_loadable_module.c:1290 Error Loading module /usr/local/freeswitch/mod/mod_h323.so
**libh323_linux_x86_64_.so.1.22.0: cannot open shared object file: No such file or directory**
+OK Reloading XML
-ERR [module load file routine returned an error]

This is a common problem when libh323_linux_x86_64_.so.1.22.0 is not in path. Simply:

ln -sf /usr/local/lib/libh323_linux_x86_64_.so.1.22.0 /usr/local/freeswitch/lib/libh323_linux_x86_64_.so.1.22.0

References