199 | | === Guide to accept calls in the background after ```kCFStreamNetworkServiceTypeVoIP``` is deprecated (iOS 9) === #bg-call |
200 | | |
201 | | Starting in iOS 9, [https://developer.apple.com/library/ios/documentation/CoreFoundation/Reference/CFSocketStreamRef/index.html#//apple_ref/doc/constant_group/Stream_Service_Types kCFStreamNetworkServiceTypeVoIP] is deprecated. Apple recommends that applications use VoIP Push Notifications (using !PushKit framework) to avoid persistent connections as described in the [https://developer.apple.com/library/ios/documentation/Performance/Conceptual/EnergyGuide-iOS/OptimizeVoIP.html Apple's official doc]. This will require application to implement the setup and handling of push notifications in the application layer (for additional guides, you can refer to [http://stackoverflow.com/questions/27245808/implement-pushkit-and-test-in-development-behavior here] and [http://pierremarcairoldi.com/ios-8-voip-notifications/ here]). For now, PJSIP will still use ```kCFStreamNetworkServiceTypeVoIP```, if you want to disable it right away, you can set ```PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT``` to 0. |
202 | | |
203 | | === Audio session management issue (iOS7) === |
204 | | |
205 | | Since the deprecation of C-interface Audio Session API in iOS 7 SDK, PJSIP now uses {{{AVAudioSession}}} to set audio session category (to !PlayAndRecord) and activate/deactivate audio session. Application will need to do its own audio session management to handle input/output route and notifications (interruption, media server reset, etc). Please refer to [https://developer.apple.com/library/ios/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Introduction/Introduction.html Apple's official doc on Audio Session Programming Guide] and our ticket #1697. |
| 199 | === Guide to accept calls in the background after ```kCFStreamNetworkServiceTypeVoIP``` is deprecated (iOS 10/iOS 9) === #bg-call |
| 200 | |
| 201 | Starting in iOS 9, [https://developer.apple.com/library/ios/documentation/CoreFoundation/Reference/CFSocketStreamRef/index.html#//apple_ref/doc/constant_group/Stream_Service_Types kCFStreamNetworkServiceTypeVoIP] is deprecated. Apple recommends that applications use VoIP Push Notifications (using !PushKit framework) to avoid persistent connections as described in the [https://developer.apple.com/library/ios/documentation/Performance/Conceptual/EnergyGuide-iOS/OptimizeVoIP.html Apple's official doc]. This will require application to implement the setup and handling of push notifications in the application layer (for more details, you can refer to ticket #1941). For now, PJSIP will still use ```kCFStreamNetworkServiceTypeVoIP```, if you want to disable it right away, you can set ```PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT``` to 0. |
| 202 | |
| 203 | === Audio session (AVAudioSession) management (iOS 10) === |
| 204 | |
| 205 | !CallKit requires application to configure audio session and start the call audio at specific times. Thus, to ensure a smooth integration, we disable the setup of audio session in our sound device wrapper to avoid conflict with application's audio session setting. Starting from ticket #1941, application needs to set its own audio session category, mode, and activation/deactivation. |
208 | | - [https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/#//apple_ref/occ/instm/AVAudioSession/setCategory:withOptions:error: AVAudioSession::setCategory] to enable/disable audio route via bluetooth, application can override audio session category by adding/removing option {{{AVAudioSessionCategoryOptionAllowBluetooth}}}: |
209 | | {{{ |
210 | | /* Enable */ |
211 | | [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:nil]; |
212 | | ... |
213 | | /* Disable */ |
214 | | [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil]; |
215 | | }}} |
216 | | - [https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/#//apple_ref/occ/instp/AVAudioSession/preferredInput AVAudioSession::setPreferredInput] for switching to other audio input route. |
217 | | - [https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/#//apple_ref/occ/instm/AVAudioSession/overrideOutputAudioPort:error: AVAudioSession::overrideOutputAudioPort] for toggling on/off built-in loudspeaker. |
| 208 | - [https://developer.apple.com/reference/avfoundation/avaudiosession Apple's AVAudioSession doc] |