简体   繁体   English

如何在 Android 上使用 PJSIP?

[英]How to use PJSIP on Android?

I lost hours of searching and reading.我失去了数小时的搜索和阅读时间。 I didnt really understand how to work with PJSIP .我真的不明白如何使用PJSIP

I have some questions about it:我对此有一些疑问:

  1. Can you explain how actually this library is used when developing for Android?你能解释一下这个库在为 Android 开发时是如何使用的吗?
  2. When I build the library do I use only Java code or defintely I'll have to write in C++?当我构建库时,我是只使用 Java 代码还是我必须用 C++ 编写?
  3. My goal is encrypted VOIP Application for Android.我的目标是为 Android 加密 VOIP 应用程序。
  4. Is there a good documentation with description of all methods, fields and constructors?是否有描述所有方法、字段和构造函数的良好文档?
  5. Do you have any references to some tutorials or samples?你有一些教程或示例的参考吗?

Useful Links:有用的链接:

This thread is pretty old but I've recently used PJSIP with android.这个线程已经很老了,但我最近在 android 上使用了 PJSIP。 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.如果您可以让 pjsip 正确构建,考虑到尝试为 android 和 openssl 构建时的众多问题,这是一项重大壮举(如果您需要加密),这是一个在 android 上使用的好库。

The PJSUA2 api is what you'll use to work with PJSIP on android. PJSUA2 api 是您将用于在 android 上使用 PJSIP 的工具。 The entire library is written in java and fairly easy to learn and work with.整个库是用 java 编写的,相当容易学习和使用。 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 文档将帮助解决大多数问题,但如果您遇到错误,则必须在 google 上找到它,直到弄清楚为止。

I found that the CSipSimple project does not provide a good reference for people who are completely new to PJSIP.我发现 CSipSimple 项目并没有为 PJSIP 的新手提供很好的参考。 However, this is just my opinion.然而,这只是我的意见。

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.在 Android 上,一旦您完成所有设置,只需按照 PJSUA2 文档中的说明进行操作即可使呼叫正常工作。 Video takes a bit more effort, but is still achievable.视频需要更多的努力,但仍然可以实现。

Also at the time of posting you still have to use Eclipse ADT to work with PJSIP for android;同样在发布时,您仍然必须使用 Eclipse ADT 来使用 PJSIP for android; android studio still does not support the NDK. android studio 仍然不支持 NDK。

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.我假设您熟悉 PjSIP 并且有一些使用某些 API 的经验,至少在顶层,即。 Pjsua.普苏阿。

If that's true, you can go ahead and take a look into the CSipSimple project.如果这是真的,您可以继续查看CSipSimple项目。 Its an open source Android project based on PjSIP.它是一个基于 PjSIP 的开源 Android 项目。

You can try out the app from the Google Play store 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.首先,您需要为目标平台构建所有 PjSIP 库。 Then include those libraries in your application and start using the APIs.然后将这些库包含在您的应用程序中并开始使用 API。 To begin with you can achieve almost all the SIP features you require using the PJSUA API - High Level Softphone API .首先,您可以使用PJSUA API - 高级软件电话 API实现几乎所有您需要的 SIP 功能。 PjSUA stands for PjSIP User Agent and its actually a command line softphone in itself. PjSUA 代表PjSIP 用户代理,它本身实际上是一个命令行软件电话。 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. PjSUA-lib 中的 API 根据它们的功能进行分类,例如传输创建、帐户注册、呼叫处理、媒体处理等,您可以在上一个链接中找到每个类别的链接。 That will give you a good documentation with description of all methods, fields and constructors.这将为您提供一个很好的文档,其中包含所有方法、字段和构造函数的描述。

I suggest you go through the sample application Simple PjSUA which 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.来到 Android,您可以继续使用 CSipSimple,它使用 pjsip-jni 的修改版本。 Else you can build pjsip for Android following the intructions here .否则,您可以按照此处的说明为 Android 构建 pjsip。

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM