2 questions about background mode (IOS)

AA
Aytunc Aytunc
Fri, May 4, 2012 3:04 PM

Hello all,

i am working on an iPhone/iPad client and it is about to be finalized soon.
however i am having issues with the background mode. i would be glad if you
can clarify these issues:

a- When the mobile device switches transport medium (3G / WiFi / Edge) i
believe a re-registration needs to be sent to the sip server with the new
info. But how do i know if transport medium is changed programatically? is
there a pjsip callback for this or an IOS callback and what is it?

b- in the sample ipjsua code there is a function

  • (void)keepAlive {
    if (!pj_thread_is_registered())
    {
    pj_thread_register("ipjsua", a_thread_desc, &a_thread);
    }
    keepAliveFunction(KEEP_ALIVE_INTERVAL);
    }

as i understand, this function fires every 600 seconds (the least amount of
time allowed by IOS). what should we put in this keepAliveFunction?? my
guess is we need to 1) re-subscribe for buddy presence 2) re-register to
server and 3) re-publish for our presence. IS there a sample
keepAliveFunction that i can look at?

Thank you,

Aytunc Isseven

Hello all, i am working on an iPhone/iPad client and it is about to be finalized soon. however i am having issues with the background mode. i would be glad if you can clarify these issues: a- When the mobile device switches transport medium (3G / WiFi / Edge) i believe a re-registration needs to be sent to the sip server with the new info. But how do i know if transport medium is changed programatically? is there a pjsip callback for this or an IOS callback and what is it? b- in the sample ipjsua code there is a function - (void)keepAlive { if (!pj_thread_is_registered()) { pj_thread_register("ipjsua", a_thread_desc, &a_thread); } keepAliveFunction(KEEP_ALIVE_INTERVAL); } as i understand, this function fires every 600 seconds (the least amount of time allowed by IOS). what should we put in this keepAliveFunction?? my guess is we need to 1) re-subscribe for buddy presence 2) re-register to server and 3) re-publish for our presence. IS there a sample keepAliveFunction that i can look at? Thank you, Aytunc Isseven
R
Ramu
Fri, May 4, 2012 6:04 PM

Hi,

Here is my suggestions

for a - implement network reachability call back function for monitoring
mobile device switches.

Yes you need to re-register pjsip when mobile device switches transport
medium.

for b- though keepAlive function fires for every 10 mins. SIP registration
happens as soon as it is going to expires. ex: if the UA is going to
expires in 120 seconds and the app is in background, SIP Stack sends
re-registration in 120 seconds.

You need to use TCP transport to work your app in background.

Don't forget to set "Required background modes" -> "App Provides Voice over
IP services" in Info.plist

On Fri, May 4, 2012 at 8:34 PM, Aytunc Aytunc aytunch@gmail.com wrote:

Hello all,

i am working on an iPhone/iPad client and it is about to be finalized
soon. however i am having issues with the background mode. i would be glad
if you can clarify these issues:

a- When the mobile device switches transport medium (3G / WiFi / Edge) i
believe a re-registration needs to be sent to the sip server with the new
info. But how do i know if transport medium is changed programatically? is
there a pjsip callback for this or an IOS callback and what is it?

b- in the sample ipjsua code there is a function

  • (void)keepAlive {
    if (!pj_thread_is_registered())
    {
    pj_thread_register("ipjsua", a_thread_desc, &a_thread);
    }
    keepAliveFunction(KEEP_ALIVE_INTERVAL);
    }

as i understand, this function fires every 600 seconds (the least amount
of time allowed by IOS). what should we put in this keepAliveFunction?? my
guess is we need to 1) re-subscribe for buddy presence 2) re-register to
server and 3) re-publish for our presence. IS there a sample
keepAliveFunction that i can look at?

Thank you,

Aytunc Isseven


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

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

--
Ramu

Hi, Here is my suggestions for a - implement network reachability call back function for monitoring mobile device switches. Yes you need to re-register pjsip when mobile device switches transport medium. for b- though keepAlive function fires for every 10 mins. SIP registration happens as soon as it is going to expires. ex: if the UA is going to expires in 120 seconds and the app is in background, SIP Stack sends re-registration in 120 seconds. You need to use TCP transport to work your app in background. Don't forget to set "Required background modes" -> "App Provides Voice over IP services" in Info.plist On Fri, May 4, 2012 at 8:34 PM, Aytunc Aytunc <aytunch@gmail.com> wrote: > Hello all, > > i am working on an iPhone/iPad client and it is about to be finalized > soon. however i am having issues with the background mode. i would be glad > if you can clarify these issues: > > a- When the mobile device switches transport medium (3G / WiFi / Edge) i > believe a re-registration needs to be sent to the sip server with the new > info. But how do i know if transport medium is changed programatically? is > there a pjsip callback for this or an IOS callback and what is it? > > b- in the sample ipjsua code there is a function > - (void)keepAlive { > if (!pj_thread_is_registered()) > { > pj_thread_register("ipjsua", a_thread_desc, &a_thread); > } > keepAliveFunction(KEEP_ALIVE_INTERVAL); > } > > as i understand, this function fires every 600 seconds (the least amount > of time allowed by IOS). what should we put in this keepAliveFunction?? my > guess is we need to 1) re-subscribe for buddy presence 2) re-register to > server and 3) re-publish for our presence. IS there a sample > keepAliveFunction that i can look at? > > > > > Thank you, > > Aytunc Isseven > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > -- Ramu
SV
Samuel Vinson
Sat, May 5, 2012 11:22 AM

Hello,

For the first point, you can read the Roberto Perez' question (16/04)
and the Benny's answer (17/04):
https://trac.pjsip.org/repos/wiki/IPAddressChange

Regarding the second point, you can find the keepAliveFunction function
in pjsua_app.c (line 158)

Best regards

Samuel

Le 04/05/12 17:04, Aytunc Aytunc a écrit :

Hello all,

i am working on an iPhone/iPad client and it is about to be finalized
soon. however i am having issues with the background mode. i would be
glad if you can clarify these issues:

a- When the mobile device switches transport medium (3G / WiFi / Edge)
i believe a re-registration needs to be sent to the sip server with
the new info. But how do i know if transport medium is changed
programatically? is there a pjsip callback for this or an IOS callback
and what is it?

b- in the sample ipjsua code there is a function

  • (void)keepAlive {
    if (!pj_thread_is_registered())
    {
    pj_thread_register("ipjsua", a_thread_desc, &a_thread);
    }
    keepAliveFunction(KEEP_ALIVE_INTERVAL);
    }

as i understand, this function fires every 600 seconds (the least
amount of time allowed by IOS). what should we put in this
keepAliveFunction?? my guess is we need to 1) re-subscribe for buddy
presence 2) re-register to server and 3) re-publish for our presence.
IS there a sample keepAliveFunction that i can look at?

Thank you,

Aytunc Isseven


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

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

Hello, For the first point, you can read the Roberto Perez' question (16/04) and the Benny's answer (17/04): https://trac.pjsip.org/repos/wiki/IPAddressChange Regarding the second point, you can find the keepAliveFunction function in pjsua_app.c (line 158) Best regards Samuel Le 04/05/12 17:04, Aytunc Aytunc a écrit : > Hello all, > > i am working on an iPhone/iPad client and it is about to be finalized > soon. however i am having issues with the background mode. i would be > glad if you can clarify these issues: > > a- When the mobile device switches transport medium (3G / WiFi / Edge) > i believe a re-registration needs to be sent to the sip server with > the new info. But how do i know if transport medium is changed > programatically? is there a pjsip callback for this or an IOS callback > and what is it? > > b- in the sample ipjsua code there is a function > - (void)keepAlive { > if (!pj_thread_is_registered()) > { > pj_thread_register("ipjsua", a_thread_desc, &a_thread); > } > keepAliveFunction(KEEP_ALIVE_INTERVAL); > } > > as i understand, this function fires every 600 seconds (the least > amount of time allowed by IOS). what should we put in this > keepAliveFunction?? my guess is we need to 1) re-subscribe for buddy > presence 2) re-register to server and 3) re-publish for our presence. > IS there a sample keepAliveFunction that i can look at? > > > > > Thank you, > > Aytunc Isseven > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org