Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile Support #31

Open
josephfrazier opened this issue Jun 5, 2014 · 28 comments
Open

Mobile Support #31

josephfrazier opened this issue Jun 5, 2014 · 28 comments

Comments

@josephfrazier
Copy link
Contributor

This is a general issue for discussing mobile support for SIP.js. See alongubkin/phonertc#7

@lylepratt
Copy link

Thanks for opening this Joseph. The use case is a cross platform app (Web, iOS, Android) that supports SIP calling. I've been working on a Phonegap plugin for PJSip, but its adding an extra layer of complexity that could be removed if we could get WebRTC working on iOS & Android.

Do you think something like PhoneRTC is worth pursuing for this use case?

@alongubkin
Copy link

Take a look here at my response here: alongubkin/phonertc#7

@egreenmachine
Copy link
Collaborator

I do not think that PhoneRTC in it's current state would work with SIP.js. What it does provide though is a good starting point at where mobile development is at.

For iOS I was able to recompile the WebRTC libraries (with SSL) and now I am working on creating an Obj-C layer to expose the needed WebRTC functions to SIP.js. My goal here would be to get SIP.js and iOS to be able to make WebRTC audio calls.

Once the audio functionality is solid, then I would begin working on adding video. My idea for video is to have a function that takes the id of an element on the page and pass that to Obj-C. Then have the native code find that element on the page and place a native video element over it. I think would probably create the best user experience. I am still open to other ideas on how to handle the video.

@josephfrazier
Copy link
Contributor Author

@lylepratt, I just wanted to mention that although iOS support is in the works, you can have Android support simply by visiting the app website. Take a look at the SIP.js Demo Phone for a basic example. If you'd really like to have an Android app, you can use Crosswalk to bundle your web app together with a WebRTC-enabled WebView.

@josephfrazier
Copy link
Contributor Author

@lylepratt, Here's a basic tutorial for using Crosswalk with SIP.js, if you're interested in that.

If you'd like to integrate Cordova plugins into your app, you can use Crosswalk Cordova to bring WebRTC functionality to Android apps generated by Cordova. After starting with Crosswalk Cordova's HelloWorld template, I was able to build the SIP.js Demo Phone app by replacing the assets/www directory with the demo phone assets and adding the following permissions to the AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

@lylepratt
Copy link

Thanks for the info Joseph. Unfortunately we can only pursue something that
works on iOS as well.

Based on these discussions, It looks like we're going to have to continue
with a PJSip plugin in order to do that in a reasonable amount of time.

Maybe we can make the plugin conform to the SIP.js API.
On Jun 11, 2014 2:26 PM, "Joseph Frazier" notifications@github.com wrote:

@lylepratt https://github.com/lylepratt, Here's a basic tutorial
http://sipjs.com/guides/mobile/android-native/ for using Crosswalk with
SIP.js, if you're interested in that.

If you'd like to integrate Cordova plugins into your app, you can use Crosswalk
Cordova https://crosswalk-project.org/#documentation/cordova to bring
WebRTC functionality to Android apps generated by Cordova. After starting
with Crosswalk Cordova's HelloWorld template
https://crosswalk-project.org/#documentation/cordova/develop_an_application,
I was able to build the SIP.js Demo Phone http://sipjs.com/demo-phone/
app by replacing the assets/www directory with the demo phone assets
https://github.com/onsip/sipjs-examples/tree/6d260bfd8e3e1655a881ad1cad446ed2672d6611/demo-phone
and adding the following permissions to the AndroidManifest.xml:


Reply to this email directly or view it on GitHub
#31 (comment).

@josephfrazier
Copy link
Contributor Author

I think I have a good sense of what needs to be done for SIP.js to use the PhoneRTC plugin for handling audio calls on iOS, so I'm planning to start working on a proof-of-concept tonight, as I'm personally interested in demonstrating this use case.

The general idea is to that iOS apps that use SIP.js would not use the default SIP.WebRTC.MediaHandler (that depends on JS having direct access to the PeerConnection, which we've seen isn't yet particularly feasible on iOS), but would provide a custom MediaHandler whose methods call into the PhoneRTC plugin.

We'd love for you to consider using SIP.js for your app, so I'll be sure to keep you posted on how my experiment goes.

@egreenmachine
Copy link
Collaborator

@joseph-onsip, per our discussion it was my understanding that the changes you were making are javascript application level changes. The custom media handler should be compatible with any platform implementing the phoneRTC api, and is not limited to iOS.

@lylepratt
Copy link

Thats great news. I would love to experiment with your POC this weekend if you make any progress.

@josephfrazier
Copy link
Contributor Author

Alright, I have made a bit of progress. Here's an app that can make calls to a WebRTC-enabled SIP endpoint running in a desktop browser (I tested with the SIP.js Demo Phone in Chrome).

Currently, it only works on Android, because that's what I'm developing against and I had to make a small change to the phonertc plugin. If the same change is made to the iOS plugin code, I'd expect this app to work on that platform as well, barring any platform-specific differences in WebRTC implementation.

@lylepratt
Copy link

Wow. From looking at your code, getting it to work seemed fairly simple. You just overrode mediaHandlerFactory with PhoneRTCMediaHandler (along with your change to the PhoneRTC Plugin) and it "just worked"?

Edit: At first I thought that the PhoneRTCMediaHandler was included in PhoneRTC, but I now realize that you wrote that and this all makes much more sense.

@josephfrazier
Copy link
Contributor Author

it "just worked"?

Well, I've only been able to get audio flowing between Android and Chrome (and, at the moment, only to Chrome, but I swear it was working when I last commented. I think it's that the app on my phone isn't properly playing back the stream, so I'm looking into modifying the plugin to get it working consistently), but yes, we've tried to make SIP.js very configurable in this regard. I was heavily involved in the refactor that made this sort of thing possible, which is one of the reasons I'm interested in getting together a working example of it.

@josephfrazier
Copy link
Contributor Author

I think it's that the app on my phone isn't properly playing back the stream

Ugh, this turned out to be a WebRTC issue on my laptop. Rebooting fixed it.

Also, I was able to get two-way audio on a call from Chrome to Android (I had only gotten the other direction working previously). I just had to make sure Chrome was offering only audio and not also video.

I still haven't been able to call Firefox, so I made an issue for it.

@egreenmachine
Copy link
Collaborator

Android L has built in WebRTC support.
We have created an iOS Cordova Plugin.
Guides are available on sipjs.com.

@alongubkin
Copy link

Any plans to port it to phonertc 2?

@lylepratt
Copy link

@thomasquintana is working on porting it over to phonertc 2.0. It is almost finished.

@lylepratt
Copy link

@alongubkin Tying up the loose ends now...look for a pull-request soon.
Fork: https://github.com/BetterVoice/phonertc

@egreenmachine Here is an updated version of the media handler that works with the above fork (or will in a little bit). Also supports multiple sessions:
https://github.com/BetterVoice/PhoneRTCMediaHandler

@wakamoleguy wakamoleguy added this to the 0.7.0 milestone Nov 24, 2014
@wakamoleguy wakamoleguy modified the milestones: 0.8.0, 0.7.0 Apr 23, 2015
@egreenmachine egreenmachine removed this from the 0.8.0 milestone Oct 9, 2017
@cybrox
Copy link

cybrox commented Oct 13, 2017

Since information across other sources seems to be a bit scattered and this was recently modified, what is the recommended way for mobile integration right now @egreenmachine?

@egreenmachine
Copy link
Collaborator

I do not have much to report here, as you can probably tell from me removing the milestone. I can say that internally we are working on a mobile app using NativeScript and backed by SIP.js. I am hopeful that there might be some public facing results from that will allow SIP.js users to do the same in a simple manner. However, it is still too early to tell for sure. That being said, it is definitely possible to use the native WebRTC drivers, SIP.js, and NativeScript to make a mobile app. Once I have more to share I will update this issue.

@ostrichegret
Copy link

ostrichegret commented Jan 22, 2018

@cybrox SIP.Js version 0.7.8 can works on cordova with crosswalk on Android and iosrtc on iOS, the SIP.Js 0.9.2 however got some errors on RTC stuff.

@egreenmachine please work on the react native too, thank you :)

@andrewvmail
Copy link

@GreenMachine curious on you guys effort with getting sipjs with nativescript. im running sipjs 0.7.8 with a cordova app but since sipjs isnt supporting cordova anymore on the lookout for potential replacement.

if you dont mind sharing the approach you guys use with nativescript? are you guys using the native webrtc ?

@egreenmachine
Copy link
Collaborator

@andrewvmail We ended up using native WebRTC and creating a custom SDH to interface with that. While I make it sound simple, it was far from that. At this point I do not think that we are going to make the implementation public. It is pretty difficult to get running and we expect the time we would have to commit to support it publicly too high. Additionally, it works for our app but it is a pretty specific implementation. We would have to do work to make it generic and we expect that people would run into issues trying to use it out the box. From the community activity we see it appears that most people want something that works out of the box with just some simple configuration parameters. This would not really be that.

For mobile, our target support is going to be the major mobile browsers. This would be Chrome on Android and Safari on iOS. If people would like to submit a PR back for SDH that they create for other environments, we would welcome it.

I hope that this clears up some of the cloud around mobile. Please reach out if you have any other questions or comments.

@WesUnwin
Copy link

WesUnwin commented Feb 6, 2019

I also ended up writing a custom SDH to carefully interface SIP.js@0.12.0 with the provided cordova/iOS WebRTC implementation. It allowed my to solve an issue where cordova was complaining about the argument to RTCPeerConnection.setLocalDescription() & setRemoteDescription().

And have made it available as a publicly accessible npm library:
https://github.com/WesUnwin/cordova-ios-session-description-handler

This may also be a useful example of how to write custom SDHs (in addition to the default SDH inside the SIP.js library which I also found to be a useful starting point). Hope this helps anyone!

@sido420
Copy link

sido420 commented Oct 18, 2020

Any new updates on this?

I noticed:

“The bulk of SIP.js no longer cares about the media and what it’s doing, which opens up some exciting possibilities, like running it in a non-web browser, NativeScript on a phone, or Node.js on a desktop app,” notes James Criscuolo, Director of Software Engineering at OnSIP.

Ref: https://www.onsip.com/voip-news/onsip-news/sipjs-v0.8.0-supports-all-major-browsers-and-renegotiation

Is Nativescript supported?

@egreenmachine
Copy link
Collaborator

We have built the OnSIP mobile app using Nativescript. That being said - getting the WebRTC libraries to run in Nativescript is not for beginners. Some users have reported success with react native and that may be path of least resistance.

@jsb114110
Copy link

Hello, can you support Baidu browser(china)? Can register, can also send information, can not dial

@InnovateAsterisk
Copy link

Are there any up-to-date guides on running sip.js (0.20.X) in both Android and iOS? Does it work in a simple WebView? I'm assuming camera and media permissions are the issue.

@apaul0210
Copy link

is there something i need to enable on ios 16, as the demo on the main page does not seem to work for me on safari

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests