iphone SDK dial a phone number

Discussion in 'iOS Programming' started by kiezarsoze, May 14, 2008.

  1. kiezarsoze macrumors newbie

    Mar 23, 2008
    does anyone know how to dial a phone number programmatically by calling an iphone sdk function which launches the phone app with a phone number as a parameter?

  2. Peace macrumors Core


    Apr 1, 2005
    Space--The ONLY Frontier
    Unless you have the actual beta firmware on the physical iPhone it can't be done.
  3. drivefast macrumors regular

    Mar 13, 2008
    use the tel:// url, just like you would want to navigate to a web page with an http:// url. you may use this as a hyperlink on a web page, or you may take a look at the "launchme" application in the developers page for how to use openURL. note that the phone interface will be launched, but before the number is actually dialed, the user needs to confirm the operation.
  4. kiezarsoze thread starter macrumors newbie

    Mar 23, 2008
    iphone sdk dialing a phone number

    I tried this and get a negative result.

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:mad:"http://tel:1-800-275-2273"]];

    this causes my program to exit and safari to launch (ok with me I know that apps can't run in the bg). However, safari reports "can't open the page" It shows the url in it's own window as I have it in quotes above. Furthermore, it reports the error "The error was: Cannot show URL"

    Then I tried this:

    I changed the string so that instead of http:// it says tel://

    following this is the same phone number.

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:mad:"tel://1-800-275-2273"]];

    Now I get an alert in my app saying "Unsupported URL. This URL wasn't loaded: tel://1-800-275-2273"

    I have tried this also by removing the dashes to no avail.




    Assuming I simply got the syntax wrong and this should work, what will happen when using an ipod touch? Is there a way to check if the app is running on an ipod touch or an iphone?


    FINNALY, I know I have asked this question a few times already, can anyone tell me how to get the iphone number out of the sim card? I want to be able to make a phone call and record which phone made the phone call. I suppose I can ask the user to enter their own phone number into my app but this would be a pain in the ass and open to error and hacking.
  5. drivefast macrumors regular

    Mar 13, 2008
    hm, i either had it wrong, or they just changed the syntax recently (more probably i had it wrong first time i posted). according to apple the correct syntax for a hyperlink is
    <a href="tel:1-408-555-5555">1-408-555-5555</a>
    so i would try your code as it is, with the two forward slashes removed.

    on the ipod touch there is no telephone application, so i assume no other app registers the tel: URL scheme, therefore you may get a message similar to what youre getting now.

    still no way that i know to get the user's own phone number.
  6. TAKEphONE macrumors newbie

    Jun 30, 2008
    Hi all,

    Just want to make sure - before I plunge into development...

    - Can I initiate a phone call to a specific phone number (and name) from within my own application ?

    - Will it always involve the user seeing Saffari on screen, and having to approve the dialing (on every call) ?

    - Can I make a call to a number with "extra digits" (i.e. call 1-800-222-3333, wait for answer, then dial other touch-tone digits, wait 2 sec, then dial ...) ?

    - Can my app be notified about telephony events, such as call progress, incoming call, etc. ?

    Thanks in advance !
  7. Pring macrumors 6502

    Sep 17, 2003
    Yes you can.

    Yes, otherwise you could make your users dial premium rate phone numbers without them knowing what they're calling! The user must approve the call.

    Not really, no. Once you pass off to make the call your application will no longer be running. The user can enter touch tone digits etc but your app won't know what they've done. For the same reason you can't get notifications of telephony events.
  8. izibo macrumors 6502

    Oct 6, 2004
    Couldn't you just throw in a few pauses before the tones?
  9. Pring macrumors 6502

    Sep 17, 2003
    Good idea. He could put in pauses using one or more commas.
  10. TAKEphONE macrumors newbie

    Jun 30, 2008
    Thanks, all !

    On some dialed automated systems, it is better that the dialer stops and asks prompt the caller when to continue dialing the extra digits.

    Some more questions, if I may:

    - Can I access the call-log ?
    - Can I access the speed-dial list ?

  11. dgelfuso macrumors newbie

    Jul 17, 2008
    I am trying to use the tel:// function to dial AT&T Voice Dial which is either *8, *08, or #121 but the * and # are always stripped when I use the tel:// function.

    How can I get around this?
  12. Pring macrumors 6502

    Sep 17, 2003
    Try escaping them by putting a \ in front of them. They're special characters so are likely being stripped.
  13. dgelfuso macrumors newbie

    Jul 17, 2008
    Thanks, but the "\| didn't work.
  14. TAKEphONE macrumors newbie

    Jun 30, 2008
    Hi all,

    Is there a way to read the "recents" list (calls log) ?

    Is there a way to read the "favourites" list ?

  15. schimanke macrumors member

    Feb 19, 2008
    Has anyone found a way to include special characters in phone numbers?

    My code looks like URLWithString:mad:"tel://**62*3311#" but anytime the app reaches the point where it should start dialing it just does nothing. When I include tel://**62*3311# as a hyperlink on a website, it strips off the * and #.
  16. TAKEphONE macrumors newbie

    Jun 30, 2008

    How do I represent pauses ?
    When I tried commas - it just ignored them.
  17. TAKEphONE macrumors newbie

    Jun 30, 2008

    Is there no way for an app to start a call without the user having to confirm the call ?

    I bumped into several apps that start calls without a confirmation dialog - are they using a "hidden function call" ?

    (maybe they were written using the "unofficial sdk" ?)

  18. hlysmksbtmn macrumors member

    Aug 18, 2008
    anyone know how to programmatically dial a contact in my address book?
  19. admanimal macrumors 68040

    Apr 22, 2005
    You need to extract their phone number using the address book APIs and then call it using a tel:// URL.
  20. racemize macrumors member

    Jul 2, 2007
    no confirmation!

    I know there is a way to dial without confirmation (which I think means using something other than the tel: url). There are a ton of apps in the app store, so how are they doing it? I hate when these features are hidden and to implement a simple feature you spend more time trying to find it instead of programming... Someone help!
  21. TAKEphONE macrumors newbie

    Jun 30, 2008

    I have been using the tel: url on a real iPhone device, and there was no confirmation dialog.

    I guess the confirmation dialog only appears when the url is used from a web page, not when using it programatically.
  22. beachdog macrumors member

    Aug 10, 2008
    When I downloaded and ran the calling card app, which supports postdial pauses, it seems to use commas as the means to indicate a pause. The iphone documention, however, references the tel url as defined in RFC 2806, which has a different means for specifying postdial delays -- it specifies the use of the character "p" to indicate a one-second delay, only appearing after a ";postdial=" fragment.

    Does anyone know if the SDK truly and fully suports RFC 2806 ?

Share This Page