Stop and resume audio with CallKit on iOS 10

SS
Stephan Swart
Thu, Oct 27, 2016 8:56 AM

Hi,

I'm having trouble with audio in my app. I followed this guide:
https://trac.pjsip.org/repos/ticket/1941
However, when I call from the app on iPhone to another device, audio comes
through to the iPhone from the other device, but does not go from the
iPhone to the device. I also get audio from the iPhone's mic looping
through to the iPhone's speaker.

After setting up pjsua: calling pjsua_create() and pjsua_start(), I call

pjsua_get_snd_dev(&captureDeviceID, &playbackDeviceID). captureDeviceID =
-1 and playbackDeviceID = -2 are the values that I get.

and then close the device by calling pjsua_set_null_snd_dev()

In the past I called pjsua_set_no_snd_dev(), but now follow the advice at:
http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-November/005420.html

I also call pjsua_set_null_snd_dev() on my CXProvider's didDeactivate
audioSession method and call pjsua_set_snd_dev(captureDeviceID,
playbackDeviceID);
on CXProvider's didActivate audionSession method.

I've tried explicitly calling pjsua_set_snd_dev(-1, -2) or
pjsua_set_snd_dev(0, 0) to no avail.

Any help would be highly appreciated.

Kind regards,

Stephan Swart

Hi, I'm having trouble with audio in my app. I followed this guide: https://trac.pjsip.org/repos/ticket/1941 However, when I call from the app on iPhone to another device, audio comes through to the iPhone from the other device, but does not go from the iPhone to the device. I also get audio from the iPhone's mic looping through to the iPhone's speaker. After setting up pjsua: calling pjsua_create() and pjsua_start(), I call pjsua_get_snd_dev(&captureDeviceID, &playbackDeviceID). captureDeviceID = -1 and playbackDeviceID = -2 are the values that I get. and then close the device by calling pjsua_set_null_snd_dev() In the past I called pjsua_set_no_snd_dev(), but now follow the advice at: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-November/005420.html I also call pjsua_set_null_snd_dev() on my CXProvider's didDeactivate audioSession method and call pjsua_set_snd_dev(captureDeviceID, playbackDeviceID); on CXProvider's didActivate audionSession method. I've tried explicitly calling pjsua_set_snd_dev(-1, -2) or pjsua_set_snd_dev(0, 0) to no avail. Any help would be highly appreciated. Kind regards, Stephan Swart
M
Ming
Fri, Oct 28, 2016 7:24 AM

Hi Stephan,

I managed to whip up a very basic example with our ipjsua sample app.
Please apply the attached patch.

  • First, make sure that everything works fine in ipjsua without
    CallKit, i.e. audio can flow normally for both incoming and outgoing
    calls. There's no point in making things unnecessarily complicated
    with CallKit if standard use case still doesn't work.

  • Modify ipjsuaAppDelegate.m:
    Setup your account in pjsuaStart()

To test incoming call:
Simply make an incoming call to the account you set up above.

To test outgoing call:

  1. Set the callee destination when calling pjsua_call_make_call()
  2. Find "Uncomment below to test outgoing call" and uncomment it.
  3. Rebuild ipjsua and restart it.

Again, this is still basic, so don't expect it to be complete and
thorough. Please let us know if it works.

Regards,
Ming

On Thu, Oct 27, 2016 at 4:56 PM, Stephan Swart stephanswrt@gmail.com wrote:

Hi,

I'm having trouble with audio in my app. I followed this guide:
https://trac.pjsip.org/repos/ticket/1941
However, when I call from the app on iPhone to another device, audio comes
through to the iPhone from the other device, but does not go from the iPhone
to the device. I also get audio from the iPhone's mic looping through to the
iPhone's speaker.

After setting up pjsua: calling pjsua_create() and pjsua_start(), I call

pjsua_get_snd_dev(&captureDeviceID, &playbackDeviceID). captureDeviceID = -1
and playbackDeviceID = -2 are the values that I get.

and then close the device by calling pjsua_set_null_snd_dev()

In the past I called pjsua_set_no_snd_dev(), but now follow the advice at:
http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-November/005420.html

I also call pjsua_set_null_snd_dev() on my CXProvider's didDeactivate
audioSession method and call pjsua_set_snd_dev(captureDeviceID,
playbackDeviceID); on CXProvider's didActivate audionSession method.

I've tried explicitly calling pjsua_set_snd_dev(-1, -2) or
pjsua_set_snd_dev(0, 0) to no avail.

Any help would be highly appreciated.

Kind regards,

Stephan Swart


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 Stephan, I managed to whip up a very basic example with our ipjsua sample app. Please apply the attached patch. - First, make sure that everything works fine in ipjsua without CallKit, i.e. audio can flow normally for both incoming and outgoing calls. There's no point in making things unnecessarily complicated with CallKit if standard use case still doesn't work. - Modify ipjsuaAppDelegate.m: Setup your account in pjsuaStart() To test incoming call: Simply make an incoming call to the account you set up above. To test outgoing call: 1. Set the callee destination when calling pjsua_call_make_call() 2. Find "Uncomment below to test outgoing call" and uncomment it. 3. Rebuild ipjsua and restart it. Again, this is still basic, so don't expect it to be complete and thorough. Please let us know if it works. Regards, Ming On Thu, Oct 27, 2016 at 4:56 PM, Stephan Swart <stephanswrt@gmail.com> wrote: > Hi, > > I'm having trouble with audio in my app. I followed this guide: > https://trac.pjsip.org/repos/ticket/1941 > However, when I call from the app on iPhone to another device, audio comes > through to the iPhone from the other device, but does not go from the iPhone > to the device. I also get audio from the iPhone's mic looping through to the > iPhone's speaker. > > After setting up pjsua: calling pjsua_create() and pjsua_start(), I call > > pjsua_get_snd_dev(&captureDeviceID, &playbackDeviceID). captureDeviceID = -1 > and playbackDeviceID = -2 are the values that I get. > > and then close the device by calling pjsua_set_null_snd_dev() > > In the past I called pjsua_set_no_snd_dev(), but now follow the advice at: > http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-November/005420.html > > I also call pjsua_set_null_snd_dev() on my CXProvider's didDeactivate > audioSession method and call pjsua_set_snd_dev(captureDeviceID, > playbackDeviceID); on CXProvider's didActivate audionSession method. > > I've tried explicitly calling pjsua_set_snd_dev(-1, -2) or > pjsua_set_snd_dev(0, 0) to no avail. > > Any help would be highly appreciated. > > Kind regards, > > Stephan Swart > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >