1 | Index: pjsip/build/Makefile |
---|
2 | =================================================================== |
---|
3 | RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/build/Makefile,v |
---|
4 | retrieving revision 1.1.1.3 |
---|
5 | diff -u -r1.1.1.3 Makefile |
---|
6 | --- pjsip/build/Makefile 9 Nov 2007 16:33:46 -0000 1.1.1.3 |
---|
7 | +++ pjsip/build/Makefile 18 Dec 2007 12:57:27 -0000 |
---|
8 | @@ -36,6 +36,7 @@ |
---|
9 | # |
---|
10 | export PJSIP_SRCDIR = ../src/pjsip |
---|
11 | export PJSIP_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \ |
---|
12 | + sip_config.o \ |
---|
13 | sip_errno.o sip_msg.o sip_parser.o sip_tel_uri.o sip_uri.o \ |
---|
14 | sip_endpoint.o sip_util.o sip_util_proxy.o \ |
---|
15 | sip_resolve.o sip_transport.o sip_transport_loop.o \ |
---|
16 | Index: pjsip/build/pjsip_core.vcproj |
---|
17 | =================================================================== |
---|
18 | RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/build/pjsip_core.vcproj,v |
---|
19 | retrieving revision 1.5 |
---|
20 | diff -u -r1.5 pjsip_core.vcproj |
---|
21 | --- pjsip/build/pjsip_core.vcproj 9 Nov 2007 18:09:31 -0000 1.5 |
---|
22 | +++ pjsip/build/pjsip_core.vcproj 18 Dec 2007 12:57:27 -0000 |
---|
23 | @@ -296,6 +296,10 @@ |
---|
24 | Name="Core (.c)" |
---|
25 | > |
---|
26 | <File |
---|
27 | + RelativePath="..\src\pjsip\sip_config.c" |
---|
28 | + > |
---|
29 | + </File> |
---|
30 | + <File |
---|
31 | RelativePath="..\src\pjsip\sip_endpoint.c" |
---|
32 | > |
---|
33 | <FileConfiguration |
---|
34 | Index: pjsip/include/pjsip/sip_config.h |
---|
35 | =================================================================== |
---|
36 | RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/include/pjsip/sip_config.h,v |
---|
37 | retrieving revision 1.1.1.5 |
---|
38 | diff -u -r1.1.1.5 sip_config.h |
---|
39 | --- pjsip/include/pjsip/sip_config.h 14 Nov 2007 16:34:09 -0000 1.1.1.5 |
---|
40 | +++ pjsip/include/pjsip/sip_config.h 18 Dec 2007 12:57:27 -0000 |
---|
41 | @@ -407,7 +407,7 @@ |
---|
42 | |
---|
43 | |
---|
44 | /* Endpoint. */ |
---|
45 | -#define PJSIP_MAX_TIMER_COUNT (2*PJSIP_MAX_TSX_COUNT + 2*PJSIP_MAX_DIALOG_COUNT) |
---|
46 | +#define PJSIP_MAX_TIMER_COUNT (2*pjsip_cfg()->tsx.max_count + 2*PJSIP_MAX_DIALOG_COUNT) |
---|
47 | |
---|
48 | /** |
---|
49 | * Initial memory block for the endpoint. |
---|
50 | @@ -632,6 +632,31 @@ |
---|
51 | * @} |
---|
52 | */ |
---|
53 | |
---|
54 | +typedef struct pjsip_cfg_t |
---|
55 | +{ |
---|
56 | + /* Transaction settings: */ |
---|
57 | + struct { |
---|
58 | + /** Maximum number of transactions */ |
---|
59 | + unsigned max_count; |
---|
60 | + |
---|
61 | + /* Timeout values */ |
---|
62 | + unsigned t1; /**< Transaction T1 timeout, in msec */ |
---|
63 | + unsigned t2; /**< Transaction T2 timeout, in msec */ |
---|
64 | + unsigned t4; /**< Transaction completed timer for non-INVITE, in msec */ |
---|
65 | + unsigned td; /**< Transaction completed timer for INVITE, in msec */ |
---|
66 | + } tsx; |
---|
67 | + |
---|
68 | + /* Dialog layer settings .. */ |
---|
69 | + |
---|
70 | +} pjsip_cfg_t; |
---|
71 | + |
---|
72 | +/** |
---|
73 | + * Get pjsip configuration instance. Application may modify the |
---|
74 | + * settings before creating the SIP endpoint and modules. |
---|
75 | + */ |
---|
76 | +PJ_DECL(pjsip_cfg_t*) pjsip_cfg(void); |
---|
77 | + |
---|
78 | + |
---|
79 | #include <pj/config.h> |
---|
80 | |
---|
81 | |
---|
82 | Index: pjsip/src/pjsip/sip_config.c |
---|
83 | =================================================================== |
---|
84 | RCS file: pjsip/src/pjsip/sip_config.c |
---|
85 | diff -N pjsip/src/pjsip/sip_config.c |
---|
86 | --- /dev/null 1 Jan 1970 00:00:00 -0000 |
---|
87 | +++ pjsip/src/pjsip/sip_config.c 18 Dec 2007 12:57:27 -0000 |
---|
88 | @@ -0,0 +1,37 @@ |
---|
89 | +/* $Id: sip_msg.c,v 1.1.1.3 2007/09/03 17:00:57 cg Exp $ */ |
---|
90 | +/* |
---|
91 | + * This program is free software; you can redistribute it and/or modify |
---|
92 | + * it under the terms of the GNU General Public License as published by |
---|
93 | + * the Free Software Foundation; either version 2 of the License, or |
---|
94 | + * (at your option) any later version. |
---|
95 | + * |
---|
96 | + * This program is distributed in the hope that it will be useful, |
---|
97 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
98 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
99 | + * GNU General Public License for more details. |
---|
100 | + * |
---|
101 | + * You should have received a copy of the GNU General Public License |
---|
102 | + * along with this program; if not, write to the Free Software |
---|
103 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
104 | + */ |
---|
105 | + |
---|
106 | +#include <pjsip/sip_config.h> |
---|
107 | + |
---|
108 | +/* pjsip configuration instance, initialized with default values */ |
---|
109 | +static struct pjsip_cfg_t sip_cfg = |
---|
110 | +{ |
---|
111 | + /* Transaction settings */ |
---|
112 | + { |
---|
113 | + PJSIP_MAX_TSX_COUNT, |
---|
114 | + PJSIP_T1_TIMEOUT, |
---|
115 | + PJSIP_T2_TIMEOUT, |
---|
116 | + PJSIP_T4_TIMEOUT, |
---|
117 | + PJSIP_TD_TIMEOUT |
---|
118 | + } |
---|
119 | +}; |
---|
120 | + |
---|
121 | + |
---|
122 | +PJ_DEF(pjsip_cfg_t*) pjsip_cfg(void) |
---|
123 | +{ |
---|
124 | + return &sip_cfg; |
---|
125 | +} |
---|
126 | Index: pjsip/src/pjsip/sip_transaction.c |
---|
127 | =================================================================== |
---|
128 | RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/src/pjsip/sip_transaction.c,v |
---|
129 | retrieving revision 1.1.1.3 |
---|
130 | diff -u -r1.1.1.3 sip_transaction.c |
---|
131 | --- pjsip/src/pjsip/sip_transaction.c 9 Nov 2007 16:33:47 -0000 1.1.1.3 |
---|
132 | +++ pjsip/src/pjsip/sip_transaction.c 18 Dec 2007 12:57:27 -0000 |
---|
133 | @@ -130,16 +130,16 @@ |
---|
134 | |
---|
135 | |
---|
136 | /* Timer timeout value constants */ |
---|
137 | -static const pj_time_val t1_timer_val = { PJSIP_T1_TIMEOUT/1000, |
---|
138 | - PJSIP_T1_TIMEOUT%1000 }; |
---|
139 | -static const pj_time_val t2_timer_val = { PJSIP_T2_TIMEOUT/1000, |
---|
140 | - PJSIP_T2_TIMEOUT%1000 }; |
---|
141 | -static const pj_time_val t4_timer_val = { PJSIP_T4_TIMEOUT/1000, |
---|
142 | - PJSIP_T4_TIMEOUT%1000 }; |
---|
143 | -static const pj_time_val td_timer_val = { PJSIP_TD_TIMEOUT/1000, |
---|
144 | - PJSIP_TD_TIMEOUT%1000 }; |
---|
145 | -static const pj_time_val timeout_timer_val = { (64*PJSIP_T1_TIMEOUT)/1000, |
---|
146 | - (64*PJSIP_T1_TIMEOUT)%1000 }; |
---|
147 | +static pj_time_val t1_timer_val = { PJSIP_T1_TIMEOUT/1000, |
---|
148 | + PJSIP_T1_TIMEOUT%1000 }; |
---|
149 | +static pj_time_val t2_timer_val = { PJSIP_T2_TIMEOUT/1000, |
---|
150 | + PJSIP_T2_TIMEOUT%1000 }; |
---|
151 | +static pj_time_val t4_timer_val = { PJSIP_T4_TIMEOUT/1000, |
---|
152 | + PJSIP_T4_TIMEOUT%1000 }; |
---|
153 | +static pj_time_val td_timer_val = { PJSIP_TD_TIMEOUT/1000, |
---|
154 | + PJSIP_TD_TIMEOUT%1000 }; |
---|
155 | +static pj_time_val timeout_timer_val = { (64*PJSIP_T1_TIMEOUT)/1000, |
---|
156 | + (64*PJSIP_T1_TIMEOUT)%1000 }; |
---|
157 | |
---|
158 | #define TIMER_INACTIVE 0 |
---|
159 | #define TIMER_ACTIVE 1 |
---|
160 | @@ -427,6 +427,18 @@ |
---|
161 | |
---|
162 | PJ_ASSERT_RETURN(mod_tsx_layer.endpt==NULL, PJ_EINVALIDOP); |
---|
163 | |
---|
164 | + /* Initialize timer values */ |
---|
165 | + t1_timer_val.sec = pjsip_cfg()->tsx.t1 / 1000; |
---|
166 | + t1_timer_val.msec = pjsip_cfg()->tsx.t1 % 1000; |
---|
167 | + t2_timer_val.sec = pjsip_cfg()->tsx.t2 / 1000; |
---|
168 | + t2_timer_val.msec = pjsip_cfg()->tsx.t2 % 1000; |
---|
169 | + t4_timer_val.sec = pjsip_cfg()->tsx.t4 / 1000; |
---|
170 | + t4_timer_val.msec = pjsip_cfg()->tsx.t4 % 1000; |
---|
171 | + td_timer_val.sec = pjsip_cfg()->tsx.td / 1000; |
---|
172 | + td_timer_val.msec = pjsip_cfg()->tsx.td % 1000; |
---|
173 | + timeout_timer_val.sec = (64 * pjsip_cfg()->tsx.t1) / 1000; |
---|
174 | + timeout_timer_val.msec = (64 * pjsip_cfg()->tsx.t1) % 1000; |
---|
175 | + |
---|
176 | /* Initialize TLS ID for transaction lock. */ |
---|
177 | status = pj_thread_local_alloc(&pjsip_tsx_lock_tls_id); |
---|
178 | if (status != PJ_SUCCESS) |
---|
179 | @@ -452,7 +464,7 @@ |
---|
180 | |
---|
181 | |
---|
182 | /* Create hash table. */ |
---|
183 | - mod_tsx_layer.htable = pj_hash_create( pool, PJSIP_MAX_TSX_COUNT ); |
---|
184 | + mod_tsx_layer.htable = pj_hash_create( pool, pjsip_cfg()->tsx.max_count ); |
---|
185 | if (!mod_tsx_layer.htable) { |
---|
186 | pjsip_endpt_release_pool(endpt, pool); |
---|
187 | return PJ_ENOMEM; |
---|
188 | @@ -1853,20 +1865,20 @@ |
---|
189 | pj_assert((tsx->transport_flag & TSX_HAS_PENDING_TRANSPORT) == 0); |
---|
190 | |
---|
191 | if (tsx->role==PJSIP_ROLE_UAC && tsx->status_code >= 100) |
---|
192 | - msec_time = PJSIP_T2_TIMEOUT; |
---|
193 | + msec_time = pjsip_cfg()->tsx.t2; |
---|
194 | else |
---|
195 | - msec_time = (1 << (tsx->retransmit_count)) * PJSIP_T1_TIMEOUT; |
---|
196 | + msec_time = (1 << (tsx->retransmit_count)) * pjsip_cfg()->tsx.t1; |
---|
197 | |
---|
198 | if (tsx->role == PJSIP_ROLE_UAC) { |
---|
199 | pj_assert(tsx->status_code < 200); |
---|
200 | /* Retransmission for non-INVITE transaction caps-off at T2 */ |
---|
201 | - if (msec_time>PJSIP_T2_TIMEOUT && tsx->method.id!=PJSIP_INVITE_METHOD) |
---|
202 | - msec_time = PJSIP_T2_TIMEOUT; |
---|
203 | + if (msec_time>pjsip_cfg()->tsx.t2 && tsx->method.id!=PJSIP_INVITE_METHOD) |
---|
204 | + msec_time = pjsip_cfg()->tsx.t2; |
---|
205 | } else { |
---|
206 | /* Retransmission of INVITE final response also caps-off at T2 */ |
---|
207 | pj_assert(tsx->status_code >= 200); |
---|
208 | - if (msec_time>PJSIP_T2_TIMEOUT) |
---|
209 | - msec_time = PJSIP_T2_TIMEOUT; |
---|
210 | + if (msec_time>pjsip_cfg()->tsx.t2) |
---|
211 | + msec_time = pjsip_cfg()->tsx.t2; |
---|
212 | } |
---|
213 | |
---|
214 | timeout.sec = msec_time / 1000; |
---|
215 | Index: pjsip/src/pjsip-ua/sip_100rel.c |
---|
216 | =================================================================== |
---|
217 | RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/src/pjsip-ua/sip_100rel.c,v |
---|
218 | retrieving revision 1.1.1.1 |
---|
219 | diff -u -r1.1.1.1 sip_100rel.c |
---|
220 | --- pjsip/src/pjsip-ua/sip_100rel.c 9 Nov 2007 16:33:47 -0000 1.1.1.1 |
---|
221 | +++ pjsip/src/pjsip-ua/sip_100rel.c 18 Dec 2007 12:57:27 -0000 |
---|
222 | @@ -559,7 +559,7 @@ |
---|
223 | if (dd->uas_state->retransmit_count < 6) { |
---|
224 | delay.sec = 0; |
---|
225 | delay.msec = (1 << dd->uas_state->retransmit_count) * |
---|
226 | - PJSIP_T1_TIMEOUT; |
---|
227 | + pjsip_cfg()->tsx.t1; |
---|
228 | pj_time_val_normalize(&delay); |
---|
229 | } else { |
---|
230 | delay.sec = 1; |
---|
231 | Index: pjsip/src/test-pjsip/tsx_uac_test.c |
---|
232 | =================================================================== |
---|
233 | RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/src/test-pjsip/tsx_uac_test.c,v |
---|
234 | retrieving revision 1.1.1.2 |
---|
235 | diff -u -r1.1.1.2 tsx_uac_test.c |
---|
236 | --- pjsip/src/test-pjsip/tsx_uac_test.c 14 Aug 2007 15:41:42 -0000 1.1.1.2 |
---|
237 | +++ pjsip/src/test-pjsip/tsx_uac_test.c 18 Dec 2007 12:57:27 -0000 |
---|
238 | @@ -614,11 +614,11 @@ |
---|
239 | msec_elapsed = now.sec*1000 + now.msec; |
---|
240 | |
---|
241 | ++recv_count; |
---|
242 | - msec_expected = (1<<(recv_count-2))*PJSIP_T1_TIMEOUT; |
---|
243 | + msec_expected = (1<<(recv_count-2))*pjsip_cfg()->tsx.t1; |
---|
244 | |
---|
245 | if (msg->line.req.method.id != PJSIP_INVITE_METHOD) { |
---|
246 | - if (msec_expected > PJSIP_T2_TIMEOUT) |
---|
247 | - msec_expected = PJSIP_T2_TIMEOUT; |
---|
248 | + if (msec_expected > pjsip_cfg()->tsx.t2) |
---|
249 | + msec_expected = pjsip_cfg()->tsx.t2; |
---|
250 | max_received = 11; |
---|
251 | } else { |
---|
252 | max_received = 7; |
---|
253 | Index: pjsip/src/test-pjsip/tsx_uas_test.c |
---|
254 | =================================================================== |
---|
255 | RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip/src/test-pjsip/tsx_uas_test.c,v |
---|
256 | retrieving revision 1.1.1.1 |
---|
257 | diff -u -r1.1.1.1 tsx_uas_test.c |
---|
258 | --- pjsip/src/test-pjsip/tsx_uas_test.c 14 Aug 2007 08:06:59 -0000 1.1.1.1 |
---|
259 | +++ pjsip/src/test-pjsip/tsx_uas_test.c 18 Dec 2007 12:57:27 -0000 |
---|
260 | @@ -986,9 +986,9 @@ |
---|
261 | PJ_TIME_VAL_SUB(now, recv_last); |
---|
262 | |
---|
263 | msec = now.sec*1000 + now.msec; |
---|
264 | - msec_expected = (1 << (recv_count-2)) * PJSIP_T1_TIMEOUT; |
---|
265 | - if (msec_expected > PJSIP_T2_TIMEOUT) |
---|
266 | - msec_expected = PJSIP_T2_TIMEOUT; |
---|
267 | + msec_expected = (1 << (recv_count-2)) * pjsip_cfg()->tsx.t1; |
---|
268 | + if (msec_expected > pjsip_cfg()->tsx.t2) |
---|
269 | + msec_expected = pjsip_cfg()->tsx.t2; |
---|
270 | |
---|
271 | if (DIFF(msec, msec_expected) > MAX_ALLOWED_DIFF) { |
---|
272 | PJ_LOG(3,(THIS_FILE, |
---|
273 | @@ -1058,9 +1058,9 @@ |
---|
274 | PJ_TIME_VAL_SUB(now, recv_last); |
---|
275 | |
---|
276 | msec = now.sec*1000 + now.msec; |
---|
277 | - msec_expected = (1 << (recv_count-2)) * PJSIP_T1_TIMEOUT; |
---|
278 | - if (msec_expected > PJSIP_T2_TIMEOUT) |
---|
279 | - msec_expected = PJSIP_T2_TIMEOUT; |
---|
280 | + msec_expected = (1 << (recv_count-2)) * pjsip_cfg()->tsx.t1; |
---|
281 | + if (msec_expected > pjsip_cfg()->tsx.t2) |
---|
282 | + msec_expected = pjsip_cfg()->tsx.t2; |
---|
283 | |
---|
284 | if (DIFF(msec, msec_expected) > MAX_ALLOWED_DIFF) { |
---|
285 | PJ_LOG(3,(THIS_FILE, |
---|
286 | Index: pjsip-apps/src/samples/pjsip-perf.c |
---|
287 | =================================================================== |
---|
288 | RCS file: /EyePData/Cvs/org_pjsip-library-pjproject/input/pjsip-apps/src/samples/pjsip-perf.c,v |
---|
289 | retrieving revision 1.1.1.3 |
---|
290 | diff -u -r1.1.1.3 pjsip-perf.c |
---|
291 | --- pjsip-apps/src/samples/pjsip-perf.c 3 Sep 2007 17:00:58 -0000 1.1.1.3 |
---|
292 | +++ pjsip-apps/src/samples/pjsip-perf.c 18 Dec 2007 12:57:27 -0000 |
---|
293 | @@ -71,7 +71,7 @@ |
---|
294 | #endif |
---|
295 | |
---|
296 | #define THIS_FILE "pjsip-perf.c" |
---|
297 | -#define DEFAULT_COUNT (PJSIP_MAX_TSX_COUNT/2>10000?10000:PJSIP_MAX_TSX_COUNT/2) |
---|
298 | +#define DEFAULT_COUNT (pjsip_cfg()->tsx.max_count/2>10000?10000:pjsip_cfg()->tsx.max_count/2) |
---|
299 | #define JOB_WINDOW 1000 |
---|
300 | #define TERMINATE_TSX(x,c) |
---|
301 | |
---|
302 | @@ -1222,11 +1222,11 @@ |
---|
303 | PJ_LOG(3,(THIS_FILE, "Invalid --local-port %s", pj_optarg)); |
---|
304 | return -1; |
---|
305 | } |
---|
306 | - if (app.client.job_count > PJSIP_MAX_TSX_COUNT) |
---|
307 | + if (app.client.job_count > pjsip_cfg()->tsx.max_count) |
---|
308 | PJ_LOG(3,(THIS_FILE, |
---|
309 | "Warning: --count value (%d) exceeds maximum " |
---|
310 | "transaction count (%d)", app.client.job_count, |
---|
311 | - PJSIP_MAX_TSX_COUNT)); |
---|
312 | + pjsip_cfg()->tsx.max_count)); |
---|
313 | break; |
---|
314 | |
---|
315 | case OPT_THREAD_COUNT: |
---|