1

I am creating an 0800 diverting app which allows the user to use his/her monthly credit to phone an 0800 number diversion service rather than pay extra by dialling in the 0800 number directly to the native phone app. Basically XCode will take the 0800 number from a label and will phone the conversion number (01212842800) then straight after, it will dial in to the keypad (on the same call), the 0800 number from the label.

If you know what I mean, how would I do this please?

Kara
  • 6,115
  • 16
  • 50
  • 57
pixelbitlabs
  • 1,934
  • 6
  • 36
  • 65
  • Your question is not so clear. Do you need help with the number strings or with the actual dialing? (I am assuming you don't want Xcode but your **app** to dial the number.) – Mundi Aug 14 '11 at 18:55
  • Hi, yep, basically I need the app to dial a number then enter some numbers into the keypad once it's dialled. It's like those phone calls you sometimes make where it says "Hello and welcome... blah blah... Please press 1" - well I want the app to press one (in that specific example). – pixelbitlabs Aug 14 '11 at 18:57

1 Answers1

3

See this question on SO: Programmatically Dial a Phone number and pass DTMF using the iPhone SDK

It appears that you cannot dial a number programmatically, but you can achieve what you're trying to do by using ","s in the number that you call.

EX:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:01212842800,,,,,,,,,NUMBER_HERE"]];

With the commas acting as pauses.

Community
  • 1
  • 1
Daniel G. Wilson
  • 14,955
  • 2
  • 32
  • 39
  • Uh oh! I've done that, here's my code: http://pastie.org/2371754. But, the iPhone app dials 0161 354 2800,,,,,,,6855 instead of the number in a label I am extracting the phone number from. Why 6855? Where did that come from? – pixelbitlabs Aug 14 '11 at 19:42
  • Try putting in an NSLog(@"phoneNumberString: %@", phoneNumberString); Make sure it's what you think it is. – Daniel G. Wilson Aug 15 '11 at 00:46
  • It says; Dialling: (null) :'( I can't see why it should be because it's all linked up properly – pixelbitlabs Aug 15 '11 at 07:38
  • if it's null, then the issue is not the method of dialing, it's an issue with the phone number string. Try calling a static number by putting in the value manually. i.e. [[UIApplication sharedApplication] openURL:@"tel:01613542800,,,,,,,08005555555"]; – Daniel G. Wilson Aug 15 '11 at 16:12
  • in your pastie code you create an NSString called numberToDial. I want to know if that NSString's value is actually what you think it is. – Daniel G. Wilson Aug 15 '11 at 17:34
  • So like this?: NSString *numberToDial = phoneNumberString; NSLog(@"Number to Dial: %@", numberToDial); – pixelbitlabs Aug 15 '11 at 17:42
  • exactly. If that number isn't what you think it is, something is going wrong when you create it. – Daniel G. Wilson Aug 15 '11 at 17:48
  • When using the non-static number: 2011-08-15 20:00:35.888 0800Divert[9021:707] Dialing: (null) 2011-08-15 20:00:35.892 0800Divert[9021:707] Number to Dial: (null) – pixelbitlabs Aug 15 '11 at 19:01
  • When using the static number it shows the number in the number to dial properly as the label one, but doesn't call it, instead it calls the static one. Confusing or what?! :( – pixelbitlabs Aug 15 '11 at 19:02
  • Your problem lies in the fact that the numberToCall isn't what you think it is. Whatever number that you get from the text field isn't correct, not the method of calling. Play with the linking of the text field in IB (make sure everything's hooked up correctly), and NSLog all of your variables to see where things are going wrong. Beyond that, I can't help very much. – Daniel G. Wilson Aug 16 '11 at 14:13