Dial a phone number with an access code programmatically in iOS

Solution 1:

UIDevice *device = [UIDevice currentDevice];
if ([[device model] isEqualToString:@"iPhone"] ) {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:130-032-2837"]]];
} else {
    UIAlertView *notPermitted=[[UIAlertView alloc] initWithTitle:@"Alert" message:@"Your device doesn't support this feature." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [notPermitted show];
    [notPermitted release];
}

Solution 2:

follow the tutorial

http://www.makebetterthings.com/blogs/iphone/open-phone-sms-email-map-and-browser-apps-in-iphone-sdk/

to call a number use -

NSURL *url = [NSURL URLWithString:@"tel://012-4325-234"];
[[UIApplication sharedApplication] openURL:url];

to open your app after call finished use -

(Note: telprompt is undocumented)

NSURL *url = [NSURL URLWithString:@"telprompt://012-4325-234"];
[[UIApplication sharedApplication] openURL:url];

Solution 3:

You can programmatically dial phone numbers using UIApplication's openURL: method (see example below). I'm unsure if access codes are supported, but this is at least a starting point.

NSURL *URL = [NSURL URLWithString:@"tel://900-3440-567"];
[[UIApplication sharedApplication] openURL:URL];

Edit: See the Apple URL Scheme Reference and the UIApplication Class Reference for more information.

Solution 4:

I don't know if you actually found a solution for passing the access code, but for me this code worked:

NSString *dialstring = [[NSString alloc] initWithFormat:@"tel:your_phonenumber,your_accessnumber"]; 

That will result in a dial string with the following values: tel:9003440567,65445

The remaining parts are managed by the phone app of iOS with the following command:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:dialstring]];

The , in the string causes a pause in your telephonesystem (the one where you want to access a conference room) right after the first number is dialed and a connection is established. So the telephonesystem has time to ask you for the access code (I think it should ask you, that's the way our system works). And after that your access code should be passed.

BE AWARE: Your access code will be passed in in a non-secret way. For example: Your shown access code will be displayed in the iPhone phone app display this way: 9003440567, 65445

Solution 5:

Using this user can redirect on Call and after the call he/she will automatically redirected to the app. It's working for me and sure about it.

if ([[device model] isEqualToString:@"iPhone"] ) {

    NSString *phoneNumber = [@"telprompt://" stringByAppendingString:cellNameStr];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];

} else {

    UIAlertView *warning =[[UIAlertView alloc] initWithTitle:@"Alert" message:@"Your device doesn't support this feature." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

    [warning show];
}