As this wiki:
http://trac.pjsip.org/repos/wiki/Getting-Started/iPhone?format=pdf
of pjsip explains, with iOS7 onwards pjsua is using high level APIs of AVAudioSession to manage opening and closing of sound streams which doesn't allow the older methods of (automatically) reconnecting your media streams after GSM call (or any other sound) interruptions. So to make it work you need to do following:
Your application should be configured to receive interruption events, which will already be the case if you are using sound or VOIP as your UIBackgroundModes. If not then use the following to receive interruptions:
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
forcefully shutdown the sound device when interruption begins. Use
pjsua_set_no_snd_dev()
for pjsua, orAudDevManager.setNoDev()
for pjsua2When interruption ends set your AVAudioSession to active and then restart the sound device using
pjsua_set_snd_dev()
for pjsua, orAudDevManager.setPlaybackDev()+setCaptureDev()
for pjsua2
The parameters needed to send to pjsua_set_snd_dev() can be extracted using the method pjsua_get_snd_dev()
.
One thing to keep in mind here is that once you shutdown the device forcefully it will not start automatically (even if a new call starts) unless you call pjsua_set_snd_dev() to restart it again