1
/* $Id: sip_config.h 4770 2014-02-27 06:16:36Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
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.
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.
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
20
#ifndef __PJSIP_SIP_CONFIG_H__
21
#define __PJSIP_SIP_CONFIG_H__
25
* @brief Compile time configuration.
30
* @defgroup PJSIP_CORE Core SIP Library
31
* @brief The core framework from which all other SIP components depends on.
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!
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.
43
* @defgroup PJSIP_BASE Base Types
45
* @brief Basic PJSIP types and configurations.
49
* @defgroup PJSIP_CONFIG PJSIP Configurations/Settings
51
* @brief PJSIP compile time configurations.
56
* Include sip_autoconf.h if autoconf is used (PJ_AUTOCONF is set)
58
#if defined(PJ_AUTOCONF)
59
# include <pjsip/sip_autoconf.h>
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.
69
typedef struct pjsip_cfg_t
71
/** Global settings. */
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
78
* Default is PJSIP_ALLOW_PORT_IN_FROMTO_HDR.
80
pj_bool_t allow_port_in_fromto_hdr;
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.
87
* Default is PJSIP_ACCEPT_REPLACE_IN_EARLY_STATE.
89
pj_bool_t accept_replace_in_early_state;
92
* Allow hash character ('#') to appear in outgoing URIs. See
93
* https://trac.pjsip.org/repos/ticket/1569.
95
* Default is PJ_FALSE.
97
pj_bool_t allow_tx_hash_in_uri;
100
* Disable rport in request.
102
* Default is PJ_FALSE.
104
pj_bool_t disable_rport;
107
* Disable automatic switching from UDP to TCP if outgoing request
108
* is greater than 1300 bytes.
110
* Default is PJSIP_DONT_SWITCH_TO_TCP.
112
pj_bool_t disable_tcp_switch;
115
* Disable automatic switching to TLS if target-URI does not use
116
* "sips" scheme nor TLS transport, even when request-URI uses
119
* Default is PJSIP_DONT_SWITCH_TO_TLS.
121
pj_bool_t disable_tls_switch;
124
* Enable call media session to always be updated to the latest
125
* received early media SDP when receiving forked early media
126
* (multiple 183 responses with different To tag).
128
* Default is PJSIP_FOLLOW_EARLY_MEDIA_FORK.
130
pj_bool_t follow_early_media_fork;
133
* Specify whether "alias" param should be added to the Via header
134
* in any outgoing request with connection oriented transport.
136
* Default is PJSIP_REQ_HAS_VIA_ALIAS.
138
pj_bool_t req_has_via_alias;
142
/** Transaction layer settings. */
145
/** Maximum number of transactions. The value is initialized with
146
* PJSIP_MAX_TSX_COUNT
150
/* Timeout values: */
152
/** Transaction T1 timeout, in msec. Default value is PJSIP_T1_TIMEOUT
156
/** Transaction T2 timeout, in msec. Default value is PJSIP_T2_TIMEOUT
160
/** Transaction completed timer for non-INVITE, in msec. Default value
161
* is PJSIP_T4_TIMEOUT
165
/** Transaction completed timer for INVITE, in msec. Default value is
172
/* Dialog layer settings .. TODO */
174
/** Client registration settings. */
177
* Specify whether client registration should check for its
178
* registered contact in Contact header of successful REGISTER
179
* response to determine whether registration has been successful.
180
* This setting may be disabled if non-compliant registrar is unable
181
* to return correct Contact header.
183
* Default is PJSIP_REGISTER_CLIENT_CHECK_CONTACT
185
pj_bool_t check_contact;
188
* Specify whether client registration should add "x-uid" extension
189
* parameter in all Contact URIs that it registers to assist the
190
* matching of Contact URIs in the 200/OK REGISTER response, in
191
* case the registrar is unable to return exact Contact URI in the
194
* Default is PJSIP_REGISTER_CLIENT_ADD_XUID_PARAM.
196
pj_bool_t add_xuid_param;
205
* Get pjsip configuration instance. Application may modify the
206
* settings before creating the SIP endpoint and modules.
208
* @return Configuration instance.
210
PJ_DECL(pjsip_cfg_t*) pjsip_cfg(void);
214
extern pjsip_cfg_t pjsip_sip_cfg_var;
217
* Get pjsip configuration instance. Application may modify the
218
* settings before creating the SIP endpoint and modules.
220
* @return Configuration instance.
222
PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
224
return &pjsip_sip_cfg_var;
231
* Specify maximum transaction count in transaction hash table.
232
* For efficiency, the value should be 2^n-1 since it will be
235
* Default value is 1023
237
#ifndef PJSIP_MAX_TSX_COUNT
238
# define PJSIP_MAX_TSX_COUNT (1024-1)
242
* Specify maximum number of dialogs in the dialog hash table.
243
* For efficiency, the value should be 2^n-1 since it will be
246
* Default value is 511.
248
#ifndef PJSIP_MAX_DIALOG_COUNT
249
# define PJSIP_MAX_DIALOG_COUNT (512-1)
254
* Specify maximum number of transports.
255
* Default value is equal to maximum number of handles in ioqueue.
256
* See also PJSIP_TPMGR_HTABLE_SIZE.
258
#ifndef PJSIP_MAX_TRANSPORTS
259
# define PJSIP_MAX_TRANSPORTS (PJ_IOQUEUE_MAX_HANDLES)
264
* Transport manager hash table size (must be 2^n-1).
265
* See also PJSIP_MAX_TRANSPORTS
267
#ifndef PJSIP_TPMGR_HTABLE_SIZE
268
# define PJSIP_TPMGR_HTABLE_SIZE 31
273
* Specify maximum URL size.
274
* This constant is used mainly when printing the URL for logging purpose
277
#ifndef PJSIP_MAX_URL_SIZE
278
# define PJSIP_MAX_URL_SIZE 256
283
* Specify maximum number of modules.
284
* This mainly affects the size of mod_data array in various components.
286
#ifndef PJSIP_MAX_MODULE
287
# define PJSIP_MAX_MODULE 32
292
* Maximum packet length. We set it more than MTU since a SIP PDU
293
* containing presence information can be quite large (>1500).
295
#ifndef PJSIP_MAX_PKT_LEN
296
# define PJSIP_MAX_PKT_LEN 4000
301
* RFC 3261 section 18.1.1:
302
* If a request is within 200 bytes of the path MTU, or if it is larger
303
* than 1300 bytes and the path MTU is unknown, the request MUST be sent
304
* using an RFC 2914 [43] congestion controlled transport protocol, such
307
* Disable the behavior of automatic switching to TCP whenever UDP packet
308
* size exceeds the threshold defined in PJSIP_UDP_SIZE_THRESHOLD.
310
* This option can also be controlled at run-time by the \a disable_tcp_switch
311
* setting in pjsip_cfg_t.
315
#ifndef PJSIP_DONT_SWITCH_TO_TCP
316
# define PJSIP_DONT_SWITCH_TO_TCP 0
321
* As specified RFC 3261 section 8.1.2, when request-URI uses "sips" scheme,
322
* TLS must always be used regardless of the target-URI scheme or transport
325
* This option will specify whether the behavior of automatic switching to TLS
326
* should be disabled, i.e: regard the target-URI scheme or transport type.
328
* This option can also be controlled at run-time by the \a disable_tls_switch
329
* setting in pjsip_cfg_t.
333
#ifndef PJSIP_DONT_SWITCH_TO_TLS
334
# define PJSIP_DONT_SWITCH_TO_TLS 0
339
* Specify whether the call media session should be updated to the latest
340
* received early media SDP when receiving forked early media (multiple 183
341
* responses with different To tag).
343
* This option can also be controlled at run-time by the
344
* \a follow_early_media_fork setting in pjsip_cfg_t.
346
* Default is PJ_TRUE.
348
#ifndef PJSIP_FOLLOW_EARLY_MEDIA_FORK
349
# define PJSIP_FOLLOW_EARLY_MEDIA_FORK PJ_TRUE
354
* Specify whether "alias" param should be added to the Via header
355
* in any outgoing request with connection oriented transport.
357
* This option can also be controlled at run-time by the
358
* \a req_has_via_alias setting in pjsip_cfg_t.
360
* Default is PJ_TRUE.
362
#ifndef PJSIP_REQ_HAS_VIA_ALIAS
363
# define PJSIP_REQ_HAS_VIA_ALIAS PJ_TRUE
368
* Accept call replace in early state when invite is not initiated
369
* by the user agent. RFC 3891 Section 3 disallows this, however,
370
* for better interoperability reason, this might be ignored.
372
* This option can also be controlled at run-time by the
373
* \a accept_replace_in_early_state setting in pjsip_cfg_t.
377
#ifndef PJSIP_ACCEPT_REPLACE_IN_EARLY_STATE
378
# define PJSIP_ACCEPT_REPLACE_IN_EARLY_STATE 0
383
* This setting controls the threshold of the UDP packet, which if it's
384
* larger than this value the request will be sent with TCP. This setting
385
* is useful only when PJSIP_DONT_SWITCH_TO_TCP is set to 0.
387
* Default is 1300 bytes.
389
#ifndef PJSIP_UDP_SIZE_THRESHOLD
390
# define PJSIP_UDP_SIZE_THRESHOLD 1300
395
* Encode SIP headers in their short forms to reduce size. By default,
396
* SIP headers in outgoing messages will be encoded in their full names.
397
* If this option is enabled, then SIP headers for outgoing messages
398
* will be encoded in their short forms, to reduce message size.
399
* Note that this does not affect the ability of PJSIP to parse incoming
400
* SIP messages, as the parser always supports parsing both the long
401
* and short version of the headers.
403
* Note that there is also an undocumented variable defined in sip_msg.c
404
* to control whether compact form should be used for encoding SIP
405
* headers. The default value of this variable is PJSIP_ENCODE_SHORT_HNAME.
406
* To change PJSIP behavior during run-time, application can use the
407
* following construct:
410
extern pj_bool_t pjsip_use_compact_form;
412
// enable compact form
413
pjsip_use_compact_form = PJ_TRUE;
418
#ifndef PJSIP_ENCODE_SHORT_HNAME
419
# define PJSIP_ENCODE_SHORT_HNAME 0
424
* Send Allow header in dialog establishing requests?
425
* RFC 3261 Allow header SHOULD be included in dialog establishing
426
* requests to inform remote agent about which SIP requests are
427
* allowed within dialog.
429
* Note that there is also an undocumented variable defined in sip_dialog.c
430
* to control whether Allow header should be included. The default value
431
* of this variable is PJSIP_INCLUDE_ALLOW_HDR_IN_DLG.
432
* To change PJSIP behavior during run-time, application can use the
433
* following construct:
436
extern pj_bool_t pjsip_include_allow_hdr_in_dlg;
438
// do not transmit Allow header
439
pjsip_include_allow_hdr_in_dlg = PJ_FALSE;
444
#ifndef PJSIP_INCLUDE_ALLOW_HDR_IN_DLG
445
# define PJSIP_INCLUDE_ALLOW_HDR_IN_DLG 1
450
* Allow SIP modules removal or insertions during operation?
451
* If yes, then locking will be employed when endpoint need to
454
#ifndef PJSIP_SAFE_MODULE
455
# define PJSIP_SAFE_MODULE 1
460
* Perform Via sent-by checking as specified in RFC 3261 Section 18.1.2,
461
* which says that UAC MUST silently discard responses with Via sent-by
462
* containing values that the UAC doesn't recognize as its transport
465
* In PJSIP, this will cause response to be discarded and a message is
466
* written to the log, saying something like:
467
* "Dropping response Response msg 200/INVITE/cseq=608594373 (rdata00A99EF4)
468
* from 1.2.3.4:5060 because sent-by is mismatch"
470
* The default behavior is yes, but when the UA supports IP address change
471
* for the SIP transport, it will need to turn this checking off since
472
* when the transport address is changed between request is sent and
473
* response is received, the response will be discarded since its Via
474
* sent-by now contains address that is different than the transport
478
* As of version 2.1, the default value is 0. This change was part of
479
* https://trac.pjsip.org/repos/ticket/1412
481
#ifndef PJSIP_CHECK_VIA_SENT_BY
482
# define PJSIP_CHECK_VIA_SENT_BY 0
487
* If non-zero, SIP parser will unescape the escape characters ('%')
488
* in the original message, which means that it will modify the
489
* original message. Otherwise the parser will create a copy of
490
* the string and store the unescaped string to the new location.
492
* Unescaping in-place is faster, but less elegant (and it may
493
* break certain applications). So normally it's disabled, unless
494
* when benchmarking (to show off big performance).
498
#ifndef PJSIP_UNESCAPE_IN_PLACE
499
# define PJSIP_UNESCAPE_IN_PLACE 0
504
* Specify port number should be allowed to appear in To and From
505
* header. Note that RFC 3261 disallow this, see Table 1 in section
506
* 19.1.1 of the RFC. This setting can also be altered at run-time
507
* via pjsip_cfg setting, see pjsip_cfg_t.allow_port_in_fromto_hdr
512
#ifndef PJSIP_ALLOW_PORT_IN_FROMTO_HDR
513
# define PJSIP_ALLOW_PORT_IN_FROMTO_HDR 0
517
* This macro controls maximum numbers of ioqueue events to be processed
518
* in a single pjsip_endpt_handle_events() poll. When PJSIP detects that
519
* there are probably more events available from the network and total
520
* events so far is less than this value, PJSIP will call pj_ioqueue_poll()
521
* again to get more events.
523
* Value 1 works best for ioqueue with select() back-end, while for IOCP it is
524
* probably best to set this value equal to PJSIP_MAX_TIMED_OUT_ENTRIES
525
* since IOCP only processes one event at a time.
529
#ifndef PJSIP_MAX_NET_EVENTS
530
# define PJSIP_MAX_NET_EVENTS 1
535
* Max entries to process in timer heap per poll.
539
#ifndef PJSIP_MAX_TIMED_OUT_ENTRIES
540
# define PJSIP_MAX_TIMED_OUT_ENTRIES 10
545
* Idle timeout interval to be applied to outgoing transports (i.e. client
546
* side) with no usage before the transport is destroyed. Value is in
549
* Note that if the value is put lower than 33 seconds, it may cause some
550
* pjsip test units to fail. See the comment on the following link:
551
* https://trac.pjsip.org/repos/ticket/1465#comment:4
555
#ifndef PJSIP_TRANSPORT_IDLE_TIME
556
# define PJSIP_TRANSPORT_IDLE_TIME 33
561
* Idle timeout interval to be applied to incoming transports (i.e. server
562
* side) with no usage before the transport is destroyed. Server typically
563
* should let client close the connection, hence set this interval to a large
564
* value. Value is in seconds.
568
#ifndef PJSIP_TRANSPORT_SERVER_IDLE_TIME
569
# define PJSIP_TRANSPORT_SERVER_IDLE_TIME 600
574
* Maximum number of usages for a transport before a new transport is
575
* created. This only applies for ephemeral transports such as TCP.
577
* Currently this is not used.
581
#ifndef PJSIP_MAX_TRANSPORT_USAGE
582
# define PJSIP_MAX_TRANSPORT_USAGE ((unsigned)-1)
587
* The TCP incoming connection backlog number to be set in accept().
591
* @see PJSIP_TLS_TRANSPORT_BACKLOG
593
#ifndef PJSIP_TCP_TRANSPORT_BACKLOG
594
# define PJSIP_TCP_TRANSPORT_BACKLOG 5
599
* Specify whether TCP listener should use SO_REUSEADDR option. This constant
600
* will be used as the default value for the "reuse_addr" field in the
601
* pjsip_tcp_transport_cfg structure.
603
* Default is FALSE on Windows and TRUE on non-Windows.
605
* @see PJSIP_TLS_TRANSPORT_REUSEADDR
607
#ifndef PJSIP_TCP_TRANSPORT_REUSEADDR
608
# if (defined(PJ_WIN32) && PJ_WIN32) || (defined(PJ_WIN64) && PJ_WIN64)
609
# define PJSIP_TCP_TRANSPORT_REUSEADDR 0
611
# define PJSIP_TCP_TRANSPORT_REUSEADDR 1
617
* Set the interval to send keep-alive packet for TCP transports.
618
* If the value is zero, keep-alive will be disabled for TCP.
620
* Default: 90 (seconds)
622
* @see PJSIP_TCP_KEEP_ALIVE_DATA
624
#ifndef PJSIP_TCP_KEEP_ALIVE_INTERVAL
625
# define PJSIP_TCP_KEEP_ALIVE_INTERVAL 90
630
* Set the payload of the TCP keep-alive packet.
634
#ifndef PJSIP_TCP_KEEP_ALIVE_DATA
635
# define PJSIP_TCP_KEEP_ALIVE_DATA { "\r\n\r\n", 4 }
640
* Set the interval to send keep-alive packet for TLS transports.
641
* If the value is zero, keep-alive will be disabled for TLS.
643
* Default: 90 (seconds)
645
* @see PJSIP_TLS_KEEP_ALIVE_DATA
647
#ifndef PJSIP_TLS_KEEP_ALIVE_INTERVAL
648
# define PJSIP_TLS_KEEP_ALIVE_INTERVAL 90
653
* Set the payload of the TLS keep-alive packet.
657
#ifndef PJSIP_TLS_KEEP_ALIVE_DATA
658
# define PJSIP_TLS_KEEP_ALIVE_DATA { "\r\n\r\n", 4 }
663
* This macro specifies whether full DNS resolution should be used.
664
* When enabled, #pjsip_resolve() will perform asynchronous DNS SRV and
665
* A (or AAAA, when IPv6 is supported) resolution to resolve the SIP
668
* Note that even when this setting is enabled, asynchronous DNS resolution
669
* will only be done when application calls #pjsip_endpt_create_resolver(),
670
* configure the nameservers with pj_dns_resolver_set_ns(), and configure
671
* the SIP endpoint's DNS resolver with #pjsip_endpt_set_resolver(). If
672
* these steps are not followed, the domain will be resolved with normal
673
* pj_gethostbyname() function.
675
* Turning off this setting will save the footprint by about 16KB, since
676
* it should also exclude dns.o and resolve.o from PJLIB-UTIL.
678
* Default: 1 (enabled)
680
* @see PJSIP_MAX_RESOLVED_ADDRESSES
682
#ifndef PJSIP_HAS_RESOLVER
683
# define PJSIP_HAS_RESOLVER 1
688
* Maximum number of addresses returned by the resolver. The number here
689
* will slightly affect stack usage, since each entry will occupy about
690
* 32 bytes of stack memory.
694
* @see PJSIP_HAS_RESOLVER
696
#ifndef PJSIP_MAX_RESOLVED_ADDRESSES
697
# define PJSIP_MAX_RESOLVED_ADDRESSES 8
702
* Enable TLS SIP transport support. For most systems this means that
703
* OpenSSL must be installed.
705
* Default: follow PJ_HAS_SSL_SOCK setting, which is 0 (disabled) by default.
707
#ifndef PJSIP_HAS_TLS_TRANSPORT
708
# define PJSIP_HAS_TLS_TRANSPORT PJ_HAS_SSL_SOCK
713
* The TLS pending incoming connection backlog number to be set in accept().
717
* @see PJSIP_TCP_TRANSPORT_BACKLOG
719
#ifndef PJSIP_TLS_TRANSPORT_BACKLOG
720
# define PJSIP_TLS_TRANSPORT_BACKLOG 5
725
* Specify whether TLS listener should use SO_REUSEADDR option.
727
* Default is FALSE on Windows and TRUE on non-Windows.
729
* @see PJSIP_TCP_TRANSPORT_REUSEADDR
731
#ifndef PJSIP_TLS_TRANSPORT_REUSEADDR
732
# if (defined(PJ_WIN32) && PJ_WIN32) || (defined(PJ_WIN64) && PJ_WIN64)
733
# define PJSIP_TLS_TRANSPORT_REUSEADDR 0
735
# define PJSIP_TLS_TRANSPORT_REUSEADDR 1
741
#define PJSIP_MAX_TIMER_COUNT (2*pjsip_cfg()->tsx.max_count + \
742
2*PJSIP_MAX_DIALOG_COUNT)
745
* Initial memory block for the endpoint.
747
#ifndef PJSIP_POOL_LEN_ENDPT
748
# define PJSIP_POOL_LEN_ENDPT (4000)
752
* Memory increment for endpoint.
754
#ifndef PJSIP_POOL_INC_ENDPT
755
# define PJSIP_POOL_INC_ENDPT (4000)
759
/* Transport related constants. */
762
* Initial memory block for rdata.
764
#ifndef PJSIP_POOL_RDATA_LEN
765
# define PJSIP_POOL_RDATA_LEN 4000
769
* Memory increment for rdata.
771
#ifndef PJSIP_POOL_RDATA_INC
772
# define PJSIP_POOL_RDATA_INC 4000
775
#define PJSIP_POOL_LEN_TRANSPORT 512
776
#define PJSIP_POOL_INC_TRANSPORT 512
779
* Initial memory block size for tdata.
781
#ifndef PJSIP_POOL_LEN_TDATA
782
# define PJSIP_POOL_LEN_TDATA 4000
786
* Memory increment for tdata.
788
#ifndef PJSIP_POOL_INC_TDATA
789
# define PJSIP_POOL_INC_TDATA 4000
793
* Initial memory size for UA layer
795
#ifndef PJSIP_POOL_LEN_UA
796
# define PJSIP_POOL_LEN_UA 512
800
* Memory increment for UA layer.
802
#ifndef PJSIP_POOL_INC_UA
803
# define PJSIP_POOL_INC_UA 512
806
#define PJSIP_MAX_FORWARDS_VALUE 70
808
#define PJSIP_RFC3261_BRANCH_ID "z9hG4bK"
809
#define PJSIP_RFC3261_BRANCH_LEN 7
811
/* Transaction related constants. */
814
* Initial memory size for transaction layer. The bulk of pool usage
815
* for transaction layer will be used to create the hash table, so
816
* setting this value too high will not help too much with reducing
817
* fragmentation and the memory will most likely be wasted.
819
#ifndef PJSIP_POOL_TSX_LAYER_LEN
820
# define PJSIP_POOL_TSX_LAYER_LEN 512
824
* Memory increment for transaction layer. The bulk of pool usage
825
* for transaction layer will be used to create the hash table, so
826
* setting this value too high will not help too much with reducing
827
* fragmentation and the memory will most likely be wasted.
829
#ifndef PJSIP_POOL_TSX_LAYER_INC
830
# define PJSIP_POOL_TSX_LAYER_INC 512
834
* Initial memory size for a SIP transaction object.
836
#ifndef PJSIP_POOL_TSX_LEN
837
# define PJSIP_POOL_TSX_LEN 1536 /* 768 */
841
* Memory increment for transaction object.
843
#ifndef PJSIP_POOL_TSX_INC
844
# define PJSIP_POOL_TSX_INC 256
848
* Delay for non-100 1xx retransmission, in seconds.
849
* Set to 0 to disable this feature.
851
* Default: 60 seconds
853
#ifndef PJSIP_TSX_1XX_RETRANS_DELAY
854
# define PJSIP_TSX_1XX_RETRANS_DELAY 60
857
#define PJSIP_MAX_TSX_KEY_LEN (PJSIP_MAX_URL_SIZE*2)
860
#define PJSIP_POOL_LEN_USER_AGENT 1024
861
#define PJSIP_POOL_INC_USER_AGENT 1024
863
/* Message/URL related constants. */
864
#define PJSIP_MAX_CALL_ID_LEN pj_GUID_STRING_LENGTH()
865
#define PJSIP_MAX_TAG_LEN pj_GUID_STRING_LENGTH()
866
#define PJSIP_MAX_BRANCH_LEN (PJSIP_RFC3261_BRANCH_LEN + pj_GUID_STRING_LENGTH() + 2)
867
#define PJSIP_MAX_HNAME_LEN 64
869
/* Dialog related constants. */
870
#define PJSIP_POOL_LEN_DIALOG 1200
871
#define PJSIP_POOL_INC_DIALOG 512
873
/* Maximum header types. */
874
#define PJSIP_MAX_HEADER_TYPES 72
876
/* Maximum URI types. */
877
#define PJSIP_MAX_URI_TYPES 4
879
/*****************************************************************************
880
* Default timeout settings, in miliseconds.
883
/** Transaction T1 timeout value. */
884
#if !defined(PJSIP_T1_TIMEOUT)
885
# define PJSIP_T1_TIMEOUT 500
888
/** Transaction T2 timeout value. */
889
#if !defined(PJSIP_T2_TIMEOUT)
890
# define PJSIP_T2_TIMEOUT 4000
893
/** Transaction completed timer for non-INVITE */
894
#if !defined(PJSIP_T4_TIMEOUT)
895
# define PJSIP_T4_TIMEOUT 5000
898
/** Transaction completed timer for INVITE */
899
#if !defined(PJSIP_TD_TIMEOUT)
900
# define PJSIP_TD_TIMEOUT 32000
904
/*****************************************************************************
909
* If this flag is set, the stack will keep the Authorization/Proxy-Authorization
910
* headers that are sent in a cache. Future requests with the same realm and
911
* the same method will use the headers in the cache (as long as no qop is
912
* required by server).
914
* Turning on this flag will make authorization process goes faster, but
915
* will grow the memory usage undefinitely until the dialog/registration
916
* session is terminated.
920
#if !defined(PJSIP_AUTH_HEADER_CACHING)
921
# define PJSIP_AUTH_HEADER_CACHING 0
925
* If this flag is set, the stack will proactively send Authorization/Proxy-
926
* Authorization header for next requests. If next request has the same method
927
* with any of previous requests, then the last header which is saved in
928
* the cache will be used (if PJSIP_AUTH_CACHING is set). Otherwise a fresh
929
* header will be recalculated. If a particular server has requested qop, then
930
* a fresh header will always be calculated.
932
* If this flag is NOT set, then the stack will only send Authorization/Proxy-
933
* Authorization headers when it receives 401/407 response from server.
935
* Turning ON this flag will grow memory usage of a dialog/registration pool
936
* indefinitely until it is terminated, because the stack needs to keep the
937
* last WWW-Authenticate/Proxy-Authenticate challenge.
941
#if !defined(PJSIP_AUTH_AUTO_SEND_NEXT)
942
# define PJSIP_AUTH_AUTO_SEND_NEXT 0
946
* Support qop="auth" directive.
947
* This option also requires client to cache the last challenge offered by
952
#if !defined(PJSIP_AUTH_QOP_SUPPORT)
953
# define PJSIP_AUTH_QOP_SUPPORT 1
958
* Maximum number of stale retries when server keeps rejecting our request
963
#ifndef PJSIP_MAX_STALE_COUNT
964
# define PJSIP_MAX_STALE_COUNT 3
969
* Specify support for IMS/3GPP digest AKA authentication version 1 and 2
970
* (AKAv1-MD5 and AKAv2-MD5 respectively).
972
* Note that if this is enabled, application would need to link with
973
* <b>libmilenage</b> library from \a third_party directory.
975
* Default: 0 (for now)
977
#ifndef PJSIP_HAS_DIGEST_AKA_AUTH
978
# define PJSIP_HAS_DIGEST_AKA_AUTH 0
983
* Specify the number of seconds to refresh the client registration
984
* before the registration expires.
988
#ifndef PJSIP_REGISTER_CLIENT_DELAY_BEFORE_REFRESH
989
# define PJSIP_REGISTER_CLIENT_DELAY_BEFORE_REFRESH 5
994
* Specify whether client registration should check for its registered
995
* contact in Contact header of successful REGISTE response to determine
996
* whether registration has been successful. This setting may be disabled
997
* if non-compliant registrar is unable to return correct Contact header.
999
* This setting can be changed in run-time by settting \a regc.check_contact
1000
* field of pjsip_cfg().
1004
#ifndef PJSIP_REGISTER_CLIENT_CHECK_CONTACT
1005
# define PJSIP_REGISTER_CLIENT_CHECK_CONTACT 1
1010
* Specify whether client registration should add "x-uid" extension
1011
* parameter in all Contact URIs that it registers to assist the
1012
* matching of Contact URIs in the 200/OK REGISTER response, in
1013
* case the registrar is unable to return exact Contact URI in the
1016
* This setting can be changed in run-time by setting
1017
* \a regc.add_xuid_param field of pjsip_cfg().
1021
#ifndef PJSIP_REGISTER_CLIENT_ADD_XUID_PARAM
1022
# define PJSIP_REGISTER_CLIENT_ADD_XUID_PARAM 0
1026
/*****************************************************************************
1027
* SIP Event framework and presence settings.
1031
* Specify the time (in seconds) to send SUBSCRIBE to refresh client
1032
* subscription before the actual interval expires.
1034
* Default: 5 seconds
1036
#ifndef PJSIP_EVSUB_TIME_UAC_REFRESH
1037
# define PJSIP_EVSUB_TIME_UAC_REFRESH 5
1042
* Specify the time (in seconds) to send PUBLISH to refresh client
1043
* publication before the actual interval expires.
1045
* Default: 5 seconds
1047
#ifndef PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH
1048
# define PJSIP_PUBLISHC_DELAY_BEFORE_REFRESH 5
1053
* Specify the time (in seconds) to wait for the final NOTIFY from the
1054
* server after client has sent un-SUBSCRIBE request.
1056
* Default: 5 seconds
1058
#ifndef PJSIP_EVSUB_TIME_UAC_TERMINATE
1059
# define PJSIP_EVSUB_TIME_UAC_TERMINATE 5
1064
* Specify the time (in seconds) for client subscription to wait for another
1065
* NOTIFY from the server, if it has rejected the last NOTIFY with non-2xx
1066
* final response (such as 401). If further NOTIFY is not received within
1067
* this period, the client will unsubscribe.
1069
* Default: 5 seconds
1071
#ifndef PJSIP_EVSUB_TIME_UAC_WAIT_NOTIFY
1072
# define PJSIP_EVSUB_TIME_UAC_WAIT_NOTIFY 5
1077
* Specify the default expiration time for presence event subscription, for
1078
* both client and server subscription. For client subscription, application
1079
* can override this by specifying positive non-zero value in "expires"
1080
* parameter when calling #pjsip_pres_initiate(). For server subscription,
1081
* we would take the expiration value from the Expires header sent by client
1082
* in the SUBSCRIBE request if the header exists and its value is less than
1083
* this setting, otherwise this setting will be used.
1085
* Default: 600 seconds (10 minutes)
1087
#ifndef PJSIP_PRES_DEFAULT_EXPIRES
1088
# define PJSIP_PRES_DEFAULT_EXPIRES 600
1093
* Specify the status code value to respond to bad message body in NOTIFY
1094
* request for presence. Scenarios that are considered bad include non-
1095
* PIDF/XML and non-XPIDF/XML body, multipart message bodies without PIDF/XML
1096
* nor XPIDF/XML part, and bad (parsing error) PIDF and X-PIDF bodies
1099
* Default value is 488. Application may change this to 200 to ignore the
1100
* unrecognised content (this is useful if the application wishes to handle
1101
* the content itself). Only non-3xx final response code is allowed here.
1103
* Default: 488 (Not Acceptable Here)
1105
#ifndef PJSIP_PRES_BAD_CONTENT_RESPONSE
1106
# define PJSIP_PRES_BAD_CONTENT_RESPONSE 488
1111
* Add "timestamp" information in generated PIDF document for both server
1112
* subscription and presence publication.
1116
#ifndef PJSIP_PRES_PIDF_ADD_TIMESTAMP
1117
# define PJSIP_PRES_PIDF_ADD_TIMESTAMP 1
1122
* Default session interval for Session Timer (RFC 4028) extension, in
1123
* seconds. As specified in RFC 4028 Section 4, this value must not be
1124
* less than the absolute minimum for the Session-Expires header field
1125
* 90 seconds, and the recommended value is 1800 seconds.
1127
* Default: 1800 seconds
1129
#ifndef PJSIP_SESS_TIMER_DEF_SE
1130
# define PJSIP_SESS_TIMER_DEF_SE 1800
1135
* Specify whether the client publication session should queue the
1136
* PUBLISH request should there be another PUBLISH transaction still
1137
* pending. If this is set to false, the client will return error
1138
* on the PUBLISH request if there is another PUBLISH transaction still
1143
#ifndef PJSIP_PUBLISHC_QUEUE_REQUEST
1144
# define PJSIP_PUBLISHC_QUEUE_REQUEST 1
1149
* Specify the default expiration time for Message Waiting Indication
1150
* (RFC 3842) event subscription, for both client and server subscription.
1151
* For client subscription, application can override this by specifying
1152
* positive non-zero value in "expires" parameter when calling
1153
* #pjsip_mwi_initiate(). For server subscription, we would take the
1154
* expiration value from the Expires header sent by client in the SUBSCRIBE
1155
* request if the header exists and its value is less than this setting,
1156
* otherwise this setting will be used.
1158
* Default: 3600 seconds
1160
#ifndef PJSIP_MWI_DEFAULT_EXPIRES
1161
# define PJSIP_MWI_DEFAULT_EXPIRES 3600
1166
* Specify whether transport manager should maintain a list of transmit
1167
* buffer instances, so any possible dangling instance can be cleaned up
1168
* when the transport manager is shutdown (see also ticket #1671).
1169
* Note that this feature will have slight impact on the performance as
1170
* mutex is employed in updating the list, i.e: on creation and destruction
1175
#ifndef PJSIP_HAS_TX_DATA_LIST
1176
# define PJSIP_HAS_TX_DATA_LIST 0
1187
#include <pj/config.h>
1190
#endif /* __PJSIP_SIP_CONFIG_H__ */