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

2019-03-13 13:36发布

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.

标签: android sip voip
3条回答
来,给爷笑一个
2楼-- · 2019-03-13 13:55

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
查看更多
虎瘦雄心在
3楼-- · 2019-03-13 13:56

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.

查看更多
啃猪蹄的小仙女
4楼-- · 2019-03-13 14:00

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.

查看更多
登录 后发表回答