Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy/paste phone number into keypad or dial a toll free number in iOS programatically

I am trying to make a call from my app using

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://1800000002"]];

This is a toll free number in India.But while dialing, it is converting to +1(800)-000-000 (Converting and Saying dialing to United states number)

I have referred Copy/paste phone number into keypad And When I'm redialing a Toll free No. in India, iPhone is connecting USA]. But could not find the solution.

So can any please help me to avoid this ISD call Indian local call..

like image 639
soumya Avatar asked Apr 29 '16 12:04

soumya


People also ask

How do I paste numbers into iPhone dial pad?

On the Keypad screen, locate the blank white area near the top of the screen that normally displays the phone number as you dial it. Place your finger on that area and hold it for a moment, then release. After releasing your finger, a tiny “Paste” button will pop up.


1 Answers

The telprompt wants the number in the international format. So you need to convert it to that. I think for India and the number you are trying to call, this should be +911800000002.

So this should work:

NSURL *phoneURL = [NSURL URLWithString:@"telprompt://+911800000002"];
if ([[UIApplication sharedApplication] canOpenURL:phoneURL]) {
    [[UIApplication sharedApplication] openURL:phoneURL];
} else {
    // handle that case. e.g show number to user so that they can
    // type it in a phone manually or copy it to the clipboard and
    // notify user about that.
}

Depending on how the local numbers compared to international format works in India, you might need to remove the 1 on your number, not sure about that.

On a sidenote: You should always use the international format when dealing with phone numbers. Otherwise a device that is currently outside of the destination country may call somebody else or simply can't place the call at all.

like image 110
Michael Ochs Avatar answered Sep 19 '22 18:09

Michael Ochs