Programmatically Dial a Phone number and pass DTMF using the iPhone SDK
How do you programmatically do the following from the iPhone SDK:
Programmatically Dial a Phone Number through the iPhone SDK
Bypass the dial / cancel prompt that the iPhone brings up
Send additional DTMF after the number is dialed just like how you would program pauses into a regular phone.
I know you can make a tel://
call but the issue is that it brings up the dial / cancel prompt and after that it prevents any future DTMF from being sent.
The iPhone SDK does NOT give you direct access to dial numbers (imagine if a 'bad' program got on your phone and dialed a pay per minute number on mute so you didn't notice).
However, if you use the tel link, then you should be able to send it "," characters which inserts pauses.
So to dial 555-1212, then wait 4 seconds, then do 12345# on the touch tone you would use tel:5551212,,12345#
Check out https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/PhoneLinks/PhoneLinks.html
I dont know why everyone says you cant... you CAN!
NSString *phoneNumber = @"15555551212";
NSString *dtmfAfterPickup = @"1234";
NSString *telString = [NSString stringWithFormat:@"tel:%@,%@", phoneNumber, dtmfAfterPickup];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:telString]];
This will dial the phoneNumber bypassing the dial/cancel prompt... 1 second after the call is answered, the dtmfAfterPickup string will be automatically dialed.
Its a good idea to detect whether or not the device support phone calls
Per Adam's Apple developer link above, there's this RFC link that explains more about the different options for a telephone link scheme that the iPhone supports -
http://www.ietf.org/rfc/rfc2806.txt
This at least allows you to insert pauses with a 'p' in the URL, but plenty of the options are specified (but not all are required) per the RFC. What else works?
I tried with my iPhone using CoronaSDK and openurl API. It works very well! Just do: system.openURL("tel:[phonenumber],123"). You can wait more with additinal commas. Tested with Corona SDK / iOS7.