sip_config.h 45 KB

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