如何为 Xcode 构建和编译 PJSIP,使用示例代码 IPJSUA 进行测试?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11848333/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How To Build and Compile PJSIP for Xcode, Using sample code IPJSUA to test?
提问by Alfred Angkasa
How to build and compile PJSIP using xCode and run the sample code IPJSUA?
如何使用 xCode 构建和编译 PJSIP 并运行示例代码 IPJSUA?
回答by Alfred Angkasa
First, you need to open the terminal. Terminal can be found at Applications->Utilities->terminal. After you open the terminal, make sure you point to the desktop to make it easier to get the data folder. just type :
首先,您需要打开终端。终端可以在 Applications->Utilities->terminal 中找到。打开终端后,请确保指向桌面,以便更轻松地获取数据文件夹。只需输入:
cd Desktop
光盘桌面
Congrats, you already at your desktop. Now continue to type this.
恭喜,你已经在你的桌面上了。现在继续输入这个。
svn co http://svn.pjsip.org/repos/pjproject/trunkpjproject
svn co http://svn.pjsip.org/repos/pjproject/trunkpjproject
That code means you download the pjproject from the website to your desktop. After you finish download the PJSIP, you need to add a config_site.h. Honestly, I don't what should we do that, but just follow it. :D
该代码意味着您将 pjproject 从网站下载到您的桌面。下载完 PJSIP 后,您需要添加一个 config_site.h。老实说,我不知道我们应该做什么,但只是遵循它。:D
How to create a config_site.h? Just copy the config_site_sample.h, paste, and change the content become like this.
如何创建 config_site.h?复制config_site_sample.h,粘贴,把内容改成这样就可以了。
After this, we need to change the configure-iphone. I figured it out. If you just want to run at simulator you need to change the DevPath. If you want to test on device, just leave it be.
在此之后,我们需要更改configure-iphone。我想到了。如果您只想在模拟器上运行,则需要更改 DevPath。如果您想在设备上进行测试,请保持原样。
Now, I will give example to run at simulator. Ppen the pjproject, you will find the configure-iphone. Ppen the file using textfield. and change the DEVPATH and hardcode the IPHONESDK.
现在,我将举例在模拟器上运行。打开pjproject,你会发现configure-iphone。使用文本字段打开文件。并更改 DEVPATH 并对 IPHONESDK 进行硬编码。
The devpath will looks like this.
devpath 将如下所示。
DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
Remember, this refer to your Xcode. If you want to make sure, go to finder->applications->xcode->show package contents. I also hardcoded the IPHONESDK.
请记住,这是指您的 Xcode。如果你想确定,去 finder->applications->xcode->show package contents。我还对 IPHONESDK 进行了硬编码。
IPHONESDK=iPhoneSimulator5.1.sdk
IPHONESDK=iPhoneSimulator5.1.sdk
After you're done with that, we will going back to the terminal. Make sure you already at the pjproject folder. Type this.
完成后,我们将返回终端。确保您已经在 pjproject 文件夹中。输入这个。
export CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc
export CFLAGS="-O2 -m32 -miphoneos-version-min=5.0 -g -ggdb -g3 -DNDEBUG"
export LDFLAGS="-O2 -m32"
export CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc
导出 CFLAGS="-O2 -m32 -miphoneos-version-min=5.0 -g -ggdb -g3 -DNDEBUG"
导出 LDFLAGS="-O2 -m32"
After that, you can configure it. Just click this on terminal. If you want to test on your device, you don't need to change the configure-iphone, export CC, etc., just directly configure-iphone.
之后,您可以对其进行配置。只需在终端上单击它。如果你想在你的设备上测试,你不需要改变configure-iphone,export CC等,直接configure-iphone就可以了。
./configure-iphone
./configure-iphone
After you're done, continue with this code.
完成后,继续使用此代码。
make dep && make clean && make
make dep && make clean && make
You will find that all the library already compile. This library can help us if we want to create a new project. -> this is what I'm thinking right now. And you almost finish, just go to the pjsip-apps->src->ipjsua. You will find the Xcode project, just click it to open at your xcode. Click build and run. You will find the interface like this.
你会发现所有的库都已经编译好了。如果我们想创建一个新项目,这个库可以帮助我们。-> 这就是我现在的想法。你快完成了,只需转到 pjsip-apps->src->ipjsua。您将找到 Xcode 项目,只需单击它即可在您的 xcode 中打开。单击构建并运行。你会发现这样的界面。
If you want to test on your device, you must have the certificate and private key chain. I can't explain that because I got that certificate from my company. They provide it.
如果您想在您的设备上进行测试,您必须拥有证书和私钥链。我无法解释,因为我从我的公司获得了该证书。他们提供。
If you want to try, you must create a SIP account first. You can use sip2sip or ekiga. At here I tried ekiga. for example my SIP is [email protected] and [email protected].
如果你想尝试,你必须先创建一个 SIP 帐户。您可以使用 sip2sip 或 ekiga。在这里,我尝试了 ekiga。例如我的 SIP 是 [email protected] 和 [email protected]。
After the simulator we key in +a to add new account. Next you will have to type your SIP name. remember to type "sip:". dont ever forget. here is the example:sip:[email protected].
在模拟器之后,我们键入 +a 以添加新帐户。接下来,您必须键入您的 SIP 名称。记得输入“sip:”。永远不要忘记。这是示例:sip:[email protected]。
After that you will have to type the URL address, just type ekiga.net since that is our URL. This URL means our server. Tor example, sip:ekiga.net.
之后,您必须输入 URL 地址,只需输入 ekiga.net,因为这是我们的 URL。此 URL 表示我们的服务器。Tor 示例,sip:ekiga.net。
Next is the auth realm. Type the same as the URL address, sip:ekiga.net. Next is your username. In here my username is 12345678. You don't need to add sip or type with @ekiga.net. Last is your password. After you register, it will add automatically to the account. Just go to the textfield, and hit enter. It will refresh for you.
接下来是身份验证领域。输入与 URL 地址相同的 sip:ekiga.net。接下来是您的用户名。在这里,我的用户名是 12345678。您不需要添加 sip 或使用 @ekiga.net 键入。最后是你的密码。注册后,它会自动添加到帐户中。只需转到文本字段,然后按 Enter。它会为你刷新。
Next, we need to add buddy. Type +b
, and you must input the URI address. Type sip:[email protected]
and you are done. Back to the textfield, it will add automatically to your buddy list.
接下来,我们需要添加好友。键入+b
,您必须输入 URI 地址。输入sip:[email protected]
,你就完成了。回到文本框,它会自动添加到您的好友列表中。
You will see, your account still in offline mode. You need to change into online mode before you make a call. Just change the status by type t, and hit enter.
您会看到,您的帐户仍处于离线模式。您需要在拨打电话之前更改为在线模式。只需按类型 t 更改状态,然后按 Enter。
After that you can make a call by type M. and type 1. because our buddy is no 1. 1 is their ID. and you can make a call.
之后就可以按M. 和1. 拨打电话,因为我们的好友不是1。1 是他们的ID。你可以打电话。
回答by Ganesh Guturi
Please check below link. You can get source code from there and biuld for both device and simulator.
请检查以下链接。您可以从那里获取源代码并为设备和模拟器构建。
https://github.com/radif/SIPHON-SIP-Client-that-actually-compiles
https://github.com/radif/SIPHON-SIP-Client-that-actually-compiles
回答by OsTaLaKaR
For XCode 4.5
对于 XCode 4.5
->
->
export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/
export IPHONESDK=iPhoneSimulator5.1.sdk
export CC=/Applications/Xcode.app/Contents/Developer/usr/bin/gcc