Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#342 closed enhancement (fixed)

Add PJSIP configuration to optimize the size of outgoing SIP messages

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-0.8.0
Component: pjsip Version: trunk
Keywords: MTU packet size Cc:
Backport to 1.x milestone: Backported:

Description

When ICE is enabled, outgoing SIP messages can be bigger than 1500 bytes. This would cause problem with NAT/routers, so it would be desirable to trim outgoing messages down to minimal.

Few ideas that can be done to reduce the SIP message size:

  • use compact form of SIP headers
  • remove optional headers such as Allow
  • don't use User-Agent header

Change History (8)

comment:1 Changed 17 years ago by bennylp

More ideas:

  • don't include SDP rtpmap attribute for static payload types.

comment:2 follow-up: Changed 17 years ago by bennylp

  • Status changed from new to assigned

r1389:
Added configuration to send SIP headers in their compact forms.

comment:3 in reply to: ↑ 2 Changed 17 years ago by bennylp

Replying to bennylp:

r1389:
Added configuration to send SIP headers in their compact forms.

This can be done in two ways:

1) Using compile time settings in config_site.h:

 #define PJSIP_ENCODE_SHORT_HNAME 1

2) Using run-time setting:

   extern pj_bool_t pjsip_use_compact_form;
 
   // enable compact form
   pjsip_use_compact_form = PJ_TRUE;

comment:4 Changed 17 years ago by bennylp

In r1390, added configuration to suppress the inclusion of Allow header in outgoing INVITE. This can be done in two ways:

1) Using compile-time setting in config_site.h:

 #define PJSIP_INCLUDE_ALLOW_HDR_IN_DLG 0

2) Using run-time setting:

   extern pj_bool_t pjsip_include_allow_hdr_in_dlg;
 
   // do not transmit Allow header
   pjsip_include_allow_hdr_in_dlg = PJ_FALSE;

comment:5 Changed 17 years ago by bennylp

In r1391, added configuration to control whether SDP rtpmap attribute should be included for static payload types. Default is yes.

Application can change this setting in two ways:

1) Using compile-time setting in config_site.h:

 #define PJMEDIA_ADD_RTPMAP_FOR_STATIC_PT 0

2) Using run-time setting:

    extern pj_bool_t pjmedia_add_rtpmap_for_static_pt;

    // Do not include rtpmap for static payload types (<96)
    pjmedia_add_rtpmap_for_static_pt = PJ_FALSE;

comment:6 Changed 17 years ago by bennylp

In r1393, added compile time setting to disable RTCP advertisement in SDP, by setting in config_site.h:

 #define PJMEDIA_ADVERTISE_RTCP 0

When ICE is used, disabling RTCP will reduce SDP by about 65 bytes per network interface. Note that this requires ticket #344 to be applied.

comment:7 follow-up: Changed 17 years ago by bennylp

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

Summary of the size reductions:

  • With compact form of the header: 50 bytes
  • Suppressing Allow header: 86 bytes
  • Not putting rtpmap for static payload types: 65 bytes
  • Not advertising SDP, when ICE is used with three candidates: 235 bytes

Total potential size reduction: 436 bytes

Application can also suppress the User-Agent header for another ~36 bytes reduction.

comment:8 in reply to: ↑ 7 Changed 17 years ago by bennylp

  • Keywords MTU packet size added

Replying to bennylp:

Summary of the size reductions:

  • Not advertising SDP, when ICE is used with three candidates: 235 bytes

This should read Not advertising RTCP .. rather than Not advertising SDP ...

Application can also suppress the User-Agent header for another ~36 bytes reduction.

PJSUA-LIB application can do this by setting the pjsua_config.user_agent field.

Note: See TracTickets for help on using tickets.