网络电话pjsip Getting Started: Building for Apple iPhone, iPad and iPod Touch
Getting Started: Building for Apple iPhone, iPad and iPod Touch ¶
- Getting Started
- Preparation
- Build for Desktop
- Build for Mobile
- Build for Other
- Next: Using the libraries
- See Also
- Features
- Requirements
- Build Preparation
- Building PJSIP
- Simulator
- OpenSSL Suport
- Common problems
- Unable to accept incoming call in background mode (iOS4)
- Audio session management issue (iOS7)
- Audio issue (no audio) (iOS7)
- Supporting multiple architectures (armv6, armv7, armv7s, and so on)
- Unable to support Bluetooth input
- Problem with interruption (by a phone call or an alarm), headset plug/unplug, or Bluetooth input
- Sound not working in the simulator
- List of Issues
- Other iPhone Projects
Apple iOS target is supported by PJSIP version 1.7 and later.
Features ¶
Some of the features of the iPhone port:
- it has a native CoreAudio based audio device, which supports the following features:
- the built-in/device's echo canceller
- output volume setting
- change input route to bluetooth input
- change output route
- input latency setting
- output latency setting
- supports for the built-in iLBC codec
- Note: video (from 2.x) is not yet supported on iOS.
Requirements ¶
- iOS SDK, part of Xcode. Apple iPad is supported starting with iPhone SDK 3.2 onwards.
- Command Line Tools for Xcode: download from Apple Developer Downloads then install.
Build Preparation ¶
- Get the source code, if you haven't already.
- Set your config_site.h to the following: #define PJ_CONFIG_IPHONE 1
- #include <pj/config_site_sample.h>
- This will activate iPhone specific settings in the config_site_sample.h.
Building PJSIP ¶
Just run:
$ cd /path/to/your/pjsip/dir
$ ./configure-iphone
$ make dep && make clean && make
For iPhone 5, use armv7s architecture:
$ cd /path/to/your/pjsip/dir
$ ARCH='-arch armv7s' ./configure-iphone
$ make dep && make clean && make
Open ipjsua.xcodeproj using Xcode in pjproject/pjsip-apps/src/pjsua/ios and build the project. You will see telnet instructions on the device's screen. Telnet to this address to operate the application. See PJSUA CLI Manual for commands available. (For release 2.1 and below, ipjsua is located in pjproject/pjsip-apps/src/ipjsua and does not have CLI telnet feature).
Notes:
- the ./configure-iphone is a wrapper that calls the standard ./configure script with settings suitable for iPhone target.
- the latest iPhone SDK version will be selected by default. You may change this by setting IPHONESDK environment variable to the desired SDK path. For ipjsua, select Project-Edit Project Settings-Base SDK and Targets-ipjsua-Get Info-Base SDK to change the SDK version.
- you may pass standard ./configure options to this script too.
- for more info, run ./configure-iphone --help
- other customizations are similar to what is explained in Building with GNU page.
Simulator ¶
To configure the build system for the iPhone simulator:
export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
ARCH="-arch i386" CFLAGS="-O2 -m32 -miphoneos-version-min=4.0" LDFLAGS="-O2 -m32 -miphoneos-version-min=4.0" ./configure-iphone
make dep && make clean && make
Note that the exact paths may vary according to your SDK version.
OpenSSL Suport ¶
Follow the instructions below to enable TLS transport by using OpenSSL:
- Build and install OpenSSL-1.0.0 for iPhone by following these instructions or OpenSSL-0.9.8o with these instructions.
- Specify OpenSSL location when running configure-iphone, for example (with Bash): export OPENSSL=${HOME}/openssl/openssl_arm
- export CFLAGS="-O2 -Wno-unused-label -I${OPENSSL}/include"
- export LDFLAGS="-L${OPENSSL}/lib"
- ./configure-iphone
- And check that OpenSSL is detected by the configure script: ...
- checking for OpenSSL installations..
- checking openssl/ssl.h usability... yes
- checking openssl/ssl.h presence... no
- aconfigure: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!
- aconfigure: WARNING: openssl/ssl.h: proceeding with the compiler's result
- checking for openssl/ssl.h... yes
- checking for ERR_load_BIO_strings in -lcrypto... yes
- checking for SSL_library_init in -lssl... yes
- OpenSSL library found, SSL support enabled
- ...
- Build the libraries: make dep && make
- In XCode project setting of your application (for example, ipjsua), add libssl.a and libcrypto.a from OpenSSL ARM directory to the project's Libraries:
- In Group & Files pane, expand ipjsua, then right click Libraries, and select Add -> Existing Files....
- Find libssl.a and libcrypto.a from OpenSSL ARM directory (for example, ${HOME}/openssl/openssl_arm) and add them to the project.
- Build the app
Common problems ¶
Unable to accept incoming call in background mode (iOS4) ¶
If while in the background, ipjsua (or your application) is unable to detect if there is an incoming call and display the local notification:
- Note that background feature only works with TCP.
- Make sure that voip is included in the required background modes (UIBackgroundModes) in the application’s Info.plist file.
- Make sure that the TCP socket is successfully wrapped with CFReadStreamRef (check if there is a message: "Failed to configure TCP transport for VoIP usage").
- Check whether you can accept the incoming call by bringing the app to the foreground. If yes, make sure that the incoming call request comes from the wrapped TCP socket (check the log for the INVITE request).
Note: these steps do not troubleshoot audio problems.
Audio session management issue (iOS7) ¶
Since the deprecation of C-interface Audio Session API in iOS 7 SDK, PJSIP now uses AVAudioSession to set audio session category (to PlayAndRecord?) and activate/deactivate audio session. Application will need to do its own audio session management to handle input/output route and notifications (interruption, media server reset, etc). Please refer to Apple's official doc on Audio Session Programming Guide and our ticket #1697.
Audio issue (no audio) (iOS7) ¶
There are a few reports that the audio is not working on iOS 7 (so far it's only reported to happen in iPhone 5) after getting the following error:
iPhone mediaserverd[45] <Error>: 10:53:59.986 ERROR: [0x240b000] 740: _vp: initialize hw input: fs mismatched! REF=0.000000Hz, MIC=44100.000000Hz
iPhone mediaserverd[45] <Error>: Resampler2 bad sample rate(s) : 0.00 16000.00
One solution is to set the sound device's clock rate to 44100 Hz as to avoid resampling.
Supporting multiple architectures (armv6, armv7, armv7s, and so on) ¶
You need to compile separately for each architecture. If your iPhone SDK has llvm-gcc compiler (which is the supported compiler starting iOS SDK 5) or clang, then you need to set ARCH environment variable to the desired architecture before running configure-iphone, for example:
export ARCH = "-arch armv6"
Then you need to combine the resulting libraries using the lipo command. For example:
lipo -arch armv6 lib/armv6/libpjlib.a -arch armv7 lib/armv7/libpjlib.a -create -output lib/libpjlib.a
Unable to support Bluetooth input ¶
Since Bluetooth input support is only available for iOS 3.1 or later, you need to specifically specify that your deployment target is iOS 3.1 or above. You can do this either in user.mak:
export CFLAGS += -D__IPHONE_OS_VERSION_MIN_REQUIRED=30100
or in config_site.h:
#define __IPHONE_OS_VERSION_MIN_REQUIRED 30100
You need to recompile PJSIP after this.
Problem with interruption (by a phone call or an alarm), headset plug/unplug, or Bluetooth input ¶
For devices running iOS 4.0 or later, you need to enable your application to respond to remote-control events. This allows PJSIP to properly receive and process the above events. You can do this by adding the following code in your application:
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
For more details, please refer to Apple's doc on Remote Control of Multimedia.
Sound not working in the simulator ¶
Go to System Preferences > Sound > Sound Effects and then uncheck and recheck "Play user interface sound effects". If it still doesn't work, you can try some other suggestions here.
List of Issues ¶
iPhone: Echo cancellation may not work on iOS using SDK 4.x
iPhone: Long delay when calling AudioConverterNew() causing timeout in acquiring pjsua lock (thanks Bogdan Krakowski the report)
Incoming TCP connection on iPhone iOS4 BG mode would fail over and over with EAGAIN error (thanks Bogdan Krakowski for the report)
Crash in coreaudio_dev (iPhone OS) when there is no call during a GSM interruption
Fix crash in coreaudio_dev's interruptionListener (iPhone OS) and support for multiple interrupted streams (thanks to Seth Hinze for the patch)
iPhone: Fix problems with echo cancellation and Bluetooth input (SDK 4.x)
iPhone: UDP socket send error after waking up from background mode (thanks Joe Meade for the report)
iPhone (info only): No audio in calls if app is woken up from background mode without network connectivity (thanks Joe Meade for the report)
Long delay in iPhone initialization (thanks Guy Zelkha for the report)
Crash in iPhone iOS when trying to make a call after the application is left running for days (thanks Alejandro Orellana for the report)
Assertion may be raised if iPhone app woken up to perform registration and the server is down (thanks Alejandro Orellana for the report)
Use CFHost API for pj_getaddrinfo() on iPhone OS
Build correctness on non-video platforms (Symbian, iPhone, Windows Mobile)
Fixes assertion when interruptionListener is called from an unregistered thread on iPhone OS (thanks to Ilya Kalinin for the patch)
Disable local host resolution on iPhone OS
Handle socket failure in STUN resolution when coming back from iPhone/iOS background mode
Other iPhone Projects ¶
Also have a look at these PJSIP iPhone ports by pjsip users:
- Siphon Project by Samuel Vinson
- iPhone Audio Driver by Voalté
- TabikPhone, an adaptation of Sipphone code from V-Net Corp
Attachments
网络电话pjsip Getting Started: Building for Apple iPhone, iPad and iPod Touch的更多相关文章
- iOS 图标、图形尺寸? iPhone、iPad、 iPod touch
链接地址:http://www.zhihu.com/question/20248971 著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处.作者:刘剑链接:http://www.zhi ...
- Apple iPhone 12 Pro 数据迁移方式 All In One
Apple iPhone 12 Pro 数据迁移方式 All In One iPhone 12 Pro https://mp.weixin.qq.com/s/US1Z_69zVQIhV-cNW1E6A ...
- 【优秀的iPhone/iPad数据恢复工具】Omni Recover for Mac 2.5
[简介] 今天和大家分享最新的 Omni Recover for Mac 2.5 版本,这是一款Mac上优秀的iPhone/iPad设备数据恢复工具,支持恢复误删除的短信.照片.视频.文档.通话记录等 ...
- 吐槽 Apple iPhone 十大反人类的设计 All In One
吐槽 Apple iPhone 十大反人类的设计 All In One 不支持 GPS 快捷开关 每次都要到,设置> 隐身 > 位置,脑残的设计 顶部的状态栏,网络不支持显示网速 顶部的状 ...
- 最新 Apple iPhone 12 价格 All In One
最新 Apple iPhone 12 价格 All In One 美版价格 Apple iPhone 12 mini $699 Apple iPhone 12 $799 Apple iPhone 12 ...
- 忘记Apple ID密码,如何从iPhone/iPad上移除iCloud账号
忘记Apple ID密码?不用担心!在本文中,我们将分享3种有效方法,即使您不知道密码,也可以轻松移除iPhone或iPad设备上的iCloud账号. 注意:移除iCloud 账号前请备份数据 在开始 ...
- HOWTO: Create native-looking iPhone/iPad applications from HTML, CSS and JavaScript
HOWTO: Create native-looking iPhone/iPad applications from HTML, CSS and JavaScript Though it's not ...
- 【Openvpn】iOS OpenVPN客户端设置指南(适用iPhone/iPad)
适用于iPhone/iPad/这些iOS设备.之前iOS使用OpenVPN是需要越狱的,并且是付费第三方应用. 去年开始OpenVPN官方推出了iOS客户端就好用多了,免费也无需越狱. 说明:如果是新 ...
- 强制关闭iPhone iPad AppleWatch MacOS
iPhone/iPad 强制关闭APP:按住Power(电源键),出现关机界面松开,按住Home键9秒左右. 强制重启/关机:同时按住Power和Home键几秒后重启,出现logo时松开Home继续按 ...
随机推荐
- 【Unity】动态调用其他脚本的函数
本文转载自:http://blog.csdn.net/smilingeyes/article/details/17767269 第一种,被调用脚本函数为static类型,调用时直接用 脚本名.函数名( ...
- 利用GDB对程序进行调试
第一章初涉调试会话 调试工具 GDB,Unix下最常用的调试工具 DDD,基于GUI的调试器,大多数工具都是GDB的GUI前端. Eclipse,IDE也是一种调试工具 atoi( )把字符串变为整数 ...
- 如何在WebService中重载方法
1. 本来在WebService中这样写的重载方法,如下所示: [WebService(Namespace = "http://tempuri.org/")] [WebSer ...
- Java-ThreadLocal,Java中特殊的线程绑定机制
在DRP项目中,我们使用了ThreadLocal来创建Connection连接,避免了一直以参数的形式将Connection向下传递(传递connection的目的是由于jdbc事务要求确保使用同一个 ...
- python_matplotlib知识点总结
文作为学习过程中对matplotlib一些常用知识点的整理,方便查找. 强烈推荐ipython无论你工作在什么项目上,IPython都是值得推荐的.利用ipython --pylab,可以进入PyLa ...
- Python 变量类型和运算符
-*- coding:utf-8 -*- ''' if语法 if conditon: [tab键] command [tab键] command ... else: [tab键] command [t ...
- java中main函数解析
从写java至今,写的最多的可能就是主函数 public static void main(String[] args) {} 但是以前一直都没有问自己,为什么要这么写,因为在c语言中就没有这样子的要 ...
- mysql的优化:官网地址
http://dev.mysql.com/doc/refman/5.1/zh/optimization.html#index-merge-optimization
- samtools faidx 命令处理fasta序列
samtools faidx 能够对fasta 序列建立一个后缀为.fai 的文件,根据这个.fai 文件和原始的fastsa文件, 能够快速的提取任意区域的序列 用法: samtools faidx ...
- 最新版ChemDraw 15.1 免费获取下载
ChemDraw 15.1 Pro是最新版的ChemOffice套件的个人生产力工具,它可以帮助科学家有效地捕捉和分享工作内容,通过可视化功能对结果获得更深入的了解.现在为大家带来好消息,ChemOf ...