Hi Ming, thank you for the reference! I am currently using the version 1.8.10 (before both changes you made in ticket #1175). But, even without those changes, the application started to work properly (i.e. remote audio now returns back to us after the interruption) after I added the following code to my view controller .mm file: - (BOOL) canBecomeFirstResponder { return YES; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; [self becomeFirstResponder]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [[UIApplication sharedApplication] endReceivingRemoteControlEvents]; [self resignFirstResponder]; } This is exactly what the reference you provided suggests. Thank you for your help! Dmitry On 2/15/11 12:35 AM, Ming wrote: > Hi Dmitry and Cornelis, > > I just simplify the code for interruption handling in coreaudio (for > more details, please see ticket #1175: > http://trac.pjsip.org/repos/ticket/1175). However, there's still one > magic trick to make everything works as expected. You have to add a > single line of code in your application: > > [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; > > (Reference: http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/RemoteControl/RemoteControl.html) > > Best regards, > Ming > > On Sun, Feb 13, 2011 at 8:38 AM,<cg_vanderbent at mail.com> wrote: >> Yes, I'm having the same problem and it's on my list of sorting this out >> next week. >> >> Glad you did it, and hope to see a solution soon as this is a show stopper >> issue. >> >> Regards, >> >> Cornelis >> >> >> -----Original Message----- >> From: dto<dto2005@xxxxxxxxx> >> To: pjsip list<pjsip at lists.pjsip.org> >> Sent: Sat, Feb 12, 2011 10:44 pm >> Subject: iOS, remote audio lost after interruption by an alarm >> >> Hello, >> >> We are using PJSIP in a SIP calling application for iPhone. We currently >> have one problem with audio interruption on iOS 4.2 when in a call. We use >> PJSIP coreaudio_dev as is with no changes. So other PJSIP users will likely >> experience the same problem. It happens in 100% of attempts. >> >> Following are the easy steps to reproduce it (assuming you already have >> working calling application based on pjsip. I refer to such application as >> "APP"): >> >> 1) "APP" registers with the SIP server, makes a SIP call. (for example, one >> could call 8800 on Asterisk based SIP server). Stay on this call, send "APP" >> to the background. Remote audio still can be heard. >> 2) Now go to the "Clock" application on iPhone and set up an alarm to happen >> a a minute later from current time. Close the "Clock" app. >> 3) At this point DO NOT put "APP" in the foreground. Observe the call is >> still active in the background, red bar indicates that, you can hear the >> remote audio. >> 4) The alarm happens as scheduled. It plays some sound and shows the dialog. >> Press OK on the dialog. Alarm sound stops, the dialog gets dismissed. >> 5) At this point there is no red bar any more. The remote audio can not be >> heard any more. >> 6) Put "APP" in the foreground, observe the call itself is still active. >> Just the remote audio has gone. >> >> === >> >> Tracking down the error, I see that in coreaudio_dev.c, after audio >> interruption ended, the interruptionListener() is called. This one calls >> propListener() as shown below: >> >> ..... >> if (inInterruption == kAudioSessionEndInterruption) { >> strm->interrupted = PJ_FALSE; >> /* There may be an audio route change during the interruption >> * (such as when the alarm rings), so we have to notify the >> * listener as well. >> */ >> propListener(strm, kAudioSessionProperty_AudioRouteChange, >> 0, NULL); >> } else if (inInterruption == kAudioSessionBeginInterruption) { >> .... >> >> Then propListener(), in turn, tries to recreate the audio device and fails >> with the log message below: >> >> .... >> if (create_audio_unit(strm->cf->io_comp, 0, >> strm->param.dir, strm, >> &strm->io_units[0]) != PJ_SUCCESS) >> { >> PJ_LOG(3, (THIS_FILE, >> "Error: failed to create a new instance of audio unit")); >> return; >> } >> .... >> >> I added more logging and learned that create_audio_unit() fails on the >> following line: >> >> /* Initialize the audio unit */ >> ostatus = AudioUnitInitialize(*io_unit); >> >> and ostatus is -12985. >> >> ==== >> >> Did anybody see that problem? Did anybody fix it? Any thoughts? >> >> Thanks, >> Dmitry >> >> >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip at lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip at lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> >> > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org