| 1 |
rtp_media_server Module |
| 2 |
|
| 3 |
Julien Chavanton |
| 4 |
|
| 5 |
<[email protected]> |
| 6 |
|
| 7 |
Julien Chavanton |
| 8 |
|
| 9 |
flowroute.com |
| 10 |
<[email protected]> |
| 11 |
|
| 12 |
Edited by |
| 13 |
|
| 14 |
Julien Chavanton |
| 15 |
|
| 16 |
flowroute.com |
| 17 |
<[email protected]> |
| 18 |
|
| 19 |
Copyright © 2017-2019 Flowroute.com |
| 20 |
__________________________________________________________________ |
| 21 |
|
| 22 |
Table of Contents |
| 23 |
|
| 24 |
1. Admin Guide |
| 25 |
|
| 26 |
1. Overview |
| 27 |
2. Quick start, how-to build on debian |
| 28 |
|
| 29 |
2.1. Building on Debian, Dockerfile and docker image |
| 30 |
|
| 31 |
3. Dependencies |
| 32 |
|
| 33 |
3.1. Kamailio Modules |
| 34 |
3.2. External Libraries or Applications |
| 35 |
|
| 36 |
4. Parameters |
| 37 |
|
| 38 |
4.1. log_file_name (string) |
| 39 |
|
| 40 |
5. Functions |
| 41 |
|
| 42 |
5.1. rms_answer (event_route) |
| 43 |
5.2. rms_hangup () |
| 44 |
5.3. rms_bridge (target URI, event_route) |
| 45 |
5.4. rms_dialog_check () |
| 46 |
5.5. rms_sip_request () |
| 47 |
5.6. rms_play (file, event_route) |
| 48 |
|
| 49 |
List of Examples |
| 50 |
|
| 51 |
1.1. log_file_name example |
| 52 |
1.2. rms_answer usage example |
| 53 |
1.3. rms_hangup usage example |
| 54 |
1.4. rms_bridge usage example |
| 55 |
1.5. rms_dialog_check usage example |
| 56 |
1.6. rms_sip_request usage example |
| 57 |
1.7. rms_play usage example |
| 58 |
|
| 59 |
Chapter 1. Admin Guide |
| 60 |
|
| 61 |
Table of Contents |
| 62 |
|
| 63 |
1. Overview |
| 64 |
2. Quick start, how-to build on debian |
| 65 |
|
| 66 |
2.1. Building on Debian, Dockerfile and docker image |
| 67 |
|
| 68 |
3. Dependencies |
| 69 |
|
| 70 |
3.1. Kamailio Modules |
| 71 |
3.2. External Libraries or Applications |
| 72 |
|
| 73 |
4. Parameters |
| 74 |
|
| 75 |
4.1. log_file_name (string) |
| 76 |
|
| 77 |
5. Functions |
| 78 |
|
| 79 |
5.1. rms_answer (event_route) |
| 80 |
5.2. rms_hangup () |
| 81 |
5.3. rms_bridge (target URI, event_route) |
| 82 |
5.4. rms_dialog_check () |
| 83 |
5.5. rms_sip_request () |
| 84 |
5.6. rms_play (file, event_route) |
| 85 |
|
| 86 |
1. Overview |
| 87 |
|
| 88 |
rtp_media_server module adds RTP and media processing functionalities |
| 89 |
to Kamailio. Kamailio is providing SIP signaling including an endpoint |
| 90 |
with Dialog state, SDP parsing and scripting language. |
| 91 |
|
| 92 |
oRTP: is providing Real-time Transport Protocol (RFC 3550) |
| 93 |
|
| 94 |
mediastreamer2: is providing mediaprocessing functionnalities using |
| 95 |
graphs and filters, many modules are available to support various |
| 96 |
features, it should be relatively simple to integrated them. |
| 97 |
|
| 98 |
mediastreamer2 is also providing a framework to create custom |
| 99 |
mediaprocessing modules. |
| 100 |
|
| 101 |
2. Quick start, how-to build on debian |
| 102 |
|
| 103 |
2.1. Building on Debian, Dockerfile and docker image |
| 104 |
|
| 105 |
2.1. Building on Debian, Dockerfile and docker image |
| 106 |
|
| 107 |
The module includes Dockerfile that can also be used as a reference on |
| 108 |
how to build everything from source on Debian, the package of |
| 109 |
libmediastreamer on Linux is usually outdated. A Docker image is also |
| 110 |
available from dockerhub |
| 111 |
https://hub.docker.com/r/jchavanton/rtp_media_server |
| 112 |
|
| 113 |
3. Dependencies |
| 114 |
|
| 115 |
3.1. Kamailio Modules |
| 116 |
3.2. External Libraries or Applications |
| 117 |
|
| 118 |
3.1. Kamailio Modules |
| 119 |
|
| 120 |
The module depends on the following modules (in other words the listed |
| 121 |
modules must be loaded before this module): |
| 122 |
* tm - transaction module |
| 123 |
|
| 124 |
3.2. External Libraries or Applications |
| 125 |
|
| 126 |
The following libraries or applications must be installed before |
| 127 |
running Kamailio with this module loaded: |
| 128 |
|
| 129 |
If you want to build oRTP and mediastreamer from source, you can use |
| 130 |
the provided script for Debian "install_bc.sh". |
| 131 |
* oRTP git clone git://git.linphone.org/ortp.git |
| 132 |
oRTP is a library implementing Real-time Transport Protocol (RFC |
| 133 |
3550), distributed under GNU GPLv2 or proprietary license. |
| 134 |
* mediastreamer2 git clone git://git.linphone.org/mediastreamer2.git |
| 135 |
Mediastreamer2 is a powerful and lightweight streaming engine |
| 136 |
specialized for voice/video telephony applications. |
| 137 |
* bcunit git clone |
| 138 |
https://github.com/BelledonneCommunications/bcunit.git |
| 139 |
fork of the defunct project CUnit, with several fixes and patches |
| 140 |
applied. CUnit is a Unit testing framework for C. |
| 141 |
|
| 142 |
4. Parameters |
| 143 |
|
| 144 |
4.1. log_file_name (string) |
| 145 |
|
| 146 |
4.1. log_file_name (string) |
| 147 |
|
| 148 |
oRTP and MediaStreamer2 log file settings the log mask is not |
| 149 |
configurable : MESSAGE | WARNING | ERROR | FATAL levels are activated. |
| 150 |
|
| 151 |
Default value is not-set (no logging to file). |
| 152 |
|
| 153 |
Example 1.1. log_file_name example |
| 154 |
... |
| 155 |
modparam("rtp_media_server", "log_file_name", "/var/log/rms/rms_ortp.log") |
| 156 |
... |
| 157 |
|
| 158 |
5. Functions |
| 159 |
|
| 160 |
5.1. rms_answer (event_route) |
| 161 |
5.2. rms_hangup () |
| 162 |
5.3. rms_bridge (target URI, event_route) |
| 163 |
5.4. rms_dialog_check () |
| 164 |
5.5. rms_sip_request () |
| 165 |
5.6. rms_play (file, event_route) |
| 166 |
|
| 167 |
5.1. rms_answer (event_route) |
| 168 |
|
| 169 |
Create a call leg with a SIP dialog and an RTP session call the |
| 170 |
event_route |
| 171 |
|
| 172 |
This function can be used from REQUEST_ROUTE, REPLY_ROUTE and |
| 173 |
FAILURE_ROUTE. |
| 174 |
|
| 175 |
Example 1.2. rms_answer usage example |
| 176 |
... |
| 177 |
event_route[rms:start] { |
| 178 |
xnotice("[rms:start] play ...\n"); |
| 179 |
rms_play("/tmp/reference_8000.wav", "rms:after_play"); |
| 180 |
}; |
| 181 |
|
| 182 |
event_route[rms:after_play] { |
| 183 |
xnotice("[rms:after_play] play done...\n"); |
| 184 |
rms_hangup(); |
| 185 |
}; |
| 186 |
|
| 187 |
route { |
| 188 |
if (t_precheck_trans()) { |
| 189 |
t_check_trans(); |
| 190 |
exit; |
| 191 |
} |
| 192 |
t_check_trans(); |
| 193 |
if (is_method("INVITE") && !has_totag()) { |
| 194 |
if (!rms_answer("rms:start")) { |
| 195 |
t_reply("503", "server error"); |
| 196 |
} |
| 197 |
} |
| 198 |
rms_sip_request(); |
| 199 |
... |
| 200 |
|
| 201 |
5.2. rms_hangup () |
| 202 |
|
| 203 |
Send a BYE, delete the RTP session and the media resources. |
| 204 |
|
| 205 |
This function can be used from EVENT_ROUTE. |
| 206 |
|
| 207 |
Example 1.3. rms_hangup usage example |
| 208 |
... |
| 209 |
rms_hangup(); |
| 210 |
... |
| 211 |
|
| 212 |
5.3. rms_bridge (target URI, event_route) |
| 213 |
|
| 214 |
Bridge the incoming call, create a second call leg using a UAC in a |
| 215 |
B2BUA manner, this is needed in case we want to un-bridge later, a |
| 216 |
feature not currently implemented Call the specified event_route, |
| 217 |
defaulting to [rms:bridge]. |
| 218 |
|
| 219 |
This function can be used from REQUEST_ROUTE. |
| 220 |
|
| 221 |
Example 1.4. rms_bridge usage example |
| 222 |
... |
| 223 |
event_route[rms:bridged] { |
| 224 |
xnotice("[rms:bridged] !\n"); |
| 225 |
}; |
| 226 |
|
| 227 |
route { |
| 228 |
if (t_precheck_trans()) { |
| 229 |
t_check_trans(); |
| 230 |
exit; |
| 231 |
} |
| 232 |
t_check_trans(); |
| 233 |
if (is_method("INVITE") && !has_totag()) { |
| 234 |
$var(target) = "sip:" + $rU + "@mydomain.com:5060;"; |
| 235 |
if (!rms_bridge("$var(target)", "rms:bridged")) { |
| 236 |
t_reply("503", "server error"); |
| 237 |
} |
| 238 |
} |
| 239 |
if(rms_dialog_check()) // If the dialog is managed by the RMS module, th |
| 240 |
e in-dialog request needs to be handled by it. |
| 241 |
rms_sip_request(); |
| 242 |
... |
| 243 |
|
| 244 |
5.4. rms_dialog_check () |
| 245 |
|
| 246 |
Returns true if the current SIP message it handled/known by the RMS |
| 247 |
module, else it may be handled in any other way by Kamailio. |
| 248 |
|
| 249 |
This function can be used from REQUEST_ROUTE, REPLY_ROUTE and |
| 250 |
FAILURE_ROUTE. |
| 251 |
|
| 252 |
Example 1.5. rms_dialog_check usage example |
| 253 |
... |
| 254 |
if (rms_dialog_check()) { |
| 255 |
xnotice("This dialog is handled by the RMS module\n"); |
| 256 |
rms_sip_request(); |
| 257 |
} |
| 258 |
... |
| 259 |
|
| 260 |
5.5. rms_sip_request () |
| 261 |
|
| 262 |
This should be called for every in-dialog SIP request, it will be |
| 263 |
forwarded behaving as a B2BUA, the transaction will be suspended until |
| 264 |
the second leg replies. |
| 265 |
|
| 266 |
If the SIP dialog is not found "481 Call/Transaction Does Not Exist" is |
| 267 |
returned. |
| 268 |
|
| 269 |
This function can be used from REQUEST_ROUTE, REPLY_ROUTE and |
| 270 |
FAILURE_ROUTE. |
| 271 |
|
| 272 |
Example 1.6. rms_sip_request usage example |
| 273 |
... |
| 274 |
if (rms_dialog_check()) { |
| 275 |
rms_sip_request(); |
| 276 |
} |
| 277 |
... |
| 278 |
|
| 279 |
5.6. rms_play (file, event_route) |
| 280 |
|
| 281 |
Play a wav file, a resampler is automatically configured to resample |
| 282 |
and convert stereo to mono if needed. |
| 283 |
|
| 284 |
The second parameter is the event route that will be called when the |
| 285 |
file was played. |
| 286 |
|
| 287 |
This function can be used from EVENT_ROUTE. |
| 288 |
|
| 289 |
Example 1.7. rms_play usage example |
| 290 |
... |
| 291 |
rms_play("file.wav", "event_route_name"); |
| 292 |
... |