Reputation: 39
How would I call an extension after dialing a phone number?
This is how I make the call but I'm not really sure where to go from here.
@IBAction func phoneLaunch(sender: AnyObject) {
callNumber("\(newArray[3])")
}
I don't know how to keep dialing numbers correctly after a phone number is called.
Upvotes: 2
Views: 1373
Reputation: 39
This is how I solved the issue, you just have to insert a comma in between the phone number and the extension.
@IBAction func phoneLaunch(sender: AnyObject) {
callNumber("phoneNumber", extensionNum: "extensionNumber")
}
private func callNumber(phoneNumber:String, extensionNum:String) {
if let phoneCallURL:NSURL = NSURL(string: "tel://\(phoneNumber),\(extensionNum)") {
let application:UIApplication = UIApplication.sharedApplication()
if (application.canOpenURL(phoneCallURL)) {
application.openURL(phoneCallURL);
}
}
}
Upvotes: 1