Port exosip to android platform isn't a difficult task because exosip doesn't rely on any special system calls that aren't available on android. It only requires osip to compile, which can also be easily ported.
As an example, I created two applications to run against exosip lib. One is a native application that can run inandroid shell, the other is an java application that interact with exosip through jni. The dependency relationship between modules is:
The diagram below depicts the organization of files. They're organized this way so that they can be compiled through android ndk build system.
- libosip
- libexosip
- sip_exe
- sip_jni
- jni
- Android.mk
- source files
- libs
- armeabi
- libosip.so
- libexosip.so
- armeabi
- src
- java source files
- AndroidManifest.xml
- jni
To comply with ndk build system's requirements, we create a directory named jni under sip_jni and sip_exe module, and place actual source file there. The Android.mk and Application.mk (optional) are placed in the jni directory as well. Keeping files this way, we can issue ndk-build command right in sip_jni or sip_exe directories to compile applications.
Note that we don't create jni directory for libosip and libexosip, their Android.mk is placed directly under libosipand libexosip directories. This is because they are dependent on by application modules. We don't need compile them directly, instead, the build system will build them automatically while building applications. In order to help build system find libosip and libexosip, we must set NDK_MODULE_PATH environment variable to the directory that directly containing libosip and libexosip. The build system will search for them based on directory name, so their names matter.
To port exosip to android, the essential task is to create the Android.mk file, which specifies source files, c flags, ld flags, dependent libraries. We define HAVE_TIME_H and HAVE_SYS_SELECT_H to compile exosipsuccessfully. And we define ENABLE_TRACE and OSIP_MT to enable logging and multi-threading. In the last line, $ ( call import - module , libosip ) tells the build system that exosip depends on osip, and all header files exported by osip ( LOCAL_EXPORT_C_INCLUDES := $ ( LOCAL_C_INCLUDES ) ) will be included by exosipautomatically.
import-module is a feature that isn't available in the build system in android source tree. It enables us organizing our projects in arbitrary manner. For example, we can place libosip and libexosip directories in another directory. The build system can still find them as long as NDK_MODULE_PATH is set to the directory containing them. It's much more flexible than specifying dependency relationship with relative path.
Sample:
The sample for this post is available at:
http://code.google.com/p/rxwen-blog-stuff/source/browse/trunk/android/exosip_sample/
It shows how to:
- use ndk build system
- use stl in c++ code
- create a very basic exosip application
- call native code from java
- call java code from native code
References:
ndk document
exosip user manual
相关推荐
使用Android NDK编译Android平台的eXosip库,有静态库和动态库。
使用ndk编译eXosip安卓端库执行脚本,ndk编译需要指定configure参数及设置相关路径,
linphone项目中sip协议层exosip协议分析
exOsip使用
介绍exoSip开发流程和调用方法,及有关宏定义说明,适合初学者查阅.
exoSip开发手册.pdf
exosip开发手册 exosip 教程
该程序用VC书写,它可实现基于EXOSIP协议栈的终端,用于注册服务器部分
eXosip2 has support for: * registrations. (REGISTER) * call initiation and modification. (INVITE, re-INVITE) * other methods within calls ... This allow you to write any kind of SIP endpoint/gateway.
osip和exosip的使用 osip.dll和osip.lib的编译
可直接调用的exosip动态库,可直接用于GB28181认证
exosip 开发文档,英文英文, 新版本 eXosip用户手册
exoSip开发者手册.doc oSip
exoSip开发手册详细版,带word文档!!!!!!!!!1
exosip和jsip源码
eXosip开发手册,osiop协议栈,sip协议
exoSip+开发者手册,在源文件的基础上进行了整理,编排了格式,使整个文档更加清晰,明了.我自己打印了一份,也在学习中......
工作需要收集到的sip+osip+exosip资料集合。内容如下 exoSip开发手册.pdf libeXosip2-3.3.0.tar.gz libosip2-3.3.0.tar.tar libosip reference manual.pdf oSIP开发者手册.doc oSIP协议栈(及eXoSIP,Ortp等)使用入门....