How can I make outbound calls with a Twilio number? - iphone

I have registered a phone number within twilio to use as "my" phone number.
I set up a simple twiml bin do handle call forwarding to whatever phone SIM/handset I am using right now. So people call my (twilio) number and it forwards to my phone.
However, if I make an outbound call from my phone, of course the callerID is from my SIM, not my twilio number. This confuses people and is inconvenient.
What is the best (easiest) way for me to place calls, using my current phone/SIM/number, but have the call come from my twilio number ?
(I am currently using an iphone, FWIW)
Thanks.

Twilio developer evangelist here.
There are a few options here. You can implement the Twilio Programmable Voice SDK for iOS into an iPhone app that you can then use to make calls from. There are quickstarts and example applications available here: https://github.com/twilio/voice-quickstart-swift#quickstart
Alternatively, you could update your incoming webhook to point at some code that works out if it is your number dialling or not. If it is not, then carry on with the current forwarding behaviour. If it is your number, then ask what number you want to dial and take the digits using <Gather>, then use a <Dial> to make the outbound call.
You could also install a SIP phone app to your device and set up SIP registration. You would then need to set up some TwiML to make outgoing calls from the SIP endpoint.
Just some ideas there. Let me know if that helps at all.

Now there is a Twilio mobile app for iOS and Android called TwiConnect https://twiconnect.com
You can login through your Twilio Account SID, choose one of your Twilio Voice or SMS numbers as a default one, then you will be able to make outgoing calls or send/receive SMS messages usi

Related

Convert a text to voice recording and then play it after calling a phone number on Flutter

I'm trying to make an app which gets the location of a user and then call a number(pre-selected by user) to send a recorded voice message, like say "Location is {longitude} degrees, {latitude} degrees" but I can't find anything to do the same I found Twilio on some searching but in the Flutter package twilio_voice I can't find anything to do what I want.
So my question is can this be done in Twilio and if not what else I can do?
(Edit :I have figured out the part to fetch the user location and just display it on the screen, the part that remains is to convert this to speech and play on call)
You can achieve this with Twilio, however you will need a server from which to make the requests to the Twilio API. To make an API call to Twilio you need to use your Account SID and Auth Token and if you were to embed those within your Flutter application then a malicious user would be able to decompile your app, steal your credentials and abuse your account.
So, the best way is to build a server-side application that can make the API calls on behalf of your app and then send the relevant data (the location, in this case) from your mobile app to the server application.
On the server-side application, once you receive the location data you can generate a call by calling on the Twilio calls resource and pass the number you want to call, the number you are calling from and the TwiML you want to execute on the call. TwiML tells Twilio what to do on a call, and in this case you can direct Twilio to <Say> the message with the location.
I see you've asked python questions in the past, so here's a quick example of calling the Twilio API to create a call in python:
import os
from twilio.rest import Client
# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)
call = client.calls.create(
twiml='<Response><Say>Location is {longitude} degrees, {latitude} degrees</Say></Response>',
to=TO_NUMBER,
from_=YOUR_TWILIO_NUMBER
)
print(call.sid)
You need to divide your problem into smaller subproblems and test if the native OS (Android / iOS) allows you this:
Fetching current user location
Create an audio file with a text-to-audio speech generator
Research if it's possible to make calls programmatically (this might be tricky)
Make a phone call
Research if it's possible to play audio file while in call
Play an audio file on speaker while incall

Add a new sms into iPhone inbox programmatically

I searched all already asked questions here on Stack Overflow, and all of them deal with "sending" an SMS programmatically to another phone and that is NOT what I want.
I want to just add an SMS to the inbox, without using the cellular network or any other service and write a from "my_company_name" etc. Basically I want to avoid making the user or my company pay for the SMS. I know about push notifications and I will use them as well, but I need SMSs.
I thought about that maybe, if the user sends the SMS to himself it would be free of charge, but that "seems" to be not true at all.
The Messages app (and its notification UIs) only displays messages that come in over SMS or iMessage. What you're looking for isn't possible with public API.
As there is no public API available to do this (I guess you already now that), you'll have to go for the private APIs.
You might want to take a look at the source code of BigBoss's WifiSMS. This app allows one to control the iPhone's SMS system thru your computer. I haven't tested it myself yet, but BigBoss is a pretty credible application creator when it comes to jailbroken devices.

Understanding details of Apple Push Notification Service

Is it true that we can use any component for our own server component? I mean it can be a Java or C# TCP/IP client which connects with Apple servers to push notifications. This can also be a console application, is that right?
Also, is it right that we have to push notifications for APN server, with each and every deviceTokens registered on our own server?
You can use whatever language you want and you will have to send push notifications for every registered device token. You should also investigate apple's feedback API's which you should periodically check to see which of your devices are no longer registered because sending a push has no feedback and you will not know if it is being received or not. If you use a service such as Urban Airship the setup will be much much easier to start and they have helpful API's to give them a group of device tokens or to do a mass push to all registered device tokens.
You are right on both accounts. You can write your own method to send it, and you must send it to each device id.
framework that might help you:
http://www.easyapns.com/

iPhone App communication using phone numbers?

Is it somehow possible to use phone number of receiver to send app messages?
The idea is the user don't have to know anything about ips, etc. just a phone number. Then the app can find this user and send messages (app protocol).
Sorry complete newbie question, but was just wondering if there's a connection… I didn't find any information with search engine…
Yes, you could do this, but it would require both parties to have your app installed and you would likely need to create some sort of intermediate web-based service to store their account information (username, password, phone number, UDID, etc) then use that service to send the app messages from the sender to the receiver.
Assuming both of these users would be using an iPhone it will probably just be easier to wait until iMessage is released with iOS 5 in a month or two since it will work similar to FaceTime in that you can use phone numbers, emails, etc and works between all iOS devices running iOS 5.

iPhone Programming: Send a text message? Access contact list?

I'm still new to the API and I wanted to ask:
Can you send a text message programmatically?
Can you access the users contact list programmatically?
I'm thinking no. I haven't seen anything about text messaging in the API, and I figure the sandboxing that the iPhone does keeps you away from the phones contact list.
Thanks everyone.
1) I'm afraid you can't send SMS with the iPhone SDK although you can make a link to send an SMS like so:
a href="sms:408-555-5555">408 555 5555</a>
2) You can access the contact list with the Address Book UI framework
one way round the sms/mms problem is to use an external aggregator then you can utilise http between a server and the iphone to send sms obviously there is a cost involved this way to the developer
Yes You can build an app to send SMS.
All u need a server API, which u gonna call through ur code, to send sms.
I am saying this bcoz i am currently working on it.
As soon as i m done with my app,i am gonna share it.
http://shishir.com?from=shishir&to=shishir&message=hi&sandbox=false&username=user&password=pass
u hv to pass values through URL.
will go in deep very soon.
regards
shishir