rtpproxy_admin.xml 29 KB

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