rtpproxy_admin.xml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  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 rtpproxy. Rtpproxies know to work with this module
  16. are Sippy RTPproxy <ulink url="http://www.rtpproxy.org"></ulink>
  17. and ngcp-rtpproxy-ng
  18. <ulink url="http://deb.sipwise.com/spce/2.6/pool/main/n/ngcp-mediaproxy-ng"></ulink>.
  19. Some features of the rtpproxy module apply only to one of the two rtpproxies.
  20. </para>
  21. </section>
  22. <section>
  23. <title>Multiple RTPProxy usage</title>
  24. <para>
  25. The rtpproxy module can support multiple rtpproxies for
  26. balancing/distribution and control/selection purposes.
  27. </para>
  28. <para>
  29. The module allows definition of several sets of rtpproxies.
  30. Load-balancing will be performed over a set and the admin has the
  31. ability to choose what set should be used. The set is selected via
  32. its id - the id being defined with the set. Refer to the
  33. <quote>rtpproxy_sock</quote> module parameter definition for syntax
  34. description.
  35. </para>
  36. <para>
  37. The balancing inside a set is done automatically by the module based on
  38. the weight of each rtpproxy from the set.
  39. </para>
  40. <para>
  41. The selection of the set is done from script prior using
  42. unforce_rtp_proxy(), rtpproxy_offer() or rtpproxy_answer()
  43. functions - see the set_rtp_proxy_set() function.
  44. </para>
  45. <para>
  46. For backward compatibility reasons, a set with no id take by default
  47. the id 0. Also if no set is explicitly set before
  48. unforce_rtp_proxy(), rtpproxy_offer() or rtpproxy_answer()
  49. the 0 id set will be used.
  50. </para>
  51. <para>
  52. IMPORTANT: if you use multiple sets, take care and use the same set for
  53. both rtpproxy_offer()/rtpproxy_answer() and unforce_rtpproxy()!!
  54. </para>
  55. </section>
  56. <section>
  57. <title>Dependencies</title>
  58. <section>
  59. <title>&kamailio; Modules</title>
  60. <para>
  61. The following modules must be loaded before this module:
  62. <itemizedlist>
  63. <listitem>
  64. <para>
  65. <emphasis>tm module</emphasis> - (optional) if you want to
  66. have rtpproxy_manage() fully functional
  67. </para>
  68. </listitem>
  69. </itemizedlist>
  70. </para>
  71. </section>
  72. <section>
  73. <title>External Libraries or Applications</title>
  74. <para>
  75. The following libraries or applications must be installed before
  76. running &kamailio; with this module loaded:
  77. <itemizedlist>
  78. <listitem>
  79. <para>
  80. <emphasis>None</emphasis>.
  81. </para>
  82. </listitem>
  83. </itemizedlist>
  84. </para>
  85. </section>
  86. </section>
  87. <section>
  88. <title>Parameters</title>
  89. <section>
  90. <title><varname>rtpproxy_sock</varname> (string)</title>
  91. <para>
  92. Definition of socket(s) used to connect to (a set) RTPProxy. It may
  93. specify a UNIX socket or an IPv4/IPv6 UDP socket.
  94. </para>
  95. <para>
  96. <emphasis>
  97. Default value is <quote>NONE</quote> (disabled).
  98. </emphasis>
  99. </para>
  100. <example>
  101. <title>Set <varname>rtpproxy_sock</varname> parameter</title>
  102. <programlisting format="linespecific">
  103. ...
  104. # single rtproxy
  105. modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:12221")
  106. # multiple rtproxies for LB
  107. modparam("rtpproxy", "rtpproxy_sock",
  108. "udp:localhost:12221 udp:localhost:12222")
  109. # multiple sets of multiple rtproxies
  110. modparam("rtpproxy", "rtpproxy_sock",
  111. "1 == udp:localhost:12221 udp:localhost:12222")
  112. modparam("rtpproxy", "rtpproxy_sock",
  113. "2 == udp:localhost:12225")
  114. ...
  115. </programlisting>
  116. </example>
  117. </section>
  118. <section>
  119. <title><varname>rtpproxy_disable_tout</varname> (integer)</title>
  120. <para>
  121. Once RTPProxy was found unreachable and marked as disabled, the rtpproxy
  122. module will not attempt to establish communication to RTPProxy for
  123. rtpproxy_disable_tout seconds.
  124. </para>
  125. <para>
  126. <emphasis>
  127. Default value is <quote>60</quote>.
  128. </emphasis>
  129. </para>
  130. <example>
  131. <title>Set <varname>rtpproxy_disable_tout</varname> parameter</title>
  132. <programlisting format="linespecific">
  133. ...
  134. modparam("rtpproxy", "rtpproxy_disable_tout", 20)
  135. ...
  136. </programlisting>
  137. </example>
  138. </section>
  139. <section>
  140. <title><varname>rtpproxy_tout</varname> (integer)</title>
  141. <para>
  142. Timeout value in waiting for reply from RTPProxy.
  143. </para>
  144. <para>
  145. <emphasis>
  146. Default value is <quote>1</quote>.
  147. </emphasis>
  148. </para>
  149. <example>
  150. <title>Set <varname>rtpproxy_tout</varname> parameter</title>
  151. <programlisting format="linespecific">
  152. ...
  153. modparam("rtpproxy", "rtpproxy_tout", 2)
  154. ...
  155. </programlisting>
  156. </example>
  157. </section>
  158. <section>
  159. <title><varname>rtpproxy_retr</varname> (integer)</title>
  160. <para>
  161. How many times the module should retry to send and receive after
  162. timeout was generated.
  163. </para>
  164. <para>
  165. <emphasis>
  166. Default value is <quote>5</quote>.
  167. </emphasis>
  168. </para>
  169. <example>
  170. <title>Set <varname>rtpproxy_retr</varname> parameter</title>
  171. <programlisting format="linespecific">
  172. ...
  173. modparam("rtpproxy", "rtpproxy_retr", 2)
  174. ...
  175. </programlisting>
  176. </example>
  177. </section>
  178. <section>
  179. <title><varname>nortpproxy_str</varname> (string)</title>
  180. <para>
  181. This parameter sets the SDP attribute used by rtpproxy to mark
  182. the message's SDP attachemnt with information that it have
  183. already been changed.
  184. </para>
  185. <para>
  186. If empty string, no marker will be added or checked.
  187. </para>
  188. <note><para>
  189. The string must be a complete SDP line, including the EOH (\r\n).
  190. </para></note>
  191. <para>
  192. <emphasis>
  193. Default value is <quote>a=nortpproxy:yes\r\n</quote>.
  194. </emphasis>
  195. </para>
  196. <example>
  197. <title>Set <varname>nortpproxy_str</varname> parameter</title>
  198. <programlisting format="linespecific">
  199. ...
  200. modparam("rtpproxy", "nortpproxy_str", "a=sdpmangled:yes\r\n")
  201. ...
  202. </programlisting>
  203. </example>
  204. </section>
  205. <section>
  206. <title><varname>timeout_socket</varname> (string)</title>
  207. <para>
  208. The parameter sets the RTP timeout socket, which is transmitted to the RTP-Proxy.
  209. It will be used by the RTP proxy to signal back that a media stream timed
  210. out.
  211. </para>
  212. <para>
  213. If it is an empty string, no timeout socket will be transmitted to the RTP-Proxy.
  214. </para>
  215. <para>
  216. <emphasis>
  217. Default value is <quote></quote> (nothing).
  218. </emphasis>
  219. </para>
  220. <example>
  221. <title>Set <varname>timeout_socket</varname> parameter</title>
  222. <programlisting format="linespecific">
  223. ...
  224. modparam("nathelper", "timeout_socket", "xmlrpc:http://127.0.0.1:8000/RPC2")
  225. ...
  226. </programlisting>
  227. </example>
  228. </section>
  229. <section>
  230. <title><varname>ice_candidate_priority_avp</varname> (string)</title>
  231. <para>
  232. If specified and if value of the avp value is not 0,
  233. <function>rtpproxy_manage</function> function adds
  234. ICE relay candidate attributes
  235. to sdp stream(s) containing ICE candidate attributes.
  236. </para>
  237. <para>
  238. If value of the avp is 1, added candidates
  239. have high priority. If value of the avp is 2 (default),
  240. added candidates have low priority.
  241. </para>
  242. <para>
  243. <emphasis>
  244. There is no default value meaning that no ICE relay
  245. candidates are added in any circumstance.
  246. </emphasis>
  247. </para>
  248. <example>
  249. <title>Set <varname>ice_candidate_priority_avp</varname> parameter</title>
  250. <programlisting format="linespecific">
  251. ...
  252. modparam("rtpproxy", "ice_candidate_priority_avp", "$avp(ice_priority)")
  253. ...
  254. </programlisting>
  255. </example>
  256. </section>
  257. <section>
  258. <title><varname>extra_id_pv</varname> (string)</title>
  259. <para>
  260. The parameter sets the PV defination to use when the <quote>b</quote>
  261. parameter is used on unforce_rtp_proxy(), rtpproxy_offer(),
  262. rtpproxy_answer() or rtpproxy_manage() command.
  263. </para><para>
  264. Default is empty, the <quote>b</quote> parameter may not be used then.
  265. </para>
  266. <example>
  267. <title>Set <varname>extra_id_pv</varname> parameter</title>
  268. <programlisting format="linespecific">
  269. ...
  270. modparam("rtpproxy", "extra_id_pv", "$avp(extra_id)")
  271. ...
  272. </programlisting>
  273. </example>
  274. </section>
  275. </section>
  276. <section>
  277. <title>Functions</title>
  278. <section>
  279. <title>
  280. <function moreinfo="none">set_rtp_proxy_set(setid)</function>
  281. </title>
  282. <para>
  283. Sets the Id of the rtpproxy set to be used for the next
  284. unforce_rtp_proxy(), rtpproxy_offer(), rtpproxy_answer()
  285. or rtpproxy_manage() command. The parameter can be an integer or
  286. a config variable holding an integer.
  287. </para>
  288. <para>
  289. This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
  290. BRANCH_ROUTE.
  291. </para>
  292. <example>
  293. <title><function>set_rtp_proxy_set</function> usage</title>
  294. <programlisting format="linespecific">
  295. ...
  296. set_rtp_proxy_set("2");
  297. rtpproxy_offer();
  298. ...
  299. </programlisting>
  300. </example>
  301. </section>
  302. <section>
  303. <title>
  304. <function moreinfo="none">rtpproxy_offer([flags [, ip_address]])</function>
  305. </title>
  306. <para>
  307. Rewrites &sdp; body to ensure that media is passed through
  308. an &rtp; proxy. To be invoked
  309. on INVITE for the cases the SDPs are in INVITE and 200 OK and on 200 OK
  310. when SDPs are in 200 OK and ACK.
  311. </para>
  312. <para>Meaning of the parameters is as follows:</para>
  313. <itemizedlist>
  314. <listitem>
  315. <para>
  316. <emphasis>flags</emphasis> - flags to turn on some features.
  317. </para>
  318. <itemizedlist>
  319. <listitem><para>
  320. <emphasis>1</emphasis> - append first Via branch to Call-ID when sending
  321. command to rtpproxy. This can be used to create one media session per branch
  322. on the rtpproxy. When sending a subsequent <quote>delete</quote> command to
  323. the rtpproxy, you can then stop just the session for a specific branch when
  324. passing the flag '1' or '2' in the <quote>unforce_rtpproxy</quote>, or stop
  325. all sessions for a call when not passing one of those two flags there. This is
  326. especially useful if you have serially forked call scenarios where rtpproxy
  327. gets an <quote>update</quote> command for a new branch, and then a
  328. <quote>delete</quote> command for the previous branch, which would otherwise
  329. delete the full call, breaking the subsequent <quote>lookup</quote> for the
  330. new branch. <emphasis>This flag is only supported by the ngcp-mediaproxy-ng
  331. rtpproxy at the moment!</emphasis>
  332. </para></listitem>
  333. <listitem><para>
  334. <emphasis>2</emphasis> - append second Via branch to Call-ID when sending
  335. command to rtpproxy. See flag '1' for its meaning.
  336. </para></listitem>
  337. <listitem><para>
  338. <emphasis>3</emphasis> - behave like flag 1 is set for a request and
  339. like flag 2 is set for a reply.
  340. </para></listitem>
  341. <listitem><para>
  342. <emphasis>a</emphasis> - flags that UA from which message is
  343. received doesn't support symmetric RTP. (automatically sets the 'r' flag)
  344. </para></listitem>
  345. <listitem><para>
  346. <emphasis>b</emphasis> - append branch specific variable to Call-ID when sending
  347. command to rtpproxy. This creates one rtpproxy session per unique variable.
  348. Works similar to the 1, 2 and 3 parameter, but is usefull when forking to multiple
  349. destinations on different address families or network segments, requiring different
  350. rtpproxy parameters.
  351. The variable value is taken from the <quote>extra_id_pv</quote>.
  352. When used, it must be used in every call to rtpproxy_manage(), rtpproxy_offer(),
  353. rtpproxy_answer() and rtpproxy_destroy() with the same contents of the PV.
  354. The b parameter may not be used in conjunction with the 1, 2 or 3 parameter
  355. to use the Via branch in the Call-ID.
  356. </para></listitem>
  357. <listitem><para>
  358. <emphasis>l</emphasis> - force <quote>lookup</quote>, that is,
  359. only rewrite SDP when corresponding session already exists
  360. in the RTP proxy. By default is on when the session is to be
  361. completed.
  362. </para></listitem>
  363. <listitem><para>
  364. <emphasis>i, e</emphasis> - these flags specify the direction of the SIP
  365. message. These flags only make sense when rtpproxy is running in bridge mode.
  366. 'i' means internal network (LAN), 'e' means external network (WAN). 'i'
  367. corresponds to rtpproxy's first interface, 'e' corresponds to rtpproxy's
  368. second interface. You always have to specify two flags to define
  369. the incoming network and the outgoing network. For example, 'ie' should be
  370. used for SIP message received from the local interface and sent out on the
  371. external interface, and 'ei' vice versa. Other options are 'ii' and 'ee'.
  372. So, for example if a SIP requests is processed with 'ie' flags, the corresponding
  373. response must be processed with 'ie' flags.
  374. </para><para>
  375. Note: As rtpproxy in bridge mode s per default asymmetric, you have to specify
  376. the 'w' flag for clients behind NAT! See also above notes!
  377. </para></listitem>
  378. <listitem><para>
  379. <emphasis>x</emphasis> - this flag a shortcut for using the "ie" or "ei"-flags of RTP-Proxy,
  380. in order to do automatic bridging between IPv4 on the
  381. "internal network" and IPv6 on the "external network". The distinction is done by
  382. the given IP in the SDP, e.g. a IPv4 Address will always call "ie" to the RTPProxy
  383. (IPv4(i) to IPv6(e)) and an IPv6Address will always call "ei" to the RTPProxy (IPv6(e)
  384. to IPv4(i)).
  385. </para><para>
  386. Note: Please note, that this will only work properly with non-dual-stack user-agents or with
  387. dual-stack clients according to RFC6157 (which suggest ICE for Dual-Stack implementations).
  388. This short-cut will not work properly with RFC4091 (ANAT) compatible clients, which suggests
  389. having different m-lines with different IP-protocols grouped together.
  390. </para></listitem>
  391. <listitem><para>
  392. <emphasis>f</emphasis> - instructs rtpproxy to ignore marks
  393. inserted by another rtpproxy in transit to indicate that the
  394. session is already goes through another proxy. Allows creating
  395. a chain of proxies.
  396. </para></listitem>
  397. <listitem><para>
  398. <emphasis>r</emphasis> - flags that IP address in SDP should
  399. be trusted. Without this flag, rtpproxy ignores address in
  400. the SDP and uses source address of the SIP message as media
  401. address which is passed to the RTP proxy.
  402. </para></listitem>
  403. <listitem><para>
  404. <emphasis>o</emphasis> - flags that IP from the origin
  405. description (o=) should be also changed.
  406. </para></listitem>
  407. <listitem><para>
  408. <emphasis>c</emphasis> - flags to change the session-level
  409. SDP connection (c=) IP if media-description also includes
  410. connection information.
  411. </para></listitem>
  412. <listitem><para>
  413. <emphasis>w</emphasis> - flags that for the UA from which
  414. message is received, support symmetric RTP must be forced.
  415. </para></listitem>
  416. <listitem><para>
  417. <emphasis>zNN</emphasis> - requests the RTPproxy to perform
  418. re-packetization of RTP traffic coming from the UA which
  419. has sent the current message to increase or decrease payload
  420. size per each RTP packet forwarded if possible. The NN is the
  421. target payload size in ms, for the most codecs its value should
  422. be in 10ms increments, however for some codecs the increment
  423. could differ (e.g. 30ms for GSM or 20ms for G.723). The
  424. RTPproxy would select the closest value supported by the codec.
  425. This feature could be used for significantly reducing bandwith
  426. overhead for low bitrate codecs, for example with G.729 going
  427. from 10ms to 100ms saves two thirds of the network bandwith.
  428. </para></listitem>
  429. </itemizedlist>
  430. </listitem>
  431. <listitem><para>
  432. <emphasis>ip_address</emphasis> - new SDP IP address.
  433. </para></listitem>
  434. </itemizedlist>
  435. <para>
  436. This function can be used from ANY_ROUTE.
  437. </para>
  438. <example>
  439. <title><function>rtpproxy_offer</function> usage</title>
  440. <programlisting format="linespecific">
  441. route {
  442. ...
  443. if (is_method("INVITE")) {
  444. if (has_sdp()) {
  445. if (rtpproxy_offer())
  446. t_on_reply("1");
  447. } else {
  448. t_on_reply("2");
  449. }
  450. }
  451. if (is_method("ACK") &amp;&amp; has_sdp())
  452. rtpproxy_answer();
  453. ...
  454. }
  455. onreply_route[1]
  456. {
  457. ...
  458. if (has_sdp())
  459. rtpproxy_answer();
  460. ...
  461. }
  462. onreply_route[2]
  463. {
  464. ...
  465. if (has_sdp())
  466. rtpproxy_offer();
  467. ...
  468. }
  469. </programlisting>
  470. </example>
  471. </section>
  472. <section>
  473. <title>
  474. <function moreinfo="none">rtpproxy_answer([flags [, ip_address]])</function>
  475. </title>
  476. <para>
  477. Rewrites &sdp; body to ensure that media is passed through
  478. an &rtp; proxy. To be invoked
  479. on 200 OK for the cases the SDPs are in INVITE and 200 OK and on ACK
  480. when SDPs are in 200 OK and ACK.
  481. </para>
  482. <para>
  483. See rtpproxy_answer() function description above for the meaning of the
  484. parameters.
  485. </para>
  486. <para>
  487. This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
  488. FAILURE_ROUTE, BRANCH_ROUTE.
  489. </para>
  490. <example>
  491. <title><function>rtpproxy_answer</function> usage</title>
  492. <para>
  493. See rtpproxy_offer() function example above for example.
  494. </para>
  495. </example>
  496. </section>
  497. <section>
  498. <title>
  499. <function moreinfo="none">rtpproxy_destroy([flags])</function>
  500. </title>
  501. <para>
  502. Tears down the RTPProxy session for the current call.
  503. </para>
  504. <para>
  505. This function can be used from ANY_ROUTE.
  506. </para>
  507. <para>Meaning of the parameters is as follows:</para>
  508. <itemizedlist>
  509. <listitem>
  510. <para>
  511. <emphasis>flags</emphasis> - flags to turn on some features.
  512. </para>
  513. <itemizedlist>
  514. <listitem><para>
  515. <emphasis>1</emphasis> - append first Via branch to Call-ID when sending
  516. command to rtpproxy. This can be used to create one media session per branch
  517. on the rtpproxy. When sending a subsequent <quote>delete</quote> command to
  518. the rtpproxy, you can then stop just the session for a specific branch when
  519. passing the flag '1' or '2' in the <quote>unforce_rtpproxy</quote>, or stop
  520. all sessions for a call when not passing one of those two flags there. This is
  521. especially useful if you have serially forked call scenarios where rtpproxy
  522. gets an <quote>update</quote> command for a new branch, and then a
  523. <quote>delete</quote> command for the previous branch, which would otherwise
  524. delete the full call, breaking the subsequent <quote>lookup</quote> for the
  525. new branch. <emphasis>This flag is only supported by the ngcp-mediaproxy-ng
  526. rtpproxy at the moment!</emphasis>
  527. </para></listitem>
  528. <listitem><para>
  529. <emphasis>2</emphasis> - append second Via branch to Call-ID when sending
  530. command to rtpproxy. See flag '1' for its meaning.
  531. </para></listitem>
  532. <listitem><para>
  533. <emphasis>b</emphasis> - append branch specific variable to Call-ID when sending
  534. command to rtpproxy. See rtpproxy_offer() for details.
  535. <listitem><para>
  536. </para></listitem>
  537. <emphasis>t</emphasis> - do not include To tag to <quote>delete</quote> command to rtpproxy thus causing full call to be deleted. Useful for deleting unused rtpproxy call when 200 OK is received on a branch, where rtpproxy is not needed.
  538. </para></listitem>
  539. </itemizedlist>
  540. </listitem>
  541. </itemizedlist>
  542. <example>
  543. <title><function>rtpproxy_destroy</function> usage</title>
  544. <programlisting format="linespecific">
  545. ...
  546. rtpproxy_destroy();
  547. ...
  548. </programlisting>
  549. </example>
  550. </section>
  551. <section>
  552. <title>
  553. <function moreinfo="none">unforce_rtp_proxy()</function>
  554. </title>
  555. <para>
  556. Same as rtpproxy_destroy().
  557. </para>
  558. </section>
  559. <section>
  560. <title>
  561. <function moreinfo="none">rtpproxy_manage([flags [, ip_address]])</function>
  562. </title>
  563. <para>
  564. Manage the RTPProxy session - it combines the functionality of
  565. rtpproxy_offer(), rtpproxy_answer() and unforce_rtpproxy(), detecting
  566. internally based on message type and method which one to execute.
  567. </para>
  568. <para>
  569. It can take the same parameters as <function>rtpproxy_offer().</function>
  570. The flags parameter to rtpproxy_manage() can be a configuration variable
  571. containing the flags as a string.
  572. </para>
  573. <para>
  574. Functionality:
  575. </para>
  576. <itemizedlist>
  577. <listitem>
  578. <para>
  579. If INVITE with SDP, then do <function>rtpproxy_offer()</function>
  580. </para>
  581. </listitem>
  582. <listitem>
  583. <para>
  584. If INVITE with SDP, when the tm module is loaded, mark transaction with
  585. internal flag FL_SDP_BODY to know that the 1xx and 2xx are for
  586. <function>rtpproxy_answer()</function>
  587. </para>
  588. </listitem>
  589. <listitem>
  590. <para>
  591. If ACK with SDP, then do <function>rtpproxy_answer()</function>
  592. </para>
  593. </listitem>
  594. <listitem>
  595. <para>
  596. If BYE or CANCEL, or called within a FAILURE_ROUTE[], then do <function>unforce_rtpproxy()</function>
  597. </para>
  598. </listitem>
  599. <listitem>
  600. <para>
  601. If reply to INVITE with code >= 300 do <function>unforce_rtpproxy()</function>
  602. </para>
  603. </listitem>
  604. <listitem>
  605. <para>
  606. If reply with SDP to INVITE having code 1xx and 2xx, then
  607. do <function>rtpproxy_answer()</function> if the request had SDP or tm is not loaded,
  608. otherwise do <function>rtpproxy_offer()</function>
  609. </para>
  610. </listitem>
  611. </itemizedlist>
  612. <para>
  613. This function can be used from ANY_ROUTE.
  614. </para>
  615. <example>
  616. <title><function>rtpproxy_manage</function> usage</title>
  617. <programlisting format="linespecific">
  618. ...
  619. rtpproxy_manage();
  620. ...
  621. </programlisting>
  622. </example>
  623. </section>
  624. <section id="rtpproxy_stream2uac">
  625. <title>
  626. <function>rtpproxy_stream2uac(prompt_name, count)</function>,
  627. </title>
  628. <para>
  629. Instruct the RTPproxy to stream prompt/announcement pre-encoded with
  630. the makeann command from the RTPproxy distribution. The uac/uas
  631. suffix selects who will hear the announcement relatively to the current
  632. transaction - UAC or UAS. For example invoking the
  633. <function>rtpproxy_stream2uac</function> in the request processing
  634. block on ACK transaction will play the prompt to the UA that has
  635. generated original INVITE and ACK while
  636. <function>rtpproxy_stop_stream2uas</function> on 183 in reply
  637. processing block will play the prompt to the UA that has generated 183.
  638. </para>
  639. <para>
  640. Apart from generating announcements, another possible application
  641. of this function is implementing music on hold (MOH) functionality.
  642. When count is -1, the streaming will be in loop indefinitely until
  643. the appropriate <function>rtpproxy_stop_stream2xxx</function> is issued.
  644. </para>
  645. <para>
  646. In order to work correctly, these functions require that a session in the
  647. RTPproxy already exists. Also those functions don't alter the SDP, so that
  648. they are not a substitute for calling <function>rtpproxy_offer</function>
  649. or <function>rtpproxy_answer</function>.
  650. </para>
  651. <para>
  652. This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE.
  653. </para>
  654. <para>Meaning of the parameters is as follows:</para>
  655. <itemizedlist>
  656. <listitem>
  657. <para>
  658. <emphasis>prompt_name</emphasis> - name of the prompt to
  659. stream. Should be either absolute pathname or pathname
  660. relative to the directory where RTPproxy runs.
  661. </para>
  662. </listitem>
  663. <listitem>
  664. <para>
  665. <emphasis>count</emphasis> - number of times the prompt
  666. should be repeated. A value of -1 means that it will
  667. be streaming in a loop indefinitely, until the appropriate
  668. <function>rtpproxy_stop_stream2xxx</function> is issued.
  669. </para>
  670. </listitem>
  671. </itemizedlist>
  672. <example>
  673. <title><function>rtpproxy_stream2xxx</function> usage</title>
  674. <programlisting>
  675. ...
  676. if (is_method("INVITE")) {
  677. rtpproxy_offer();
  678. if (detect_hold()) {
  679. rtpproxy_stream2uas("/var/rtpproxy/prompts/music_on_hold", "-1");
  680. } else {
  681. rtpproxy_stop_stream2uas();
  682. };
  683. };
  684. ...
  685. </programlisting>
  686. </example>
  687. </section>
  688. <section id="rtpproxy_stream2uas">
  689. <title>
  690. <function>rtpproxy_stream2uas(prompt_name, count)</function>
  691. </title>
  692. <para>
  693. See function <function>rtpproxy_stream2uac(prompt_name, count)</function>.
  694. </para>
  695. </section>
  696. <section id="rtpproxy_stop_stream2uac">
  697. <title>
  698. <function>rtpproxy_stop_stream2uac()</function>,
  699. </title>
  700. <para>
  701. Stop streaming of announcement/prompt/MOH started previously by the
  702. respective <function>rtpproxy_stream2xxx</function>. The uac/uas
  703. suffix selects whose announcement relatively to tha current
  704. transaction should be stopped - UAC or UAS.
  705. </para>
  706. <para>
  707. These functions can be used from REQUEST_ROUTE, ONREPLY_ROUTE.
  708. </para>
  709. </section>
  710. <section>
  711. <title>
  712. <function moreinfo="none">start_recording()</function>
  713. </title>
  714. <para>
  715. This function will send a signal to the RTP-Proxy to record
  716. the RTP stream on the RTP-Proxy.
  717. <emphasis>This function is only supported by Sippy RTPproxy at the moment!</emphasis>
  718. </para>
  719. <para>
  720. This function can be used from REQUEST_ROUTE and ONREPLY_ROUTE.
  721. </para>
  722. <example>
  723. <title><function>start_recording</function> usage</title>
  724. <programlisting format="linespecific">
  725. ...
  726. start_recording();
  727. ...
  728. </programlisting>
  729. </example>
  730. </section>
  731. <section id="rtpproxy_stop_stream2uas">
  732. <title>
  733. <function>rtpproxy_stop_stream2uas(prompt_name, count)</function>
  734. </title>
  735. <para>
  736. See function <function>rtpproxy_stop_stream2uac(prompt_name, count)</function>.
  737. </para>
  738. </section>
  739. </section>
  740. <section>
  741. <title>Exported Pseudo Variables</title>
  742. <section>
  743. <title><function moreinfo="none">$rtpstat</function></title>
  744. <para>
  745. Returns the RTP-Statistics from the RTP-Proxy. The RTP-Statistics from the RTP-Proxy
  746. are provided as a string and it does contain several packet-counters. The statistics
  747. must be retrieved before the session is deleted (before <function>unforce_rtpproxy()</function>).
  748. </para>
  749. <example>
  750. <title>$rtpstat-Usage</title>
  751. <programlisting format="linespecific">
  752. ...
  753. append_hf("X-RTP-Statistics: $rtpstat\r\n");
  754. ...
  755. </programlisting>
  756. </example>
  757. </section>
  758. </section>
  759. <section>
  760. <title><acronym>MI</acronym> Commands</title>
  761. <section>
  762. <title><function moreinfo="none">nh_enable_rtpp</function></title>
  763. <para>
  764. Enables a rtp proxy if parameter value is greater than 0.
  765. Disables it if a zero value is given.
  766. </para>
  767. <para>
  768. The first parameter is the rtp proxy url (exactly as defined in
  769. the config file).
  770. </para>
  771. <para>
  772. The second parameter value must be a number in decimal.
  773. </para>
  774. <para>
  775. NOTE: if a rtpproxy is defined multiple times (in the same or
  776. diferente sete), all of its instances will be enables/disabled.
  777. </para>
  778. <example>
  779. <title>
  780. <function moreinfo="none">nh_enable_rtpp</function> usage</title>
  781. <programlisting format="linespecific">
  782. ...
  783. $ &ctltool; fifo nh_enable_rtpp udp:192.168.2.133:8081 0
  784. ...
  785. </programlisting>
  786. </example>
  787. </section>
  788. <section>
  789. <title><function moreinfo="none">nh_show_rtpp</function></title>
  790. <para>
  791. Displays all the rtp proxies and their information: set and
  792. status (disabled or not, weight and recheck_ticks).
  793. </para>
  794. <para>
  795. No parameter.
  796. </para>
  797. <example>
  798. <title>
  799. <function moreinfo="none">nh_show_rtpp</function> usage</title>
  800. <programlisting format="linespecific">
  801. ...
  802. $ &ctltool; fifo nh_show_rtpp
  803. ...
  804. </programlisting>
  805. </example>
  806. </section>
  807. </section>
  808. </chapter>