Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#1825 closed enhancement (fixed)

New on_reg_started2 callback

Reported by: riza Owned by: bennylp
Priority: normal Milestone: release-2.4
Component: pjsua-lib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description (last modified by nanang)

On IP Address change case, app might want to close the transport before connecting state, however it is not possible to get the transport instance before registration process is finished.

This ticket is mainly for getting registration transport instance before getting the registration result (via pjsua callback on_reg_state).

Example scenario:

  1. Connecting to network A (3G)
  2. Check if a transport is saved. Finding None so go on.
  3. Register requested (and account created)
  4. Transport created in PJSIP
  5. Connecting to network B (WIFI)
  6. Register request on network B (old account destroyed and new one created)
  7. Check if a transport is saved. Finding None so go on.
  8. Transport A and transport B connect (may happen in an iphone since the 3G connection is never really lost).
  9. Transport A is saved and then transport B is saved in its stead
  10. If on transport connect we also check if there is already a transport connected and then release the old one (which we are doing at the time), then if by chance transport B connects first, then network A would actually cause a release of transport B which is the latest one
  11. Otherwise, transport A is never released.

on_reg_started callback can be used for getting registration transport instance, but we need to include pjsua_internal.h to get account's pjsip_regc instance (to eventually get the registration transport). With this ticket, it can be done as follow:

static void on_reg_started2(pjsua_acc_id acc_id, pjsua_reg_info *info)
{
    pjsip_regc_info regc_info;
    pjsip_regc_get_info(info->regc, &regc_info);

    // transport instance is in 'regc_info.transport'
    ...
}

Change History (4)

comment:1 Changed 10 years ago by riza

  • Type changed from defect to enhancement

comment:2 Changed 10 years ago by riza

In 4999:

Re #1825: Implement new on_reg_started2 callback

comment:3 Changed 10 years ago by riza

  • Resolution set to fixed
  • Status changed from new to closed

comment:4 Changed 9 years ago by nanang

  • Description modified (diff)
Note: See TracTickets for help on using tickets.