reference.xml 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
  4. <section id="reference" xmlns:xi="http://www.w3.org/2001/XInclude">
  5. <sectioninfo>
  6. <revhistory>
  7. <revision>
  8. <revnumber>$Revision$</revnumber>
  9. <date>$Date$</date>
  10. </revision>
  11. </revhistory>
  12. </sectioninfo>
  13. <title>Reference</title>
  14. <section id="coreoptions">
  15. <title>Core Options</title>
  16. <para>Core options are located in beginning of configuration file and
  17. affect behavior of the server.</para>
  18. <itemizedlist>
  19. <listitem>
  20. <para>
  21. <varname>debug</varname> - Set log level, this is number between 0 and 9. Default
  22. is 0.
  23. </para>
  24. </listitem>
  25. <listitem>
  26. <para>
  27. <varname>fork</varname> - If set to yes, the server will spawn children. If set to no, the main
  28. process will be processing all messages. Default is yes.
  29. <note>
  30. <para>
  31. Disabling child spawning is useful mainly for
  32. debugging. When <varname>fork</varname> is turned off,
  33. some features are unavailable:
  34. there is no attendant process, no pid file is generated,
  35. and server listens only at one address. Make sure you
  36. are debugging the same interface at which
  37. <application>ser</application> listens.
  38. The easiest way to do so is to set the interface using
  39. <varname>listen</varname> option explicitly.
  40. </para>
  41. </note>
  42. </para>
  43. </listitem>
  44. <listitem>
  45. <para>
  46. <varname>log_stderror</varname> - If set to yes, the server will print its debugging
  47. information to standard error output. If set to no, <command>syslog</command>
  48. will be used. Default is no (printing to syslog).
  49. </para>
  50. </listitem>
  51. <listitem>
  52. <para>
  53. <varname>listen</varname> - list of all IP addresses or hostnames SER should listen on.
  54. <note>
  55. <para>
  56. This parameter may repeat several times, then SER will
  57. listen on all addresses. For example, the following
  58. command-line options (equivalent to "listen" config
  59. option) may be used:
  60. <command>
  61. ser -l foo -l bar -p 5061 -l x -l y
  62. </command>
  63. will listen on foo:5060, bar:5061 &amp; x:5061 &amp; y:5061
  64. </para>
  65. </note>
  66. </para>
  67. </listitem>
  68. <listitem>
  69. <para>
  70. <varname>alias</varname> - Add IP addresses or hostnames to list of name aliases.
  71. All requests with hostname matching an alias will satisfy the condition
  72. "uri==myself".
  73. </para>
  74. </listitem>
  75. <listitem>
  76. <para>
  77. <varname>dns</varname> - Uses dns to check if it is necessary to add a "received=" field to a via.
  78. Default is no.
  79. </para>
  80. </listitem>
  81. <listitem>
  82. <para>
  83. <varname>rev_dns</varname> - Same as dns but use reverse DNS. Default is no.
  84. </para>
  85. </listitem>
  86. <listitem>
  87. <para>
  88. <varname>port</varname> - Listens on the specified port (default 5060). It applies to the last
  89. address specified in listen and to all the following that do not have a corresponding "port" option.
  90. </para>
  91. </listitem>
  92. <listitem>
  93. <para>
  94. <varname>maxbuffer</varname> - Maximum receive buffer size which will not be exceeded by
  95. the auto-probing procedure even if the OS allows. Default value is MAX_RECV_BUFFER_SIZE,
  96. which is 256k.
  97. </para>
  98. </listitem>
  99. <listitem>
  100. <para>
  101. <varname>children</varname> - Specifies how many processes should be started
  102. for each transport protocol.
  103. Running multiple children allows a server to
  104. server multiple requests in parallel when request processing block (e.g., on DNS
  105. lookup). Note that <application>ser</application> typically spawns additional
  106. processes, such as timer process or FIFO server. If FIFO server is turned on,
  107. you can watch running processes using the <application>serctl</application>
  108. utility.
  109. </para>
  110. </listitem>
  111. <listitem>
  112. <para>
  113. <varname>check_via</varname> - Turn on or off Via host checking when forwarding replies.
  114. Default is no.
  115. </para>
  116. </listitem>
  117. <listitem>
  118. <para>
  119. <varname>syn_branch</varname> - Shall the server use stateful synonym branches? It is faster but not
  120. reboot-safe. Default is yes.
  121. </para>
  122. </listitem>
  123. <listitem>
  124. <para>
  125. <varname>memlog</varname> - Debugging level for final memory statistics report. Default is L_DBG --
  126. memory statistics are dumped only if <varname>debug</varname> is set high.
  127. </para>
  128. </listitem>
  129. <listitem>
  130. <para>
  131. <varname>sip_warning</varname> - Should replies include extensive warnings? By default yes,
  132. it is good for trouble-shooting.
  133. </para>
  134. </listitem>
  135. <listitem>
  136. <para>
  137. <varname>fifo</varname> - FIFO special file pathname, for example "/tmp/ser_fifo". Default is
  138. no filename -- no FIFO server is started then. We recommend to set it so that
  139. accompanying applications such as <application>serweb</application> or
  140. <application>serctl</application> can communicate with
  141. <application>ser</application>.
  142. </para>
  143. </listitem>
  144. <listitem>
  145. <para>
  146. <varname>fifo_mode</varname> - Permissions of the FIFO special file.
  147. </para>
  148. </listitem>
  149. <listitem>
  150. <para>
  151. <varname>server_signature</varname> - Should locally-generated messages include server's signature?
  152. By default yes, it is good for trouble-shooting.
  153. </para>
  154. </listitem>
  155. <listitem>
  156. <para>
  157. <varname>reply_to_via</varname> - A hint to reply modules
  158. whether they should send reply
  159. to IP advertised in Via.
  160. Turned off by default, which means that replies are
  161. sent to IP address from which requests came from.
  162. </para>
  163. </listitem>
  164. <listitem>
  165. <para>
  166. <varname>user | uid</varname> - uid to be used by the server.
  167. </para>
  168. </listitem>
  169. <listitem>
  170. <para>
  171. <varname>group | gid</varname> - gid to be used by the server.
  172. </para>
  173. </listitem>
  174. <listitem>
  175. <para>
  176. <varname>mhomed</varname> -- enable calculation of
  177. outbound interface; useful on multihomed servers,
  178. see <xref linkend="mhomed"/>.
  179. </para>
  180. </listitem>
  181. <listitem>
  182. <para>
  183. <varname>loadmodule</varname> - Specifies a module to be loaded (for example "/usr/lib/ser/modules/tm.so")
  184. </para>
  185. </listitem>
  186. <listitem>
  187. <para>
  188. <varname>modparam</varname> - Module parameter configuration. The commands takes three parameters:
  189. <itemizedlist>
  190. <listitem>
  191. <para>
  192. <emphasis>module</emphasis> - Module in which the parameter resides.
  193. </para>
  194. </listitem>
  195. <listitem>
  196. <para>
  197. <emphasis>parameter</emphasis> - Name of the parameter to be configured.
  198. </para>
  199. </listitem>
  200. <listitem>
  201. <para>
  202. <emphasis>value</emphasis> - New value of the parameter.
  203. </para>
  204. </listitem>
  205. </itemizedlist>
  206. </para>
  207. </listitem>
  208. </itemizedlist>
  209. </section>
  210. <section id="builtinref">
  211. <title>Core Commands</title>
  212. <itemizedlist id="routeblocks">
  213. <title>Route Blocks and Process Control</title>
  214. <!--<para>
  215. Route block and process control keywords determine
  216. the order in which SIP requests are processed.
  217. </para>-->
  218. <listitem>
  219. <para>
  220. <command>route[number]{...}</command> - This marks a "route block" in configuration files.
  221. route blocks are basic building blocks of <application>ser</application> scripts.
  222. Each route block contains a sequence of
  223. <application>SER</application> actions enclosed in braces. Multiple route blocks
  224. can be included in a configuration file.
  225. When script execution begins on request receipt,
  226. route block number 0 is entered. Other route blocks serve as a kind of sub-routines and
  227. may be entered by calling the action <command>route(n)</command>,
  228. where n is number of the block. The action <command>break</command>
  229. exits currently executed route block. It stops script execution for
  230. route block number 0 or returns to calling route block otherwise.
  231. </para>
  232. <example>
  233. <title>route</title>
  234. <programlisting>
  235. route[0] {
  236. # call routing block number 2
  237. route(2);
  238. }
  239. route[2] {
  240. forward("host.foo.bar", 5060);
  241. }
  242. </programlisting>
  243. </example>
  244. </listitem>
  245. <listitem>
  246. <para>
  247. <command>failure_route</command> is used to restart request processing
  248. when a negative reply for a previously relayed request is received. It is only
  249. used along with tm module, which stores the original requests and
  250. can return to their processing later. To activate processing
  251. of a <command>failure_route</command> block, call the TM action
  252. <command>t_on_failure(route_number)</command> before calling
  253. <command>t_relay</command>. When a negative reply
  254. comes back, the desired <command>failure_route</command>
  255. will be entered and processing of the original request may
  256. continue.
  257. </para>
  258. <para>
  259. The set of actions applicable from within
  260. <command>failure_route</command> blocks is limited.
  261. Permitted actions are URI-manipulation actions, logging and
  262. sending stateful replies using <command>t_reply</command>.
  263. </para>
  264. <example>
  265. <title>failure_route</title>
  266. <programlisting>
  267. failure_route[1] {
  268. # for some reason, the original forwarding attempt
  269. # failed, try at another URI
  270. append_branch("sip:[email protected]");
  271. # if this new attempt fails too, try another failure_route
  272. t_on_failure("2");
  273. t_relay();
  274. }
  275. </programlisting>
  276. </example>
  277. </listitem>
  278. <listitem>
  279. <para>
  280. The action <command>break</command> exits currently executed route block.
  281. It stops script execution for route block number 0 or returns to calling
  282. route block otherwise.
  283. <note>
  284. <para>
  285. We recommend to use <command>break</command>
  286. after any request forwarding or replying. This practice
  287. helps to avoid erroneous scripts that
  288. continue execution and mistakenly send another reply or
  289. forward a request to another place, resulting in
  290. protocol confusion.
  291. </para>
  292. </note>
  293. </para>
  294. <para>
  295. <emphasis>Example:</emphasis> break;
  296. </para>
  297. </listitem>
  298. <listitem>
  299. <para>
  300. <command>route(n)</command> - call routing block route[n]{...};
  301. when the routing block n finishes processing, control is passed
  302. back to current block and processing continues.
  303. </para>
  304. </listitem>
  305. <listitem>
  306. <para>
  307. <command>if (condition) statement</command> - Conditional statement.
  308. </para>
  309. <example>
  310. <title>Use of <command>if</command></title>
  311. <programlisting>
  312. if (method=="REGISTER) {
  313. log("register received\n");
  314. };
  315. </programlisting>
  316. </example>
  317. </listitem>
  318. <listitem>
  319. <para>
  320. <command>if - else</command> - If-Else Conditional statement.
  321. </para>
  322. <example>
  323. <title>Use of <command>if-else</command></title>
  324. <programlisting>
  325. if (method=="REGISTER) {
  326. log("register received\n");
  327. } else {
  328. log("non-register received\n");
  329. };
  330. </programlisting>
  331. </example>
  332. </listitem>
  333. </itemizedlist>
  334. <itemizedlist>
  335. <title>Flag Manipulation</title>
  336. <listitem>
  337. <para>
  338. <command>setflag</command> - Set flag in the message.
  339. </para>
  340. <para>
  341. <emphasis>Example:</emphasis> setflag(1);
  342. </para>
  343. </listitem>
  344. <listitem>
  345. <para>
  346. <command>resetflag</command> - Reset flag in the message.
  347. </para>
  348. <para>
  349. <emphasis>Example:</emphasis> resetflag(1);
  350. </para>
  351. </listitem>
  352. <listitem>
  353. <para>
  354. <command>isflagset</command> - Test whether a particular flag is set.
  355. </para>
  356. <example>
  357. <title>isflagset</title>
  358. <programlisting>
  359. if (isflagset(1)) {
  360. ....
  361. };
  362. </programlisting>
  363. </example>
  364. </listitem>
  365. <listitem>
  366. <para>
  367. <function>setavpflag(avp, flag_id)</function> - Sets a flag in the
  368. AVP(s). The command simply set custom flag of AVP. The flags
  369. may be used in script using <function>isavpflagset</function>
  370. or in a module to perform specific operation on marked AVPs.
  371. Flag identifier must be declared via <emphasis>avpflags</emphasis>
  372. statement.
  373. </para>
  374. <example>
  375. <title>setavpflag</title>
  376. <programlisting>
  377. avpflags
  378. my_flag,
  379. your_flag;
  380. ....
  381. setavpflag($avp[1], "my_flag");
  382. ....
  383. if (isavpflagset($avp2, "your_flag")) {
  384. }
  385. </programlisting>
  386. </example>
  387. </listitem>
  388. <listitem>
  389. <para>
  390. <function>resetavpflag(avp, flag_id)</function> - Same as command
  391. <function>setavpflag</function> - only resetavpflag will be
  392. called instead of setavpflag.
  393. </para>
  394. </listitem>
  395. <listitem>
  396. <para>
  397. <function>isavpflagset(avp, flag_id)</function> - Test if the avp flag
  398. is set or not.
  399. </para>
  400. </listitem>
  401. </itemizedlist>
  402. <itemizedlist>
  403. <title>Manipulation of URI and Destination Set</title>
  404. <listitem>
  405. <para>
  406. <command>rewritehost | sethost | seth</command> - Rewrite host part of the Request URI.
  407. </para>
  408. <para>
  409. <emphasis>Example:</emphasis> sethost("foo.bar.com");
  410. </para>
  411. </listitem>
  412. <listitem>
  413. <para>
  414. <command>rewritehostport | sethostport | sethp</command> - Rewrite host and port part of the Request URI.
  415. </para>
  416. <para>
  417. <emphasis>Example:</emphasis> sethostport("foo.bar.com:5060");
  418. </para>
  419. </listitem>
  420. <listitem>
  421. <para>
  422. <command>rewriteuser | setuser | setu</command> - Rewrite or set username part of the Request URI.
  423. </para>
  424. <para>
  425. <emphasis>Example:</emphasis> setuser("joe");
  426. </para>
  427. </listitem>
  428. <listitem>
  429. <para>
  430. <command>rewriteuserpass | setuserpass | setup</command> - Rewrite or set username and password part
  431. of the Request URI.
  432. </para>
  433. <para>
  434. <emphasis>Example:</emphasis> setuserpass("joe:mypass");
  435. </para>
  436. </listitem>
  437. <listitem>
  438. <para>
  439. <command>rewriteport | setport | setp</command> - Rewrite or set port of the Request URI.
  440. </para>
  441. <para>
  442. <emphasis>Example:</emphasis> setport("5060");
  443. </para>
  444. </listitem>
  445. <listitem>
  446. <para>
  447. <command>rewriteuri | seturi</command> - Rewrite or set the whole Request URI.
  448. </para>
  449. <para>
  450. <emphasis>Example:</emphasis> seturi("sip:[email protected]:5060");
  451. </para>
  452. </listitem>
  453. <listitem>
  454. <para>
  455. <command>revert_uri</command> - Revert changes made to the Request URI and use original Request URI.
  456. </para>
  457. <para>
  458. <emphasis>Example:</emphasis> revert_uri();
  459. </para>
  460. </listitem>
  461. <listitem>
  462. <para>
  463. <command>prefix</command> - Add prefix to username in Request URI.
  464. </para>
  465. <para>
  466. <emphasis>Example:</emphasis> prefix("123");
  467. </para>
  468. </listitem>
  469. <listitem>
  470. <para>
  471. <command>strip</command> - Remove first n characters of username in Request URI.
  472. </para>
  473. <para>
  474. <emphasis>Example:</emphasis> strip(3);
  475. </para>
  476. </listitem>
  477. <listitem>
  478. <para>
  479. <command>append_branch</command> - Append a new destination to destination set of the message.
  480. </para>
  481. <para>
  482. <example>
  483. <title>Use of <command>append_branch</command></title>
  484. <programlisting>
  485. # redirect to these two destinations: [email protected] and [email protected]
  486. # 1) rewrite the current URI
  487. rewriteuri("sip:[email protected]");
  488. # 2) append another entry to the destination ser
  489. append_branch("sip:[email protected]");
  490. # redirect now
  491. sl_send_reply("300", "redirection");
  492. </programlisting>
  493. </example>
  494. </para>
  495. </listitem>
  496. </itemizedlist>
  497. <itemizedlist>
  498. <title>Message Forwarding</title>
  499. <listitem>
  500. <para>
  501. <command>forward(uri, port)</command> - Forward the request to given
  502. destination statelessly. The uri and port parameters may take special
  503. values 'uri:host'
  504. and 'uri:port' respectively, in which case SER forwards to destination
  505. set in current URI. All other elements in a destination set are
  506. ignored by stateless forwarding.
  507. </para>
  508. <para>
  509. <emphasis>Example:</emphasis> forward("foo.bar.com"); # port defaults to 5060
  510. </para>
  511. </listitem>
  512. <listitem>
  513. <para>
  514. <command>send</command> - Send the message as is to a third party
  515. </para>
  516. <para>
  517. <emphasis>Example:</emphasis> send("foo.bar.com");
  518. </para>
  519. </listitem>
  520. </itemizedlist>
  521. <itemizedlist>
  522. <title>Logging</title>
  523. <listitem>
  524. <para>
  525. <command>log([level], message)</command> - Log a message.
  526. </para>
  527. <para>
  528. <emphasis>Example:</emphasis> log(1, "This is a message with high log-level set to 1\n");
  529. </para>
  530. <para>
  531. Logging is very useful for troubleshooting or attracting administrator's
  532. attention to unusual situations. <application>ser</application>
  533. reports log messages to <application>syslog</application>
  534. facility unless it is configured to print them to <filename>stderr</filename>
  535. with the <varname>log_stderr</varname> configuration option. Log messages
  536. are only issued if their log level exceeds threshold set with the
  537. <varname>debug</varname> configuration option. If log level is omitted,
  538. messages are issued at log level 4.
  539. </para>
  540. </listitem>
  541. </itemizedlist>
  542. <itemizedlist>
  543. <title>Miscellaneous</title>
  544. <listitem>
  545. <para>
  546. <command>len_gt</command> - If length of the message is greater than value given as parameter, the
  547. command will return 1 (indicating true). Otherwise -1 (indicating false) will be returned. It may
  548. take 'max_len' as parameter, in which case message size is limited
  549. to internal buffer size BUF_SIZE (3040 by default).
  550. </para>
  551. <example>
  552. <title>Use of <command>len_gt</command></title>
  553. <programlisting>
  554. # deny all requests larger in size than 1 kilobyte
  555. if (len_gt(1024)) {
  556. sl_send_reply("513", "Too big");
  557. break;
  558. };
  559. </programlisting>
  560. </example>
  561. </listitem>
  562. </itemizedlist>
  563. </section>
  564. <section>
  565. <title>Command Line Parameters</title>
  566. <note>
  567. <para>
  568. Command-Line parameters may be overridden by configuration
  569. file options which take precedence over them.
  570. </para>
  571. </note>
  572. <itemizedlist>
  573. <listitem>
  574. <para>
  575. <emphasis>-h</emphasis> - Displays a short usage description, including all available options.
  576. </para>
  577. </listitem>
  578. <listitem>
  579. <para>
  580. <emphasis>-c</emphasis> - Performs loop checks and computes branches.
  581. </para>
  582. </listitem>
  583. <listitem>
  584. <para>
  585. <emphasis>-r</emphasis> - Uses dns to check if it is necessary to add a "received=" field to a via.
  586. </para>
  587. </listitem>
  588. <listitem>
  589. <para>
  590. <emphasis>-R</emphasis> - Same as -r but uses reverse dns.
  591. </para>
  592. </listitem>
  593. <listitem>
  594. <para>
  595. <emphasis>-v</emphasis> - Turns on via host checking when forwarding replies.
  596. </para>
  597. </listitem>
  598. <listitem>
  599. <para>
  600. <emphasis>-d</emphasis> - Turns on debugging, multiple -d increase debugging level.
  601. </para>
  602. </listitem>
  603. <listitem>
  604. <para>
  605. <emphasis>-D</emphasis> - Runs ser in the foreground (it doesn't fork into daemon mode).
  606. </para>
  607. </listitem>
  608. <listitem>
  609. <para>
  610. <emphasis>-E</emphasis> - Sends all the log messages to stderr.
  611. </para>
  612. </listitem>
  613. <listitem>
  614. <para>
  615. <emphasis>-V</emphasis> - Displays the version number.
  616. </para>
  617. </listitem>
  618. <listitem>
  619. <para>
  620. <emphasis>-f config-file</emphasis> - Reads the configuration from "config-file" (default ./ser.cfg).
  621. </para>
  622. </listitem>
  623. <listitem>
  624. <para>
  625. <emphasis>-l address</emphasis> - Listens on the specified address. Multiple -l mean listening
  626. on multiple addresses. The default behavior is to listen on all the ipv4 interfaces.
  627. </para>
  628. </listitem>
  629. <listitem>
  630. <para>
  631. <emphasis>-p port</emphasis> - Listens on the specified port (default 5060). It applies to the last
  632. address specified with -l and to all the following that do not have a corresponding -p.
  633. </para>
  634. </listitem>
  635. <listitem>
  636. <para>
  637. <emphasis>-n processes-no</emphasis> - Specifies the number of children processes forked per
  638. interface (default 8).
  639. </para>
  640. </listitem>
  641. <listitem>
  642. <para>
  643. <emphasis>-b max_rcv_buf_size</emphasis> - Maximum receive buffer size which will not be exceeded by
  644. the auto-probing procedure even if the OS allows.
  645. </para>
  646. </listitem>
  647. <listitem>
  648. <para>
  649. <emphasis>-m shared_mem_size</emphasis> - Size of the shared memory which will be allocated (in Megabytes).
  650. </para>
  651. </listitem>
  652. <listitem>
  653. <para>
  654. <emphasis>-w working-dir</emphasis> - Specifies the working directory. In the very improbable event
  655. that will crash, the core file will be generated here.
  656. </para>
  657. </listitem>
  658. <listitem>
  659. <para>
  660. <emphasis>-t chroot-dir</emphasis> - Forces ser to chroot after reading the config file.
  661. </para>
  662. </listitem>
  663. <listitem>
  664. <para>
  665. <emphasis>-u uid</emphasis> - Changes the user id under which ser runs.
  666. </para>
  667. </listitem>
  668. <listitem>
  669. <para>
  670. <emphasis>-g gid</emphasis> - Changes the group id under which ser runs.
  671. </para>
  672. </listitem>
  673. <listitem>
  674. <para>
  675. <emphasis>-P pid-file</emphasis> - Creates a file containing the pid of the main ser process.
  676. </para>
  677. </listitem>
  678. <listitem>
  679. <para>
  680. <emphasis>-i fifo-path</emphasis> - Creates a fifo, useful for monitoring ser status.
  681. </para>
  682. </listitem>
  683. </itemizedlist>
  684. </section>
  685. <section id="modulereference">
  686. <title>Modules</title>
  687. <para>
  688. Module description is currently located in READMEs of
  689. respective module directories. <filename>README-MODULES</filename>
  690. lists all available modules, including their maturity status.
  691. In the current <application>ser</application>
  692. distribution, there are the following modules:
  693. <itemizedlist>
  694. <listitem>
  695. <para>
  696. <emphasis>
  697. acc
  698. </emphasis>
  699. -- call accounting using <application>syslog</application> facility.
  700. RADIUS and mysql support can be compiled in.
  701. Depends on tm.
  702. </para>
  703. </listitem>
  704. <listitem>
  705. <para>
  706. <emphasis>
  707. auth, auth_db, auth_radius
  708. </emphasis>
  709. -- digest authentication. Depends on sl and mysql.
  710. </para>
  711. </listitem>
  712. <listitem>
  713. <para>
  714. <emphasis>domain</emphasis> -- checks URIs whether they belong
  715. in a list of served domains or not.
  716. </para>
  717. </listitem>
  718. <listitem>
  719. <para>
  720. <emphasis>ENUM</emphasis> -- E.164 phone number resolution using ENUM.
  721. </para>
  722. </listitem>
  723. <listitem>
  724. <para>
  725. <emphasis>
  726. exec
  727. </emphasis>
  728. -- execution of shell programs.
  729. </para>
  730. </listitem>
  731. <listitem>
  732. <para>
  733. <emphasis>
  734. group, group_radius
  735. </emphasis>
  736. -- checks membership of users in groups
  737. </para>
  738. </listitem>
  739. <listitem>
  740. <para>
  741. <emphasis>
  742. jabber
  743. </emphasis> -- gateway between SIMPLE and Jabber instant messaging. Depends
  744. on tm and mysql.
  745. </para>
  746. </listitem>
  747. <listitem>
  748. <para>
  749. <emphasis>
  750. maxfwd
  751. </emphasis>
  752. -- checking max-forwards header field.
  753. </para>
  754. </listitem>
  755. <listitem>
  756. <para>
  757. <emphasis>msilo</emphasis>
  758. -- message silo. Store for undelivered instant messages. Depends on tm and mysql.
  759. </para>
  760. </listitem>
  761. <listitem>
  762. <para>
  763. <emphasis>
  764. mysql
  765. </emphasis>
  766. -- mysql database back-end.
  767. </para>
  768. </listitem>
  769. <listitem>
  770. <para>
  771. <emphasis>
  772. nathelper
  773. </emphasis>
  774. -- facilitates NAT traversal for symmetric SIP phones such as ATA.
  775. </para>
  776. </listitem>
  777. <listitem>
  778. <para>
  779. <emphasis>
  780. pa
  781. </emphasis>
  782. -- presence agent
  783. </para>
  784. </listitem>
  785. <listitem>
  786. <para>
  787. <emphasis>
  788. registrar, usrloc
  789. </emphasis>
  790. -- User Location database. Works in in-memory mode or with mysql persistence
  791. support. Depends on sl, and on mysql if configured for use with mysql.
  792. </para>
  793. </listitem>
  794. <listitem>
  795. <para>
  796. <emphasis>
  797. rr
  798. </emphasis>
  799. -- Record Routing (strict and loose)
  800. </para>
  801. </listitem>
  802. <listitem>
  803. <para>
  804. <emphasis>
  805. sl
  806. </emphasis>
  807. -- stateless User Agent server.
  808. </para>
  809. </listitem>
  810. <listitem>
  811. <para>
  812. <emphasis>
  813. sms
  814. </emphasis>
  815. -- SIMPLE/SMS gateway. Depends on tm. Takes special hardware.
  816. </para>
  817. </listitem>
  818. <listitem>
  819. <para>
  820. <emphasis>textops</emphasis> -- textual database back-end.
  821. </para>
  822. </listitem>
  823. <listitem>
  824. <para>
  825. <emphasis>
  826. tm
  827. </emphasis>
  828. -- transaction manager (stateful processing).
  829. </para>
  830. </listitem>
  831. <listitem>
  832. <para>
  833. <emphasis>
  834. uri, uri_radius
  835. </emphasis>
  836. -- checks digest identity against header URIs or a database list
  837. </para>
  838. </listitem>
  839. </itemizedlist>
  840. </para>
  841. <para>
  842. The most frequently used actions exported by modules are summarized
  843. in <xref linkend="moduleactions"/>. For a full explanation of
  844. module actions, see documentation in respective module directories
  845. in source distribution of <application>ser</application>.
  846. </para>
  847. <table id="moduleactions">
  848. <title>Frequently Used Module Actions</title>
  849. <tgroup cols="4">
  850. <thead>
  851. <row>
  852. <entry>
  853. Command
  854. </entry>
  855. <entry>
  856. Modules
  857. </entry>
  858. <entry>
  859. Parameters
  860. </entry>
  861. <entry>
  862. Comments
  863. </entry>
  864. </row>
  865. </thead>
  866. <tbody>
  867. <row>
  868. <entry>
  869. append_hf
  870. </entry>
  871. <entry>
  872. textops
  873. </entry>
  874. <entry>
  875. header field
  876. </entry>
  877. <entry>
  878. append a header field to the end of request's header
  879. </entry>
  880. </row>
  881. <row>
  882. <entry>
  883. check_from
  884. </entry>
  885. <entry>
  886. uri
  887. </entry>
  888. <entry>
  889. none
  890. </entry>
  891. <entry>
  892. check if username in from header field matches authentication id
  893. </entry>
  894. </row>
  895. <row>
  896. <entry>
  897. check_to
  898. </entry>
  899. <entry>
  900. uri
  901. </entry>
  902. <entry>
  903. none
  904. </entry>
  905. <entry>
  906. check if username in To header field matched authentication id
  907. </entry>
  908. </row>
  909. <row>
  910. <entry>
  911. exec_dset
  912. </entry>
  913. <entry>
  914. exec
  915. </entry>
  916. <entry>
  917. command name
  918. </entry>
  919. <entry>
  920. execute an external command and replace destination set with
  921. its output
  922. </entry>
  923. </row>
  924. <row>
  925. <entry>
  926. exec_msg
  927. </entry>
  928. <entry>
  929. exec
  930. </entry>
  931. <entry>
  932. command name
  933. </entry>
  934. <entry>
  935. execute an external command and pass received SIP request
  936. to its input
  937. </entry>
  938. </row>
  939. <row>
  940. <entry>
  941. is_user
  942. </entry>
  943. <entry>
  944. uri
  945. </entry>
  946. <entry>
  947. user id
  948. </entry>
  949. <entry>
  950. returns true if request credentials belong to a user
  951. </entry>
  952. </row>
  953. <row>
  954. <entry>
  955. is_user_in
  956. </entry>
  957. <entry>
  958. auth
  959. </entry>
  960. <entry>
  961. user, group
  962. </entry>
  963. <entry>
  964. check if user is member of a group; user can be gained
  965. from request URI ("Request-URI"), To header field ("To"),
  966. From header field ("From") or digest credentials
  967. ("Credentials")
  968. </entry>
  969. </row>
  970. <row>
  971. <entry>
  972. lookup
  973. </entry>
  974. <entry>
  975. usrloc
  976. </entry>
  977. <entry>
  978. table name
  979. </entry>
  980. <entry>
  981. attempt to translate request URI using user location database;
  982. returns false if no contact for user found;
  983. </entry>
  984. </row>
  985. <row>
  986. <entry>
  987. loose_route
  988. </entry>
  989. <entry>
  990. rr
  991. </entry>
  992. <entry>
  993. none
  994. </entry>
  995. <entry>
  996. process loose routes in requests
  997. </entry>
  998. </row>
  999. <row>
  1000. <entry>
  1001. mf_process_maxfwd_header
  1002. </entry>
  1003. <entry>
  1004. maxfwd
  1005. </entry>
  1006. <entry>
  1007. default max_forwards value
  1008. </entry>
  1009. <entry>
  1010. return true, if request's max_forwards value has not
  1011. reached zero yet; if none is included in the request,
  1012. set it to value in parameter
  1013. </entry>
  1014. </row>
  1015. <row>
  1016. <entry>
  1017. proxy_authorize
  1018. </entry>
  1019. <entry>
  1020. auth
  1021. </entry>
  1022. <entry>
  1023. realm, subscriber table
  1024. </entry>
  1025. <entry>
  1026. returns true if requests contains proper credentials, false
  1027. otherwise
  1028. </entry>
  1029. </row>
  1030. <row>
  1031. <entry>
  1032. proxy_challenge
  1033. </entry>
  1034. <entry>
  1035. auth
  1036. </entry>
  1037. <entry>
  1038. realm, qop
  1039. </entry>
  1040. <entry>
  1041. challenge user to submit digest credentials; qop may be turned
  1042. off for backwards compatibility with elderly implementations
  1043. </entry>
  1044. </row>
  1045. <row>
  1046. <entry>
  1047. record_route
  1048. </entry>
  1049. <entry>
  1050. rr
  1051. </entry>
  1052. <entry>
  1053. none
  1054. </entry>
  1055. <entry>
  1056. record-route a request
  1057. </entry>
  1058. </row>
  1059. <row>
  1060. <entry>
  1061. replace
  1062. </entry>
  1063. <entry>
  1064. textops
  1065. </entry>
  1066. <entry>
  1067. RegExp, Substitute
  1068. </entry>
  1069. <entry>
  1070. find the first occurrence of a string matching the regular
  1071. expression in header or body and replace it with a substitute
  1072. </entry>
  1073. </row>
  1074. <row>
  1075. <entry>
  1076. replace_all
  1077. </entry>
  1078. <entry>
  1079. textops
  1080. </entry>
  1081. <entry>
  1082. RegExp, Substitute
  1083. </entry>
  1084. <entry>
  1085. find all occurrences of a string matching the regular
  1086. expression in header or body and replace it with a substitute
  1087. </entry>
  1088. </row>
  1089. <row>
  1090. <entry>
  1091. save
  1092. </entry>
  1093. <entry>
  1094. usrloc
  1095. </entry>
  1096. <entry>
  1097. table name
  1098. </entry>
  1099. <entry>
  1100. for use in registrar: save content of Contact header fields
  1101. in user location database and reply with 200
  1102. </entry>
  1103. </row>
  1104. <row>
  1105. <entry>
  1106. search
  1107. </entry>
  1108. <entry>
  1109. textops
  1110. </entry>
  1111. <entry>
  1112. regular expression
  1113. </entry>
  1114. <entry>
  1115. search for a regular expression match in request header of body
  1116. </entry>
  1117. </row>
  1118. <row>
  1119. <entry>
  1120. sl_send_reply
  1121. </entry>
  1122. <entry>
  1123. sl
  1124. </entry>
  1125. <entry>
  1126. status code, reason phrase
  1127. </entry>
  1128. <entry>
  1129. reply a request statelessly
  1130. </entry>
  1131. </row>
  1132. <row>
  1133. <entry>
  1134. t_relay
  1135. </entry>
  1136. <entry>
  1137. tm
  1138. </entry>
  1139. <entry>
  1140. none
  1141. </entry>
  1142. <entry>
  1143. stateful forwarding to locations in current destination set
  1144. </entry>
  1145. </row>
  1146. <row>
  1147. <entry>
  1148. t_on_failure
  1149. </entry>
  1150. <entry>
  1151. tm
  1152. </entry>
  1153. <entry>
  1154. failure_route number
  1155. </entry>
  1156. <entry>
  1157. set failure_route block which shall be entered if stateful
  1158. forwarding fails
  1159. </entry>
  1160. </row>
  1161. <row>
  1162. <entry>
  1163. t_replicate
  1164. </entry>
  1165. <entry>
  1166. tm
  1167. </entry>
  1168. <entry>
  1169. host, port number
  1170. </entry>
  1171. <entry>
  1172. replicate a request to a destination
  1173. </entry>
  1174. </row>
  1175. </tbody>
  1176. </tgroup>
  1177. </table>
  1178. </section> <!-- modules -->
  1179. <section id="fiforeference">
  1180. <title>FIFO Commands Reference</title>
  1181. <para>
  1182. This section lists currently supported FIFO commands. Some of them are
  1183. built-in in <application>ser</application> core, whereas
  1184. others are exported by modules. The most important exporters are now
  1185. tm and usrloc module. tm FIFO commands allow users to initiate transactions
  1186. without knowledge of underlying SIP stack. usrloc FIFO commands allow
  1187. users to access in-memory user-location database. Note that that is the
  1188. only way how to affect content of the data-base in real-time. Changes
  1189. to MySql database do not affect in-memory table unless <application>ser</application>
  1190. is restarted.
  1191. </para>
  1192. <table>
  1193. <title>FIFO Commands</title>
  1194. <tgroup cols="4">
  1195. <thead>
  1196. <row>
  1197. <entry>
  1198. Command
  1199. </entry>
  1200. <entry>
  1201. Module
  1202. </entry>
  1203. <entry>
  1204. Parameters
  1205. </entry>
  1206. <entry>
  1207. Comments
  1208. </entry>
  1209. </row>
  1210. </thead>
  1211. <tbody>
  1212. <row>
  1213. <entry>
  1214. ps
  1215. </entry>
  1216. <entry>
  1217. core
  1218. </entry>
  1219. <entry>
  1220. none
  1221. </entry>
  1222. <entry>
  1223. prints running <application>ser</application> processes
  1224. </entry>
  1225. </row>
  1226. <row>
  1227. <entry>which</entry>
  1228. <entry>core</entry>
  1229. <entry>none</entry>
  1230. <entry>prints list of available FIFO commands</entry>
  1231. </row>
  1232. <row>
  1233. <entry>arg</entry>
  1234. <entry>core</entry>
  1235. <entry>none</entry>
  1236. <entry>prints list of command-line arguments with which
  1237. <application>ser</application> was started</entry>
  1238. </row>
  1239. <row>
  1240. <entry>pwd</entry>
  1241. <entry>core</entry>
  1242. <entry>none</entry>
  1243. <entry>prints <application>ser</application>'s working
  1244. directory</entry>
  1245. </row>
  1246. <row>
  1247. <entry>version</entry>
  1248. <entry>core</entry>
  1249. <entry>none</entry>
  1250. <entry>prints version of <application>ser</application></entry>
  1251. </row>
  1252. <row>
  1253. <entry>uptime</entry>
  1254. <entry>core</entry>
  1255. <entry>none</entry>
  1256. <entry>prints <application>ser</application>'s running time</entry>
  1257. </row>
  1258. <row>
  1259. <entry>sl_stats</entry>
  1260. <entry>sl</entry>
  1261. <entry>none</entry>
  1262. <entry>prints statistics for sl module</entry>
  1263. </row>
  1264. <row>
  1265. <entry>t_stats</entry>
  1266. <entry>tm</entry>
  1267. <entry>none</entry>
  1268. <entry>print statistics for tm module</entry>
  1269. </row>
  1270. <row>
  1271. <entry>t_hash</entry>
  1272. <entry>tm</entry>
  1273. <entry>none</entry>
  1274. <entry>print occupation of transaction table (mainly for debugging)</entry>
  1275. </row>
  1276. <row>
  1277. <entry>t_uac_dlg</entry>
  1278. <entry>tm</entry>
  1279. <entry>method, request URI, outbound URI (if none, empty line with a single dot),
  1280. dot-line-terminated header fields, optionally dot-line terminated message
  1281. body.
  1282. </entry>
  1283. <entry>initiate a transaction.
  1284. From and To header fields must be present in header field list,
  1285. so does Content-Type if body is present. If CSeq, CallId and From-tag
  1286. are not present, ephemeral values are generated. Content_length is
  1287. calculated automatically if body present.
  1288. </entry>
  1289. </row>
  1290. <row>
  1291. <entry>ul_stats</entry>
  1292. <entry>usrloc</entry>
  1293. <entry>none</entry>
  1294. <entry>print usrloc statistics</entry>
  1295. </row>
  1296. <row>
  1297. <entry>ul_rm</entry>
  1298. <entry>usrloc</entry>
  1299. <entry>table name, user name</entry>
  1300. <entry>remove all user's contacts from user-location database</entry>
  1301. </row>
  1302. <row>
  1303. <entry>ul_rm_contact</entry>
  1304. <entry>usrloc</entry>
  1305. <entry>table name, user name, contact</entry>
  1306. <entry>remove a user's contact from user-location database</entry>
  1307. </row>
  1308. <row>
  1309. <entry>ul_dump</entry>
  1310. <entry>usrloc</entry>
  1311. <entry>none</entry>
  1312. <entry>print content of in-memory user-location database</entry>
  1313. </row>
  1314. <row>
  1315. <entry>ul_flush</entry>
  1316. <entry>usrloc</entry>
  1317. <entry>none</entry>
  1318. <entry>flush content of in-memory user-location cache in
  1319. persistent database (MySQL)</entry>
  1320. </row>
  1321. <row>
  1322. <entry>ul_add</entry>
  1323. <entry>usrloc</entry>
  1324. <entry>table name, user name, contact, expiration, priority (q)</entry>
  1325. <entry>insert a contact address in user-location database</entry>
  1326. </row>
  1327. <row>
  1328. <entry>ul_show_contact</entry>
  1329. <entry>usrloc</entry>
  1330. <entry>table, user name</entry>
  1331. <entry>show user's contact addresses in user-location database</entry>
  1332. </row>
  1333. </tbody>
  1334. </tgroup>
  1335. </table>
  1336. </section>
  1337. <section>
  1338. <title>Used Database Tables</title>
  1339. <para>
  1340. <application>ser</application> includes MySQL support
  1341. to guarantee data persistence across server reboots and storage
  1342. of users' web environment. The data stored in
  1343. the database include user profiles, access control lists, user location,
  1344. etc. Note that users are not supposed to alter the data directly, as it
  1345. could introduce inconsistency between data on persistence storage and
  1346. in server's memory.
  1347. The following list enumerates used tables and explains their purpose.
  1348. <itemizedlist>
  1349. <listitem>
  1350. <para>
  1351. subscriber -- table of users. It includes user names and
  1352. security credentials, as well as additional user information.
  1353. </para>
  1354. </listitem>
  1355. <listitem>
  1356. <para>
  1357. reserved -- reserved user names. <application>serweb</application>
  1358. does not permit creation of accounts with name on this list.
  1359. </para>
  1360. </listitem>
  1361. <listitem>
  1362. <para>
  1363. phonebook -- user's personal phonebooks. Accessible via
  1364. <application>serweb</application>.
  1365. </para>
  1366. </listitem>
  1367. <listitem>
  1368. <para>
  1369. pending -- table of unconfirmed subscription requests. Used by
  1370. <application>serweb</application>.
  1371. </para>
  1372. </listitem>
  1373. <listitem>
  1374. <para>
  1375. missed_calls -- table of missed calls. Can be fed by acc modules
  1376. if mysql support is turned on. Displayed by <application>serweb</application>.
  1377. </para>
  1378. </listitem>
  1379. <listitem>
  1380. <para>
  1381. location -- user contacts. Typically updated through
  1382. <application>ser</application>'r registrar
  1383. functionality.
  1384. </para>
  1385. </listitem>
  1386. <listitem>
  1387. <para>
  1388. grp -- group membership. Used by auth module to determine
  1389. whether a user belongs to a group.
  1390. </para>
  1391. </listitem>
  1392. <listitem>
  1393. <para>
  1394. event -- allows users to subscribe to additional services.
  1395. Currently unused.
  1396. </para>
  1397. </listitem>
  1398. <listitem>
  1399. <para>
  1400. aliases -- keeps track of alternative user names.
  1401. </para>
  1402. </listitem>
  1403. <listitem>
  1404. <para>
  1405. active_sessions -- keeps track of currently active web sessions.
  1406. For use by <application>serweb</application>.
  1407. </para>
  1408. </listitem>
  1409. <listitem>
  1410. <para>
  1411. acc -- keeps track of accounted calls. Can be fed by acc module
  1412. if mysql support is turned on. Displayed by <application>serweb</application>.
  1413. </para>
  1414. </listitem>
  1415. <listitem>
  1416. <para>
  1417. config -- maintains attribute-value pairs for keeping various information.
  1418. Currently not used.
  1419. </para>
  1420. </listitem>
  1421. <listitem>
  1422. <para>
  1423. silo -- message store for instant messages which could not have been
  1424. delivered.
  1425. </para>
  1426. </listitem>
  1427. <listitem>
  1428. <para>
  1429. version -- keeps version number of each table definition.
  1430. </para>
  1431. </listitem>
  1432. <listitem>
  1433. <para>
  1434. domain -- maintains list of served domains.
  1435. </para>
  1436. </listitem>
  1437. <listitem>
  1438. <para>
  1439. server_monitoring-* -- reserved for persistent monitoring of
  1440. server's operation
  1441. </para>
  1442. </listitem>
  1443. <listitem>
  1444. <para>
  1445. uri -- used to keep lists of URIs "owned" by a user
  1446. (as identified by digest identity); good for some
  1447. PSTN interworking scenarios
  1448. </para>
  1449. </listitem>
  1450. </itemizedlist>
  1451. </para>
  1452. </section>
  1453. </section>