Tuesday, 8 April 2008

HOWTO Compil Asterisk 1.4.19 with H323

Hi All,

You are probably interesting to compile Asterisk with H323, after lot of test it has been successfully compiled but is not easy when you don't know Linux so if you follow this tutorial it will be easy for the majority of the people:


Installation of the package necessary on CentOS 5.1:
yum -y install ncurses ncurses-devel openssl openssl-devel zlib zlib-devel bison bison-devel glibc gcc kernel-devel flex


Installation of the package on Debian:

pt-get install libc6 libc6-dev libncurses5 libncurses5-dev libssl-dev openssl libssl0.9.8 flex m4 bison libpopt-dev libdv4-dev libpopt-dev zlib1g zlib1g-dev



Now you need to download the package for Asterisk from the folder /usr/src/:


mkdir -p /usr/src/Asterisk_and_H323
wget -P /usr/src/Asterisk_and_H323 http://www.voxgratia.org/releases/pwlib-v1_10_0-src-tar.gz
wget -P /usr/src/Asterisk_and_H323 http://www.voxgratia.org/releases/openh323-v1_18_0-src-tar.gz
wget -P /usr/src/Asterisk_and_H323 http://downloads.digium.com/pub/libpri/releases/libpri-1.4.3.tar.gz
wget -P /usr/src/Asterisk_and_H323 http://downloads.digium.com/pub/asterisk/releases/asterisk-1.4.19.tar.gz


Do not use another release more recent of OpenH323/Pwlib because the dependencies are not stable.

It can arrives sometimes that the compilation doesn't work due to a missing files /usr/include/linux/compiler.h, so it could be nice to create in all case the file below:

vi /usr/include/linux/compiler.h


Below the content of the compiler.h:


#ifndef __LINUX_COMPILER_H
#define __LINUX_COMPILER_H
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
#endif /* __LINUX_COMPILER_H */



Compilation de PWLib:


cd /usr/src/Asterisk_and_H323
tar -xvzf pwlib-v1_10_0-src-tar.gz
cd pwlib_v1_10_0/
./configure --prefix=/usr
make opt
make install
export PWLIBDIR=/usr/src/Asterisk_and_H323/pwlib_v1_10_0


Compilation of the library OpenH323:

cd /usr/src/Asterisk_and_H323
tar -xvzf openh323-v1_18_0-src-tar.gz
cd openh323_v1_18_0
./configure --prefix=/usr
make opt
make install
export OPENH323DIR=/usr/src/Asterisk_and_H323/openh323_v1_18_0


Compilation de Libpri:

cd /usr/src/Asterisk_and_H323
tar -xvzf libpri-1.4.3.tar.gz
cd libpri-1.4.3
make install


Compilation d'Asterisk:

You can observe that there is 2 times the make command, it permits to check if the compilation of H323 has been successfully done, if it is not the case please re-check the step above.

cd /usr/src/Asterisk_and_H323
tar -xvzf asterisk-1.4.19.tar.gz
cd asterisk-1.4.19/
./configure --prefix=/usr
make menuselect (The modification can damage the compilation)
make
make
make install
make samples
make config
asterisk


In case of failure:

- Check the version of the software used. I can certify that all version used on CentOS works correctly. Take care about "./configure --prefix=/usr".

To uninstall:
In the installation folder (/usr/src/Asterisk_and_H323/...): make uninstall et rm

Please find the French version of this HOWTO originally made by my colleague Etienne:

Compiler Asterisk avec H323

17 comments:

Izan said...

Thank you! It worked for me in asterisk 1.4.19.
I can place calls between IAX exten trough H323 trunk...but i have one problem, and it is that the call takes about 30 seconds! to start ringing!.
I only just modify in h323.conf:

[general]
port = 1720
bindaddr = my ip

disallow=all
allow=alaw

It is curious that in one AsteriskNow (1.4.9) with the same config and codecs it place the call Instantly.

When i make one call, i only see:
-- Executing [1000forexample@outgoing:6] Dial("H323/ip$192.XX.141.XX:12160/15817", "H323/1000forexample@192.XX.141.XX:1720|20|tT") in new stack
-- Requested transfer capability: 0x00 - SPEECH

And it takes a looong time to start making the call. About 30 seconds.
Can you help me?

Thank you

constantin said...

Hi Izan,

Have you tried with the option fastart to yes?

Or it could be a problem of port in your H323.conf, check if your port used is correct.

Best Regards.

Gabriel said...

Hi, i did all your steps, when iam gonna run asterisk it drops me:

asterisk: error while loading shared libraries: libh323_linux_x86_64_r.so.1.18.0: cannot open shared object file: No such file or director

i located libh323_linux_x86_64_r.so.1.18.0 and:
/usr/lib/libh323_linux_x86_64_r.so.1.18.0
/usr/lib/asterisk/libh323_linux_x86_64_r.so.1.18.0
/usr/lib/asterisk/modules/libh323_linux_x86_64_r.so.1.18.0
/usr/src/Asterisk_and_H323/openh323_v1_18_0/lib/libh323_linux_x86_64_r.so.1.18.0
looks fine, also did chmod 755 on each link, what am i doing wrong??.

Thanks
Gabriel

johndenver said...

i get the following error when trying to compile the openh3232 drivers:

In file included from /usr/src/openh323_v1_18_0/include/ixjlid.h:277,
from ixjunix.cxx:491:
/usr/include/linux/compiler.h:1:2: error: invalid preprocessing directive #ifndef__LINUX_COMPILER_H
/usr/include/linux/compiler.h:2:2: error: invalid preprocessing directive #define__LINUX_COMPILER_H
/usr/include/linux/compiler.h:5:2: error: #endif without #if
make[1]: *** [/usr/src/openh323_v1_18_0/lib/obj_linux_x86_r/ixjunix.o] Error 1
make[1]: Leaving directory `/usr/src/openh323_v1_18_0/src'
make: *** [opt] Error 2


Any help anyone?

johndenver said...

Found the error, missing spaces in the compiler.h file.

My trunks on the Avaya have gone into Out-of-service near End state since upgrading the drivers. Not sure why. Anyone have an idea on this?

alejandro said...

Constantin, Thank you so much for your helpful post. Im also getting the:

asterisk: error while loading shared libraries: libh323_linux_x86_64_r.so.1.18.0: cannot open shared object file: No such file or directory


Error, i think it might be something about using an X86_64 system. Any ideas?

Daniel said...

Thank you! Finally I got Asterisk compiled with H323, but I have one question... How can I configure Asterisk to accept calls from OpenPhone (h323) and then send it to an external endpoint.

Thank you very much!

Anonymous said...

hi, i have this error when i put:
service asterisk restart

[root@asterisk1 asterisk-1.4.12.1]# service asterisk restart
Shutting down asterisk: /usr/sbin/safe_asterisk: line 117: 3132 Terminado (killed)
nice -n $PRIORITY ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS} >&/dev/${TTY}
< /dev/${TTY}
Asterisk ended with exit status 137
Asterisk exited on signal 9.
Automatically restarting Asterisk.

constantin said...

Wow interesting,

Have you tried /etc/inid.d/asterisk restart ?


Let me know

Omar Perez said...

Hi I am the problem:

[root@asterisk1 asterisk-1.4.12.1]# service asterisk restart
Shutting down asterisk: /usr/sbin/safe_asterisk: line 117: 3132 Terminado (killed)
nice -n $PRIORITY ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS} >&/dev/${TTY}
< /dev/${TTY}
Asterisk ended with exit status 137
Asterisk exited on signal 9.
Automatically restarting Asterisk.

and yes i try whit
/etc/inid.d/asterisk restart
and more....
this error is to when incoming a call from to h323 (avaya)

Omar Perez said...

Hi....
And zaptel????
I not see the compiler from zaptel....

Thanks

OP

Omar Perez said...

Hi... escribire en espanol porque a esta hora no recuerdo mi email... bueno el problema al parecer lo solucione y manana lo pruebo en produccion con la Avaya, al arecer el problema es con el safe_asterisk que se queda reiniciandoce, lo solucione cambiandole unas lineas al archivo /etc/init.d/asterisk en la parte de stop... alli coloque:
stop() {
echo
echo "STOPPING ASTERISK"
pid_length=`pidof asterisk|awk '{print length($0)}'`
if [ "$pid_length" != "0" -a "$pid_length" != "" ]
then
/usr/sbin/asterisk -rx "stop now"
echo "Asterisk Stopped"
fi
}

y al parecer esto fue .. manana comento gracias

Omar Perez said...

Hi....
when i install:
centos 5.2
pwlib-v1_10_3
openh323-v1_18_0
libpri-1.4.7
zaptel-1.4.12.1 (only zdummy)
asterisk-1.4.21.2 (whit h323)
asterisk-addons-1.4.7 (whit out ooh323, mpg)

And put the comand:

service asterisk restart
say the error:

[root@asterisk1 asterisk-1.4.12.1]# service asterisk restart
Shutting down asterisk: /usr/sbin/safe_asterisk: line 117: 3132 Terminado (killed)
nice -n $PRIORITY ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS} >&/dev/${TTY}
< /dev/${TTY}
Asterisk ended with exit status 137
Asterisk exited on signal 9.
Automatically restarting Asterisk.

Solution:
1. In /etc/init.d change the lines stop for:
stop() {
echo
echo "STOPPING ASTERISK"
pid_length=`pidof asterisk|awk '{print length($0)}'`
if [ "$pid_length" != "0" -a "$pid_length" != "" ]
then
/usr/sbin/asterisk -rx "stop now"
echo "Asterisk Stopped"
fi
}
2. In /usr/sbin/safe_asterisk
coment the lines:
#TTY=9
#KILLALLMPG123=1

Thanks

George said...

hello

i also try to connect my asterisk to the avaya using the h323.

the inbound part is working
but the outbound part not

here are my details

h323.conf
[general]
port = 1720 ;port
bindaddr = xx.xx.xx.xx ;asterisk ip
disallow=all
allow=alaw
dtmfmode=inband
gatekeeper = DISABLE
context=survey
progress_setup = 8
progress_alert = 8


[Avaya]
type=friend
context=from-internal
host=xx.xx.xx.xx ;clan ip
port=1720 ;port
disallow=all
allow=alaw
canreinvite=no
dtmfmode=inband
h245tunneling=yes
fastStart=yes

extensions.conf

exten => _007XXXXXXXX,1,Dial(H323/${EXTEN}@Avaya)
exten => _5XXX,1,Dial(H323/${EXTEN}@Avaya)

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
dan rogy said...

My project required to integrate dialer
with voice playing ability, fax detection and digit recognition

I bought
http://voipcore.com
and that guys provide great support