Opened 12 years ago

Closed 10 years ago

Last modified 10 years ago

#1677 closed enhancement (fixed)

Contact uses source port in initial registration

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

Description (last modified by bennylp)

Currently Contact header for initial registration will always use listening port. There is a report that this causes problem in incoming call, see the following scenario:

  1. Client A and server both use private IP, client sets allow_contact_rewrite==1 or 0.
  2. Initial registration succeeds with listening port in Contact, note that there is no Contact update even Via rport is different with Contact port (note that allow_contact_rewrite==1 won't trigger Contact update when both using private IP)
  3. Client B makes call to client A
  4. Server tries to connect to client A, i.e: to A Contact address, and it fails (as client is not ready for accepting TLS, e.g: no TLS cert is set), so call is not passed through to client A.

Setting allow_contact_rewrite==2 is reported to solve the problem, however for some reason, such Contact update mechanism may not be preferred/allowed on some system setup. So in this case, adding option setting for using source port in initial registration Contact is needed.

Note: for some platform, there may be problem in getting source port on async socket connect operation.

Implementation: new setting in account config:

    /**
     * Specify if source TCP port should be used as the initial Contact
     * address if TCP/TLS transport is used. Note that this feature will
     * be automatically turned off when nameserver is configured because
     * it may yield different destination address due to DNS SRV resolution.
     * Also some platforms are unable to report the local address of the
     * TCP socket when it is still connecting. In these cases, this
     * feature will also be turned off.
     *
     * Default: PJ_TRUE (yes).
     */
    pj_bool_t	     contact_use_src_port;

Change History (5)

comment:1 Changed 11 years ago by nanang

  • Milestone changed from Known-Issues-and-Ideas to release-2.3

comment:2 Changed 10 years ago by bennylp

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

In 4888:

Closed #1677: Contact uses source port in initial registration.

comment:3 Changed 10 years ago by bennylp

  • Description modified (diff)

comment:4 Changed 10 years ago by bennylp

In 4889:

More re #1677:

  • renamed the option to contact_use_src_port
  • added the missing pjsua2 API implementation

comment:5 Changed 10 years ago by bennylp

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