README 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  1. rtpproxy Module
  2. Maxim Sobolev
  3. Sippy Software, Inc.
  4. Juha Heinanen
  5. TuTPro, Inc.
  6. Edited by
  7. Maxim Sobolev
  8. Edited by
  9. Bogdan-Andrei Iancu
  10. Edited by
  11. Juha Heinanen
  12. Edited by
  13. Sas Ovidiu
  14. Edited by
  15. Carsten Bock
  16. ng-voice GmbH
  17. Copyright © 2003-2008 Sippy Software, Inc.
  18. Copyright © 2005 Voice Sistem SRL
  19. Copyright © 2009-2012 TuTPro Inc.
  20. Copyright © 2010 VoIPEmbedded Inc.
  21. _________________________________________________________________
  22. Table of Contents
  23. 1. Admin Guide
  24. 1. Overview
  25. 2. Multiple RTPProxy usage
  26. 3. Dependencies
  27. 3.1. Kamailio Modules
  28. 3.2. External Libraries or Applications
  29. 4. Parameters
  30. 4.1. rtpproxy_sock (string)
  31. 4.2. rtpproxy_disable_tout (integer)
  32. 4.3. rtpproxy_tout (integer)
  33. 4.4. rtpproxy_retr (integer)
  34. 4.5. nortpproxy_str (string)
  35. 4.6. timeout_socket (string)
  36. 4.7. ice_candidate_priority_avp (string)
  37. 4.8. extra_id_pv (string)
  38. 4.9. db_url (string)
  39. 4.10. table_name (string)
  40. 4.11. rtp_inst_pvar (string)
  41. 5. Functions
  42. 5.1. set_rtp_proxy_set(setid)
  43. 5.2. rtpproxy_offer([flags [, ip_address]])
  44. 5.3. rtpproxy_answer([flags [, ip_address]])
  45. 5.4. rtpproxy_destroy([flags])
  46. 5.5. unforce_rtp_proxy()
  47. 5.6. rtpproxy_manage([flags [, ip_address]])
  48. 5.7. rtpproxy_stream2uac(prompt_name, count),
  49. 5.8. rtpproxy_stream2uas(prompt_name, count)
  50. 5.9. rtpproxy_stop_stream2uac(),
  51. 5.10. start_recording()
  52. 5.11. rtpproxy_stop_stream2uas(prompt_name, count)
  53. 6. Exported Pseudo Variables
  54. 6.1. $rtpstat
  55. 7. MI Commands
  56. 7.1. nh_enable_rtpp
  57. 7.2. nh_show_rtpp
  58. 2. Frequently Asked Questions
  59. List of Examples
  60. 1.1. Set rtpproxy_sock parameter
  61. 1.2. Set rtpproxy_disable_tout parameter
  62. 1.3. Set rtpproxy_tout parameter
  63. 1.4. Set rtpproxy_retr parameter
  64. 1.5. Set nortpproxy_str parameter
  65. 1.6. Set timeout_socket parameter
  66. 1.7. Set ice_candidate_priority_avp parameter
  67. 1.8. Set extra_id_pv parameter
  68. 1.9. Set db_url parameter
  69. 1.10. Set table_name parameter
  70. 1.11. Set rtp_inst_pvar parameter
  71. 1.12. rtp_inst_pvar usage
  72. 1.13. set_rtp_proxy_set usage
  73. 1.14. rtpproxy_offer usage
  74. 1.15. rtpproxy_answer usage
  75. 1.16. rtpproxy_destroy usage
  76. 1.17. rtpproxy_manage usage
  77. 1.18. rtpproxy_stream2xxx usage
  78. 1.19. start_recording usage
  79. 1.20. $rtpstat-Usage
  80. 1.21. nh_enable_rtpp usage
  81. 1.22. nh_show_rtpp usage
  82. Chapter 1. Admin Guide
  83. Table of Contents
  84. 1. Overview
  85. 2. Multiple RTPProxy usage
  86. 3. Dependencies
  87. 3.1. Kamailio Modules
  88. 3.2. External Libraries or Applications
  89. 4. Parameters
  90. 4.1. rtpproxy_sock (string)
  91. 4.2. rtpproxy_disable_tout (integer)
  92. 4.3. rtpproxy_tout (integer)
  93. 4.4. rtpproxy_retr (integer)
  94. 4.5. nortpproxy_str (string)
  95. 4.6. timeout_socket (string)
  96. 4.7. ice_candidate_priority_avp (string)
  97. 4.8. extra_id_pv (string)
  98. 4.9. db_url (string)
  99. 4.10. table_name (string)
  100. 4.11. rtp_inst_pvar (string)
  101. 5. Functions
  102. 5.1. set_rtp_proxy_set(setid)
  103. 5.2. rtpproxy_offer([flags [, ip_address]])
  104. 5.3. rtpproxy_answer([flags [, ip_address]])
  105. 5.4. rtpproxy_destroy([flags])
  106. 5.5. unforce_rtp_proxy()
  107. 5.6. rtpproxy_manage([flags [, ip_address]])
  108. 5.7. rtpproxy_stream2uac(prompt_name, count),
  109. 5.8. rtpproxy_stream2uas(prompt_name, count)
  110. 5.9. rtpproxy_stop_stream2uac(),
  111. 5.10. start_recording()
  112. 5.11. rtpproxy_stop_stream2uas(prompt_name, count)
  113. 6. Exported Pseudo Variables
  114. 6.1. $rtpstat
  115. 7. MI Commands
  116. 7.1. nh_enable_rtpp
  117. 7.2. nh_show_rtpp
  118. 1. Overview
  119. This is a module that enables media streams to be proxied via an
  120. rtpproxy. Rtpproxies know to work with this module are Sippy RTPproxy
  121. http://www.rtpproxy.org and ngcp-rtpproxy-ng
  122. http://deb.sipwise.com/spce/2.6/pool/main/n/ngcp-mediaproxy-ng. Some
  123. features of the rtpproxy module apply only to one of the two
  124. rtpproxies.
  125. 2. Multiple RTPProxy usage
  126. The rtpproxy module can support multiple rtpproxies for
  127. balancing/distribution and control/selection purposes.
  128. The module allows definition of several sets of rtpproxies.
  129. Load-balancing will be performed over a set and the admin has the
  130. ability to choose what set should be used. The set is selected via its
  131. id - the id being defined with the set. Refer to the "rtpproxy_sock"
  132. module parameter definition for syntax description.
  133. The balancing inside a set is done automatically by the module based
  134. on the weight of each rtpproxy from the set.
  135. The selection of the set is done from script prior using
  136. unforce_rtp_proxy(), rtpproxy_offer() or rtpproxy_answer() functions -
  137. see the set_rtp_proxy_set() function.
  138. For backward compatibility reasons, a set with no id take by default
  139. the id 0. Also if no set is explicitly set before unforce_rtp_proxy(),
  140. rtpproxy_offer() or rtpproxy_answer() the 0 id set will be used.
  141. IMPORTANT: if you use multiple sets, take care and use the same set
  142. for both rtpproxy_offer()/rtpproxy_answer() and unforce_rtpproxy()!!
  143. 3. Dependencies
  144. 3.1. Kamailio Modules
  145. 3.2. External Libraries or Applications
  146. 3.1. Kamailio Modules
  147. The following modules must be loaded before this module:
  148. * tm module - (optional) if you want to have rtpproxy_manage() fully
  149. functional
  150. 3.2. External Libraries or Applications
  151. The following libraries or applications must be installed before
  152. running Kamailio with this module loaded:
  153. * None.
  154. 4. Parameters
  155. 4.1. rtpproxy_sock (string)
  156. 4.2. rtpproxy_disable_tout (integer)
  157. 4.3. rtpproxy_tout (integer)
  158. 4.4. rtpproxy_retr (integer)
  159. 4.5. nortpproxy_str (string)
  160. 4.6. timeout_socket (string)
  161. 4.7. ice_candidate_priority_avp (string)
  162. 4.8. extra_id_pv (string)
  163. 4.9. db_url (string)
  164. 4.10. table_name (string)
  165. 4.11. rtp_inst_pvar (string)
  166. 4.1. rtpproxy_sock (string)
  167. Used to define the list of RTPPRoxy instances to connect to. These can
  168. be UNIX sockets or IPv4/IPv6 UDP sockets. Each modparam entry will
  169. insert sockets into a single set. If no set ID is given, the default
  170. set ID '0' will be used. To define multiple sets add the set number at
  171. the beginning of each parameter followed by '=='. Sockets can be
  172. weighted by adding '=#' to a socket where # is an integer. A socket
  173. with a weight of 2 will be chosen twice as often as one with a weight
  174. of 1.
  175. Default value is "NONE" (disabled).
  176. Example 1.1. Set rtpproxy_sock parameter
  177. ...
  178. # single rtproxy
  179. modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:12221")
  180. # multiple rtproxies for LB
  181. modparam("rtpproxy", "rtpproxy_sock",
  182. "udp:localhost:12221 udp:localhost:12222")
  183. # multiple sets of multiple rtproxies
  184. modparam("rtpproxy", "rtpproxy_sock",
  185. "1 == udp:localhost:12221 udp:localhost:12222")
  186. modparam("rtpproxy", "rtpproxy_sock",
  187. "2 == udp:localhost:12225")
  188. ...
  189. 4.2. rtpproxy_disable_tout (integer)
  190. Once RTPProxy was found unreachable and marked as disabled, the
  191. rtpproxy module will not attempt to establish communication to
  192. RTPProxy for rtpproxy_disable_tout seconds.
  193. Default value is "60".
  194. Example 1.2. Set rtpproxy_disable_tout parameter
  195. ...
  196. modparam("rtpproxy", "rtpproxy_disable_tout", 20)
  197. ...
  198. 4.3. rtpproxy_tout (integer)
  199. Timeout value in waiting for reply from RTPProxy.
  200. Default value is "1".
  201. Example 1.3. Set rtpproxy_tout parameter
  202. ...
  203. modparam("rtpproxy", "rtpproxy_tout", 2)
  204. ...
  205. 4.4. rtpproxy_retr (integer)
  206. How many times the module should retry to send and receive after
  207. timeout was generated.
  208. Default value is "5".
  209. Example 1.4. Set rtpproxy_retr parameter
  210. ...
  211. modparam("rtpproxy", "rtpproxy_retr", 2)
  212. ...
  213. 4.5. nortpproxy_str (string)
  214. This parameter sets the SDP attribute used by rtpproxy to mark the
  215. message's SDP attachemnt with information that it have already been
  216. changed.
  217. If empty string, no marker will be added or checked.
  218. Note
  219. The string must be a complete SDP line, including the EOH (\r\n).
  220. Default value is "a=nortpproxy:yes\r\n".
  221. Example 1.5. Set nortpproxy_str parameter
  222. ...
  223. modparam("rtpproxy", "nortpproxy_str", "a=sdpmangled:yes\r\n")
  224. ...
  225. 4.6. timeout_socket (string)
  226. The parameter sets the RTP timeout socket, which is transmitted to the
  227. RTP-Proxy. It will be used by the RTP proxy to signal back that a
  228. media stream timed out.
  229. If it is an empty string, no timeout socket will be transmitted to the
  230. RTP-Proxy.
  231. Default value is "" (nothing).
  232. Example 1.6. Set timeout_socket parameter
  233. ...
  234. modparam("rtpproxy", "timeout_socket", "xmlrpc:http://127.0.0.1:8000/RPC2")
  235. ...
  236. 4.7. ice_candidate_priority_avp (string)
  237. If specified and if value of the avp value is not 0, rtpproxy_manage
  238. function adds ICE relay candidate attributes to sdp stream(s)
  239. containing ICE candidate attributes.
  240. If value of the avp is 1, added candidates have high priority. If
  241. value of the avp is 2 (default), added candidates have low priority.
  242. There is no default value meaning that no ICE relay candidates are
  243. added in any circumstance.
  244. Example 1.7. Set ice_candidate_priority_avp parameter
  245. ...
  246. modparam("rtpproxy", "ice_candidate_priority_avp", "$avp(ice_priority)")
  247. ...
  248. 4.8. extra_id_pv (string)
  249. The parameter sets the PV defination to use when the "b" parameter is
  250. used on unforce_rtp_proxy(), rtpproxy_offer(), rtpproxy_answer() or
  251. rtpproxy_manage() command.
  252. Default is empty, the "b" parameter may not be used then.
  253. Example 1.8. Set extra_id_pv parameter
  254. ...
  255. modparam("rtpproxy", "extra_id_pv", "$avp(extra_id)")
  256. ...
  257. 4.9. db_url (string)
  258. The database URL to load rtp_proxy sets from. If this parameter is
  259. set, the module will attempt to load the rtpproxy sets from the
  260. specified database and will ignore any 'rtpproxy_sock' modparams.
  261. Default is empty, a database will not be used.
  262. Example 1.9. Set db_url parameter
  263. ...
  264. modparam("rtpproxy", "db_url", "mysql://user:passwb@localhost/database")
  265. ...
  266. 4.10. table_name (string)
  267. The name of the table containing the rtpproxy sets.
  268. Default value is "rtpproxy".
  269. Example 1.10. Set table_name parameter
  270. ...
  271. modparam("rtpproxy", "table_name", "my_rtpp_sets")
  272. ...
  273. 4.11. rtp_inst_pvar (string)
  274. A pseudo variable to store the chosen RTPProxy address. If this
  275. parameter is set, the instance URL will be stored in the given
  276. variable.
  277. By default, this parameter is not set.
  278. Example 1.11. Set rtp_inst_pvar parameter
  279. ...
  280. modparam("rtpproxy", "rtp_inst_pvar", "$avp(RTP_INSTANCE)")
  281. ...
  282. Example 1.12. rtp_inst_pvar usage
  283. modparam("rtpproxy", "rtpproxy_sock",
  284. "udp:localhost:12221 udp:localhost:12222")
  285. modparam("rtpproxy", "rtp_inst_pvar", "$var(RTP_INSTANCE)")
  286. ...
  287. rtpproxy_manage("eiro");
  288. xlog("L_INFO", "Chose rtpp instance $var(RTP_INSTANCE)\n");
  289. # This will display 'udp:localhost:12222'
  290. ...
  291. 5. Functions
  292. 5.1. set_rtp_proxy_set(setid)
  293. 5.2. rtpproxy_offer([flags [, ip_address]])
  294. 5.3. rtpproxy_answer([flags [, ip_address]])
  295. 5.4. rtpproxy_destroy([flags])
  296. 5.5. unforce_rtp_proxy()
  297. 5.6. rtpproxy_manage([flags [, ip_address]])
  298. 5.7. rtpproxy_stream2uac(prompt_name, count),
  299. 5.8. rtpproxy_stream2uas(prompt_name, count)
  300. 5.9. rtpproxy_stop_stream2uac(),
  301. 5.10. start_recording()
  302. 5.11. rtpproxy_stop_stream2uas(prompt_name, count)
  303. 5.1. set_rtp_proxy_set(setid)
  304. Sets the Id of the rtpproxy set to be used for the next
  305. unforce_rtp_proxy(), rtpproxy_offer(), rtpproxy_answer() or
  306. rtpproxy_manage() command. The parameter can be an integer or a config
  307. variable holding an integer.
  308. This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
  309. BRANCH_ROUTE.
  310. Example 1.13. set_rtp_proxy_set usage
  311. ...
  312. set_rtp_proxy_set("2");
  313. rtpproxy_offer();
  314. ...
  315. 5.2. rtpproxy_offer([flags [, ip_address]])
  316. Rewrites SDP body to ensure that media is passed through an RTP proxy.
  317. To be invoked on INVITE for the cases the SDPs are in INVITE and 200
  318. OK and on 200 OK when SDPs are in 200 OK and ACK.
  319. Meaning of the parameters is as follows:
  320. * flags - flags to turn on some features.
  321. + 1 - append first Via branch to Call-ID when sending command
  322. to rtpproxy. This can be used to create one media session per
  323. branch on the rtpproxy. When sending a subsequent "delete"
  324. command to the rtpproxy, you can then stop just the session
  325. for a specific branch when passing the flag '1' or '2' in the
  326. "unforce_rtpproxy", or stop all sessions for a call when not
  327. passing one of those two flags there. This is especially
  328. useful if you have serially forked call scenarios where
  329. rtpproxy gets an "update" command for a new branch, and then
  330. a "delete" command for the previous branch, which would
  331. otherwise delete the full call, breaking the subsequent
  332. "lookup" for the new branch. This flag is only supported by
  333. the ngcp-mediaproxy-ng rtpproxy at the moment!
  334. + 2 - append second Via branch to Call-ID when sending command
  335. to rtpproxy. See flag '1' for its meaning.
  336. + 3 - behave like flag 1 is set for a request and like flag 2
  337. is set for a reply.
  338. + a - flags that UA from which message is received doesn't
  339. support symmetric RTP. (automatically sets the 'r' flag)
  340. + b - append branch specific variable to Call-ID when sending
  341. command to rtpproxy. This creates one rtpproxy session per
  342. unique variable. Works similar to the 1, 2 and 3 parameter,
  343. but is usefull when forking to multiple destinations on
  344. different address families or network segments, requiring
  345. different rtpproxy parameters. The variable value is taken
  346. from the "extra_id_pv". When used, it must be used in every
  347. call to rtpproxy_manage(), rtpproxy_offer(),
  348. rtpproxy_answer() and rtpproxy_destroy() with the same
  349. contents of the PV. The b parameter may not be used in
  350. conjunction with the 1, 2 or 3 parameter to use the Via
  351. branch in the Call-ID.
  352. + l - force "lookup", that is, only rewrite SDP when
  353. corresponding session already exists in the RTP proxy. By
  354. default is on when the session is to be completed.
  355. + i, e - these flags specify the direction of the SIP message.
  356. These flags only make sense when rtpproxy is running in
  357. bridge mode. 'i' means internal network (LAN), 'e' means
  358. external network (WAN). 'i' corresponds to rtpproxy's first
  359. interface, 'e' corresponds to rtpproxy's second interface.
  360. You always have to specify two flags to define the incoming
  361. network and the outgoing network. For example, 'ie' should be
  362. used for SIP message received from the local interface and
  363. sent out on the external interface, and 'ei' vice versa.
  364. Other options are 'ii' and 'ee'. So, for example if a SIP
  365. requests is processed with 'ie' flags, the corresponding
  366. response must be processed with 'ie' flags.
  367. Note: As rtpproxy in bridge mode s per default asymmetric,
  368. you have to specify the 'w' flag for clients behind NAT! See
  369. also above notes!
  370. + x - this flag a shortcut for using the "ie" or "ei"-flags of
  371. RTP-Proxy, in order to do automatic bridging between IPv4 on
  372. the "internal network" and IPv6 on the "external network".
  373. The distinction is done by the given IP in the SDP, e.g. a
  374. IPv4 Address will always call "ie" to the RTPProxy (IPv4(i)
  375. to IPv6(e)) and an IPv6Address will always call "ei" to the
  376. RTPProxy (IPv6(e) to IPv4(i)).
  377. Note: Please note, that this will only work properly with
  378. non-dual-stack user-agents or with dual-stack clients
  379. according to RFC6157 (which suggest ICE for Dual-Stack
  380. implementations). This short-cut will not work properly with
  381. RFC4091 (ANAT) compatible clients, which suggests having
  382. different m-lines with different IP-protocols grouped
  383. together.
  384. + f - instructs rtpproxy to ignore marks inserted by another
  385. rtpproxy in transit to indicate that the session is already
  386. goes through another proxy. Allows creating a chain of
  387. proxies.
  388. + r - flags that IP address in SDP should be trusted. Without
  389. this flag, rtpproxy ignores address in the SDP and uses
  390. source address of the SIP message as media address which is
  391. passed to the RTP proxy.
  392. + o - flags that IP from the origin description (o=) should be
  393. also changed.
  394. + c - flags to change the session-level SDP connection (c=) IP
  395. if media-description also includes connection information.
  396. + w - flags that for the UA from which message is received,
  397. support symmetric RTP must be forced.
  398. + zNN - requests the RTPproxy to perform re-packetization of
  399. RTP traffic coming from the UA which has sent the current
  400. message to increase or decrease payload size per each RTP
  401. packet forwarded if possible. The NN is the target payload
  402. size in ms, for the most codecs its value should be in 10ms
  403. increments, however for some codecs the increment could
  404. differ (e.g. 30ms for GSM or 20ms for G.723). The RTPproxy
  405. would select the closest value supported by the codec. This
  406. feature could be used for significantly reducing bandwith
  407. overhead for low bitrate codecs, for example with G.729 going
  408. from 10ms to 100ms saves two thirds of the network bandwith.
  409. * ip_address - new SDP IP address.
  410. This function can be used from ANY_ROUTE.
  411. Example 1.14. rtpproxy_offer usage
  412. route {
  413. ...
  414. if (is_method("INVITE")) {
  415. if (has_body("application/sdp")) {
  416. if (rtpproxy_offer())
  417. t_on_reply("1");
  418. } else {
  419. t_on_reply("2");
  420. }
  421. }
  422. if (is_method("ACK") && has_body("application/sdp"))
  423. rtpproxy_answer();
  424. ...
  425. }
  426. onreply_route[1]
  427. {
  428. ...
  429. if (has_body("application/sdp"))
  430. rtpproxy_answer();
  431. ...
  432. }
  433. onreply_route[2]
  434. {
  435. ...
  436. if (has_body("application/sdp"))
  437. rtpproxy_offer();
  438. ...
  439. }
  440. 5.3. rtpproxy_answer([flags [, ip_address]])
  441. Rewrites SDP body to ensure that media is passed through an RTP proxy.
  442. To be invoked on 200 OK for the cases the SDPs are in INVITE and 200
  443. OK and on ACK when SDPs are in 200 OK and ACK.
  444. See rtpproxy_answer() function description above for the meaning of
  445. the parameters.
  446. This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
  447. FAILURE_ROUTE, BRANCH_ROUTE.
  448. Example 1.15. rtpproxy_answer usage
  449. See rtpproxy_offer() function example above for example.
  450. 5.4. rtpproxy_destroy([flags])
  451. Tears down the RTPProxy session for the current call.
  452. This function can be used from ANY_ROUTE.
  453. Meaning of the parameters is as follows:
  454. * flags - flags to turn on some features.
  455. + 1 - append first Via branch to Call-ID when sending command
  456. to rtpproxy. This can be used to create one media session per
  457. branch on the rtpproxy. When sending a subsequent "delete"
  458. command to the rtpproxy, you can then stop just the session
  459. for a specific branch when passing the flag '1' or '2' in the
  460. "unforce_rtpproxy", or stop all sessions for a call when not
  461. passing one of those two flags there. This is especially
  462. useful if you have serially forked call scenarios where
  463. rtpproxy gets an "update" command for a new branch, and then
  464. a "delete" command for the previous branch, which would
  465. otherwise delete the full call, breaking the subsequent
  466. "lookup" for the new branch. This flag is only supported by
  467. the ngcp-mediaproxy-ng rtpproxy at the moment!
  468. + 2 - append second Via branch to Call-ID when sending command
  469. to rtpproxy. See flag '1' for its meaning.
  470. + b - append branch specific variable to Call-ID when sending
  471. command to rtpproxy. See rtpproxy_offer() for details.
  472. <listitem>
  473. </listitem>
  474. t - do not include To tag to "delete" command to rtpproxy
  475. thus causing full call to be deleted. Useful for deleting
  476. unused rtpproxy call when 200 OK is received on a branch,
  477. where rtpproxy is not needed.
  478. Example 1.16. rtpproxy_destroy usage
  479. ...
  480. rtpproxy_destroy();
  481. ...
  482. 5.5. unforce_rtp_proxy()
  483. Same as rtpproxy_destroy().
  484. 5.6. rtpproxy_manage([flags [, ip_address]])
  485. Manage the RTPProxy session - it combines the functionality of
  486. rtpproxy_offer(), rtpproxy_answer() and unforce_rtpproxy(), detecting
  487. internally based on message type and method which one to execute.
  488. It can take the same parameters as rtpproxy_offer(). The flags
  489. parameter to rtpproxy_manage() can be a configuration variable
  490. containing the flags as a string.
  491. Functionality:
  492. * If INVITE with SDP, then do rtpproxy_offer()
  493. * If INVITE with SDP, when the tm module is loaded, mark transaction
  494. with internal flag FL_SDP_BODY to know that the 1xx and 2xx are
  495. for rtpproxy_answer()
  496. * If ACK with SDP, then do rtpproxy_answer()
  497. * If BYE or CANCEL, or called within a FAILURE_ROUTE[], then do
  498. unforce_rtpproxy()
  499. * If reply to INVITE with code >= 300 do unforce_rtpproxy()
  500. * If reply with SDP to INVITE having code 1xx and 2xx, then do
  501. rtpproxy_answer() if the request had SDP or tm is not loaded,
  502. otherwise do rtpproxy_offer()
  503. This function can be used from ANY_ROUTE.
  504. Example 1.17. rtpproxy_manage usage
  505. ...
  506. rtpproxy_manage();
  507. ...
  508. 5.7. rtpproxy_stream2uac(prompt_name, count),
  509. Instruct the RTPproxy to stream prompt/announcement pre-encoded with
  510. the makeann command from the RTPproxy distribution. The uac/uas suffix
  511. selects who will hear the announcement relatively to the current
  512. transaction - UAC or UAS. For example invoking the rtpproxy_stream2uac
  513. in the request processing block on ACK transaction will play the
  514. prompt to the UA that has generated original INVITE and ACK while
  515. rtpproxy_stop_stream2uas on 183 in reply processing block will play
  516. the prompt to the UA that has generated 183.
  517. Apart from generating announcements, another possible application of
  518. this function is implementing music on hold (MOH) functionality. When
  519. count is -1, the streaming will be in loop indefinitely until the
  520. appropriate rtpproxy_stop_stream2xxx is issued.
  521. In order to work correctly, these functions require that a session in
  522. the RTPproxy already exists. Also those functions don't alter the SDP,
  523. so that they are not a substitute for calling rtpproxy_offer or
  524. rtpproxy_answer.
  525. This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE.
  526. Meaning of the parameters is as follows:
  527. * prompt_name - name of the prompt to stream. Should be either
  528. absolute pathname or pathname relative to the directory where
  529. RTPproxy runs.
  530. * count - number of times the prompt should be repeated. A value of
  531. -1 means that it will be streaming in a loop indefinitely, until
  532. the appropriate rtpproxy_stop_stream2xxx is issued.
  533. Example 1.18. rtpproxy_stream2xxx usage
  534. ...
  535. if (is_method("INVITE")) {
  536. rtpproxy_offer();
  537. if (detect_hold()) {
  538. rtpproxy_stream2uas("/var/rtpproxy/prompts/music_on_hold", "-1");
  539. } else {
  540. rtpproxy_stop_stream2uas();
  541. };
  542. };
  543. ...
  544. 5.8. rtpproxy_stream2uas(prompt_name, count)
  545. See function rtpproxy_stream2uac(prompt_name, count).
  546. 5.9. rtpproxy_stop_stream2uac(),
  547. Stop streaming of announcement/prompt/MOH started previously by the
  548. respective rtpproxy_stream2xxx. The uac/uas suffix selects whose
  549. announcement relatively to tha current transaction should be stopped -
  550. UAC or UAS.
  551. These functions can be used from REQUEST_ROUTE, ONREPLY_ROUTE.
  552. 5.10. start_recording()
  553. This function will send a signal to the RTP-Proxy to record the RTP
  554. stream on the RTP-Proxy. This function is only supported by Sippy
  555. RTPproxy at the moment!
  556. This function can be used from REQUEST_ROUTE and ONREPLY_ROUTE.
  557. Example 1.19. start_recording usage
  558. ...
  559. start_recording();
  560. ...
  561. 5.11. rtpproxy_stop_stream2uas(prompt_name, count)
  562. See function rtpproxy_stop_stream2uac(prompt_name, count).
  563. 6. Exported Pseudo Variables
  564. 6.1. $rtpstat
  565. 6.1. $rtpstat
  566. Returns the RTP-Statistics from the RTP-Proxy. The RTP-Statistics from
  567. the RTP-Proxy are provided as a string and it does contain several
  568. packet-counters. The statistics must be retrieved before the session
  569. is deleted (before unforce_rtpproxy()).
  570. Example 1.20. $rtpstat-Usage
  571. ...
  572. append_hf("X-RTP-Statistics: $rtpstat\r\n");
  573. ...
  574. 7. MI Commands
  575. 7.1. nh_enable_rtpp
  576. 7.2. nh_show_rtpp
  577. 7.1. nh_enable_rtpp
  578. Enables a rtp proxy if parameter value is greater than 0. Disables it
  579. if a zero value is given.
  580. The first parameter is the rtp proxy url (exactly as defined in the
  581. config file).
  582. The second parameter value must be a number in decimal.
  583. NOTE: if a rtpproxy is defined multiple times (in the same or
  584. different sets), all of its instances will be enabled/disabled.
  585. Example 1.21. nh_enable_rtpp usage
  586. ...
  587. $ kamctl fifo nh_enable_rtpp udp:192.168.2.133:8081 0
  588. ...
  589. 7.2. nh_show_rtpp
  590. Displays all the rtp proxies and their information: set and status
  591. (disabled or not, weight and recheck_ticks).
  592. No parameter.
  593. Example 1.22. nh_show_rtpp usage
  594. ...
  595. $ kamctl fifo nh_show_rtpp
  596. ...
  597. Chapter 2. Frequently Asked Questions
  598. 2.1. What happend with "rtpproxy_disable" parameter?
  599. 2.2. Where can I find more about Kamailio?
  600. 2.3. Where can I post a question about this module?
  601. 2.4. How can I report a bug?
  602. 2.1.
  603. What happend with "rtpproxy_disable" parameter?
  604. It was removed as it became obsolete - now "rtpproxy_sock" can take
  605. empty value to disable the rtpproxy functionality.
  606. 2.2.
  607. Where can I find more about Kamailio?
  608. Take a look at http://www.kamailio.org/.
  609. 2.3.
  610. Where can I post a question about this module?
  611. First at all check if your question was already answered on one of our
  612. mailing lists:
  613. * User Mailing List -
  614. http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
  615. * Developer Mailing List -
  616. http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
  617. E-mails regarding any stable Kamailio release should be sent to
  618. <[email protected]> and e-mails regarding development
  619. versions should be sent to <[email protected]>.
  620. If you want to keep the mail private, send it to
  621. <[email protected]>.
  622. 2.4.
  623. How can I report a bug?
  624. Please follow the guidelines provided at:
  625. http://sip-router.org/tracker.