Three different network which are Telecom, PSTN, IP will be integrated in the future. So, more and more applications such as audio, video, file share will become more popular. Because of this, I will introduce H323plus open source project, this article is responsible for building of ptlib, h323plus, sample for newcomers which are interest in voip technology. I will implement another example using h323plus and wxWidgets for UI.
Here are some stuff which are important and necessary for learning, as following,
1. Src: http://www.h323plus.org/
2. Environment: http://www.opalvoip.org/wiki/index.php?n=Main.BuildingPTLib
3. Server: http://sourceforge.net/scm/?type=cvs&group_id=4797
http://sourceforge.net/projects/openh323gk/files/
4. MCU: http://www.csis.pace.edu/i2/wvc/primer/MCU.html
5. P2P of UDP through NAT principle and implementation:
http://midcom-p2p.sourceforge.net/draft-ford-midcom-p2p-01.txt
http://www.ppcn.net/n1306c2.aspx
6. Doc: http://www.itu.int/rec/T-REC-H.323/en
7. Other: http://en.wikipedia.org/wiki/Comparison_of_VoIP_software
http://wotug.org/parallel/nhse/ptlib/
8. PDF: openh323.pdf [OPENH323源码分析]
Openh323-RTH323.pdf [如何成功的运用OPENH323来开发商业的H.323协议栈]
Now let’s build the ptlib project, should use more convenient way to control and compile. Firstly, create a dir just like voip which hold all project and dependencies, and then use dos command ‘subst’ to redirect this dir, eg,
subst r: D:/opensource/voip
maybe you can save this clause into batch file and automatically execute on setup windows. Check environment configuration and set all dependencies in detail2. Here are settings,
[dirs]
c:/tools //flexbistion
c:/openssl //support encryption and authentication
r:/expat-2.0.1 //support xml
r:/openldap-2.1.17 //support the LDAP protocol
r:/sdl-1.2.14 //support fast drawing of video into windows
r:/mysql //mysql runtime library
r:/directshow //direct show runtime library
r:/ptlib //ptlib source code
r:/h323plus //h323plus source code
r:/gatekeeper //server source code
r:/h323plus/samples/myphone //copy myphone example source code from install
//dir to this dir and configure
r:/h323plus/plugins/ //both audio and video codec source code, make sure
//output dlls into r:/h323plus/bin
[vc++ Directories]
Executable files: c:/tools
r:/ptlib/lib //make sure MergeSym.exe in this dir
Include files: r:/ptlib/include
Library files: r:/ptlib/lilb
[build order]
Configure project
PTLib Static project
MergeSym project //make sure output MergeSym.exe to correct dir
PTLib Dll project
Will produce ptlib.dll in release and ptlibd.dll in debug.
Start building…… um, now you can take a break and drink coffee.
Next, let’s take a look at myphone example source code, it’s awful and have three types of compile error while building at the first time, here give one resolution,
1. virtual function overwrite error. It is easy to change.
2.doesn’t load codec library and logical error. Here just give some correct code,
Virtual void OnStartup() // MyPhone.h
{
TCHAR szFileName[MAX_PATH] = {0};
If ( GetModuleFileName(NULL, szFileName, MAX_PATH) ) {
CString str(szFileName);
CString szExeDir = str.Lef(str.ReverseFind(‘//’));
//szExeDir += _T(“//plugin//”);
PPluginManager::AddPluginDirs((const TCHAR*)szExeDir);
}
else {
PTRACE(3, “PLGUIN/tCannot load plugin dlls.”);
}
…… //original code
}
In MyPhoneEndPoint.cpp exist some stuff for creating grabber, make sure open firstly then SetFrameSize and SetColourFormatConverter, as following,
#include <dshow.h>
PString CMyPhoneEndPoint::VideoInputDriver = “DirectShow”;
//#if defined(P_DSHOW) || defined(P_DIRECTSHOW)
// #pragma message(“-->DirectShow Enabled”)
// #include <ptlib/dshow.h>
// PString CMyPhoneEndPoint::VideoInputDriver = “DirectShow”;
//#else
// PString CMyPhoneEndPoint::VideoInputDriver = “VideoForWindows”;
//#endif
If (NoDevice || // in OpenVideoChannel function
!grabber->Open(deviceName, FALSE) ||
!grabber->SetColourFormatConverter(“YUV420P”) ||
!grabber->SetFrameSize(videoWidth, videoHeight) )
3. if not video, because your local machine not support video capability or fail to load codec library. You must understand the concept of endpoint capabilities and fixed this bug. Here we go, you can input local host or ip[127.0.0.1] and communicate with yourself.
4. Don’t confuse the variable of ‘config’ of endpint, its value will be initialized by regedit, the whole path:
/HKEY_CURRENT_USER/Software/MyPhone2/MyPhone2/CurrentVersion/Options
5. if you want to communicate with other people in another subnet, must configure a
public server using gatekeeper, suppose server ip is 61.192.255.61. Set client some configuration at Gatekeeper tab page,
[check] Use Gatekeeper
[check] Discover by Host --- 61.192.255.61
Add user aliases: testgk [alias name for calling by other people]
hoho, the end, good luck to you!