java 如何在 Android 上使用 PJSIP?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26552353/
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 use PJSIP on Android?
提问by dephinera
I lost hours of searching and reading. I didnt really understand how to work with PJSIP.
我失去了数小时的搜索和阅读时间。我真的不明白如何使用PJSIP。
I have some questions about it:
我对此有一些疑问:
- Can you explain how actually this library is used when developing for Android?
- When I build the library do I use only Java code or defintely I'll have to write in C++?
- My goal is encrypted VOIP Application for Android.
- Is there a good documentation with description of all methods, fields and constructors?
- Do you have any references to some tutorials or samples?
- 你能解释一下这个库在为 Android 开发时是如何使用的吗?
- 当我构建库时,我是只使用 Java 代码还是我必须用 C++ 编写?
- 我的目标是为 Android 加密 VOIP 应用程序。
- 是否有描述所有方法、字段和构造函数的良好文档?
- 您是否对某些教程或示例有任何参考?
回答by nnb
I am assuming that you are familiar with PjSIP and have some experience using some of the APIs, at least from the top level layer, viz. Pjsua.
我假设您熟悉 PjSIP 并且有一些使用某些 API 的经验,至少在顶层,即。普苏阿。
If that's true, you can go ahead and take a look into the CSipSimpleproject. Its an open source Android project based on PjSIP.
如果这是真的,您可以继续查看CSipSimple项目。它是一个基于 PjSIP 的开源 Android 项目。
You can try out the app from the Google Playstore and see if it fits your needs before you start modifying the source.
在开始修改源代码之前,您可以从Google Play商店试用该应用程序,看看它是否符合您的需求。
EDIT: Since you say, you are new to PjSIP, I suggest you get familiar with it on desktop platform first.
编辑:既然你说你是 PjSIP 的新手,我建议你先在桌面平台上熟悉它。
First of all you will need to build all the PjSIP libraries for your target platform. Then include those libraries in your application and start using the APIs. To begin with you can achieve almost all the SIP features you require using the PJSUA API - High Level Softphone API. PjSUA stands for PjSIP User Agentand its actually a command line softphone in itself. The APIs in PjSUA-lib are categorized based on their functionality like transport creation, account registration, call handling, media handling etc. and you can find links to each category in the previous link. That will give you a good documentation with description of all methods, fields and constructors.
首先,您需要为目标平台构建所有 PjSIP 库。然后将这些库包含在您的应用程序中并开始使用 API。首先,您可以使用PJSUA API - 高级软件电话 API实现几乎所有您需要的 SIP 功能。PjSUA 代表PjSIP 用户代理,它本身实际上是一个命令行软件电话。PjSUA-lib 中的 API 根据它们的功能进行分类,例如传输创建、帐户注册、呼叫处理、媒体处理等,您可以在上一个链接中找到每个类别的链接。这将为您提供一个很好的文档,其中包含所有方法、字段和构造函数的描述。
I suggest you go through the sample application Simple PjSUAwhich will get you familiar with the way of initializing PjSIP, account registration, how to handle incoming INVITE in the case of an incoming call, how to make an outbound call and how to handle the call media.
我建议您通过示例应用程序Simple PjSUA熟悉初始化PjSIP 的方式、帐户注册、来电时如何处理INVITE、如何拨打电话以及如何处理来电媒体。
Coming to Android you can either go ahead and use the CSipSimple which uses a modified version of pjsip-jni. Else you can build pjsip for Android following the intructions here.
来到 Android,您可以继续使用 CSipSimple,它使用 pjsip-jni 的修改版本。否则,您可以按照此处的说明为 Android 构建 pjsip 。
Hope this helps.
希望这可以帮助。
回答by Marc Schmitt
Useful Links:
有用的链接:
This thread is pretty old but I've recently used PJSIP with android. If you can get pjsip to build correctly, which a major feat considering the numerous issues when trying to build for android and openssl(if you want encryption), it's a good library to work with on android.
这个线程已经很老了,但我最近在 android 上使用了 PJSIP。如果您可以让 pjsip 正确构建,考虑到尝试为 android 和 openssl 构建时的众多问题,这是一项重大壮举(如果您需要加密),它是一个可以在 android 上使用的好库。
The PJSUA2 api is what you'll use to work with PJSIP on android. The entire library is written in java and fairly easy to learn and work with. The PJSUA2 documentation will help with most issues, but if you run into errors you'll have to google it until you figure it out.
PJSUA2 api 是您将用于在 android 上使用 PJSIP 的。整个库是用 java 编写的,相当容易学习和使用。PJSUA2 文档将帮助解决大多数问题,但如果您遇到错误,则必须在 google 上找到它,直到弄清楚为止。
I found that the CSipSimple project does not provide a good reference for people who are completely new to PJSIP. However, this is just my opinion.
我发现 CSipSimple 项目并没有为 PJSIP 的新手提供很好的参考。然而,这只是我的意见。
On Android, once you get it all set up, it's as simple as just following the instructions on the PJSUA2 documentation to get calls working. Video takes a bit more effort, but is still achievable.
在 Android 上,一旦您完成所有设置,只需按照 PJSUA2 文档中的说明进行操作即可使呼叫正常工作。视频需要更多的努力,但仍然可以实现。
Also at the time of posting you still have to use Eclipse ADT to work with PJSIP for android; android studio still does not support the NDK.
同样在发布时,您仍然必须使用 Eclipse ADT 来使用 PJSIP for android;android studio 仍然不支持 NDK。