views:

3208

answers:

4

hi to all,

can anyone help me to do making phone call by using objective c.

thanks in advance...

+9  A: 

You can initiate a call

https://developer.apple.com/iphone/library/featuredarticles/iPhoneURLScheme_Reference/Articles/PhoneLinks.html

So this would probably work

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:12125551212"]];
Lou Franco
+1  A: 

This will either be very platform-specific, or you'll have to use a wrapper library to account for the differences among platforms, so you better state what platform this is intended for. In general, there are various telephony APIs available on most platforms.

On Windows systems there's for example the "TAPI", also things may somewhat differ if you are targeting a digital telephone system such as ISDN, because there are other APIs available.

none
+3  A: 

well if you are talking about using objective-c to make a phone call on the iphone, then you can do something like this:

NSURL *phoneNumber = [[NSURL alloc] initWithString: @"tel:867-5309"];
[[UIApplication sharedApplication] openURL: phoneNumber];

If you are talking about doing this on a mac ,well, then like others have mentioned that is specific based on number of things like, if you are using voip, a modem, connecting through something like an Asterisks box, etc..

nstehr
+5  A: 

This is clipped from a project I did to do just that:

NSString *phoneStr = [[NSString alloc] initWithFormat:@"tel:%@",phone_number];
NSURL *phoneURL = [[NSURL alloc] initWithString:phoneStr];
[[UIApplication sharedApplication] openURL:phoneURL];
[phoneURL release];
[phoneStr release];
GoatRider