-2

I want to detect if a phone is on calling or not, and I searched it on internet, I didn't find a function to get the statut of a phone....Could you give me some suggestions or codes to show how can I know if a phone is on calling or not? Thank you.

my code

self.callCenter.callEventHandler = { (call:CTCall!) in

        switch call.callState {

        case CTCallStateDialing:
            self.toLogin = false

            break
        case CTCallStateIncoming:
            self.toLogin = false

            break
        case CTCallStateConnected:
            self.toLogin = false

            break
        case CTCallStateDisconnected:
            self.toLogin = false

            break
        default:
            self.toLogin = true
            break

    }
    }

My question is When I want to call someone, after entre numero of phone of someone, and he doesn't answer my call yet. I can not get this state, this state is none of the four states, do you know how?

user2262304
  • 329
  • 1
  • 3
  • 10
  • 2
    http://stackoverflow.com/questions/8799399/how-can-we-detect-call-interruption-in-our-iphone-application – Bhavin Bhadani Jun 16 '16 at 13:19
  • Thank you for your answer, ctcallcenter only has four states: `CTCallStateDialing`, `CTCallStateIncoming`,`CTCallStateConnected`,`CTCallStateDisconnected` and I can not get state when I call someone but he doesn't answer...I can't get this state, how can I do this? thank you – user2262304 Jun 16 '16 at 14:41

1 Answers1

3

You use the Core Telephony framework link Ctcallcenter should do the trick

Haligen
  • 231
  • 1
  • 7
  • Thank you for your answer, ctcallcenter only has four states: `CTCallStateDialing`, `CTCallStateIncoming`,`CTCallStateConnected`,`CTCallStateDisconnected` and I can not get state when I call someone but he doesn't answer...I can't get this state, how can I do this? thank you – user2262304 Jun 16 '16 at 14:41
  • you would use a handler block and `var callEventHandler: ((CTCall) -> Void)? ` to determine if the call was disconnected or not. – Haligen Jun 16 '16 at 14:51
  • Yes, I have update, please check it, Thank you – user2262304 Jun 16 '16 at 14:55