Twilio: Answer an incoming call that started before opening browser - twilio

I'm using the Twilio Javascript Client SDK to allow users of our application to receive incoming calls through their browser. We have everything working well (ie: the call can be answered) if the user already has a browser tab open and receives an incoming call.
The use-case that we would like to support is this:
The user has no browser open to our site
An incoming call comes into our app and attempts to Dial the user (using their client ID)
The user opens up their browser to our app
The user sees the incoming call and answers it
I've tested this scenario and it doesn't appear to work. When the browser is opened and an incoming call is already ringing, the user is not presented our call dialog (which is triggered by the Twilio.Device.incoming event).
So my question is: Is this use-case possible to implement? Is there a setting that needs to be enabled, or is this something that cannot happen because we missed the initial incoming event?
Thanks for any help!

My .02, to achieve this a desktop app would be needed. It could be a simple web-wrapper though. Create an app that wraps a browser and have that user login. When a call comes in the app would receive it because the user WAS logged in. Your user wouldn't interact with your webapp through the desktop app, but I don't think that would be a problem given your use-case.

Related

Creating private messages

I'm writing a simple mini-chat with custom User model and authentication via omniauth. The chat uses web-socket faye-rails to send and display messages instantly without refreshing the page. The matter is that I'd like to add private messages - I mean, that I can choose an user and start our own dialog in a secondary chat window. I've looked for the solutions, but everything I found was about e-mailing - with inbox messages, trash cans and so on. So I wonder if there's any solution easy to implement.
The source code of my chat is here
Welcome to push technology and active web design!
When someone logs in, present them with a list of friended accounts and logged in state. For logged in friends, they can select a friend from the list and start a chat session in a new window. For logged out friends, they can send a message that's delivered the next time the recipient logs in.
You'll then have to create a friending mechanism that allows a user to request a connection to a prospective friend, be notified of pending connection requests, approve friend requests, and an unfriend feature. Hopefully that one won't be used too often.
I've worked with Faye & I like Faye but also take a quick look at the beta release of Rails 5. Action Cable will do the same thing and the framework support is better.

What if the Twilio Browser Client user is afk? How to change a Ready device to Not Ready?

I must be missing something.
I've successfully set my web page so that the browser is ready to receive incoming calls using the code from the Twilio QuickStart guides, but I wanted to give my user the ability to set their status to "Not Ready to Take Calls" if they're afk for example.
Is there a way to do this?
I've looked at the documentation and the closest thing I can find is:
Twilio.Device.disconnectAll();
But disconnectAll doesn't prevent incoming calls.
I'm wanting something like the ability to set Presence but there's only a method to register a callback when a Client's Presence changes:
Twilio.Device.presence(function(presenceEvent) {...});
And Presence currently only changes when a Client is on another call. I want the Client to be able to set Presence to a state that means incoming calls aren't directed to it.

How to share links via FB App when I am offline

I am developing an mobile app for iPhone. The app will primary used by people who are on holiday in a different country and will be offline most of the time, due to high costs for internet traffic.
However, the company for which I am developing the app wants to users to be able to use the "Facebook Share" functionality also when people are not connected to the internet.
It should work on a way that they click the SHARE link button in the app, but then get a message that they are offline and the link will get shared as soon as they are online again.
I am trying to figure out how to do this. Can I pass the link I want to share to the official FB App via fb:// protocol (or whatever) and the FB App handles the post/share as soon as it is online again?
Or do I have to do it on my own, put the links I want to share in a internal database and then post them to the wall when I am online again?
Or any other ways??
Any suggestions would be welcome, I would prefer a very quick solution and hope someone maybe has an idea how to do this. I was hoping I can pass the share-link to the official FB App and this one handles everything when it goes online again !?
Thanks for your ideas!
Your approach should be to make your link-sharing code automatically cache requests until they are sent. The app then doesn't need to concern itself with the details - it can just post the link and get a 'failed', 'success', or 'postponed' response from your API and notify the user accordingly.
Your link-sharing code can then internally check if it can currently post to FB and if not (either because the user is currently offline or perhaps the Facebook token is expired) it will store it for later. This class will then re-check periodically (for example when the app comes to the foreground or when the class is initialised the next time the app starts) for connectivity and then it will check if the token is still valid and perform FB login if required. Once it has a valid token it can then iterate through the pending requests and act upon them.
If you really want to make it nice and clean, you can separate out the code that accepts incoming requests to do something, checks if it can be performed now, does it or stores it for later, and periodically checks any requests in the pending queue. This class will not have any idea what the requests do or how they are performed, it will work with another class that implements a protocol to do the actual work and knows about facebook, etc. There may even be an existing design pattern for such a setup, but I don't know what it's called if there is.
Update: I did some research and found this is very similar to the "Fire-and-Forget Pattern".

Can we get any result or feedback when launched a link in UIWebview within an ipad application

I developed an ipad app where in i have a situation where the user taps a button which redirects to a login page (UIWebView),The user enters his credentials and web page hits a server where the validation takes place and the browser is returned a feed back string (authorization).
Question:
Is there a provision to know the feedback string/data by the application? According to my knowledge as soon as a webView is launched our application has no info about the happenings on Webview.
I don't want to implement services in my application since the service provider says that the webpage redirects the user to app upon successful login.Which may be possible on a desktop,but in ipad application can the bowser/Webview redirect back to the application upon login and more ever i need the feedback string in my application.Can some one suggest how could i implement the same.Please correct me if i am going wrong...
TNQ
You can call Objective-C methods from UIWebView. This you can do by trapping your custom urls in the shouldStartLoadWithRequest: method. More details are here.

If a UIWebView displays a remote page with a username/password then can the native code tell if/when it has been validated?

I have a requirement for an app to communicate with a server, this communication is done using a proprietary http based protocol and the app uses NSUrlConnection for this.
However before the app can be used the user must first perform a one-off registration, and the requirement is that this is done by them logging onto a web page which will be downloaded and displayed in a UIWebView. As a UIWebView is used I no longer have access to the HTTP header/body nor the NSURLConnectionDelgate etc. for this part of things.
My question is, how can the app know if and when the user has successfully logged onto the web site?
It sounds like you want to implement some code in the connection:didReceiveAuthenticationChallenge: method of the NSURLConnectionDelegateProtocol. There's more information about how to respond to a challenge here.

Resources