blob: ed93e92e50556781e5559bcf3ac5320645b5ac25 [file] [log] [blame]
Alexandre Lision8af73cb2013-12-10 14:11:20 -05001/* $Id$ */
2/*
3 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __PJSIP_SIP_CONFIG_H__
21#define __PJSIP_SIP_CONFIG_H__
22
23/**
24 * @file sip_config.h
25 * @brief Compile time configuration.
26 */
27#include <pj/types.h>
28
29/**
30 * @defgroup PJSIP_CORE Core SIP Library
31 * @brief The core framework from which all other SIP components depends on.
32 *
33 * The PJSIP Core library only provides transport framework, event
34 * dispatching/module framework, and SIP message representation and
35 * parsing. It doesn't do anything usefull in itself!
36 *
37 * If application wants the stack to do anything usefull at all,
38 * it must registers @ref PJSIP_MOD to the core library. Examples
39 * of modules are @ref PJSIP_TRANSACT and @ref PJSUA_UA.
40 */
41
42/**
43 * @defgroup PJSIP_BASE Base Types
44 * @ingroup PJSIP_CORE
45 * @brief Basic PJSIP types and configurations.
46 */
47
48/**
49 * @defgroup PJSIP_CONFIG PJSIP Configurations/Settings
50 * @ingroup PJSIP_BASE
51 * @brief PJSIP compile time configurations.
52 * @{
53 */
54
55/*
56 * Include sip_autoconf.h if autoconf is used (PJ_AUTOCONF is set)
57 */
58#if defined(PJ_AUTOCONF)
59# include <pjsip/sip_autoconf.h>
60#endif
61
62PJ_BEGIN_DECL
63
64/**
65 * This structure describes PJSIP run-time configurations/settings.
66 * Application may use #pjsip_cfg() function to modify the settings
67 * before creating the stack.
68 */
69typedef struct pjsip_cfg_t
70{
71 /** Global settings. */
72 struct {
73 /**
74 * Specify port number should be allowed to appear in To and From
75 * header. Note that RFC 3261 disallow this, see Table 1 in section
76 * 19.1.1 of the RFC.
77 *
78 * Default is PJSIP_ALLOW_PORT_IN_FROMTO_HDR.
79 */
80 pj_bool_t allow_port_in_fromto_hdr;
81
82 /**
83 * Accept call replace in early state when invite is not initiated
84 * by the user agent. RFC 3891 Section 3 disallows this, however,
85 * for better interoperability reason, this might be ignored.
86 *
87 * Default is PJSIP_ACCEPT_REPLACE_IN_EARLY_STATE.
88 */
89 pj_bool_t accept_replace_in_early_state;
90
91 /**
92 * Allow hash character ('#') to appear in outgoing URIs. See
93 * https://trac.pjsip.org/repos/ticket/1569.
94 *
95 * Default is PJ_FALSE.
96 */
97 pj_bool_t allow_tx_hash_in_uri;
98
99 /**
100 * Disable rport in request.
101 *
102 * Default is PJ_FALSE.
103 */
104 pj_bool_t disable_rport;
105
106 /**
107 * Disable automatic switching from UDP to TCP if outgoing request
108 * is greater than 1300 bytes.
109 *
110 * Default is PJSIP_DONT_SWITCH_TO_TCP.
111 */
112 pj_bool_t disable_tcp_switch;
113
114 /**
115 * Enable call media session to always be updated to the latest
116 * received early media SDP when receiving forked early media
117 * (multiple 183 responses with different To tag).
118 *
119 * Default is PJSIP_FOLLOW_EARLY_MEDIA_FORK.
120 */
121 pj_bool_t follow_early_media_fork;
122
123 /**
124 * Specify whether "alias" param should be added to the Via header
125 * in any outgoing request with connection oriented transport.
126 *
127 * Default is PJSIP_REQ_HAS_VIA_ALIAS.
128 */
129 pj_bool_t req_has_via_alias;
130
131 } endpt;
132
133 /** Transaction layer settings. */
134 struct {
135
136 /** Maximum number of transactions. The value is initialized with
137 * PJSIP_MAX_TSX_COUNT
138 */
139 unsigned max_count;
140
141 /* Timeout values: */
142
143 /** Transaction T1 timeout, in msec. Default value is PJSIP_T1_TIMEOUT
144 */
145 unsigned t1;
146
147 /** Transaction T2 timeout, in msec. Default value is PJSIP_T2_TIMEOUT
148 */
149 unsigned t2;
150
151 /** Transaction completed timer for non-INVITE, in msec. Default value
152 * is PJSIP_T4_TIMEOUT
153 */
154 unsigned t4;
155
156 /** Transaction completed timer for INVITE, in msec. Default value is
157 * PJSIP_TD_TIMEOUT.
158 */
159 unsigned td;
160
161 } tsx;
162
163 /* Dialog layer settings .. TODO */
164
165 /** Client registration settings. */
166 struct {
167 /**
168 * Specify whether client registration should check for its
169 * registered contact in Contact header of successful REGISTER
170 * response to determine whether registration has been successful.
171 * This setting may be disabled if non-compliant registrar is unable
172 * to return correct Contact header.
173 *
174 * Default is PJSIP_REGISTER_CLIENT_CHECK_CONTACT
175 */
176 pj_bool_t check_contact;
177
178 /**
179 * Specify whether client registration should add "x-uid" extension
180 * parameter in all Contact URIs that it registers to assist the
181 * matching of Contact URIs in the 200/OK REGISTER response, in
182 * case the registrar is unable to return exact Contact URI in the
183 * 200/OK response.
184 *
185 * Default is PJSIP_REGISTER_CLIENT_ADD_XUID_PARAM.
186 */
187 pj_bool_t add_xuid_param;
188
189 } regc;
190
191} pjsip_cfg_t;
192
193
194#ifdef PJ_DLL
195/**
196 * Get pjsip configuration instance. Application may modify the
197 * settings before creating the SIP endpoint and modules.
198 *
199 * @return Configuration instance.
200 */
201PJ_DECL(pjsip_cfg_t*) pjsip_cfg(void);
202
203#else /* PJ_DLL */
204
205extern pjsip_cfg_t pjsip_sip_cfg_var;
206
207/**
208 * Get pjsip configuration instance. Application may modify the
209 * settings before creating the SIP endpoint and modules.
210 *
211 * @return Configuration instance.
212 */
213PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
214{
215 return &pjsip_sip_cfg_var;
216}
217
218#endif /* PJ_DLL */
219
220
221/**
222 * Specify maximum transaction count in transaction hash table.
223 * For efficiency, the value should be 2^n-1 since it will be
224 * rounded up to 2^n.
225 *
226 * Default value is 1023
227 */
228#ifndef PJSIP_MAX_TSX_COUNT
229# define PJSIP_MAX_TSX_COUNT (1024-1)
230#endif
231
232/**
233 * Specify maximum number of dialogs in the dialog hash table.
234 * For efficiency, the value should be 2^n-1 since it will be
235 * rounded up to 2^n.
236 *
237 * Default value is 511.
238 */
239#ifndef PJSIP_MAX_DIALOG_COUNT
240# define PJSIP_MAX_DIALOG_COUNT (512-1)
241#endif
242
243
244/**
245 * Specify maximum number of transports.
246 * Default value is equal to maximum number of handles in ioqueue.
247 * See also PJSIP_TPMGR_HTABLE_SIZE.
248 */
249#ifndef PJSIP_MAX_TRANSPORTS
250# define PJSIP_MAX_TRANSPORTS (PJ_IOQUEUE_MAX_HANDLES)
251#endif
252
253
254/**
255 * Transport manager hash table size (must be 2^n-1).
256 * See also PJSIP_MAX_TRANSPORTS
257 */
258#ifndef PJSIP_TPMGR_HTABLE_SIZE
259# define PJSIP_TPMGR_HTABLE_SIZE 31
260#endif
261
262
263/**
264 * Specify maximum URL size.
265 * This constant is used mainly when printing the URL for logging purpose
266 * only.
267 */
268#ifndef PJSIP_MAX_URL_SIZE
269# define PJSIP_MAX_URL_SIZE 256
270#endif
271
272
273/**
274 * Specify maximum number of modules.
275 * This mainly affects the size of mod_data array in various components.
276 */
277#ifndef PJSIP_MAX_MODULE
278# define PJSIP_MAX_MODULE 32
279#endif
280
281
282/**
283 * Maximum packet length. We set it more than MTU since a SIP PDU
284 * containing presence information can be quite large (>1500).
285 */
286#ifndef PJSIP_MAX_PKT_LEN
287# define PJSIP_MAX_PKT_LEN 4000
288#endif
289
290
291/**
292 * RFC 3261 section 18.1.1:
293 * If a request is within 200 bytes of the path MTU, or if it is larger
294 * than 1300 bytes and the path MTU is unknown, the request MUST be sent
295 * using an RFC 2914 [43] congestion controlled transport protocol, such
296 * as TCP.
297 *
298 * Disable the behavior of automatic switching to TCP whenever UDP packet
299 * size exceeds the threshold defined in PJSIP_UDP_SIZE_THRESHOLD.
300 *
301 * This option can also be controlled at run-time by the \a disable_tcp_switch
302 * setting in pjsip_cfg_t.
303 *
304 * Default is 0 (no).
305 */
306#ifndef PJSIP_DONT_SWITCH_TO_TCP
307# define PJSIP_DONT_SWITCH_TO_TCP 0
308#endif
309
310
311/**
312 * Specify whether the call media session should be updated to the latest
313 * received early media SDP when receiving forked early media (multiple 183
314 * responses with different To tag).
315 *
316 * This option can also be controlled at run-time by the
317 * \a follow_early_media_fork setting in pjsip_cfg_t.
318 *
319 * Default is PJ_TRUE.
320 */
321#ifndef PJSIP_FOLLOW_EARLY_MEDIA_FORK
322# define PJSIP_FOLLOW_EARLY_MEDIA_FORK PJ_TRUE
323#endif
324
325
326/**
327 * Specify whether "alias" param should be added to the Via header
328 * in any outgoing request with connection oriented transport.
329 *
330 * This option can also be controlled at run-time by the
331 * \a req_has_via_alias setting in pjsip_cfg_t.
332 *
333 * Default is PJ_TRUE.
334 */
335#ifndef PJSIP_REQ_HAS_VIA_ALIAS
336# define PJSIP_REQ_HAS_VIA_ALIAS PJ_TRUE
337#endif
338
339
340/**
341 * Accept call replace in early state when invite is not initiated
342 * by the user agent. RFC 3891 Section 3 disallows this, however,
343 * for better interoperability reason, this might be ignored.
344 *
345 * This option can also be controlled at run-time by the
346 * \a accept_replace_in_early_state setting in pjsip_cfg_t.
347 *
348 * Default is 0 (no).
349 */
350#ifndef PJSIP_ACCEPT_REPLACE_IN_EARLY_STATE
351# define PJSIP_ACCEPT_REPLACE_IN_EARLY_STATE 0
352#endif
353
354
355/**
356 * This setting controls the threshold of the UDP packet, which if it's
357 * larger than this value the request will be sent with TCP. This setting
358 * is useful only when PJSIP_DONT_SWITCH_TO_TCP is set to 0.
359 *
360 * Default is 1300 bytes.
361 */
362#ifndef PJSIP_UDP_SIZE_THRESHOLD
363# define PJSIP_UDP_SIZE_THRESHOLD 1300
364#endif
365
366
367/**
368 * Encode SIP headers in their short forms to reduce size. By default,
369 * SIP headers in outgoing messages will be encoded in their full names.
370 * If this option is enabled, then SIP headers for outgoing messages
371 * will be encoded in their short forms, to reduce message size.
372 * Note that this does not affect the ability of PJSIP to parse incoming
373 * SIP messages, as the parser always supports parsing both the long
374 * and short version of the headers.
375 *
376 * Note that there is also an undocumented variable defined in sip_msg.c
377 * to control whether compact form should be used for encoding SIP
378 * headers. The default value of this variable is PJSIP_ENCODE_SHORT_HNAME.
379 * To change PJSIP behavior during run-time, application can use the
380 * following construct:
381 *
382 \verbatim
383 extern pj_bool_t pjsip_use_compact_form;
384
385 // enable compact form
386 pjsip_use_compact_form = PJ_TRUE;
387 \endverbatim
388 *
389 * Default is 0 (no)
390 */
391#ifndef PJSIP_ENCODE_SHORT_HNAME
392# define PJSIP_ENCODE_SHORT_HNAME 0
393#endif
394
395
396/**
397 * Send Allow header in dialog establishing requests?
398 * RFC 3261 Allow header SHOULD be included in dialog establishing
399 * requests to inform remote agent about which SIP requests are
400 * allowed within dialog.
401 *
402 * Note that there is also an undocumented variable defined in sip_dialog.c
403 * to control whether Allow header should be included. The default value
404 * of this variable is PJSIP_INCLUDE_ALLOW_HDR_IN_DLG.
405 * To change PJSIP behavior during run-time, application can use the
406 * following construct:
407 *
408 \verbatim
409 extern pj_bool_t pjsip_include_allow_hdr_in_dlg;
410
411 // do not transmit Allow header
412 pjsip_include_allow_hdr_in_dlg = PJ_FALSE;
413 \endverbatim
414 *
415 * Default is 1 (Yes)
416 */
417#ifndef PJSIP_INCLUDE_ALLOW_HDR_IN_DLG
418# define PJSIP_INCLUDE_ALLOW_HDR_IN_DLG 1
419#endif
420
421
422/**
423 * Allow SIP modules removal or insertions during operation?
424 * If yes, then locking will be employed when endpoint need to
425 * access module.
426 */
427#ifndef PJSIP_SAFE_MODULE
428# define PJSIP_SAFE_MODULE 1
429#endif
430
431
432/**
433 * Perform Via sent-by checking as specified in RFC 3261 Section 18.1.2,
434 * which says that UAC MUST silently discard responses with Via sent-by
435 * containing values that the UAC doesn't recognize as its transport
436 * address.
437 *
438 * In PJSIP, this will cause response to be discarded and a message is
439 * written to the log, saying something like:
440 * "Dropping response Response msg 200/INVITE/cseq=608594373 (rdata00A99EF4)
441 * from 1.2.3.4:5060 because sent-by is mismatch"
442 *
443 * The default behavior is yes, but when the UA supports IP address change
444 * for the SIP transport, it will need to turn this checking off since
445 * when the transport address is changed between request is sent and
446 * response is received, the response will be discarded since its Via
447 * sent-by now contains address that is different than the transport
448 * address.
449 *
450 * Update:
451 * As of version 2.1, the default value is 0. This change was part of
452 * https://trac.pjsip.org/repos/ticket/1412
453 */
454#ifndef PJSIP_CHECK_VIA_SENT_BY
455# define PJSIP_CHECK_VIA_SENT_BY 0
456#endif
457
458
459/**
460 * If non-zero, SIP parser will unescape the escape characters ('%')
461 * in the original message, which means that it will modify the
462 * original message. Otherwise the parser will create a copy of
463 * the string and store the unescaped string to the new location.
464 *
465 * Unescaping in-place is faster, but less elegant (and it may
466 * break certain applications). So normally it's disabled, unless
467 * when benchmarking (to show off big performance).
468 *
469 * Default: 0
470 */
471#ifndef PJSIP_UNESCAPE_IN_PLACE
472# define PJSIP_UNESCAPE_IN_PLACE 0
473#endif
474
475
476/**
477 * Specify port number should be allowed to appear in To and From
478 * header. Note that RFC 3261 disallow this, see Table 1 in section
479 * 19.1.1 of the RFC. This setting can also be altered at run-time
480 * via pjsip_cfg setting, see pjsip_cfg_t.allow_port_in_fromto_hdr
481 * field.
482 *
483 * Default: 0
484 */
485#ifndef PJSIP_ALLOW_PORT_IN_FROMTO_HDR
486# define PJSIP_ALLOW_PORT_IN_FROMTO_HDR 0
487#endif
488
489/**
490 * This macro controls maximum numbers of ioqueue events to be processed
491 * in a single pjsip_endpt_handle_events() poll. When PJSIP detects that
492 * there are probably more events available from the network and total
493 * events so far is less than this value, PJSIP will call pj_ioqueue_poll()
494 * again to get more events.
495 *
496 * Value 1 works best for ioqueue with select() back-end, while for IOCP it is
497 * probably best to set this value equal to PJSIP_MAX_TIMED_OUT_ENTRIES
498 * since IOCP only processes one event at a time.
499 *
500 * Default: 1
501 */
502#ifndef PJSIP_MAX_NET_EVENTS
503# define PJSIP_MAX_NET_EVENTS 1
504#endif
505
506
507/**
508 * Max entries to process in timer heap per poll.
509 *
510 * Default: 10
511 */
512#ifndef PJSIP_MAX_TIMED_OUT_ENTRIES
513# define PJSIP_MAX_TIMED_OUT_ENTRIES 10
514#endif
515
516
517/**
518 * Idle timeout interval to be applied to outgoing transports (i.e. client
519 * side) with no usage before the transport is destroyed. Value is in
520 * seconds.
521 *
522 * Note that if the value is put lower than 33 seconds, it may cause some
523 * pjsip test units to fail. See the comment on the following link:
524 * https://trac.pjsip.org/repos/ticket/1465#comment:4
525 *
526 * Default: 33
527 */
528#ifndef PJSIP_TRANSPORT_IDLE_TIME
529# define PJSIP_TRANSPORT_IDLE_TIME 33
530#endif
531
532
533/**
534 * Idle timeout interval to be applied to incoming transports (i.e. server
535 * side) with no usage before the transport is destroyed. Server typically
536 * should let client close the connection, hence set this interval to a large
537 * value. Value is in seconds.
538 *
539 * Default: 600
540 */
541#ifndef PJSIP_TRANSPORT_SERVER_IDLE_TIME
542# define PJSIP_TRANSPORT_SERVER_IDLE_TIME 600
543#endif
544
545
546/**
547 * Maximum number of usages for a transport before a new transport is
548 * created. This only applies for ephemeral transports such as TCP.
549 *
550 * Currently this is not used.
551 *
552 * Default: -1
553 */
554#ifndef PJSIP_MAX_TRANSPORT_USAGE
555# define PJSIP_MAX_TRANSPORT_USAGE ((unsigned)-1)
556#endif
557
558
559/**
560 * The TCP incoming connection backlog number to be set in accept().
561 *
562 * Default: 5
563 *
564 * @see PJSIP_TLS_TRANSPORT_BACKLOG
565 */
566#ifndef PJSIP_TCP_TRANSPORT_BACKLOG
567# define PJSIP_TCP_TRANSPORT_BACKLOG 5
568#endif
569
570
571/**
572 * Specify whether TCP listener should use SO_REUSEADDR option. This constant
573 * will be used as the default value for the "reuse_addr" field in the
574 * pjsip_tcp_transport_cfg structure.
575 *
576 * Default is FALSE on Windows and TRUE on non-Windows.
577 *
578 * @see PJSIP_TLS_TRANSPORT_REUSEADDR
579 */
580#ifndef PJSIP_TCP_TRANSPORT_REUSEADDR
581# if (defined(PJ_WIN32) && PJ_WIN32) || (defined(PJ_WIN64) && PJ_WIN64)
582# define PJSIP_TCP_TRANSPORT_REUSEADDR 0
583# else
584# define PJSIP_TCP_TRANSPORT_REUSEADDR 1
585# endif
586#endif
587
588
589/**
590 * Set the interval to send keep-alive packet for TCP transports.
591 * If the value is zero, keep-alive will be disabled for TCP.
592 *
593 * Default: 90 (seconds)
594 *
595 * @see PJSIP_TCP_KEEP_ALIVE_DATA
596 */
597#ifndef PJSIP_TCP_KEEP_ALIVE_INTERVAL
598# define PJSIP_TCP_KEEP_ALIVE_INTERVAL 90
599#endif
600
601
602/**
603 * Set the payload of the TCP keep-alive packet.
604 *
605 * Default: CRLF
606 */
607#ifndef PJSIP_TCP_KEEP_ALIVE_DATA
608# define PJSIP_TCP_KEEP_ALIVE_DATA { "\r\n\r\n", 4 }
609#endif
610
611
612/**
613 * Set the interval to send keep-alive packet for TLS transports.
614 * If the value is zero, keep-alive will be disabled for TLS.
615 *
616 * Default: 90 (seconds)
617 *
618 * @see PJSIP_TLS_KEEP_ALIVE_DATA
619 */
620#ifndef PJSIP_TLS_KEEP_ALIVE_INTERVAL
621# define PJSIP_TLS_KEEP_ALIVE_INTERVAL 90
622#endif
623
624
625/**
626 * Set the payload of the TLS keep-alive packet.
627 *
628 * Default: CRLF
629 */
630#ifndef PJSIP_TLS_KEEP_ALIVE_DATA
631# define PJSIP_TLS_KEEP_ALIVE_DATA { "\r\n\r\n", 4 }
632#endif
633
634
635/**
636 * This macro specifies whether full DNS resolution should be used.
637 * When enabled, #pjsip_resolve() will perform asynchronous DNS SRV and
638 * A (or AAAA, when IPv6 is supported) resolution to resolve the SIP
639 * domain.
640 *
641 * Note that even when this setting is enabled, asynchronous DNS resolution
642 * will only be done when application calls #pjsip_endpt_create_resolver(),
643 * configure the nameservers with pj_dns_resolver_set_ns(), and configure
644 * the SIP endpoint's DNS resolver with #pjsip_endpt_set_resolver(). If
645 * these steps are not followed, the domain will be resolved with normal
646 * pj_gethostbyname() function.
647 *
648 * Turning off this setting will save the footprint by about 16KB, since
649 * it should also exclude dns.o and resolve.o from PJLIB-UTIL.
650 *
651 * Default: 1 (enabled)
652 *
653 * @see PJSIP_MAX_RESOLVED_ADDRESSES
654 */
655#ifndef PJSIP_HAS_RESOLVER
656# define PJSIP_HAS_RESOLVER 1
657#endif
658
659
660/**
661 * Maximum number of addresses returned by the resolver. The number here
662 * will slightly affect stack usage, since each entry will occupy about
663 * 32 bytes of stack memory.
664 *
665 * Default: 8
666 *
667 * @see PJSIP_HAS_RESOLVER
668 */
669#ifndef PJSIP_MAX_RESOLVED_ADDRESSES
670# define PJSIP_MAX_RESOLVED_ADDRESSES 8
671#endif
672
673
674/**
675 * Enable TLS SIP transport support. For most systems this means that
676 * OpenSSL must be installed.
677 *
678 * Default: follow PJ_HAS_SSL_SOCK setting, which is 0 (disabled) by default.
679 */
680#ifndef PJSIP_HAS_TLS_TRANSPORT
681# define PJSIP_HAS_TLS_TRANSPORT PJ_HAS_SSL_SOCK
682#endif
683
684
685/**
686 * The TLS pending incoming connection backlog number to be set in accept().
687 *
688 * Default: 5
689 *
690 * @see PJSIP_TCP_TRANSPORT_BACKLOG
691 */
692#ifndef PJSIP_TLS_TRANSPORT_BACKLOG
693# define PJSIP_TLS_TRANSPORT_BACKLOG 5
694#endif
695
696
697/**
698 * Specify whether TLS listener should use SO_REUSEADDR option.
699 *
700 * Default is FALSE on Windows and TRUE on non-Windows.
701 *
702 * @see PJSIP_TCP_TRANSPORT_REUSEADDR
703 */
704#ifndef PJSIP_TLS_TRANSPORT_REUSEADDR
705# if (defined(PJ_WIN32) && PJ_WIN32) || (defined(PJ_WIN64) && PJ_WIN64)
706# define PJSIP_TLS_TRANSPORT_REUSEADDR 0
707# else
708# define PJSIP_TLS_TRANSPORT_REUSEADDR 1
709# endif
710#endif
711
712
713/* Endpoint. */
714#define PJSIP_MAX_TIMER_COUNT (2*pjsip_cfg()->tsx.max_count + \
715 2*PJSIP_MAX_DIALOG_COUNT)
716
717/**
718 * Initial memory block for the endpoint.
719 */
720#ifndef PJSIP_POOL_LEN_ENDPT
721# define PJSIP_POOL_LEN_ENDPT (4000)
722#endif
723
724/**
725 * Memory increment for endpoint.
726 */
727#ifndef PJSIP_POOL_INC_ENDPT
728# define PJSIP_POOL_INC_ENDPT (4000)
729#endif
730
731
732/* Transport related constants. */
733
734/**
735 * Initial memory block for rdata.
736 */
737#ifndef PJSIP_POOL_RDATA_LEN
738# define PJSIP_POOL_RDATA_LEN 4000
739#endif
740
741/**
742 * Memory increment for rdata.
743 */
744#ifndef PJSIP_POOL_RDATA_INC
745# define PJSIP_POOL_RDATA_INC 4000
746#endif
747
748#define PJSIP_POOL_LEN_TRANSPORT 512
749#define PJSIP_POOL_INC_TRANSPORT 512
750
751/**
752 * Initial memory block size for tdata.
753 */
754#ifndef PJSIP_POOL_LEN_TDATA
755# define PJSIP_POOL_LEN_TDATA 4000
756#endif
757
758/**
759 * Memory increment for tdata.
760 */
761#ifndef PJSIP_POOL_INC_TDATA
762# define PJSIP_POOL_INC_TDATA 4000
763#endif
764
765/**
766 * Initial memory size for UA layer
767 */
768#ifndef PJSIP_POOL_LEN_UA
769# define PJSIP_POOL_LEN_UA 512
770#endif
771
772/**
773 * Memory increment for UA layer.
774 */
775#ifndef PJSIP_POOL_INC_UA
776# define PJSIP_POOL_INC_UA 512
777#endif
778
779#define PJSIP_MAX_FORWARDS_VALUE 70
780
781#define PJSIP_RFC3261_BRANCH_ID "z9hG4bK"
782#define PJSIP_RFC3261_BRANCH_LEN 7
783
784/* Transaction related constants. */
785
786/**
787 * Initial memory size for transaction layer. The bulk of pool usage
788 * for transaction layer will be used to create the hash table, so
789 * setting this value too high will not help too much with reducing
790 * fragmentation and the memory will most likely be wasted.
791 */
792#ifndef PJSIP_POOL_TSX_LAYER_LEN
793# define PJSIP_POOL_TSX_LAYER_LEN 512
794#endif
795
796/**
797 * Memory increment for transaction layer. The bulk of pool usage
798 * for transaction layer will be used to create the hash table, so
799 * setting this value too high will not help too much with reducing
800 * fragmentation and the memory will most likely be wasted.
801 */
802#ifndef PJSIP_POOL_TSX_LAYER_INC
803# define PJSIP_POOL_TSX_LAYER_INC 512
804#endif
805
806/**
807 * Initial memory size for a SIP transaction object.
808 */
809#ifndef PJSIP_POOL_TSX_LEN
810# define PJSIP_POOL_TSX_LEN 1536 /* 768 */
811#endif
812
813/**
814 * Memory increment for transaction object.
815 */
816#ifndef PJSIP_POOL_TSX_INC
817# define PJSIP_POOL_TSX_INC 256
818#endif
819
820/**
821 * Delay for non-100 1xx retransmission, in seconds.
822 * Set to 0 to disable this feature.
823 *
824 * Default: 60 seconds
825 */
826#ifndef PJSIP_TSX_1XX_RETRANS_DELAY
827# define PJSIP_TSX_1XX_RETRANS_DELAY 60
828#endif
829
830#define PJSIP_MAX_TSX_KEY_LEN (PJSIP_MAX_URL_SIZE*2)
831
832/* User agent. */
833#define PJSIP_POOL_LEN_USER_AGENT 1024
834#define PJSIP_POOL_INC_USER_AGENT 1024
835
836/* Message/URL related constants. */
837#define PJSIP_MAX_CALL_ID_LEN pj_GUID_STRING_LENGTH()
838#define PJSIP_MAX_TAG_LEN pj_GUID_STRING_LENGTH()
839#define PJSIP_MAX_BRANCH_LEN (PJSIP_RFC3261_BRANCH_LEN + pj_GUID_STRING_LENGTH() + 2)
840#define PJSIP_MAX_HNAME_LEN 64
841
842/* Dialog related constants. */
843#define PJSIP_POOL_LEN_DIALOG 1200
844#define PJSIP_POOL_INC_DIALOG 512
845
846/* Maximum header types. */
847#define PJSIP_MAX_HEADER_TYPES 72
848
849/* Maximum URI types. */
850#define PJSIP_MAX_URI_TYPES 4
851
852/*****************************************************************************
853 * Default timeout settings, in miliseconds.
854 */
855
856/** Transaction T1 timeout value. */
857#if !defined(PJSIP_T1_TIMEOUT)
858# define PJSIP_T1_TIMEOUT 500
859#endif
860
861/** Transaction T2 timeout value. */
862#if !defined(PJSIP_T2_TIMEOUT)
863# define PJSIP_T2_TIMEOUT 4000
864#endif
865
866/** Transaction completed timer for non-INVITE */
867#if !defined(PJSIP_T4_TIMEOUT)
868# define PJSIP_T4_TIMEOUT 5000
869#endif
870
871/** Transaction completed timer for INVITE */
872#if !defined(PJSIP_TD_TIMEOUT)
873# define PJSIP_TD_TIMEOUT 32000
874#endif
875
876
877/*****************************************************************************
878 * Authorization
879 */
880
881/**
882 * If this flag is set, the stack will keep the Authorization/Proxy-Authorization
883 * headers that are sent in a cache. Future requests with the same realm and
884 * the same method will use the headers in the cache (as long as no qop is
885 * required by server).
886 *
887 * Turning on this flag will make authorization process goes faster, but
888 * will grow the memory usage undefinitely until the dialog/registration
889 * session is terminated.
890 *
891 * Default: 0
892 */
893#if !defined(PJSIP_AUTH_HEADER_CACHING)
894# define PJSIP_AUTH_HEADER_CACHING 0
895#endif
896
897/**
898 * If this flag is set, the stack will proactively send Authorization/Proxy-
899 * Authorization header for next requests. If next request has the same method
900 * with any of previous requests, then the last header which is saved in
901 * the cache will be used (if PJSIP_AUTH_CACHING is set). Otherwise a fresh
902 * header will be recalculated. If a particular server has requested qop, then
903 * a fresh header will always be calculated.
904 *
905 * If this flag is NOT set, then the stack will only send Authorization/Proxy-
906 * Authorization headers when it receives 401/407 response from server.
907 *
908 * Turning ON this flag will grow memory usage of a dialog/registration pool
909 * indefinitely until it is terminated, because the stack needs to keep the
910 * last WWW-Authenticate/Proxy-Authenticate challenge.
911 *
912 * Default: 0
913 */
914#if !defined(PJSIP_AUTH_AUTO_SEND_NEXT)
915# define PJSIP_AUTH_AUTO_SEND_NEXT 0
916#endif
917
918/**
919 * Support qop="auth" directive.
920 * This option also requires client to cache the last challenge offered by
921 * server.
922 *
923 * Default: 1
924 */
925#if !defined(PJSIP_AUTH_QOP_SUPPORT)
926# define PJSIP_AUTH_QOP_SUPPORT 1
927#endif
928
929
930/**
931 * Maximum number of stale retries when server keeps rejecting our request
932 * with stale=true.
933 *
934 * Default: 3
935 */
936#ifndef PJSIP_MAX_STALE_COUNT
937# define PJSIP_MAX_STALE_COUNT 3
938#endif
939
940
941/**
942 * Specify support for IMS/3GPP digest AKA authentication version 1 and 2
943 * (AKAv1-MD5 and AKAv2-MD5 respectively).
944 *
945 * Default: 0 (for now)
946 */
947#ifndef PJSIP_HAS_DIGEST_AKA_AUTH
948# define PJSIP_HAS_DIGEST_AKA_AUTH 0
949#endif
950
951
952/**
953 * Specify the number of seconds to refresh the client registration
954 * before the registration expires.
955 *
956 * Default: 5 seconds
957 */
958#ifndef PJSIP_REGISTER_CLIENT_DELAY_BEFORE_REFRESH
959# define PJSIP_REGISTER_CLIENT_DELAY_BEFORE_REFRESH 5
960#endif
961
962
963/**
964 * Specify whether client registration should check for its registered
965 * contact in Contact header of successful REGISTE response to determine
966 * whether registration has been successful. This setting may be disabled
967 * if non-compliant registrar is unable to return correct Contact header.
968 *
969 * This setting can be changed in run-time by settting \a regc.check_contact
970 * field of pjsip_cfg().
971 *
972 * Default is 1
973 */
974#ifndef PJSIP_REGISTER_CLIENT_CHECK_CONTACT
975# define PJSIP_REGISTER_CLIENT_CHECK_CONTACT 1
976#endif
977
978
979/**
980 * Specify whether client registration should add "x-uid" extension
981 * parameter in all Contact URIs that it registers to assist the
982 * matching of Contact URIs in the 200/OK REGISTER response, in
983 * case the registrar is unable to return exact Contact URI in the
984 * 200/OK response.
985 *
986 * This setting can be changed in run-time by setting
987 * \a regc.add_xuid_param field of pjsip_cfg().
988 *
989 * Default is 0.
990 */
991#ifndef PJSIP_REGISTER_CLIENT_ADD_XUID_PARAM
992# define PJSIP_REGISTER_CLIENT_ADD_XUID_PARAM 0
993#endif
994
995
996/*****************************************************************************
997 * SIP Event framework and presence settings.
998 */
999
1000/**
1001 * Specify the time (in seconds) to send SUBSCRIBE to refresh client
1002 * subscription before the actual interval expires.
1003 *
1004 * Default: 5 seconds
1005 */
1006#ifndef PJSIP_EVSUB_TIME_UAC_REFRESH
1007# define PJSIP_EVSUB_TIME_UAC_REFRESH 5
1008#endif
1009
1010
1011/**
1012 * Specify the time (in seconds) to send PUBLISH to refresh client
1013 * publication before the actual interval expires.
1014 *
1015 * Default: 5 seconds
1016 */
1017#ifndef PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH
1018# define PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH 5
1019#endif
1020
1021
1022/**
1023 * Specify the time (in seconds) to wait for the final NOTIFY from the
1024 * server after client has sent un-SUBSCRIBE request.
1025 *
1026 * Default: 5 seconds
1027 */
1028#ifndef PJSIP_EVSUB_TIME_UAC_TERMINATE
1029# define PJSIP_EVSUB_TIME_UAC_TERMINATE 5
1030#endif
1031
1032
1033/**
1034 * Specify the time (in seconds) for client subscription to wait for another
1035 * NOTIFY from the server, if it has rejected the last NOTIFY with non-2xx
1036 * final response (such as 401). If further NOTIFY is not received within
1037 * this period, the client will unsubscribe.
1038 *
1039 * Default: 5 seconds
1040 */
1041#ifndef PJSIP_EVSUB_TIME_UAC_WAIT_NOTIFY
1042# define PJSIP_EVSUB_TIME_UAC_WAIT_NOTIFY 5
1043#endif
1044
1045
1046/**
1047 * Specify the default expiration time for presence event subscription, for
1048 * both client and server subscription. For client subscription, application
1049 * can override this by specifying positive non-zero value in "expires"
1050 * parameter when calling #pjsip_pres_initiate(). For server subscription,
1051 * we would take the expiration value from the Expires header sent by client
1052 * in the SUBSCRIBE request if the header exists and its value is less than
1053 * this setting, otherwise this setting will be used.
1054 *
1055 * Default: 600 seconds (10 minutes)
1056 */
1057#ifndef PJSIP_PRES_DEFAULT_EXPIRES
1058# define PJSIP_PRES_DEFAULT_EXPIRES 600
1059#endif
1060
1061
1062/**
1063 * Specify the status code value to respond to bad message body in NOTIFY
1064 * request for presence. Scenarios that are considered bad include non-
1065 * PIDF/XML and non-XPIDF/XML body, multipart message bodies without PIDF/XML
1066 * nor XPIDF/XML part, and bad (parsing error) PIDF and X-PIDF bodies
1067 * themselves.
1068 *
1069 * Default value is 488. Application may change this to 200 to ignore the
1070 * unrecognised content (this is useful if the application wishes to handle
1071 * the content itself). Only non-3xx final response code is allowed here.
1072 *
1073 * Default: 488 (Not Acceptable Here)
1074 */
1075#ifndef PJSIP_PRES_BAD_CONTENT_RESPONSE
1076# define PJSIP_PRES_BAD_CONTENT_RESPONSE 488
1077#endif
1078
1079
1080/**
1081 * Add "timestamp" information in generated PIDF document for both server
1082 * subscription and presence publication.
1083 *
1084 * Default: 1 (yes)
1085 */
1086#ifndef PJSIP_PRES_PIDF_ADD_TIMESTAMP
1087# define PJSIP_PRES_PIDF_ADD_TIMESTAMP 1
1088#endif
1089
1090
1091/**
1092 * Default session interval for Session Timer (RFC 4028) extension, in
1093 * seconds. As specified in RFC 4028 Section 4, this value must not be
1094 * less than the absolute minimum for the Session-Expires header field
1095 * 90 seconds, and the recommended value is 1800 seconds.
1096 *
1097 * Default: 1800 seconds
1098 */
1099#ifndef PJSIP_SESS_TIMER_DEF_SE
1100# define PJSIP_SESS_TIMER_DEF_SE 1800
1101#endif
1102
1103
1104/**
1105 * Specify whether the client publication session should queue the
1106 * PUBLISH request should there be another PUBLISH transaction still
1107 * pending. If this is set to false, the client will return error
1108 * on the PUBLISH request if there is another PUBLISH transaction still
1109 * in progress.
1110 *
1111 * Default: 1 (yes)
1112 */
1113#ifndef PJSIP_PUBLISHC_QUEUE_REQUEST
1114# define PJSIP_PUBLISHC_QUEUE_REQUEST 1
1115#endif
1116
1117
1118/**
1119 * Specify the default expiration time for Message Waiting Indication
1120 * (RFC 3842) event subscription, for both client and server subscription.
1121 * For client subscription, application can override this by specifying
1122 * positive non-zero value in "expires" parameter when calling
1123 * #pjsip_mwi_initiate(). For server subscription, we would take the
1124 * expiration value from the Expires header sent by client in the SUBSCRIBE
1125 * request if the header exists and its value is less than this setting,
1126 * otherwise this setting will be used.
1127 *
1128 * Default: 3600 seconds
1129 */
1130#ifndef PJSIP_MWI_DEFAULT_EXPIRES
1131# define PJSIP_MWI_DEFAULT_EXPIRES 3600
1132#endif
1133
1134
1135/**
1136 * Specify whether transport manager should maintain a list of transmit
1137 * buffer instances, so any possible dangling instance can be cleaned up
1138 * when the transport manager is shutdown (see also ticket #1671).
1139 * Note that this feature will have slight impact on the performance as
1140 * mutex is employed in updating the list, i.e: on creation and destruction
1141 * of transmit data.
1142 *
1143 * Default: 0 (no)
1144 */
1145#ifndef PJSIP_HAS_TX_DATA_LIST
1146# define PJSIP_HAS_TX_DATA_LIST 0
1147#endif
1148
1149
1150PJ_END_DECL
1151
1152/**
1153 * @}
1154 */
1155
1156
1157#include <pj/config.h>
1158
1159
1160#endif /* __PJSIP_SIP_CONFIG_H__ */
1161