Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making a call programmatically from iPhone app and returning back to the app after ending the call

I am trying to initiate a call from my iphone app,and I did it the following way..

-(IBAction) call:(id)sender
{

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Call Besito" message:@"\n\n\n"
                                                   delegate:self cancelButtonTitle:@"Cancel"  otherButtonTitles:@"Submit", nil];


    [alert show];
    [alert release];
}

- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
{
    if (buttonIndex != [alertView cancelButtonIndex])
    {
      NSString *phone_number = @"0911234567"; // assing dynamically from your code
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString    stringWithFormat:@"tel:%@", phone_number]]]; 
         NSString *phone_number = @"09008934848";
        NSString *phoneStr = [[NSString alloc] initWithFormat:@"tel:%@",phone_number];
        NSURL *phoneURL = [[NSURL alloc] initWithString:phoneStr];
        [[UIApplication sharedApplication] openURL:phoneURL];
        [phoneURL release];
        [phoneStr release];
    }
}

by the above code..I am able to successfully make a call..but when I end a call,I'm not able to return to my app

So, I want to know how to achieve,that..also please tell me how we can initiate a call using webview...

like image 315
Ranjit Avatar asked Aug 18 '11 09:08

Ranjit


1 Answers

This is my code :

NSURL *url = [NSURL URLWithString:@"telprompt://123-4567-890"]; 
[[UIApplication  sharedApplication] openURL:url]; 

Use this so that after call end it will return to app.

like image 126
Sandhya Shettigar Avatar answered Sep 22 '22 02:09

Sandhya Shettigar