[pjsip] Making T1, T2, etc. configurable without recompile

Christian Grigis christian.grigis at eyepmedia.com
Tue Nov 20 11:22:17 EST 2007

Hello Benny,

Pjsip, in accordance with the RFC, uses some values to determine timer
timeout values in transaction processing, namely T1, T2, T4 and TD.
Currently these values are #defines (in
./pjsip/include/pjsip/sip_config.h) and consequently determined at

We would like to be able to have the application change the default
values at runtime, during the initialization of the stack, without
requiring a recompilation of the SIP stack.

We are perfectly willing to make the necessary changes, but are
wondering if you had any advice as to how these changes should be made.

After some examination, it appears the constant values are used only in
the following files:


The first thing that comes to mind is to provide a function to override
the default values, and another function (or rather, one per value),
that returns either the default value if it has not been overridden, or
the override value. These last functions would then be used wherever the
constants were previously used.

Something like:

* a set of 4 values to be somehow passed to
  pjsip_tsx_layer_init_module(), indicating overrides for T1, T2, T4 and
  TD (0 meaning no override), stored in static variables
  pjsip_t1_timeout, pjsip_t2_timeout, pjsip_t4_timeout and

* 4 functions similar to:

	unsigned int pjsip_get_t1_timeout()
		if (pjsip_t1_timeout > 0) {
			return pjsip_t1_timeout;
		} else {
			return PJSIP_T1_TIMEOUT;

What do you think?

Thanks and best regards,

Christian Grigis
Senior Software Engineer

eyeP Media S.A. -- http://www.eyepmedia.com/

More information about the pjsip mailing list