README 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  1. siputils
  2. Hardy Kahl
  3. 1&1 Internet AG
  4. Henning Westerholt
  5. 1&1 Internet AG
  6. Nils Ohlmeier
  7. FhG Fokus
  8. Jan Janak
  9. FhG FOKUS
  10. Daniel-Constantin Mierla
  11. asipto.com
  12. Gabriel Vasile
  13. FhG FOKUS
  14. Juha Heinanen
  15. TutPro Inc.
  16. Edited by
  17. Jan Janak
  18. Edited by
  19. Bogdan-Andrei Iancu
  20. Edited by
  21. Gabriel Vasile
  22. Copyright (c) 2008, 2005, 2003 1&1 Internet AG, FhG Fokus, Voice Sistem
  23. SRL
  24. __________________________________________________________________
  25. Table of Contents
  26. 1. Admin Guide
  27. 1. Overview
  28. 2. Dependencies
  29. 2.1. Kamailio Modules
  30. 2.2. External Libraries or Applications
  31. 3. Parameters
  32. 3.1. ring_timeout (int)
  33. 3.2. options_accept (string)
  34. 3.3. options_accept_encoding (string)
  35. 3.4. contact_flds_separator (string)
  36. 3.5. options_accept_language (string)
  37. 3.6. options_support (string)
  38. 3.7. rpid_prefix (string)
  39. 3.8. rpid_suffix (string)
  40. 3.9. rpid_avp (string)
  41. 4. Functions
  42. 4.1. ring_insert_callid()
  43. 4.2. options_reply()
  44. 4.3. is_user(username)
  45. 4.4. has_totag()
  46. 4.5. uri_param(param)
  47. 4.6. uri_param(param,value)
  48. 4.7. add_uri_param(param)
  49. 4.8. get_uri_param(name, var)
  50. 4.9. tel2sip(uri, hostpart, result)
  51. 4.10. is_e164(pseudo-variable)
  52. 4.11. is_uri_user_e164(pseudo-variable)
  53. 4.12. encode_contact(encoding_prefix,hostpart)
  54. 4.13. decode_contact()
  55. 4.14. decode_contact_header()
  56. 4.15. cmp_uri(str1, str2)
  57. 4.16. cmp_aor(str1, str2)
  58. 4.17. is_rpid_user_e164()
  59. 4.18. append_rpid_hf()
  60. 4.19. append_rpid_hf(prefix, suffix)
  61. 4.20. is_rpid_user_e164()
  62. 4.21. set_uri_user(uri, user)
  63. 4.22. set_uri_host(uri, host)
  64. 4.23. is_request()
  65. 4.24. is_reply()
  66. 4.25. is_gruu([uri])
  67. 4.26. is_supported(option)
  68. List of Examples
  69. 1.1. Set ring_timeout parameter
  70. 1.2. Set options_accept parameter
  71. 1.3. Set options_accept_encoding parameter
  72. 1.4. Set contact_flds_separator parameter
  73. 1.5. Set options_accept_language parameter
  74. 1.6. Set options_support parameter
  75. 1.7. rpid_prefix parameter example
  76. 1.8. rpid_suffix parameter example
  77. 1.9. rpid_avp parameter example
  78. 1.10. ring_insert_callid() usage
  79. 1.11. options_reply usage
  80. 1.12. is_user usage
  81. 1.13. has_totag usage
  82. 1.14. uri_param usage
  83. 1.15. uri_param usage
  84. 1.16. add_uri_param usage
  85. 1.17. add_uri_param usage
  86. 1.18. tel2sip usage
  87. 1.19. is_e164 usage
  88. 1.20. is_uri_user_e164 usage
  89. 1.21. encode_contact usage
  90. 1.22. decode_contact usage
  91. 1.23. decode_contact_header usage
  92. 1.24. cmp_uri usage
  93. 1.25. cmp_aor usage
  94. 1.26. is_rpid_user_e164 usage
  95. 1.27. append_rpid_hf usage
  96. 1.28. append_rpid_hf(prefix, suffix) usage
  97. 1.29. is_rpid_user_e164 usage
  98. 1.30. set_uri_user usage
  99. 1.31. set_uri_host usage
  100. 1.32. is_request usage
  101. 1.33. is_reply usage
  102. 1.34. is_gruu() usage
  103. 1.35. is_supported() usage
  104. Chapter 1. Admin Guide
  105. Table of Contents
  106. 1. Overview
  107. 2. Dependencies
  108. 2.1. Kamailio Modules
  109. 2.2. External Libraries or Applications
  110. 3. Parameters
  111. 3.1. ring_timeout (int)
  112. 3.2. options_accept (string)
  113. 3.3. options_accept_encoding (string)
  114. 3.4. contact_flds_separator (string)
  115. 3.5. options_accept_language (string)
  116. 3.6. options_support (string)
  117. 3.7. rpid_prefix (string)
  118. 3.8. rpid_suffix (string)
  119. 3.9. rpid_avp (string)
  120. 4. Functions
  121. 4.1. ring_insert_callid()
  122. 4.2. options_reply()
  123. 4.3. is_user(username)
  124. 4.4. has_totag()
  125. 4.5. uri_param(param)
  126. 4.6. uri_param(param,value)
  127. 4.7. add_uri_param(param)
  128. 4.8. get_uri_param(name, var)
  129. 4.9. tel2sip(uri, hostpart, result)
  130. 4.10. is_e164(pseudo-variable)
  131. 4.11. is_uri_user_e164(pseudo-variable)
  132. 4.12. encode_contact(encoding_prefix,hostpart)
  133. 4.13. decode_contact()
  134. 4.14. decode_contact_header()
  135. 4.15. cmp_uri(str1, str2)
  136. 4.16. cmp_aor(str1, str2)
  137. 4.17. is_rpid_user_e164()
  138. 4.18. append_rpid_hf()
  139. 4.19. append_rpid_hf(prefix, suffix)
  140. 4.20. is_rpid_user_e164()
  141. 4.21. set_uri_user(uri, user)
  142. 4.22. set_uri_host(uri, host)
  143. 4.23. is_request()
  144. 4.24. is_reply()
  145. 4.25. is_gruu([uri])
  146. 4.26. is_supported(option)
  147. 1. Overview
  148. This module implement various functions and checks related to SIP
  149. message handling and URI handling.
  150. It offers some functions related to handle ringing. In a parallel
  151. forking scenario you get several 183s with SDP. You don't want that
  152. your customers hear more than one ringtone or answer machine in
  153. parallel on the phone. So its necessary to drop the 183 in this cases
  154. and send a 180 instead.
  155. This module also provides a function to answer OPTIONS requests which
  156. are directed to the server itself. This means an OPTIONS request which
  157. has the address of the server in the request URI, and no username in
  158. the URI. The request will be answered with a 200 OK with the
  159. capabilities of the server.
  160. To answer OPTIONS request directed to your server is the easiest way
  161. for is-alive-tests on the SIP (application) layer from remote (similar
  162. to ICMP echo requests, also known as "ping", on the network layer).
  163. 2. Dependencies
  164. 2.1. Kamailio Modules
  165. 2.2. External Libraries or Applications
  166. 2.1. Kamailio Modules
  167. The following modules must be loaded before this module:
  168. * sl -- Stateless replies.
  169. 2.2. External Libraries or Applications
  170. The following libraries or applications must be installed before
  171. running Kamailio with this module loaded:
  172. * None.
  173. 3. Parameters
  174. 3.1. ring_timeout (int)
  175. 3.2. options_accept (string)
  176. 3.3. options_accept_encoding (string)
  177. 3.4. contact_flds_separator (string)
  178. 3.5. options_accept_language (string)
  179. 3.6. options_support (string)
  180. 3.7. rpid_prefix (string)
  181. 3.8. rpid_suffix (string)
  182. 3.9. rpid_avp (string)
  183. 3.1. ring_timeout (int)
  184. Timeout value in seconds, define how long the call-id is stored in the
  185. internal list kept for replacing 183 messages with 180. A reasonable
  186. value is "30".
  187. Default value is "0". This means functionality is disabled.
  188. Example 1.1. Set ring_timeout parameter
  189. ...
  190. modparam("siputils", "ring_timeout", 30)
  191. ...
  192. 3.2. options_accept (string)
  193. This parameter is the content of the Accept header field. Note: it is
  194. not clearly written in RFC3261 if a proxy should accept any content
  195. (the default "*/*") because it does not care about content. Or if it
  196. does not accept any content, which is "".
  197. Default value is "*/*".
  198. Example 1.2. Set options_accept parameter
  199. ...
  200. modparam("siputils", "options_accept", "application/*")
  201. ...
  202. 3.3. options_accept_encoding (string)
  203. This parameter is the content of the Accept-Encoding header field.
  204. Please do not change the default value because Kamailio does not
  205. support any encodings yet.
  206. Default value is "".
  207. Example 1.3. Set options_accept_encoding parameter
  208. ...
  209. modparam("siputils", "options_accept_encoding", "gzip")
  210. ...
  211. 3.4. contact_flds_separator (string)
  212. First char of this parameter is used as separator for encoding/decoding
  213. Contact header.
  214. Warning
  215. First char of this field must be set to a value which is not used
  216. inside username,password or other fields of contact. Otherwise it is
  217. possible for the decoding step to fail/produce wrong results.
  218. Default value is "*".
  219. Example 1.4. Set contact_flds_separator parameter
  220. ...
  221. modparam("siputils", "contact_flds_separator", "-")
  222. ...
  223. then an encoded uri might look
  224. sip:user-password-ip-port-protocol@PublicIP
  225. 3.5. options_accept_language (string)
  226. This parameter is the content of the Accept-Language header field. You
  227. can set any language code which you prefer for error descriptions from
  228. other devices, but presumably there are not many devices around which
  229. support other languages than the default English.
  230. Default value is "en".
  231. Example 1.5. Set options_accept_language parameter
  232. ...
  233. modparam("siputils", "options_accept_language", "de")
  234. ...
  235. 3.6. options_support (string)
  236. This parameter is the content of the Support header field, indicating
  237. SIP extensions. Please do not change the default value, because
  238. Kamailio currently does not support any of the SIP extensions
  239. registered at the IANA.
  240. Default value is "".
  241. Example 1.6. Set options_support parameter
  242. ...
  243. modparam("siputils", "options_support", "100rel")
  244. ...
  245. 3.7. rpid_prefix (string)
  246. Prefix to be added to Remote-Party-ID header field just before the URI
  247. returned from either radius or database.
  248. Default value is "".
  249. Example 1.7. rpid_prefix parameter example
  250. modparam("auth", "rpid_prefix", "Whatever <")
  251. 3.8. rpid_suffix (string)
  252. Suffix to be added to Remote-Party-ID header field after the URI
  253. returned from either radius or database.
  254. Default value is ";party=calling;id-type=subscriber;screen=yes".
  255. Example 1.8. rpid_suffix parameter example
  256. modparam("auth", "rpid_suffix", "@1.2.3.4>")
  257. 3.9. rpid_avp (string)
  258. Full AVP specification for the AVP which stores the RPID value. It used
  259. to transport the RPID value from authentication backend modules
  260. (auth_db or auth_radius) or from script to the auth function
  261. append_rpid_hf and is_rpid_user_e164.
  262. If defined to NULL string, all RPID functions will fail at runtime.
  263. Default value is "$avp(s:rpid)".
  264. Example 1.9. rpid_avp parameter example
  265. modparam("auth", "rpid_avp", "$avp(myrpid)")
  266. 4. Functions
  267. 4.1. ring_insert_callid()
  268. 4.2. options_reply()
  269. 4.3. is_user(username)
  270. 4.4. has_totag()
  271. 4.5. uri_param(param)
  272. 4.6. uri_param(param,value)
  273. 4.7. add_uri_param(param)
  274. 4.8. get_uri_param(name, var)
  275. 4.9. tel2sip(uri, hostpart, result)
  276. 4.10. is_e164(pseudo-variable)
  277. 4.11. is_uri_user_e164(pseudo-variable)
  278. 4.12. encode_contact(encoding_prefix,hostpart)
  279. 4.13. decode_contact()
  280. 4.14. decode_contact_header()
  281. 4.15. cmp_uri(str1, str2)
  282. 4.16. cmp_aor(str1, str2)
  283. 4.17. is_rpid_user_e164()
  284. 4.18. append_rpid_hf()
  285. 4.19. append_rpid_hf(prefix, suffix)
  286. 4.20. is_rpid_user_e164()
  287. 4.21. set_uri_user(uri, user)
  288. 4.22. set_uri_host(uri, host)
  289. 4.23. is_request()
  290. 4.24. is_reply()
  291. 4.25. is_gruu([uri])
  292. 4.26. is_supported(option)
  293. 4.1. ring_insert_callid()
  294. Inserting the call-id in the internal list, which is checked when
  295. further replies arrive. Any 183 reply that is received during the
  296. timeout value will be converted to a 180 message. Please note that you
  297. need to set a positive timeout value in order to use this function.
  298. The function returns TRUE on success, and FALSE during processing
  299. failures.
  300. This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.
  301. Example 1.10. ring_insert_callid() usage
  302. ...
  303. ring_insert_callid();
  304. ...
  305. 4.2. options_reply()
  306. This function checks if the request method is OPTIONS and if the
  307. request URI does not contain an username. If both is true the request
  308. will be answered stateless with "200 OK" and the capabilities from the
  309. modules parameters.
  310. It sends "500 Server Internal Error" for some errors and returns false
  311. if it is called for a wrong request.
  312. The check for the request method and the missing username is optional
  313. because it is also done by the function itself. But you should not call
  314. this function outside the myself check because in this case the
  315. function could answer OPTIONS requests which are sent to you as
  316. outbound proxy but with an other destination then your proxy (this
  317. check is currently missing in the function).
  318. This function can be used from REQUEST_ROUTE.
  319. Example 1.11. options_reply usage
  320. ...
  321. if (uri==myself) {
  322. if ((method==OPTIONS) && (! uri=~"sip:.*[@]+.*")) {
  323. options_reply();
  324. }
  325. }
  326. ...
  327. 4.3. is_user(username)
  328. Check if the username in credentials matches the given username.
  329. Meaning of the parameters is as follows:
  330. * username - Username string.
  331. This function can be used from REQUEST_ROUTE.
  332. Example 1.12. is_user usage
  333. ...
  334. if (is_user("john")) {
  335. ...
  336. };
  337. ...
  338. 4.4. has_totag()
  339. Check if To header field uri contains tag parameter.
  340. This function can be used from ANY_ROUTE.
  341. Example 1.13. has_totag usage
  342. ...
  343. if (has_totag()) {
  344. ...
  345. };
  346. ...
  347. 4.5. uri_param(param)
  348. Find if Request URI has a given parameter with no value
  349. Meaning of the parameters is as follows:
  350. * param - parameter name to look for.
  351. This function can be used from REQUEST_ROUTE.
  352. Example 1.14. uri_param usage
  353. ...
  354. if (uri_param("param1")) {
  355. ...
  356. };
  357. ...
  358. 4.6. uri_param(param,value)
  359. Find if Request URI has a given parameter with matching value
  360. Meaning of the parameters is as follows:
  361. * param - parameter name to look for.
  362. * value - parameter value to match.
  363. This function can be used from REQUEST_ROUTE.
  364. Example 1.15. uri_param usage
  365. ...
  366. if (uri_param("param1","value1")) {
  367. ...
  368. };
  369. ...
  370. 4.7. add_uri_param(param)
  371. Add to RURI a parameter (name=value);
  372. Meaning of the parameters is as follows:
  373. * param - parameter to be appended in "name=value" format.
  374. This function can be used from REQUEST_ROUTE.
  375. Example 1.16. add_uri_param usage
  376. ...
  377. add_uri_param("nat=yes");
  378. ...
  379. 4.8. get_uri_param(name, var)
  380. Get the value of RURI parameter.
  381. Meaning of the parameters is as follows:
  382. * name - the name of R-URI parameter
  383. * var - the variable where to store the value of the parameter
  384. This function can be used from REQUEST_ROUTE.
  385. Example 1.17. add_uri_param usage
  386. ...
  387. get_uri_param("nat", "$var(nat)");
  388. ...
  389. 4.9. tel2sip(uri, hostpart, result)
  390. Converts URI in first param (pseudo variable or string) to SIP URI, if
  391. it is a tel URI. If conversion was done, writes resulting SIP URI to
  392. third param (pseudo variable). Returns 1 if conversion succeeded or if
  393. no conversion was needed.
  394. The conversion follows the rules in RFC 3261 section 19.1.6:
  395. * Visual separators ( "-", ".", "(", ")" ) are removed from tel URI
  396. number before converting it to SIP URI userinfo.
  397. * tel URI parameters are downcased before appending them to SIP URI
  398. userinfo
  399. The SIP URI hostpart is taken from second param (pseudo variable or
  400. string).
  401. This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
  402. BRANCH_ROUTE, or ONREPLY_ROUTE.
  403. Example 1.18. tel2sip usage
  404. ...
  405. # $ru: tel:+(34)-999-888-777
  406. # $fu: sip:[email protected]
  407. tel2sip("$ru", $fd", "$ru");
  408. # $ru: sip:[email protected];user=phone
  409. # $ru: tel:+12-(34)-56-78;Ext=200;ISUB=+123-456
  410. # $fu: sip:[email protected]
  411. tel2sip("$ru", $fd", "$ru");
  412. # $ru: sip:+12345678;ext=200;[email protected];user=phone
  413. ...
  414. 4.10. is_e164(pseudo-variable)
  415. Checks if string value of pseudo variable argument is an E164 number.
  416. This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, and
  417. LOCAL_ROUTE.
  418. Example 1.19. is_e164 usage
  419. ...
  420. if (is_164("$fU")) { # Check From header URI user part
  421. ...
  422. }
  423. if (is_e164("$avp(i:705)") {
  424. # Check stgring value stored in avp i:705
  425. ...
  426. };
  427. ...
  428. 4.11. is_uri_user_e164(pseudo-variable)
  429. Checks if userpart of URI stored in pseudo variable is E164 number.
  430. This function can be used from ANY_ROUTE.
  431. Example 1.20. is_uri_user_e164 usage
  432. ...
  433. if (is_uri_user_e164("$fu")) { # Check From header URI user part
  434. ...
  435. }
  436. if (is_uri_user_e164("$avp(i:705)") {
  437. # Check user part of URI stored in avp i:705
  438. ...
  439. };
  440. ...
  441. 4.12. encode_contact(encoding_prefix,hostpart)
  442. This function will encode uri-s inside Contact header in the following
  443. manner sip:username:password@ip:port;transport=protocol goes
  444. sip:encoding_prefix*username*ip*port*protocol@hostpart.
  445. * is the default separator and can be changed by setting the
  446. contact_flds_separator module parameter.
  447. Note: This function discards all of the URI parameters. Thus, none of
  448. the parameters (except the transport parameter which is encoded into
  449. the userpart) can be restored.
  450. The function returns negative on error, 1 on success.
  451. Meaning of the parameters is as follows:
  452. * encoding_prefix - Something to allow us to determine that a contact
  453. is encoded.
  454. * hostpart - An IP address or a hostname.
  455. This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE.
  456. Example 1.21. encode_contact usage
  457. ...
  458. if (src_ip == 10.0.0.0/8) encode_contact("natted_client","1.2.3.4");
  459. ...
  460. 4.13. decode_contact()
  461. This function will decode the request URI. If the RURI is in the format
  462. sip:encoding_prefix*username*ip*port*protocol@hostpart it will be
  463. decoded to sip:username:password@ip:port;transport=protocol It uses the
  464. default set parameter for contact encoding separator.
  465. The function returns negative on error, 1 on success.
  466. Meaning of the parameters is as follows:
  467. This function can be used from REQUEST_ROUTE.
  468. Example 1.22. decode_contact usage
  469. ...
  470. if (uri =~ "^sip:natted_client") { decode_contact(); }
  471. ...
  472. 4.14. decode_contact_header()
  473. This function will decode URIs inside Contact header. If the URI in the
  474. format sip:encoding_prefix*username*ip*port*protocol@hostpart it will
  475. be decoded to sip:username:password@ip:port;transport=protocol. It uses
  476. the default set parameter for contact encoding separator.
  477. The function returns negative on error, 1 on success.
  478. Meaning of the parameters is as follows:
  479. This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE.
  480. Example 1.23. decode_contact_header usage
  481. ...
  482. reply_route[2] {
  483. ...
  484. decode_contact_header();
  485. ...
  486. }
  487. ...
  488. 4.15. cmp_uri(str1, str2)
  489. The function returns true if the two parameters matches as SIP URI.
  490. This function can be used from ANY_ROUTE.
  491. Example 1.24. cmp_uri usage
  492. ...
  493. if(cmp_uri("$ru", "sip:[email protected]"))
  494. {
  495. # do interesting stuff here
  496. }
  497. ...
  498. 4.16. cmp_aor(str1, str2)
  499. The function returns true if the two parameters matches as AoR. The
  500. parameters have to be SIP URIs.
  501. This function can be used from ANY_ROUTE.
  502. Example 1.25. cmp_aor usage
  503. ...
  504. if(cmp_aor("[email protected]", "sip:kamailio@$fd"))
  505. {
  506. # do interesting stuff here
  507. }
  508. ...
  509. 4.17. is_rpid_user_e164()
  510. The function checks if the SIP URI received from the database or radius
  511. server and will potentially be used in Remote-Party-ID header field
  512. contains an E164 number (+followed by up to 15 decimal digits) in its
  513. user part. Check fails, if no such SIP URI exists (i.e. radius server
  514. or database didn't provide this information).
  515. This function can be used from REQUEST_ROUTE.
  516. Example 1.26. is_rpid_user_e164 usage
  517. ...
  518. if (is_rpid_user_e164()) {
  519. # do something here
  520. };
  521. ...
  522. 4.18. append_rpid_hf()
  523. Appends to the message a Remote-Party-ID header that contains header
  524. 'Remote-Party-ID: ' followed by the saved value of the SIP URI received
  525. from the database or radius server followed by the value of module
  526. parameter radius_rpid_suffix. The function does nothing if no saved SIP
  527. URI exists.
  528. This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
  529. BRANCH_ROUTE.
  530. Example 1.27. append_rpid_hf usage
  531. ...
  532. append_rpid_hf(); # Append Remote-Party-ID header field
  533. ...
  534. 4.19. append_rpid_hf(prefix, suffix)
  535. This function is the same as Section 4.18, " append_rpid_hf()". The
  536. only difference is that it accepts two parameters--prefix and suffix to
  537. be added to Remote-Party-ID header field. This function ignores
  538. rpid_prefix and rpid_suffix parameters, instead of that allows to set
  539. them in every call.
  540. Meaning of the parameters is as follows:
  541. * prefix - Prefix of the Remote-Party-ID URI. The string will be
  542. added at the begining of body of the header field, just before the
  543. URI.
  544. * suffix - Suffix of the Remote-Party-ID header field. The string
  545. will be appended at the end of the header field. It can be used to
  546. set various URI parameters, for example.
  547. This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
  548. BRANCH_ROUTE.
  549. Example 1.28. append_rpid_hf(prefix, suffix) usage
  550. ...
  551. # Append Remote-Party-ID header field
  552. append_rpid_hf("", ";party=calling;id-type=subscriber;screen=yes");
  553. ...
  554. 4.20. is_rpid_user_e164()
  555. The function checks if the SIP URI received from the database or radius
  556. server and will potentially be used in Remote-Party-ID header field
  557. contains an E164 number (+followed by up to 15 decimal digits) in its
  558. user part. Check fails, if no such SIP URI exists (i.e. radius server
  559. or database didn't provide this information).
  560. This function can be used from REQUEST_ROUTE.
  561. Example 1.29. is_rpid_user_e164 usage
  562. ...
  563. if (is_rpid_user_e164()) {
  564. # do something here
  565. };
  566. ...
  567. 4.21. set_uri_user(uri, user)
  568. Sets userpart of SIP URI stored in writable pseudo variable 'uri' to
  569. value of pseudo variable 'user'.
  570. This function can be used from ANY_ROUTE.
  571. Example 1.30. set_uri_user usage
  572. ...
  573. $var(uri) = "sip:user@host";
  574. $var(user) = "new_user";
  575. set_uri_user("$var(uri)", "$var(user)");
  576. ...
  577. 4.22. set_uri_host(uri, host)
  578. Sets hostpart of SIP URI stored in writable pseudo variable 'uri' to
  579. value of pseudo variable 'host'.
  580. This function can be used from ANY_ROUTE.
  581. Example 1.31. set_uri_host usage
  582. ...
  583. $var(uri) = "sip:user@host";
  584. $var(host) = "new_host";
  585. set_uri_host("$var(uri)", "$var(host)");
  586. ...
  587. 4.23. is_request()
  588. Return true if the SIP message is a request.
  589. This function can be used from ANY_ROUTE.
  590. Example 1.32. is_request usage
  591. ...
  592. if (is_request()) {
  593. ...
  594. }
  595. ...
  596. 4.24. is_reply()
  597. Return true if the SIP message is a reply.
  598. This function can be used from ANY_ROUTE.
  599. Example 1.33. is_reply usage
  600. ...
  601. if (is_reply()) {
  602. ...
  603. }
  604. ...
  605. 4.25. is_gruu([uri])
  606. The function returns true if the uri is GRUU ('gr' parameter is
  607. present): 1 - pub-gruu; 2 - temp-gruu.
  608. Meaning of the parameters is as follows:
  609. * uri - the SIP URI to check for GRUU parameter. It is optional, when
  610. missing, the value of R-URI is used.
  611. This function can be used from ANY_ROUTE.
  612. Example 1.34. is_gruu() usage
  613. ...
  614. if(is_gruu()) { ... }
  615. ...
  616. 4.26. is_supported(option)
  617. Function returns true if given option is listed in Supported header(s)
  618. (if any) of the request. Currently the following options are known:
  619. path, 100rel, timer, eventlist, gruu, and outbound.
  620. This function can be used from ANY_ROUTE.
  621. Example 1.35. is_supported() usage
  622. ...
  623. if (is_supported("outbound")) { ... }
  624. ...