Making T1, T2, etc. configurable without recompile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
compile-time.

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:

./pjsip/include/pjsip/sip_config.h
./pjsip/src/pjsip/sip_transaction.c
./pjsip/src/test-pjsip/tsx_uac_test.c
./pjsip/src/test-pjsip/tsx_uas_test.c
./pjsip/src/pjsip-ua/sip_100rel.c

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
  pjsip_td_timeout;

* 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
-- 
Christian Grigis
Senior Software Engineer

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



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux