iphone SDK dial a phone number

Discussion in 'iPhone/iPad Programming' started by kiezarsoze, May 14, 2008.

  1. macrumors newbie

    Joined:
    Mar 23, 2008
    #1
    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?

    cheers!
     
  2. macrumors P6

    Peace

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

    Joined:
    Mar 13, 2008
    #3
    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. thread starter macrumors newbie

    Joined:
    Mar 23, 2008
    #4
    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.

    HELP!

    ---

    NEXT QUESTION:

    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. macrumors regular

    Joined:
    Mar 13, 2008
    #5
    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
    Code:
    <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. macrumors newbie

    Joined:
    Jun 30, 2008
    #6
    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. macrumors 6502

    Joined:
    Sep 17, 2003
    #7
    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. macrumors 6502

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

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

    Joined:
    Jun 30, 2008
    #10
    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 ?

    Thanks.
     
  11. macrumors newbie

    Joined:
    Jul 17, 2008
    #11
    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. macrumors 6502

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

    Joined:
    Jul 17, 2008
    #13
    Thanks, but the "\| didn't work.
     
  14. macrumors newbie

    Joined:
    Jun 30, 2008
    #14
    Hi all,

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

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

    Thanks.
     
  15. macrumors member

    Joined:
    Feb 19, 2008
    #15
    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. macrumors newbie

    Joined:
    Jun 30, 2008
    #16
    Hi,

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

    Joined:
    Jun 30, 2008
    #17
    Hi,

    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" ?)

    Thanks.
     
  18. macrumors member

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

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

    Joined:
    Jul 2, 2007
    #20
    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. macrumors newbie

    Joined:
    Jun 30, 2008
    #21
    Hi,

    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. macrumors newbie

    Joined:
    Dec 1, 2008
    #22
  23. macrumors member

    Joined:
    Aug 10, 2008
    #23
    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