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).
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.
There are two parts to implement WerbRTC in cordova:
- SIP Communication to make call (send invite req) or receive incoming call (receive invite req)
- 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.
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 ...
A proof-of-concept Cordova app that uses SIP.js with the PhoneRTC plugin to make WebRTC calls over the internet.
© 2022 - 2024 — McMap. All rights reserved.