Outgoing calls with Twilio iOS Client - ios

I am using the Twilio API and can successfully make outgoing calls to a phone number, but when I try to enter another username to connect to, nothing happens. I have two emulators running (one with the Android quickstart client, with which I can make outgoing calls to another user. I can make calls from the Android client to the iOS client using usernames and it works fine, but when I try to do the same from the iOS client to the Android client, nothing happens. I don't get a crash or anything, I just get the initial sound that it tries to start, then the disconnect sound. Here is my code:
- (IBAction)dialButtonPressed:(id)sender {
[self.dialField resignFirstResponder];
NSDictionary *params = #{#"To": self.dialField.text};
_connection = [_phone connect:params delegate:nil];
}
I have searched everywhere I can think of online, but every reference seems to talk only about calls with a phone number. The Twilio API for Android handles this easily, but I cannot figure it out for iOS. Any suggestions would be greatly appreciated.
Thanks in advance!!

Much thanks to Zack from Twilio who finally noticed that we just needed to add client: before the username when trying to call a user rather than a phone number (When using the Heroku App for the server setup as instructed in the Quickstart tutorial). Not sure why this is not built into the iOS instructions, but it is to the Android version. I'm just glad to have something that works.
I just have to dial client: then the username right into the dial field and it works. Now I can make any desired programming changes.
Thanks

Related

How can I best manually reply to texts from a Twilio phone number?

I'm a bit fed up with other phone providers and would like to have a more programmable, configurable, personal phone number (I miss GrandCentral). Google Voice is good, but I want to build something better. Twilio is great! I'm considering porting my personal phone number to Twilio.
I already have phone routing TwiML figured out, but where I'm stuck is text messaging. I can't just forward text messages to my burner phone/smart phone, because for replies to be natural, I need to be able to reply and have it get routed back to the sender. Google Voice handles this by forwarding every incoming forwarded text from a unique number so replies go to the right place, but I think this would get expensive quick with Twilio.
Is there a simple app or gateway that someone somewhere has already built (Twilio themselves perhaps) that lets me reply to texts to a Twilio phone number? It could be a web app, mobile app, WhatsApp gateway, whatever.
I looked into Twilio Programmable SMS/Chat, which definitely seems like the right building blocks, but also seems like to solve this I'd be building a web/mobile app and a backend service to manage my texts. Surely something already exists for manual text response to Twilio numbers.
I looked into Twilio Flex (and other customer management/agent center solutions) and that could work! But it seems overkill and I couldn't find a way to do Twilio Flex agent responses (e.g., reply to my family) on my smart phone. Is there a Twilio Flex mobile app? Is there something less overkill? I thought for sure I'd find something in the Twilio dashboard that would let me manually reply to texts.
Just looking for the most basic SMS/MMS inbox with reply functionality for a Twilio phone number I can find without having to build too much. Thanks!
FrontApp is another paid service that supports a Twilio integration for SMS messaging. There isn’t exactly a huge base of people using Twilio for individual purposes, so I don’t think it’s that surprising that what you’re looking for doesn’t already exist (though I agree it would be cool if it did).
Potentially, you could also look into the Twilio CLI utility as a way to interact with the API without so much developer overhead. Perhaps your new SMS interface is just going to be an SSH client on your phone connected to a box with the Twilio CLI installed?
An easy way to use your number for free (besides Twilio's costs) is to use a Google Spreadsheet with a script attached.
Here is a basic template you could start from and adjust accordingly.
STEP 1. Create New Google Spreadsheet.
STEP 2. Label columns A-E Date, From, Incoming Message, Reply, Status.
STEP 3. Open script editor and clear contents and paste code below.
STEP 4. Edit script by inserting your TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, (can be found in your Twilio dashboard) TWILIO PHONE NUMBER.
STEP 5. Deploy your script as a web app MAKE SURE to set the "who has access to the app" to "anyone, even anonymous" (Twilio will only work with public URLs).
STEP 6. After deployed copy the web app URL supplied by google.
STEP 7. Go to your Twilio phone numbers and paste the URL as the webhook for when a message comes in, MAKE SURE you change it to HTTP GET.
NOTE: make sure to authorize the script, by running the function from script editor.
function doGet(e) {
var body = e.parameter.Body;
var from = e.parameter.From;
var time = new Date();
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet()
ss.appendRow([time,from,body]);
}
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Reply')
.addItem('Send Reply', 'sendText').addToUi();
}
function sendText(){
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = ss.getActiveRange();
var message = range.getValue();
var getNumber = ss.getRange(range.getRow(), 2).getValue();
var number = '+' + getNumber;
var messagesUrl = "https://api.twilio.com/2010-04-01/Accounts/PASTE_YOUR_TWILIO_ACCOUNT_SID_HERE/Messages.json";
var payload = {
"To": number,
"From" : "PASTE_YOUR_TWILIO_PHONE_NUMBER_HERE", //make sure its formated as +15556667777
"Body" : message,
};
var options = {
"method" : "post",
"payload" : payload
};
options.headers = {
"Authorization" : "Basic " + Utilities.base64Encode("PASTE_YOUR_TWILIO_ACCOUNT_SID_HERE:PASTE_YOUR_TWILIO_AUTH_TOKEN_HERE")
};
UrlFetchApp.fetch(messagesUrl, options);
return ss.getRange(range.getRow(), 5).setValue('Sent');
}
To use it type a reply in the row you want to respond to make sure any cell in that row is selected, then go to the "Reply" tab and click "send text"
Here is a free android app you can download from the google play store. It was created by a Twilio employee, and offers what you were looking for. It does have some limitations which you can read in the description.
https://play.google.com/store/apps/details?id=com.tigerfarmpress.owlsms

Phone call from Apple Watch with openSystem API?

As I watched the WWDC 2015 session video "Introducing WatchKit for watchOS 2" (at 13:29), I saw that it is possible to make phone calls directly on Apple Watch with the openSystem API. How can I use this API in Swift?
You can use the openSystemURL method, which is available on the shared WKExtension object. Pass a tel: URL to this method to initiate a phone call.
if let telURL=NSURL(string:"tel:5553478") {
let wkExtension=WKExtension.sharedExtension()
wkExtension.openSystemURL(telURL)
}
There seems to be a bug in beta 1 that is not allowing the use of openSystemURL on phone numbers. I've seen several sample projects as well as banged my own head against the wall attempting to get going. No implementation I've seen works. SMS works fine however.

Did Facebook recently disable accessing public page feeds via uri?

This worked in my iOS app just yesterday, it's worked for months. I wake up today and no bueno. I put this into the address bar of my web browser with the desired ID and now I'm getting "Sorry, this page isn't available." Anyone know what's up?
NSString *urlString = [NSString stringWithFormat:#"https://www.facebook.com/feeds/page.php?format=json&id=%#", pageId];
same here i think there is a lot of people if you can find work around do tell please
Update
The Pages JSON feed (e.g. https://www.facebook.com/feeds/page.php?id=%2019292868552&format=json) is now deprecated and will stop returning data from Jan 28, 2015 onwards. Developers should instead call the feed edge on the Graph API's Page object: /v2.2/{page_id}/feed.
Source
Though I can't find a way to access a feed without authentification ! Facebook is becoming more and more liberty killer and is withdrawing into himself !

xcode apigee logInUserWithFacebook extra parameter?

I'm using Apigee for my iphone/ipad app.
Like many apps today, mine requires a login via Facebook and Apigee has a function specifically for this in the iOs framework, here's how it's called:
[ApigeeDataClient logInUserWithFacebook:[FBSession activeSession].accessTokenData.accessToken];
As far as my code goes, everything works well up until the above line. I'm receiving the following error.
Response: {"error":"invalid_request","error_description":"missing access token"}
However check out how the function is making the call (from the logs):
Synch outgoing call: 'https://api.usergrid.com/sgfishing/deepseafishing/auth/facebook?ql=fb_access_token=CAADrhKxrQp4BANfZCMuZBdOwUL9nc0H4VzZC1EXVLjABRbcrucTlUgwlKczFinl51GIWyBM5nlZBX1RF84azFAEOfChqN7vgSmvqgwybV8iPU2xjncZB9T5YTdY0pesJkHsSlvOafMhQ6MfIa6qdZCbTYBZCFB2oIPgEnro4runJKcqCy68wZCFQwyIzACVThAC3IEjZADs36hToQxhYZBzAWVhbKlcqJQsroZD'
I would like to bring your attention to this ...facebook?<b>ql=</b>fb_access_token=CAADrh....
I'm not sure why ql= is there, I've checked the definition of logInUserWithFacebook and ql= is nowhere to be found.
Any help would be greatly appreciated.
This is a bug in our iOS SDK. It has been fixed in version 2.0.9 of our SDK (released yesterday).
?ql= is typically used for query language statements see if there is any such code around in your program
This just a tip...may help

iOS FB SDK Incoming URL for apprequests is missing ref=notif, request_ids, app_request_type

I am using iOS FB SDK (baked in Parse F/W) to send app request invites using
[facebook dialog:#"apprequests" andParams:params andDelegate:nil];]
The requests are being sent correctly and also appear on the invitee's account.
When I click on the request, the Facebook app correctly starts my app.
At this point, I am checking for incoming URL to process and get request_ids etc.
The sample code on FB (http://developers.facebook.com/docs/tutorials/ios-sdk-games/requests/) says the incoming URL should be of following format
fb480369938658210://authorize&expires_in=3600&access_token=xyz&target_url=http://m.facebook.com/apps/friendsmashsample?fb_source=notification&request_ids=abc&ref=notif&app_request_type=Duser_to_user
However, I am receiving it like this
fb123456789123456://authorize?expires_in=86400&access_token=BAADiMgKGSZB8BAD3ZCeZAGNkm7d8tGuNZAKuq5nThbNTdiZA1ZBFcp1bhIKp1cFvwDsOPZCZBIgowSwRkBnZARF5tBsyWHk0yLukZAK8ubNZA4ZCbkyQg619cg9v0SMqsaBzgwNbQZCdPZBSLoYwZDZD&
target_url=http%3A%2F%2Fwww.facebook.com%2Fappcenter%2F123456789123456
So there are missing components here like request_ids, ref=notif etc.
Does anything obvious looks to be missing here?
Please help.
Thanks.
For future users, I had to set up the Mobile Site URL as per this bug filed with Facebook - https://developers.facebook.com/bugs/465760136778889/
Ridiculous, but it works. Hope this is resolved. Not sure why they have this dependency.

Resources