Hi all, I've noticed a problem where PJSip cannot open the audio device if the audio category changes away from kAudioSessionCategory_PlayAndRecord. E.g. in our app we have sound effects which require the audio category to be changed to ambient. Once this happens when you try to place a SIP call you will see the following output: 07:50:31.682 pjsua_media.c Opening sound device PCM at 16000/1/20ms 07:50:32.062 pjsua_media.c Opening sound device PCM at 44100/1/20ms 07:50:32.447 pjsua_media.c Opening sound device PCM at 48000/1/20ms 07:50:32.846 pjsua_media.c Opening sound device PCM at 32000/1/20ms 07:50:33.246 pjsua_media.c Opening sound device PCM at 16000/1/20ms 07:50:33.647 pjsua_media.c Opening sound device PCM at 8000/1/20ms 07:50:34.044 pjsua_media.c Unable to open sound device: Unknown error -1768403636 [status=-1768403636] Then the call will fail. Having dug around in coreaudio_dev I notice the playandrecord category is only set at startup, the following diff makes PJSip set this as it is creating the stream, and fixes the problem. Index: pjmedia/src/pjmedia-audiodev/coreaudio_dev.c =================================================================== --- pjmedia/src/pjmedia-audiodev/coreaudio_dev.c (revision 3415) +++ pjmedia/src/pjmedia-audiodev/coreaudio_dev.c (working copy) @@ -1513,6 +1513,21 @@ PJMEDIA_AUD_DEV_CAP_EC, &ec); } +#if !COREAUDIO_MAC + /* We want to be able to open playback and recording streams */ + UInt32 audioCategory; + OSStatus ostatus; + audioCategory = kAudioSessionCategory_PlayAndRecord; + ostatus = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, + sizeof(audioCategory), + &audioCategory); + if (ostatus != kAudioSessionNoError) { + PJ_LOG(4, (THIS_FILE, + "Error: cannot set the audio session category (%i)", + ostatus)); + } +#endif + strm->io_units[0] = strm->io_units[1] = NULL; if (param->dir == PJMEDIA_DIR_CAPTURE_PLAYBACK && param->rec_id == param->play_id) Regards, -- Tony Million