iOS, remote audio lost after interruption by an alarm

D
dto
Sat, Feb 12, 2011 9:44 PM

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

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
CV
cg_vanderbent (at) mail.com
Sun, Feb 13, 2011 12:38 AM

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@gmail.com
To: pjsip list pjsip@lists.pjsip.org
Sent: Sat, Feb 12, 2011 10:44 pm
Subject: [pjsip] 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@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

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@gmail.com> To: pjsip list <pjsip@lists.pjsip.org> Sent: Sat, Feb 12, 2011 10:44 pm Subject: [pjsip] 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@lists.pjsip.org http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
D
dto
Mon, Feb 14, 2011 6:22 PM

Hi Cornelis,

I'm glad you joined the discussion.

I forgot to mention that we also experience the same remote audio lost
(same error) in a similar scenario.

In this other case instead of setting up an alarm, we make a direct cell
call to the iPhone. When the incoming cell call notification pops up, we
reject the call. And the remote audio in our VoIP call is getting lost
with the same error as when we used the alarm.

Do you experience the same in your application?

Thanks,
Dmitry Ter-Ovanesyan,
DiVitas Networks.

On 2/12/11 7:38 PM, cg_vanderbent@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@gmail.com
To: pjsip list pjsip@lists.pjsip.org
Sent: Sat, Feb 12, 2011 10:44 pm
Subject: [pjsip] 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@lists.pjsip.org mailto:pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Cornelis, I'm glad you joined the discussion. I forgot to mention that we also experience the same remote audio lost (same error) in a similar scenario. In this other case instead of setting up an alarm, we make a direct cell call to the iPhone. When the incoming cell call notification pops up, we reject the call. And the remote audio in our VoIP call is getting lost with the same error as when we used the alarm. Do you experience the same in your application? Thanks, Dmitry Ter-Ovanesyan, DiVitas Networks. On 2/12/11 7:38 PM, cg_vanderbent@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@gmail.com> > To: pjsip list <pjsip@lists.pjsip.org> > Sent: Sat, Feb 12, 2011 10:44 pm > Subject: [pjsip] 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@lists.pjsip.org <mailto:pjsip@lists.pjsip.org> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
M
Ming
Tue, Feb 15, 2011 5:35 AM

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@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@gmail.com
To: pjsip list pjsip@lists.pjsip.org
Sent: Sat, Feb 12, 2011 10:44 pm
Subject: [pjsip] 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@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

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@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@gmail.com> > To: pjsip list <pjsip@lists.pjsip.org> > Sent: Sat, Feb 12, 2011 10:44 pm > Subject: [pjsip] 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@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >
EA
Even André Fiskvik
Tue, Feb 15, 2011 7:45 AM

Ming: On the ticket I see that [3411] has a comment: "Modified default core audio unit used on iOS from VPIO to RemoteIO".

Could you explain why the default has changed? If I'm not mistaken I have read that only the VPIO support
echo cancelation on the iPhone?

Best regards,
Even André Fiskvik

On 15. feb. 2011, at 06.35, 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@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@gmail.com
To: pjsip list pjsip@lists.pjsip.org
Sent: Sat, Feb 12, 2011 10:44 pm
Subject: [pjsip] 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@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Ming: On the ticket I see that [3411] has a comment: "Modified default core audio unit used on iOS from VPIO to RemoteIO". Could you explain why the default has changed? If I'm not mistaken I have read that only the VPIO support echo cancelation on the iPhone? Best regards, Even André Fiskvik On 15. feb. 2011, at 06.35, 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@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@gmail.com> >> To: pjsip list <pjsip@lists.pjsip.org> >> Sent: Sat, Feb 12, 2011 10:44 pm >> Subject: [pjsip] 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@lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip@lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> >> > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >
D
dto
Tue, Feb 15, 2011 11:11 PM

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@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: dtodto2005@gmail.com
To: pjsip listpjsip@lists.pjsip.org
Sent: Sat, Feb 12, 2011 10:44 pm
Subject: [pjsip] 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@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

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@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@gmail.com> >> To: pjsip list<pjsip@lists.pjsip.org> >> Sent: Sat, Feb 12, 2011 10:44 pm >> Subject: [pjsip] 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@lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip@lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> >> > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org