Peer-to-peer SIP call with Android SIP Stack?

久未见 提交于 2019-12-20 10:46:55

问题


I have been looking for a way to set up the Android SIP stack to be able to establish a SIP call between two devices on the same network, in an ad-hoc manner. i.e without REGISTERing to a SIP server.

I have not been able to get this to work, as the SIP Demo includes server registration, and I cannot get it to make or receive a call without this step.

I am not even sure if this is supposed to be possible. The little mention of this I have been able to find is conflicting (some say it can be done with a specific set up which they do not say what is, and some say the Android SIP API is not meant for this).

I was wondering if anyone has got this to work or has any clues as to how I could go about configuring the API for this, as I would like to use the built in SIP API before looking at third party ones.

The application I am developing is an internal one which will always be running on the same devices, so the fact that the SIP API is not present on all devices will not be an issue for me.


回答1:


I have been stuck on the same problematic.

If you can make it without the android sip api, you can look at the rtp api which gives you a bit lower-level tools to make a P2P VOIP application without the need of a server.

To support audio conferencing and similar usages, you need to instantiate two classes as endpoints for the stream:

AudioStream specifies a remote endpoint and consists of network mapping and a configured AudioCodec. AudioGroup represents the local endpoint for one or more AudioStreams. The AudioGroup mixes all the AudioStreams and optionally interacts with the device speaker and the microphone at the same time.

The counterpart is that you have to write your own device discovery protocol in order to know the port used by the audiostream peer as explained in this answer

The problem is not so hard if you only intend to make one-to-one conversation but is a little bit trickier if you want to make one-to-n conversation.

For a one-to-n conversation, the conference host has to instanciate n audiostream for each remote device he wants to call. Each remote peer has only one audiostream linked to one of the host audiostream.




回答2:


You can do this with CSipSimple, which is open source: http://code.google.com/p/csipsimple/

You set up local accounts, register to yourself instead of a server, then make a phone call using TXT mode and dial remote_account_name@remote_ip_address.




回答3:


Sip peer is like an extension number used to configure in sip phone . Please find details for creating sip peer . I am using centos 6.9 64 bit and having installed asterisk 11 You can create sip peer using asterisk server . Goto vi /etc/asterisk/sip.conf

[1001]
username=1001
secret=123
qualify=yes
type=friend
disallow=all
allow=ulaw,alaw,gsm
host=dynamic

For more detail and easy understanding. Please refer given below link

https://youtu.be/27wm-fu25SM

or

http://rulariteducation.blogspot.in/2017/07/how-to-add-sip-peer-in-asterisk.html


来源:https://stackoverflow.com/questions/14525777/peer-to-peer-sip-call-with-android-sip-stack

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!