Index: pjsip/build/Makefile
===================================================================
RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/build/Makefile,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 Makefile
--- pjsip/build/Makefile 9 Nov 2007 16:33:46 -0000 1.1.1.3
+++ pjsip/build/Makefile 18 Dec 2007 12:57:27 -0000
@@ -36,6 +36,7 @@
#
export PJSIP_SRCDIR = ../src/pjsip
export PJSIP_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
+ sip_config.o \
sip_errno.o sip_msg.o sip_parser.o sip_tel_uri.o sip_uri.o \
sip_endpoint.o sip_util.o sip_util_proxy.o \
sip_resolve.o sip_transport.o sip_transport_loop.o \
Index: pjsip/build/pjsip_core.vcproj
===================================================================
RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/build/pjsip_core.vcproj,v
retrieving revision 1.5
diff -u -r1.5 pjsip_core.vcproj
--- pjsip/build/pjsip_core.vcproj 9 Nov 2007 18:09:31 -0000 1.5
+++ pjsip/build/pjsip_core.vcproj 18 Dec 2007 12:57:27 -0000
@@ -296,6 +296,10 @@
Name="Core (.c)"
>
+
+
tsx.max_count + 2*PJSIP_MAX_DIALOG_COUNT)
/**
* Initial memory block for the endpoint.
@@ -632,6 +632,31 @@
* @}
*/
+typedef struct pjsip_cfg_t
+{
+ /* Transaction settings: */
+ struct {
+ /** Maximum number of transactions */
+ unsigned max_count;
+
+ /* Timeout values */
+ unsigned t1; /**< Transaction T1 timeout, in msec */
+ unsigned t2; /**< Transaction T2 timeout, in msec */
+ unsigned t4; /**< Transaction completed timer for non-INVITE, in msec */
+ unsigned td; /**< Transaction completed timer for INVITE, in msec */
+ } tsx;
+
+ /* Dialog layer settings .. */
+
+} pjsip_cfg_t;
+
+/**
+ * Get pjsip configuration instance. Application may modify the
+ * settings before creating the SIP endpoint and modules.
+ */
+PJ_DECL(pjsip_cfg_t*) pjsip_cfg(void);
+
+
#include
Index: pjsip/src/pjsip/sip_config.c
===================================================================
RCS file: pjsip/src/pjsip/sip_config.c
diff -N pjsip/src/pjsip/sip_config.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pjsip/src/pjsip/sip_config.c 18 Dec 2007 12:57:27 -0000
@@ -0,0 +1,37 @@
+/* $Id: sip_msg.c,v 1.1.1.3 2007/09/03 17:00:57 cg Exp $ */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include
+
+/* pjsip configuration instance, initialized with default values */
+static struct pjsip_cfg_t sip_cfg =
+{
+ /* Transaction settings */
+ {
+ PJSIP_MAX_TSX_COUNT,
+ PJSIP_T1_TIMEOUT,
+ PJSIP_T2_TIMEOUT,
+ PJSIP_T4_TIMEOUT,
+ PJSIP_TD_TIMEOUT
+ }
+};
+
+
+PJ_DEF(pjsip_cfg_t*) pjsip_cfg(void)
+{
+ return &sip_cfg;
+}
Index: pjsip/src/pjsip/sip_transaction.c
===================================================================
RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/src/pjsip/sip_transaction.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 sip_transaction.c
--- pjsip/src/pjsip/sip_transaction.c 9 Nov 2007 16:33:47 -0000 1.1.1.3
+++ pjsip/src/pjsip/sip_transaction.c 18 Dec 2007 12:57:27 -0000
@@ -130,16 +130,16 @@
/* Timer timeout value constants */
-static const pj_time_val t1_timer_val = { PJSIP_T1_TIMEOUT/1000,
- PJSIP_T1_TIMEOUT%1000 };
-static const pj_time_val t2_timer_val = { PJSIP_T2_TIMEOUT/1000,
- PJSIP_T2_TIMEOUT%1000 };
-static const pj_time_val t4_timer_val = { PJSIP_T4_TIMEOUT/1000,
- PJSIP_T4_TIMEOUT%1000 };
-static const pj_time_val td_timer_val = { PJSIP_TD_TIMEOUT/1000,
- PJSIP_TD_TIMEOUT%1000 };
-static const pj_time_val timeout_timer_val = { (64*PJSIP_T1_TIMEOUT)/1000,
- (64*PJSIP_T1_TIMEOUT)%1000 };
+static pj_time_val t1_timer_val = { PJSIP_T1_TIMEOUT/1000,
+ PJSIP_T1_TIMEOUT%1000 };
+static pj_time_val t2_timer_val = { PJSIP_T2_TIMEOUT/1000,
+ PJSIP_T2_TIMEOUT%1000 };
+static pj_time_val t4_timer_val = { PJSIP_T4_TIMEOUT/1000,
+ PJSIP_T4_TIMEOUT%1000 };
+static pj_time_val td_timer_val = { PJSIP_TD_TIMEOUT/1000,
+ PJSIP_TD_TIMEOUT%1000 };
+static pj_time_val timeout_timer_val = { (64*PJSIP_T1_TIMEOUT)/1000,
+ (64*PJSIP_T1_TIMEOUT)%1000 };
#define TIMER_INACTIVE 0
#define TIMER_ACTIVE 1
@@ -427,6 +427,18 @@
PJ_ASSERT_RETURN(mod_tsx_layer.endpt==NULL, PJ_EINVALIDOP);
+ /* Initialize timer values */
+ t1_timer_val.sec = pjsip_cfg()->tsx.t1 / 1000;
+ t1_timer_val.msec = pjsip_cfg()->tsx.t1 % 1000;
+ t2_timer_val.sec = pjsip_cfg()->tsx.t2 / 1000;
+ t2_timer_val.msec = pjsip_cfg()->tsx.t2 % 1000;
+ t4_timer_val.sec = pjsip_cfg()->tsx.t4 / 1000;
+ t4_timer_val.msec = pjsip_cfg()->tsx.t4 % 1000;
+ td_timer_val.sec = pjsip_cfg()->tsx.td / 1000;
+ td_timer_val.msec = pjsip_cfg()->tsx.td % 1000;
+ timeout_timer_val.sec = (64 * pjsip_cfg()->tsx.t1) / 1000;
+ timeout_timer_val.msec = (64 * pjsip_cfg()->tsx.t1) % 1000;
+
/* Initialize TLS ID for transaction lock. */
status = pj_thread_local_alloc(&pjsip_tsx_lock_tls_id);
if (status != PJ_SUCCESS)
@@ -452,7 +464,7 @@
/* Create hash table. */
- mod_tsx_layer.htable = pj_hash_create( pool, PJSIP_MAX_TSX_COUNT );
+ mod_tsx_layer.htable = pj_hash_create( pool, pjsip_cfg()->tsx.max_count );
if (!mod_tsx_layer.htable) {
pjsip_endpt_release_pool(endpt, pool);
return PJ_ENOMEM;
@@ -1853,20 +1865,20 @@
pj_assert((tsx->transport_flag & TSX_HAS_PENDING_TRANSPORT) == 0);
if (tsx->role==PJSIP_ROLE_UAC && tsx->status_code >= 100)
- msec_time = PJSIP_T2_TIMEOUT;
+ msec_time = pjsip_cfg()->tsx.t2;
else
- msec_time = (1 << (tsx->retransmit_count)) * PJSIP_T1_TIMEOUT;
+ msec_time = (1 << (tsx->retransmit_count)) * pjsip_cfg()->tsx.t1;
if (tsx->role == PJSIP_ROLE_UAC) {
pj_assert(tsx->status_code < 200);
/* Retransmission for non-INVITE transaction caps-off at T2 */
- if (msec_time>PJSIP_T2_TIMEOUT && tsx->method.id!=PJSIP_INVITE_METHOD)
- msec_time = PJSIP_T2_TIMEOUT;
+ if (msec_time>pjsip_cfg()->tsx.t2 && tsx->method.id!=PJSIP_INVITE_METHOD)
+ msec_time = pjsip_cfg()->tsx.t2;
} else {
/* Retransmission of INVITE final response also caps-off at T2 */
pj_assert(tsx->status_code >= 200);
- if (msec_time>PJSIP_T2_TIMEOUT)
- msec_time = PJSIP_T2_TIMEOUT;
+ if (msec_time>pjsip_cfg()->tsx.t2)
+ msec_time = pjsip_cfg()->tsx.t2;
}
timeout.sec = msec_time / 1000;
Index: pjsip/src/pjsip-ua/sip_100rel.c
===================================================================
RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/src/pjsip-ua/sip_100rel.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sip_100rel.c
--- pjsip/src/pjsip-ua/sip_100rel.c 9 Nov 2007 16:33:47 -0000 1.1.1.1
+++ pjsip/src/pjsip-ua/sip_100rel.c 18 Dec 2007 12:57:27 -0000
@@ -559,7 +559,7 @@
if (dd->uas_state->retransmit_count < 6) {
delay.sec = 0;
delay.msec = (1 << dd->uas_state->retransmit_count) *
- PJSIP_T1_TIMEOUT;
+ pjsip_cfg()->tsx.t1;
pj_time_val_normalize(&delay);
} else {
delay.sec = 1;
Index: pjsip/src/test-pjsip/tsx_uac_test.c
===================================================================
RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/src/test-pjsip/tsx_uac_test.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 tsx_uac_test.c
--- pjsip/src/test-pjsip/tsx_uac_test.c 14 Aug 2007 15:41:42 -0000 1.1.1.2
+++ pjsip/src/test-pjsip/tsx_uac_test.c 18 Dec 2007 12:57:27 -0000
@@ -614,11 +614,11 @@
msec_elapsed = now.sec*1000 + now.msec;
++recv_count;
- msec_expected = (1<<(recv_count-2))*PJSIP_T1_TIMEOUT;
+ msec_expected = (1<<(recv_count-2))*pjsip_cfg()->tsx.t1;
if (msg->line.req.method.id != PJSIP_INVITE_METHOD) {
- if (msec_expected > PJSIP_T2_TIMEOUT)
- msec_expected = PJSIP_T2_TIMEOUT;
+ if (msec_expected > pjsip_cfg()->tsx.t2)
+ msec_expected = pjsip_cfg()->tsx.t2;
max_received = 11;
} else {
max_received = 7;
Index: pjsip/src/test-pjsip/tsx_uas_test.c
===================================================================
RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/src/test-pjsip/tsx_uas_test.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 tsx_uas_test.c
--- pjsip/src/test-pjsip/tsx_uas_test.c 14 Aug 2007 08:06:59 -0000 1.1.1.1
+++ pjsip/src/test-pjsip/tsx_uas_test.c 18 Dec 2007 12:57:27 -0000
@@ -986,9 +986,9 @@
PJ_TIME_VAL_SUB(now, recv_last);
msec = now.sec*1000 + now.msec;
- msec_expected = (1 << (recv_count-2)) * PJSIP_T1_TIMEOUT;
- if (msec_expected > PJSIP_T2_TIMEOUT)
- msec_expected = PJSIP_T2_TIMEOUT;
+ msec_expected = (1 << (recv_count-2)) * pjsip_cfg()->tsx.t1;
+ if (msec_expected > pjsip_cfg()->tsx.t2)
+ msec_expected = pjsip_cfg()->tsx.t2;
if (DIFF(msec, msec_expected) > MAX_ALLOWED_DIFF) {
PJ_LOG(3,(THIS_FILE,
@@ -1058,9 +1058,9 @@
PJ_TIME_VAL_SUB(now, recv_last);
msec = now.sec*1000 + now.msec;
- msec_expected = (1 << (recv_count-2)) * PJSIP_T1_TIMEOUT;
- if (msec_expected > PJSIP_T2_TIMEOUT)
- msec_expected = PJSIP_T2_TIMEOUT;
+ msec_expected = (1 << (recv_count-2)) * pjsip_cfg()->tsx.t1;
+ if (msec_expected > pjsip_cfg()->tsx.t2)
+ msec_expected = pjsip_cfg()->tsx.t2;
if (DIFF(msec, msec_expected) > MAX_ALLOWED_DIFF) {
PJ_LOG(3,(THIS_FILE,
Index: pjsip-apps/src/samples/pjsip-perf.c
===================================================================
RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip-apps/src/samples/pjsip-perf.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 pjsip-perf.c
--- pjsip-apps/src/samples/pjsip-perf.c 3 Sep 2007 17:00:58 -0000 1.1.1.3
+++ pjsip-apps/src/samples/pjsip-perf.c 18 Dec 2007 12:57:27 -0000
@@ -71,7 +71,7 @@
#endif
#define THIS_FILE "pjsip-perf.c"
-#define DEFAULT_COUNT (PJSIP_MAX_TSX_COUNT/2>10000?10000:PJSIP_MAX_TSX_COUNT/2)
+#define DEFAULT_COUNT (pjsip_cfg()->tsx.max_count/2>10000?10000:pjsip_cfg()->tsx.max_count/2)
#define JOB_WINDOW 1000
#define TERMINATE_TSX(x,c)
@@ -1222,11 +1222,11 @@
PJ_LOG(3,(THIS_FILE, "Invalid --local-port %s", pj_optarg));
return -1;
}
- if (app.client.job_count > PJSIP_MAX_TSX_COUNT)
+ if (app.client.job_count > pjsip_cfg()->tsx.max_count)
PJ_LOG(3,(THIS_FILE,
"Warning: --count value (%d) exceeds maximum "
"transaction count (%d)", app.client.job_count,
- PJSIP_MAX_TSX_COUNT));
+ pjsip_cfg()->tsx.max_count));
break;
case OPT_THREAD_COUNT: