rtpengine_admin.xml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. <?xml version="1.0" encoding='ISO-8859-1'?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  4. <!-- Include general documentation entities -->
  5. <!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
  6. %docentities;
  7. ]>
  8. <!-- Module User's Guide -->
  9. <chapter>
  10. <title>&adminguide;</title>
  11. <section>
  12. <title>Overview</title>
  13. <para>
  14. This is a module that enables media streams to be proxied
  15. via an &rtp; proxy. The only &rtp; proxy currently known to work
  16. with this module is the Sipwise rtpengine
  17. <ulink url="https://github.com/sipwise/rtpengine"></ulink>.
  18. The rtpengine module is a modified version of the original
  19. rtpproxy module using a new control protocol. The module is
  20. designed to be a drop-in replacement for the old module from
  21. a configuration file point of view, however due to the
  22. incompatible control protocol, it only works with &rtp; proxies
  23. which specifically support it.
  24. </para>
  25. </section>
  26. <section>
  27. <title>Multiple &rtp; proxy usage</title>
  28. <para>
  29. The rtpengine module can support multiple &rtp; proxies for
  30. balancing/distribution and control/selection purposes.
  31. </para>
  32. <para>
  33. The module allows definition of several sets of rtpproxies.
  34. Load-balancing will be performed over a set and the admin has the
  35. ability to choose what set should be used. The set is selected via
  36. its id - the id being defined with the set. Refer to the
  37. <quote>rtpengine_sock</quote> module parameter definition for syntax
  38. description.
  39. </para>
  40. <para>
  41. The balancing inside a set is done automatically by the module based on
  42. the weight of each &rtp; proxy from the set.
  43. </para>
  44. <para>
  45. The selection of the set is done from script prior using
  46. rtpengine_delete(), rtpengine_offer() or rtpengine_answer()
  47. functions - see the set_rtpengine_set() function.
  48. </para>
  49. <para>
  50. Another way to select the set is to define setid_avp
  51. module parameter and assign setid to the defined avp
  52. before calling rtpengine_offer() or rtpengine_manage()
  53. function. If forwarding of the requests fails and
  54. there is another branch to try, remember to unset the
  55. avp after calling rtpengine_delete() function.
  56. </para>
  57. <para>
  58. For backward compatibility reasons, a set with no id take by default
  59. the id 0. Also if no set is explicitly set before
  60. rtpengine_delete(), rtpengine_offer() or rtpengine_answer()
  61. the 0 id set will be used.
  62. </para>
  63. <para>
  64. IMPORTANT: if you use multiple sets, take care and use the same set for
  65. both rtpengine_offer()/rtpengine_answer() and rtpengine_delete()!!
  66. If the set was selected using setid_avp, the avp needs to be
  67. set only once before rtpengine_offer() or rtpengine_manage() call.
  68. </para>
  69. </section>
  70. <section>
  71. <title>Dependencies</title>
  72. <section>
  73. <title>&kamailio; Modules</title>
  74. <para>
  75. The following modules must be loaded before this module:
  76. <itemizedlist>
  77. <listitem>
  78. <para>
  79. <emphasis>tm module</emphasis> - (optional) if you want to
  80. have rtpengine_manage() fully functional
  81. </para>
  82. </listitem>
  83. </itemizedlist>
  84. </para>
  85. </section>
  86. <section>
  87. <title>External Libraries or Applications</title>
  88. <para>
  89. The following libraries or applications must be installed before
  90. running &kamailio; with this module loaded:
  91. <itemizedlist>
  92. <listitem>
  93. <para>
  94. <emphasis>None</emphasis>.
  95. </para>
  96. </listitem>
  97. </itemizedlist>
  98. </para>
  99. </section>
  100. </section>
  101. <section>
  102. <title>Parameters</title>
  103. <section id="rtpengine.p.rtpengine_sock">
  104. <title><varname>rtpengine_sock</varname> (string)</title>
  105. <para>
  106. Definition of socket(s) used to connect to (a set) &rtp; proxy. It may
  107. specify a UNIX socket or an IPv4/IPv6 UDP socket.
  108. </para>
  109. <para>
  110. <emphasis>
  111. Default value is <quote>NONE</quote> (disabled).
  112. </emphasis>
  113. </para>
  114. <example>
  115. <title>Set <varname>rtpengine_sock</varname> parameter</title>
  116. <programlisting format="linespecific">
  117. ...
  118. # single rtproxy
  119. modparam("rtpengine", "rtpengine_sock", "udp:localhost:12221")
  120. # multiple rtproxies for LB
  121. modparam("rtpengine", "rtpengine_sock",
  122. "udp:localhost:12221 udp:localhost:12222")
  123. # multiple sets of multiple rtproxies
  124. modparam("rtpengine", "rtpengine_sock",
  125. "1 == udp:localhost:12221 udp:localhost:12222")
  126. modparam("rtpengine", "rtpengine_sock",
  127. "2 == udp:localhost:12225")
  128. ...
  129. </programlisting>
  130. </example>
  131. </section>
  132. <section id="rtpengine.p.rtpengine_disable_tout">
  133. <title><varname>rtpengine_disable_tout</varname> (integer)</title>
  134. <para>
  135. Once an &rtp; proxy was found unreachable and marked as disabled, the rtpengine
  136. module will not attempt to establish communication to that &rtp; proxy for
  137. rtpengine_disable_tout seconds.
  138. </para>
  139. <para>
  140. <emphasis>
  141. Default value is <quote>60</quote>.
  142. </emphasis>
  143. </para>
  144. <example>
  145. <title>Set <varname>rtpengine_disable_tout</varname> parameter</title>
  146. <programlisting format="linespecific">
  147. ...
  148. modparam("rtpengine", "rtpengine_disable_tout", 20)
  149. ...
  150. </programlisting>
  151. </example>
  152. </section>
  153. <section id="rtpengine.p.rtpengine_tout">
  154. <title><varname>rtpengine_tout</varname> (integer)</title>
  155. <para>
  156. Timeout value in waiting for reply from &rtp; proxy.
  157. </para>
  158. <para>
  159. <emphasis>
  160. Default value is <quote>1</quote>.
  161. </emphasis>
  162. </para>
  163. <example>
  164. <title>Set <varname>rtpengine_tout</varname> parameter</title>
  165. <programlisting format="linespecific">
  166. ...
  167. modparam("rtpengine", "rtpengine_tout", 2)
  168. ...
  169. </programlisting>
  170. </example>
  171. </section>
  172. <section id="rtpengine.p.rtpengine_retr">
  173. <title><varname>rtpengine_retr</varname> (integer)</title>
  174. <para>
  175. How many times the module should retry to send and receive after
  176. timeout was generated.
  177. </para>
  178. <para>
  179. <emphasis>
  180. Default value is <quote>5</quote>.
  181. </emphasis>
  182. </para>
  183. <example>
  184. <title>Set <varname>rtpengine_retr</varname> parameter</title>
  185. <programlisting format="linespecific">
  186. ...
  187. modparam("rtpengine", "rtpengine_retr", 2)
  188. ...
  189. </programlisting>
  190. </example>
  191. </section>
  192. <section id="rtpengine.p.extra_id_pv">
  193. <title><varname>extra_id_pv</varname> (string)</title>
  194. <para>
  195. The parameter sets the PV defination to use when the <quote>b</quote>
  196. parameter is used on rtpengine_delete(), rtpengine_offer(),
  197. rtpengine_answer() or rtpengine_manage() command.
  198. </para><para>
  199. Default is empty, the <quote>b</quote> parameter may not be used then.
  200. </para>
  201. <example>
  202. <title>Set <varname>extra_id_pv</varname> parameter</title>
  203. <programlisting format="linespecific">
  204. ...
  205. modparam("rtpengine", "extra_id_pv", "$avp(extra_id)")
  206. ...
  207. </programlisting>
  208. </example>
  209. </section>
  210. <section id="rtpengine.p.setid_pv">
  211. <title><varname>setid_avp</varname> (string)</title>
  212. <para>
  213. The parameter defines an AVP that, if set,
  214. determines which &rtp; proxy set
  215. rtpengine_offer(), rtpengine_answer(),
  216. rtpengine_delete(), and rtpengine_manage()
  217. functions use.
  218. </para>
  219. <para>
  220. There is no default value.
  221. </para>
  222. <example>
  223. <title>Set <varname>setid_avp</varname> parameter</title>
  224. <programlisting format="linespecific">
  225. ...
  226. modparam("rtpengine", "setid_avp", "$avp(setid)")
  227. ...
  228. </programlisting>
  229. </example>
  230. </section>
  231. </section>
  232. <section>
  233. <title>Functions</title>
  234. <section id="rtpengine.f.set_rtpengine_set">
  235. <title>
  236. <function moreinfo="none">set_rtpengine_set(setid[, setid])</function>
  237. </title>
  238. <para>
  239. Sets the ID of the &rtp; proxy set to be used for the next
  240. rtpengine_delete(), rtpengine_offer(), rtpengine_answer()
  241. or rtpengine_manage() command. The parameter can be an integer or
  242. a config variable holding an integer.
  243. </para>
  244. <para>
  245. A second set ID can be specified to daisy-chain two &rtp; proxies.
  246. The two set IDs must be distinct from each other and there must not
  247. be any overlap in the proxies present in both sets. In this use case,
  248. the request (offer, answer, etc) is first sent to an &rtp; proxy from
  249. the first set, which rewrites the &sdp; body and sends it back to the
  250. module. The rewritten &sdp; body is then used to make another request
  251. to an &rtp; proxy from the second set, which rewrites the &sdp; body
  252. another time and sends it back to the module to be placed back into the
  253. &sip; message. This is useful if you have a set of &rtp; proxies that
  254. the caller must use, and another distinct set of &rtp; proxies that the
  255. callee must use. This is supported by all rtpengine commands except
  256. rtpengine_manage().
  257. </para>
  258. <para>
  259. This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
  260. BRANCH_ROUTE.
  261. </para>
  262. <example>
  263. <title><function>set_rtpengine_set</function> usage</title>
  264. <programlisting format="linespecific">
  265. ...
  266. set_rtpengine_set("2");
  267. rtpengine_offer();
  268. ...
  269. </programlisting>
  270. </example>
  271. </section>
  272. <section id="rtpengine.f.rtpengine_offer">
  273. <title>
  274. <function moreinfo="none">rtpengine_offer([flags])</function>
  275. </title>
  276. <para>
  277. Rewrites &sdp; body to ensure that media is passed through
  278. an &rtp; proxy. To be invoked
  279. on INVITE for the cases the &sdp; bodies are in INVITE and 200 OK and on 200 OK
  280. when &sdp; bodies are in 200 OK and ACK.
  281. </para>
  282. <para>Meaning of the parameters is as follows:</para>
  283. <itemizedlist>
  284. <listitem>
  285. <para>
  286. <emphasis>flags</emphasis> - flags to turn on some features.
  287. </para>
  288. <para>The <quote>flags</quote> string is a list of space-separated items. Each item
  289. is either an individual token, or a token in <quote>key=value</quote> format. The
  290. possible tokens are described below.</para>
  291. <itemizedlist>
  292. <listitem><para>
  293. <emphasis>via-branch=...</emphasis> - Include the <quote>branch</quote>
  294. value of one of the <quote>Via</quote> headers in the request to the
  295. &rtp; proxy. Possible values are:
  296. <quote>1</quote> - use the first <quote>Via</quote> header;
  297. <quote>2</quote> - use the second <quote>Via</quote> header;
  298. <quote>auto</quote> - use the first <quote>Via</quote> header if this is
  299. a request, or the second one if this is a reply;
  300. <quote>extra</quote> - don't take the value from a header, but instead use
  301. the value of the <quote>extra_id_pv</quote> variable.
  302. This can be used to create one media session per branch
  303. on the &rtp; proxy. When sending a subsequent <quote>delete</quote> command to
  304. the &rtp; proxy, you can then stop just the session for a specific branch when
  305. passing the flag '1' or '2' in the <quote>rtpengine_delete</quote>, or stop
  306. all sessions for a call when not passing one of those two flags there. This is
  307. especially useful if you have serially forked call scenarios where the &rtp; proxy
  308. gets an <quote>offer</quote> command for a new branch, and then a
  309. <quote>delete</quote> command for the previous branch, which would otherwise
  310. delete the full call, breaking the subsequent <quote>answer</quote> for the
  311. new branch. <emphasis>This flag is only supported by the Sipwise rtpengine
  312. &rtp; proxy at the moment!</emphasis>
  313. </para></listitem>
  314. <listitem><para>
  315. <emphasis>asymmetric</emphasis> - flags that UA from which message is
  316. received doesn't support symmetric &rtp;. Disables learning of endpoint addresses
  317. in the Sipwise rtpengine proxy.
  318. </para></listitem>
  319. <listitem><para>
  320. <emphasis>force-answer</emphasis> - force <quote>answer</quote>, that is,
  321. only rewrite &sdp; when corresponding session already exists
  322. in the &rtp; proxy. By default is on when the session is to be
  323. completed.
  324. </para></listitem>
  325. <listitem><para>
  326. <emphasis>direction=...</emphasis> - this option specifies a logical network
  327. interface and should be given exactly twice. It enables &rtp; bridging between
  328. different addresses or networks of the same family (e.g. IPv4 to IPv4). The
  329. first instance of the option
  330. specifies the interface that the originator of this message should be using,
  331. while the second instance specifies the interface that the target should be
  332. using. For example, if the &sip; message was sent by an endpoint on a private
  333. network and will be sent to an endpoint on the public internet, you would use
  334. <quote>direction=priv direction=pub</quote> if those two logical network
  335. interfaces were called <quote>priv</quote> and <quote>pub</quote> in your
  336. &rtp; proxy's configuration respectively. The direction must only be specified
  337. in for initial &sdp; offer; answers or subsequent offers can omit this option.
  338. </para></listitem>
  339. <listitem><para>
  340. <emphasis>internal, external</emphasis> - shorthand for
  341. <quote>direction=internal</quote> and <quote>direction=external</quote>
  342. respectively. Useful for brevity or as legacy option if the &rtp; proxy only
  343. supports two network interfaces instead of multiple, arbitrarily named ones.
  344. </para></listitem>
  345. <listitem><para>
  346. <emphasis>auto-bridge</emphasis> - this flag an alternative to the
  347. <quote>internal</quote> and <quote>external</quote> flags
  348. in order to do automatic bridging between IPv4 on the
  349. "internal network" and IPv6 on the "external network". Instead of
  350. explicitly instructing the &rtp; proxy to select a particular address
  351. family, the distinction is done by the given IP in the &sdp; body by
  352. the &rtp; proxy itself. Not supported by Sipwise rtpengine.
  353. </para></listitem>
  354. <listitem><para>
  355. <emphasis>address-family=...</emphasis> - instructs the &rtp; proxy that the
  356. recipient of this &sdp; body expects to see addresses of a particular family.
  357. Possible values are <quote>IP4</quote> and <quote>IP6</quote>. For example,
  358. if the &sdp; body contains IPv4 addresses but the recipient only speaks IPv6,
  359. you would use <quote>address-family=IP6</quote> to bridge between the two
  360. address families.
  361. </para><para>
  362. Sipwise rtpengine remembers the address family preference of each party after
  363. it has seen an &sdp; body from them. This means that normally it is only
  364. necessary to explicitly specify the address family in the <quote>offer</quote>,
  365. but not in the <quote>answer</quote>.
  366. </para><para>
  367. Note: Please note, that this will only work properly with non-dual-stack user-agents or with
  368. dual-stack clients according to RFC6157 (which suggest ICE for Dual-Stack implementations).
  369. This short-cut will not work properly with RFC4091 (ANAT) compatible clients, which suggests
  370. having different m-lines with different IP-protocols grouped together.
  371. </para></listitem>
  372. <listitem><para>
  373. <emphasis>force</emphasis> - instructs the &rtp; proxy to ignore marks
  374. inserted by another &rtp; proxy in transit to indicate that the
  375. session is already goes through another proxy. Allows creating
  376. a chain of proxies. Not supported and ignored by Sipwise rtpengine.
  377. </para></listitem>
  378. <listitem><para>
  379. <emphasis>trust-address</emphasis> - flags that IP address in &sdp; should
  380. be trusted. Without this flag, the &rtp; proxy ignores address in
  381. the &sdp; and uses source address of the &sip; message as media
  382. address which is passed to the &rtp; proxy.
  383. </para></listitem>
  384. <listitem><para>
  385. <emphasis>replace-origin</emphasis> - flags that IP from the origin
  386. description (o=) should be also changed.
  387. </para></listitem>
  388. <listitem><para>
  389. <emphasis>replace-session-connection</emphasis> - flags to change the session-level
  390. &sdp; connection (c=) IP if media description also includes
  391. connection information.
  392. </para></listitem>
  393. <listitem><para>
  394. <emphasis>symmetric</emphasis> - flags that for the UA from which
  395. message is received, support symmetric &rtp; must be forced. Does nothing with
  396. the Sipwise rtpengine proxy as it is the default.
  397. </para></listitem>
  398. <listitem><para>
  399. <emphasis>repacketize=NN</emphasis> - requests the &rtp; proxy to perform
  400. re-packetization of &rtp; traffic coming from the UA which
  401. has sent the current message to increase or decrease payload
  402. size per each &rtp; packet forwarded if possible. The NN is the
  403. target payload size in ms, for the most codecs its value should
  404. be in 10ms increments, however for some codecs the increment
  405. could differ (e.g. 30ms for GSM or 20ms for G.723). The
  406. &rtp; proxy would select the closest value supported by the codec.
  407. This feature could be used for significantly reducing bandwith
  408. overhead for low bitrate codecs, for example with G.729 going
  409. from 10ms to 100ms saves two thirds of the network bandwith.
  410. Not supported by Sipwise rtpengine.
  411. </para></listitem>
  412. <listitem><para>
  413. <emphasis>ICE=...</emphasis> - controls the &rtp; proxy's behaviour
  414. regarding ICE attributes within the &sdp; body. Possible values
  415. are: <quote>force</quote> -
  416. discard any ICE attributes already present in the &sdp; body
  417. and then generate and insert new ICE data, leaving itself
  418. as the <emphasis>only</emphasis> ICE candidates;
  419. <quote>force-relay</quote> -
  420. discard any <quote>relay</quote> type ICE attributes already present
  421. in the &sdp; body and then generate and insert itself
  422. as the <emphasis>only</emphasis> ICE <quote>relay</quote> candidates;
  423. <quote>remove</quote> instructs the &rtp; proxy to discard
  424. any ICE attributes and not insert any new ones into the &sdp;.
  425. The default (if no <quote>ICE=...</quote> is given at all),
  426. new ICE data will only be generated
  427. if no ICE was present in the &sdp; originally; otherwise
  428. the &rtp; proxy will only insert itself as
  429. <emphasis>additional</emphasis> ICE candidate. Other
  430. &sdp; substitutions (c=, m=, etc) are unaffected by this flag.
  431. </para></listitem>
  432. <listitem><para>
  433. <emphasis>RTP, SRTP, AVP, AVPF</emphasis> - These flags control the &rtp;
  434. transport protocol that should be used towards the recipient of
  435. the &sdp;. If none of them are specified, the protocol given in
  436. the &sdp; is left untouched. Otherwise, the <quote>SRTP</quote> flag indicates that
  437. SRTP should be used, while <quote>RTP</quote> indicates that SRTP should not be used.
  438. <quote>AVPF</quote> indicates that the advanced RTCP profile with feedback messages
  439. should be used, and <quote>AVP</quote> indicates that the regular RTCP profile
  440. should be used. See also the next set of flags below.
  441. </para></listitem>
  442. <listitem><para>
  443. <emphasis>RTP/AVP, RTP/SAVP, RTP/AVPF, RTP/SAVPF</emphasis> - these serve as
  444. an alternative, more explicit way to select between the different &rtp; protocols
  445. and profiles supported by the &rtp; proxy. For example, giving the flag
  446. <quote>RTP/SAVPF</quote> has the same effect as giving the two flags
  447. <quote>SRTP AVPF</quote>.
  448. </para></listitem>
  449. <listitem><para>
  450. <emphasis>to-tag</emphasis> - force inclusion of the <quote>To</quote> tag.
  451. Normally, the <quote>To</quote> tag is always included when present, except
  452. for <quote>delete</quote> messages. Including the <quote>To</quote> tag in
  453. a <quote>delete</quote> messages allows you to be more selective about which
  454. dialogues within a call are being torn down.
  455. </para></listitem>
  456. <listitem><para>
  457. <emphasis>rtcp-mux-demux</emphasis> - if rtcp-mux (RFC 5761) was
  458. offered, make the &rtp; proxy accept the offer, but not offer it to the
  459. recipient of this message.
  460. </para></listitem>
  461. <listitem><para>
  462. <emphasis>rtcp-mux-reject</emphasis> - if rtcp-mux was offered, make the
  463. &rtp; proxy reject the offer, but still offer it to the recipient. Can be
  464. combined with <quote>rtcp-mux-offer</quote> to always offer it.
  465. </para></listitem>
  466. <listitem><para>
  467. <emphasis>rtcp-mux-offer</emphasis> - make the &rtp; proxy offer rtcp-mux
  468. to the recipient of this message, regardless of whether it was offered
  469. originally or not.
  470. </para></listitem>
  471. <listitem><para>
  472. <emphasis>rtcp-mux-accept</emphasis> - if rtcp-mux was offered, make the
  473. &rtp; proxy accept the offer and also offer it to the recipient of this
  474. message. Can be combined with <quote>rtcp-mux-offer</quote> to always offer it.
  475. </para></listitem>
  476. <listitem><para>
  477. <emphasis>media-address=...</emphasis> - force a particular media address to
  478. be used in the &sdp; body. Address family is detected automatically.
  479. </para></listitem>
  480. <listitem><para>
  481. <emphasis>TOS=...</emphasis> - change the IP TOS value for all outgoing &rtp;
  482. packets within the entire call in both directions. Only honoured in an
  483. <quote>offer</quote>, ignored for an <quote>answer</quote>. Valid values are
  484. 0 through 255, given in decimal. If this option is not specified, the TOS
  485. value will revert to the default TOS (normally 184). A value of -1 may be used
  486. to leave the currently used TOS unchanged.
  487. </para></listitem>
  488. </itemizedlist>
  489. </listitem>
  490. </itemizedlist>
  491. <para>
  492. This function can be used from ANY_ROUTE.
  493. </para>
  494. <example>
  495. <title><function>rtpengine_offer</function> usage</title>
  496. <programlisting format="linespecific">
  497. route {
  498. ...
  499. if (is_method("INVITE")) {
  500. if (has_body("application/sdp")) {
  501. if (rtpengine_offer())
  502. t_on_reply("1");
  503. } else {
  504. t_on_reply("2");
  505. }
  506. }
  507. if (is_method("ACK") &amp;&amp; has_body("application/sdp"))
  508. rtpengine_answer();
  509. ...
  510. }
  511. onreply_route[1]
  512. {
  513. ...
  514. if (has_body("application/sdp"))
  515. rtpengine_answer();
  516. ...
  517. }
  518. onreply_route[2]
  519. {
  520. ...
  521. if (has_body("application/sdp"))
  522. rtpengine_offer();
  523. ...
  524. }
  525. </programlisting>
  526. </example>
  527. </section>
  528. <section id="rtpengine.f.rtpengine_answer">
  529. <title>
  530. <function moreinfo="none">rtpengine_answer([flags])</function>
  531. </title>
  532. <para>
  533. Rewrites &sdp; body to ensure that media is passed through
  534. an &rtp; proxy. To be invoked
  535. on 200 OK for the cases the &sdp; bodies are in INVITE and 200 OK and on ACK
  536. when &sdp; bodies are in 200 OK and ACK.
  537. </para>
  538. <para>
  539. See rtpengine_offer() function description above for the meaning of the
  540. parameters.
  541. </para>
  542. <para>
  543. This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
  544. FAILURE_ROUTE, BRANCH_ROUTE.
  545. </para>
  546. <example>
  547. <title><function>rtpengine_answer</function> usage</title>
  548. <para>
  549. See rtpengine_offer() function example above for example.
  550. </para>
  551. </example>
  552. </section>
  553. <section id="rtpengine.f.rtpengine_delete">
  554. <title>
  555. <function moreinfo="none">rtpengine_delete([flags])</function>
  556. </title>
  557. <para>
  558. Tears down the RTPProxy session for the current call.
  559. </para>
  560. <para>
  561. See rtpengine_offer() function description above for the meaning of the
  562. parameters. Note that not all flags make sense for a <quote>delete</quote>.
  563. </para>
  564. <para>
  565. This function can be used from ANY_ROUTE.
  566. </para>
  567. <example>
  568. <title><function>rtpengine_delete</function> usage</title>
  569. <programlisting format="linespecific">
  570. ...
  571. rtpengine_delete();
  572. ...
  573. </programlisting>
  574. </example>
  575. </section>
  576. <section id="rtpengine.f.rtpengine_manage">
  577. <title>
  578. <function moreinfo="none">rtpengine_manage([flags])</function>
  579. </title>
  580. <para>
  581. Manage the RTPProxy session - it combines the functionality of
  582. rtpengine_offer(), rtpengine_answer() and rtpengine_delete(), detecting
  583. internally based on message type and method which one to execute.
  584. </para>
  585. <para>
  586. It can take the same parameters as <function>rtpengine_offer().</function>
  587. The flags parameter to rtpengine_manage() can be a configuration variable
  588. containing the flags as a string.
  589. </para>
  590. <para>
  591. Functionality:
  592. </para>
  593. <itemizedlist>
  594. <listitem>
  595. <para>
  596. If INVITE with &sdp;, then do <function>rtpengine_offer()</function>
  597. </para>
  598. </listitem>
  599. <listitem>
  600. <para>
  601. If INVITE with &sdp;, when the tm module is loaded, mark transaction with
  602. internal flag FL_SDP_BODY to know that the 1xx and 2xx are for
  603. <function>rtpengine_answer()</function>
  604. </para>
  605. </listitem>
  606. <listitem>
  607. <para>
  608. If ACK with &sdp;, then do <function>rtpengine_answer()</function>
  609. </para>
  610. </listitem>
  611. <listitem>
  612. <para>
  613. If BYE or CANCEL, or called within a FAILURE_ROUTE[], then do <function>rtpengine_delete()</function>
  614. </para>
  615. </listitem>
  616. <listitem>
  617. <para>
  618. If reply to INVITE with code >= 300 do <function>rtpengine_delete()</function>
  619. </para>
  620. </listitem>
  621. <listitem>
  622. <para>
  623. If reply with &sdp; to INVITE having code 1xx and 2xx, then
  624. do <function>rtpengine_answer()</function> if the request had &sdp; or tm is not loaded,
  625. otherwise do <function>rtpengine_offer()</function>
  626. </para>
  627. </listitem>
  628. </itemizedlist>
  629. <para>
  630. This function can be used from ANY_ROUTE.
  631. </para>
  632. <example>
  633. <title><function>rtpengine_manage</function> usage</title>
  634. <programlisting format="linespecific">
  635. ...
  636. rtpengine_manage();
  637. ...
  638. </programlisting>
  639. </example>
  640. </section>
  641. <section id="rtpengine.f.start_recording">
  642. <title>
  643. <function moreinfo="none">start_recording()</function>
  644. </title>
  645. <para>
  646. This function will send a signal to the &rtp; proxy to record
  647. the &rtp; stream on the &rtp; proxy.
  648. <emphasis>This function is not supported by Sipwise rtpengine at the moment!</emphasis>
  649. </para>
  650. <para>
  651. This function can be used from REQUEST_ROUTE and ONREPLY_ROUTE.
  652. </para>
  653. <example>
  654. <title><function>start_recording</function> usage</title>
  655. <programlisting format="linespecific">
  656. ...
  657. start_recording();
  658. ...
  659. </programlisting>
  660. </example>
  661. </section>
  662. </section>
  663. <section>
  664. <title>Exported Pseudo Variables</title>
  665. <section>
  666. <title><function moreinfo="none">$rtpstat</function></title>
  667. <para>
  668. Returns the &rtp; statistics from the &rtp; proxy. The &rtp; statistics from the &rtp; proxy
  669. are provided as a string and it does contain several packet counters. The statistics
  670. must be retrieved before the session is deleted (before <function>rtpengine_delete()</function>).
  671. </para>
  672. <example>
  673. <title>$rtpstat Usage</title>
  674. <programlisting format="linespecific">
  675. ...
  676. append_hf("X-RTP-Statistics: $rtpstat\r\n");
  677. ...
  678. </programlisting>
  679. </example>
  680. </section>
  681. </section>
  682. <section>
  683. <title><acronym>MI</acronym> Commands</title>
  684. <section id="rtpengine.m.nh_enable_rtpp">
  685. <title><function moreinfo="none">nh_enable_rtpp</function></title>
  686. <para>
  687. Enables a &rtp; proxy if parameter value is greater than 0.
  688. Disables it if a zero value is given.
  689. </para>
  690. <para>
  691. The first parameter is the &rtp; proxy url (exactly as defined in
  692. the config file).
  693. </para>
  694. <para>
  695. The second parameter value must be a number in decimal.
  696. </para>
  697. <para>
  698. NOTE: if a &rtp; proxy is defined multiple times (in the same or
  699. diferente sete), all of its instances will be enables/disabled.
  700. </para>
  701. <example>
  702. <title>
  703. <function moreinfo="none">nh_enable_rtpp</function> usage</title>
  704. <programlisting format="linespecific">
  705. ...
  706. $ &ctltool; fifo nh_enable_rtpp udp:192.168.2.133:8081 0
  707. ...
  708. </programlisting>
  709. </example>
  710. </section>
  711. <section id="rtpengine.m.nh_show_rtpp">
  712. <title><function moreinfo="none">nh_show_rtpp</function></title>
  713. <para>
  714. Displays all the &rtp; proxies and their information: set and
  715. status (disabled or not, weight and recheck_ticks).
  716. </para>
  717. <para>
  718. No parameter.
  719. </para>
  720. <example>
  721. <title>
  722. <function moreinfo="none">nh_show_rtpp</function> usage</title>
  723. <programlisting format="linespecific">
  724. ...
  725. $ &ctltool; fifo nh_show_rtpp
  726. ...
  727. </programlisting>
  728. </example>
  729. </section>
  730. </section>
  731. </chapter>