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