Weird behaviour when handling interruption on iPhone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

I am trying to handle interruptions by incoming GSM call in my iPhone
application when i am on a VoIP call. i found out that PJSIP already handles
that in coreaudio_dev.c by implementing AudioSessionInitialize(...)
and interruptionListener(...). The default implementation holds the VoIP
call, one way or another, and then reconnects it when the GSM call ends. The
receiver gets no notification whatsoever about that hold state. So what i am
trying to do is to play a wav file while the call is put in that hold state
automatically by PJSIP.

I can play wav files and hold/release a VoIP call using my own
implementation of the functionality when i tap the Hold button in my app. It
is all working fine. But the problem is when the VOiP call is interrupted by
a GSM one I can not force my HoldCall function to work. It plays the wav
file for a random length of time and then it is muted. I believe that is
forced by the default implementation of interruptionListener(...)

I read somewhere that i can over-ride the existing implementation
of interruptionListener(...) by adding my own implementation and
calling AudioSessionInitialize(...) in my app before invoking PJSIP
initialisation and startup. So what i am doing is to have an empty
implementation first to see what happens and all looks ok as I could break
into my implementation whilst debugging:

-(id) initAndStartUpSipWithVCDelegate:(id) del
{
    ....
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
    AudioSessionInitialize(NULL, NULL, interruptionListener, self);
    UInt32 category = kAudioSessionCategory_PlayAndRecord;
    AudioSessionSetProperty(kAudioSessionProperty_AudioCategory,
sizeof(category), &category);
    AudioSessionAddPropertyListener (kAudioSessionProperty_AudioRouteChange,
propListener, self);

    [self sipStartup];
    ...
}

static void interruptionListener(void *inClientData, UInt32 inInterruption)
{
    // No implementation just this log
    NSLog(@"interruption happened");
}

static void propListener(void *inClientData, AudioSessionPropertyID
inID, UInt32 inDataSize, const void *inData)
{
    // No implementation just this log
    NSLog(@"interruption property triggered");
}

The problem is when the interruption ends i hear no sound in my VoIP call at
all. Both ends are mute. Bare in mind that the connection is still alive but
no audio is communicated.

So What i would like to know is:

1- Why the VoIP call is never returned to normal when i
over-ride interruptionListener(...)
2- Will I be able to play a wav file when an interruption happens?

Many thanks in advance


-- 
-------------------------------------
Fadi Chehimi, PhD
Mobile Software Engineer
Localphone Ltd
4 Paradise Street, Sheffield, S1 2DF, UK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20110818/62bb5833/attachment-0001.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux