SIP support for Cordova/Phonegap

自古美人都是妖i 提交于 2019-12-22 04:16:34

问题


Is there any possibility to use SIP in Cordova/Phonegap? I've not found any plugin, yet. Support for WebRTC is also not available (but planned in 2.x, according to their roadmap).


回答1:


Supporting SIP or WebRTC on Android has nothing to do with PhoneGap/Cordova, even though they could be added as some extension but naturally they come with the browser provided to PhoneGap by the OS. Right now you need to look for external libraries to do that for you.

You may add an extension to your PhoneGap (written in Java) yourself to communicated to some SIP server. Or if you would like you can use a Javascript library to implement the SIP protocol for you (like sipml5) but if you choose to use this late solution, your browser needs to support Websocket or WebRTC (both are applicable). As far as I know browser plugin provided to PhoneGap by Android does not support neither of the mentioned technologies, but my knowledge is for 6 month ago. Back then I tried to implement my own Websocket PhoneGap extension to provide the PhoneGap with Websocket. But I've never tested it with sipml5 and have no idea what problems you might encounter.




回答2:


There are two parts to implement WerbRTC in cordova:

  1. SIP Communication to make call (send invite req) or receive incoming call (receive invite req)
  2. Then RTP communication to make ICE Channel for sharing media (voice or video)

For first part I used sipjs for IOS & android platforms. But for second part, I use different plaugins base each platform:

  • For Android, you don't need any platform for Android now supports WebRTC in their standard WebView or you can use Crosswalk to have some feature like re-invite automatically when Mobile device switches between WIFI / Mobile data such as 3G, 4G and LTE.
  • For IOs, I recommend to use eface2face cordova-plugin-iosrtc

If you need more information let me know.




回答3:


You might be able to load sipml5 directly within your Phonegap application if the WebRTC support is available:

    <script type="text/javascript" src="js/SIPml.js"></script>

    var readyCallback = function(e){
        console.log('SIP initialized');
    };
    var errorCallback = function(e){
        console.error('Failed to initialize the engine: ' + e.message);
    }
    SIPml.init(readyCallback, errorCallback);

The Android emulator doesn't seem to support WebRTC, as I get this error:

Uncaught ReferenceError: tsk_utils_init_webrtc is not defined at file:///android_asset/www/js/SIPml.js:203

I haven't tried this on a real device ...




回答4:


A proof-of-concept Cordova app that uses SIP.js with the PhoneRTC plugin to make WebRTC calls over the internet.

https://github.com/joseph-onsip/sipjs-cordova



来源:https://stackoverflow.com/questions/16541882/sip-support-for-cordova-phonegap

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