27d8d77cac869ff8af1f1054b24cb28107ccd781
[asterisk/asterisk.git] / bridges / bridge_native_rtp.c
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2013, Digium, Inc.
5  *
6  * Joshua Colp <jcolp@digium.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18
19 /*! \file
20  *
21  * \brief Native RTP bridging technology module
22  *
23  * \author Joshua Colp <jcolp@digium.com>
24  *
25  * \ingroup bridges
26  */
27
28 /*** MODULEINFO
29         <support_level>core</support_level>
30  ***/
31
32 #include "asterisk.h"
33
34 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
35
36 #include <stdio.h>
37 #include <stdlib.h>
38 #include <string.h>
39 #include <sys/types.h>
40 #include <sys/stat.h>
41
42 #include "asterisk/module.h"
43 #include "asterisk/channel.h"
44 #include "asterisk/bridge.h"
45 #include "asterisk/bridge_technology.h"
46 #include "asterisk/frame.h"
47 #include "asterisk/rtp_engine.h"
48
49 /*! \brief Internal structure which contains information about bridged RTP channels */
50 struct native_rtp_bridge_data {
51         /*! \brief Framehook used to intercept certain control frames */
52         int id;
53 };
54
55 /*! \brief Internal helper function which gets all RTP information (glue and instances) relating to the given channels */
56 static enum ast_rtp_glue_result native_rtp_bridge_get(struct ast_channel *c0, struct ast_channel *c1, struct ast_rtp_glue **glue0,
57         struct ast_rtp_glue **glue1, struct ast_rtp_instance **instance0, struct ast_rtp_instance **instance1,
58         struct ast_rtp_instance **vinstance0, struct ast_rtp_instance **vinstance1)
59 {
60         enum ast_rtp_glue_result audio_glue0_res;
61         enum ast_rtp_glue_result video_glue0_res;
62         enum ast_rtp_glue_result audio_glue1_res;
63         enum ast_rtp_glue_result video_glue1_res;
64
65         if (!(*glue0 = ast_rtp_instance_get_glue(ast_channel_tech(c0)->type)) ||
66                 !(*glue1 = ast_rtp_instance_get_glue(ast_channel_tech(c1)->type))) {
67                 return AST_RTP_GLUE_RESULT_FORBID;
68         }
69
70         audio_glue0_res = (*glue0)->get_rtp_info(c0, instance0);
71         video_glue0_res = (*glue0)->get_vrtp_info ? (*glue0)->get_vrtp_info(c0, vinstance0) : AST_RTP_GLUE_RESULT_FORBID;
72
73         audio_glue1_res = (*glue1)->get_rtp_info(c1, instance1);
74         video_glue1_res = (*glue1)->get_vrtp_info ? (*glue1)->get_vrtp_info(c1, vinstance1) : AST_RTP_GLUE_RESULT_FORBID;
75
76         /* Apply any limitations on direct media bridging that may be present */
77         if (audio_glue0_res == audio_glue1_res && audio_glue1_res == AST_RTP_GLUE_RESULT_REMOTE) {
78                 if ((*glue0)->allow_rtp_remote && !((*glue0)->allow_rtp_remote(c0, *instance1))) {
79                         /* If the allow_rtp_remote indicates that remote isn't allowed, revert to local bridge */
80                         audio_glue0_res = audio_glue1_res = AST_RTP_GLUE_RESULT_LOCAL;
81                 } else if ((*glue1)->allow_rtp_remote && !((*glue1)->allow_rtp_remote(c1, *instance0))) {
82                         audio_glue0_res = audio_glue1_res = AST_RTP_GLUE_RESULT_LOCAL;
83                 }
84         }
85         if (video_glue0_res == video_glue1_res && video_glue1_res == AST_RTP_GLUE_RESULT_REMOTE) {
86                 if ((*glue0)->allow_vrtp_remote && !((*glue0)->allow_vrtp_remote(c0, *instance1))) {
87                         /* if the allow_vrtp_remote indicates that remote isn't allowed, revert to local bridge */
88                         video_glue0_res = video_glue1_res = AST_RTP_GLUE_RESULT_LOCAL;
89                 } else if ((*glue1)->allow_vrtp_remote && !((*glue1)->allow_vrtp_remote(c1, *instance0))) {
90                         video_glue0_res = video_glue1_res = AST_RTP_GLUE_RESULT_LOCAL;
91                 }
92         }
93
94         /* If we are carrying video, and both sides are not going to remotely bridge... fail the native bridge */
95         if (video_glue0_res != AST_RTP_GLUE_RESULT_FORBID
96                 && (audio_glue0_res != AST_RTP_GLUE_RESULT_REMOTE
97                         || video_glue0_res != AST_RTP_GLUE_RESULT_REMOTE)) {
98                 audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID;
99         }
100         if (video_glue1_res != AST_RTP_GLUE_RESULT_FORBID
101                 && (audio_glue1_res != AST_RTP_GLUE_RESULT_REMOTE
102                         || video_glue1_res != AST_RTP_GLUE_RESULT_REMOTE)) {
103                 audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID;
104         }
105
106         /* If any sort of bridge is forbidden just completely bail out and go back to generic bridging */
107         if (audio_glue0_res == AST_RTP_GLUE_RESULT_FORBID
108                 || audio_glue1_res == AST_RTP_GLUE_RESULT_FORBID) {
109                 return AST_RTP_GLUE_RESULT_FORBID;
110         }
111
112         return audio_glue0_res;
113 }
114
115 static int native_rtp_bridge_start(struct ast_bridge *bridge, struct ast_channel *target)
116 {
117         struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels);
118         struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
119         enum ast_rtp_glue_result native_type;
120         struct ast_rtp_glue *glue0, *glue1;
121         RAII_VAR(struct ast_rtp_instance *, instance0, NULL, ao2_cleanup);
122         RAII_VAR(struct ast_rtp_instance *, instance1, NULL, ao2_cleanup);
123         RAII_VAR(struct ast_rtp_instance *, vinstance0, NULL, ao2_cleanup);
124         RAII_VAR(struct ast_rtp_instance *, vinstance1, NULL, ao2_cleanup);
125         RAII_VAR(struct ast_rtp_instance *, tinstance0, NULL, ao2_cleanup);
126         RAII_VAR(struct ast_rtp_instance *, tinstance1, NULL, ao2_cleanup);
127         RAII_VAR(struct ast_format_cap *, cap0, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK), ast_format_cap_destroy);
128         RAII_VAR(struct ast_format_cap *, cap1, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK), ast_format_cap_destroy);
129
130         if (c0 == c1) {
131                 return 0;
132         }
133
134         native_type = native_rtp_bridge_get(c0->chan, c1->chan, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
135
136         if (glue0->get_codec) {
137                 glue0->get_codec(c0->chan, cap0);
138         }
139         if (glue1->get_codec) {
140                 glue1->get_codec(c1->chan, cap1);
141         }
142
143         switch (native_type) {
144         case AST_RTP_GLUE_RESULT_LOCAL:
145                 if (ast_rtp_instance_get_engine(instance0)->local_bridge) {
146                         ast_rtp_instance_get_engine(instance0)->local_bridge(instance0, instance1);
147                 }
148                 if (ast_rtp_instance_get_engine(instance1)->local_bridge) {
149                         ast_rtp_instance_get_engine(instance1)->local_bridge(instance1, instance0);
150                 }
151                 ast_rtp_instance_set_bridged(instance0, instance1);
152                 ast_rtp_instance_set_bridged(instance1, instance0);
153                 ast_debug(2, "Locally RTP bridged '%s' and '%s' in stack\n",
154                         ast_channel_name(c0->chan), ast_channel_name(c1->chan));
155                 break;
156
157         case AST_RTP_GLUE_RESULT_REMOTE:
158
159                 /* If we have a target, it's the channel that received the UNHOLD or UPDATE_RTP_PEER frame and was told to resume */
160                 if (!target) {
161                         glue0->update_peer(c0->chan, instance1, vinstance1, tinstance1, cap1, 0);
162                         glue1->update_peer(c1->chan, instance0, vinstance0, tinstance0, cap0, 0);
163                         ast_debug(2, "Remotely bridged '%s' and '%s' - media will flow directly between them\n",
164                                 ast_channel_name(c0->chan), ast_channel_name(c1->chan));
165                 } else {
166                         /*
167                          * If a target was provided, it is the recipient of an unhold or an update and needs to have
168                          * its media redirected to fit the current remote bridging needs. The other channel is either
169                          * already set up to handle the new media path or will have its own set of updates independent
170                          * of this pass.
171                          */
172                         if (c0->chan == target) {
173                                 glue0->update_peer(c0->chan, instance1, vinstance1, tinstance1, cap1, 0);
174                         } else {
175                                 glue1->update_peer(c1->chan, instance0, vinstance0, tinstance0, cap0, 0);
176                         }
177                 }
178                 break;
179         case AST_RTP_GLUE_RESULT_FORBID:
180                 break;
181         }
182
183         return 0;
184 }
185
186 static void native_rtp_bridge_stop(struct ast_bridge *bridge, struct ast_channel *target)
187 {
188         struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels);
189         struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
190         enum ast_rtp_glue_result native_type;
191         struct ast_rtp_glue *glue0, *glue1 = NULL;
192         RAII_VAR(struct ast_rtp_instance *, instance0, NULL, ao2_cleanup);
193         RAII_VAR(struct ast_rtp_instance *, instance1, NULL, ao2_cleanup);
194         RAII_VAR(struct ast_rtp_instance *, vinstance0, NULL, ao2_cleanup);
195         RAII_VAR(struct ast_rtp_instance *, vinstance1, NULL, ao2_cleanup);
196
197         if (c0 == c1) {
198                 return;
199         }
200
201         if (!c0 || !c1) {
202                 return;
203         }
204
205         native_type = native_rtp_bridge_get(c0->chan, c1->chan, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
206
207         switch (native_type) {
208         case AST_RTP_GLUE_RESULT_LOCAL:
209                 if (ast_rtp_instance_get_engine(instance0)->local_bridge) {
210                         ast_rtp_instance_get_engine(instance0)->local_bridge(instance0, NULL);
211                 }
212                 if (instance1 && ast_rtp_instance_get_engine(instance1)->local_bridge) {
213                         ast_rtp_instance_get_engine(instance1)->local_bridge(instance1, NULL);
214                 }
215                 ast_rtp_instance_set_bridged(instance0, NULL);
216                 if (instance1) {
217                         ast_rtp_instance_set_bridged(instance1, NULL);
218                 }
219                 break;
220         case AST_RTP_GLUE_RESULT_REMOTE:
221                 if (!target) {
222                         glue0->update_peer(c0->chan, NULL, NULL, NULL, NULL, 0);
223                         if (glue1) {
224                                 glue1->update_peer(c1->chan, NULL, NULL, NULL, NULL, 0);
225                         }
226                 } else {
227                         /*
228                          * If a target was provided, it is being put on hold and should expect to
229                          * receive mediafrom sterisk instead of what it was previously connected to.
230                          */
231                         if (c0->chan == target) {
232                                 glue0->update_peer(c0->chan, NULL, NULL, NULL, NULL, 0);
233                         } else if (glue1) {
234                                 glue1->update_peer(c1->chan, NULL, NULL, NULL, NULL, 0);
235                         }
236                 }
237                 break;
238         case AST_RTP_GLUE_RESULT_FORBID:
239                 break;
240         }
241
242         ast_debug(2, "Discontinued RTP bridging of '%s' and '%s' - media will flow through Asterisk core\n",
243                 ast_channel_name(c0->chan), ast_channel_name(c1->chan));
244 }
245
246 /*! \brief Frame hook that is called to intercept hold/unhold */
247 static struct ast_frame *native_rtp_framehook(struct ast_channel *chan, struct ast_frame *f, enum ast_framehook_event event, void *data)
248 {
249         RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
250
251         if (!f || (event != AST_FRAMEHOOK_EVENT_WRITE)) {
252                 return f;
253         }
254
255         ast_channel_lock(chan);
256         bridge = ast_channel_get_bridge(chan);
257         ast_channel_unlock(chan);
258
259         if (bridge) {
260                 if (f->subclass.integer == AST_CONTROL_HOLD) {
261                         native_rtp_bridge_stop(bridge, chan);
262                 } else if ((f->subclass.integer == AST_CONTROL_UNHOLD) || (f->subclass.integer == AST_CONTROL_UPDATE_RTP_PEER)) {
263                         native_rtp_bridge_start(bridge, chan);
264                 }
265         }
266
267         return f;
268 }
269
270 /*! \brief Internal helper function which checks whether the channels are compatible with our native bridging */
271 static int native_rtp_bridge_capable(struct ast_channel *chan)
272 {
273         return !ast_channel_has_audio_frame_or_monitor(chan);
274 }
275
276 static int native_rtp_bridge_compatible(struct ast_bridge *bridge)
277 {
278         struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels);
279         struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
280         enum ast_rtp_glue_result native_type;
281         struct ast_rtp_glue *glue0, *glue1;
282         RAII_VAR(struct ast_rtp_instance *, instance0, NULL, ao2_cleanup);
283         RAII_VAR(struct ast_rtp_instance *, instance1, NULL, ao2_cleanup);
284         RAII_VAR(struct ast_rtp_instance *, vinstance0, NULL, ao2_cleanup);
285         RAII_VAR(struct ast_rtp_instance *, vinstance1, NULL, ao2_cleanup);
286         RAII_VAR(struct ast_format_cap *, cap0, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK), ast_format_cap_destroy);
287         RAII_VAR(struct ast_format_cap *, cap1, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK), ast_format_cap_destroy);
288         int read_ptime0, read_ptime1, write_ptime0, write_ptime1;
289
290         /* We require two channels before even considering native bridging */
291         if (bridge->num_channels != 2) {
292                 ast_debug(1, "Bridge '%s' can not use native RTP bridge as two channels are required\n",
293                         bridge->uniqueid);
294                 return 0;
295         }
296
297         if (!native_rtp_bridge_capable(c0->chan)) {
298                 ast_debug(1, "Bridge '%s' can not use native RTP bridge as channel '%s' has features which prevent it\n",
299                         bridge->uniqueid, ast_channel_name(c0->chan));
300                 return 0;
301         }
302
303         if (!native_rtp_bridge_capable(c1->chan)) {
304                 ast_debug(1, "Bridge '%s' can not use native RTP bridge as channel '%s' has features which prevent it\n",
305                         bridge->uniqueid, ast_channel_name(c1->chan));
306                 return 0;
307         }
308
309         if ((native_type = native_rtp_bridge_get(c0->chan, c1->chan, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1))
310                 == AST_RTP_GLUE_RESULT_FORBID) {
311                 ast_debug(1, "Bridge '%s' can not use native RTP bridge as it was forbidden while getting details\n",
312                         bridge->uniqueid);
313                 return 0;
314         }
315
316         if (ao2_container_count(c0->features->dtmf_hooks) && ast_rtp_instance_dtmf_mode_get(instance0)) {
317                 ast_debug(1, "Bridge '%s' can not use native RTP bridge as channel '%s' has DTMF hooks\n",
318                         bridge->uniqueid, ast_channel_name(c0->chan));
319                 return 0;
320         }
321
322         if (ao2_container_count(c1->features->dtmf_hooks) && ast_rtp_instance_dtmf_mode_get(instance1)) {
323                 ast_debug(1, "Bridge '%s' can not use native RTP bridge as channel '%s' has DTMF hooks\n",
324                         bridge->uniqueid, ast_channel_name(c1->chan));
325                 return 0;
326         }
327
328         if ((native_type == AST_RTP_GLUE_RESULT_LOCAL) && ((ast_rtp_instance_get_engine(instance0)->local_bridge !=
329                 ast_rtp_instance_get_engine(instance1)->local_bridge) ||
330                 (ast_rtp_instance_get_engine(instance0)->dtmf_compatible &&
331                         !ast_rtp_instance_get_engine(instance0)->dtmf_compatible(c0->chan, instance0, c1->chan, instance1)))) {
332                 ast_debug(1, "Bridge '%s' can not use local native RTP bridge as local bridge or DTMF is not compatible\n",
333                         bridge->uniqueid);
334                 return 0;
335         }
336
337         /* Make sure that codecs match */
338         if (glue0->get_codec) {
339                 glue0->get_codec(c0->chan, cap0);
340         }
341         if (glue1->get_codec) {
342                 glue1->get_codec(c1->chan, cap1);
343         }
344         if (!ast_format_cap_is_empty(cap0) && !ast_format_cap_is_empty(cap1) && !ast_format_cap_has_joint(cap0, cap1)) {
345                 char tmp0[256] = { 0, }, tmp1[256] = { 0, };
346
347                 ast_debug(1, "Channel codec0 = %s is not codec1 = %s, cannot native bridge in RTP.\n",
348                         ast_getformatname_multiple(tmp0, sizeof(tmp0), cap0),
349                         ast_getformatname_multiple(tmp1, sizeof(tmp1), cap1));
350                 return 0;
351         }
352
353         read_ptime0 = (ast_codec_pref_getsize(&ast_rtp_instance_get_codecs(instance0)->pref, ast_channel_rawreadformat(c0->chan))).cur_ms;
354         read_ptime1 = (ast_codec_pref_getsize(&ast_rtp_instance_get_codecs(instance1)->pref, ast_channel_rawreadformat(c1->chan))).cur_ms;
355         write_ptime0 = (ast_codec_pref_getsize(&ast_rtp_instance_get_codecs(instance0)->pref, ast_channel_rawwriteformat(c0->chan))).cur_ms;
356         write_ptime1 = (ast_codec_pref_getsize(&ast_rtp_instance_get_codecs(instance1)->pref, ast_channel_rawwriteformat(c1->chan))).cur_ms;
357
358         if (read_ptime0 != write_ptime1 || read_ptime1 != write_ptime0) {
359                 ast_debug(1, "Packetization differs between RTP streams (%d != %d or %d != %d). Cannot native bridge in RTP\n",
360                                 read_ptime0, write_ptime1, read_ptime1, write_ptime0);
361                 return 0;
362         }
363
364         return 1;
365 }
366
367 /*! \brief Helper function which adds frame hook to bridge channel */
368 static int native_rtp_bridge_framehook_attach(struct ast_bridge_channel *bridge_channel)
369 {
370         struct native_rtp_bridge_data *data = ao2_alloc(sizeof(*data), NULL);
371         static struct ast_framehook_interface hook = {
372                 .version = AST_FRAMEHOOK_INTERFACE_VERSION,
373                 .event_cb = native_rtp_framehook,
374         };
375
376         if (!data) {
377                 return -1;
378         }
379
380         ast_channel_lock(bridge_channel->chan);
381         data->id = ast_framehook_attach(bridge_channel->chan, &hook);
382         ast_channel_unlock(bridge_channel->chan);
383         if (data->id < 0) {
384                 ao2_cleanup(data);
385                 return -1;
386         }
387
388         bridge_channel->tech_pvt = data;
389
390         return 0;
391 }
392
393 /*! \brief Helper function which removes frame hook from bridge channel */
394 static void native_rtp_bridge_framehook_detach(struct ast_bridge_channel *bridge_channel)
395 {
396         RAII_VAR(struct native_rtp_bridge_data *, data, bridge_channel->tech_pvt, ao2_cleanup);
397
398         if (!data) {
399                 return;
400         }
401
402         ast_channel_lock(bridge_channel->chan);
403         ast_framehook_detach(bridge_channel->chan, data->id);
404         ast_channel_unlock(bridge_channel->chan);
405         bridge_channel->tech_pvt = NULL;
406 }
407
408 static int native_rtp_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
409 {
410         native_rtp_bridge_framehook_detach(bridge_channel);
411         if (native_rtp_bridge_framehook_attach(bridge_channel)) {
412                 return -1;
413         }
414
415         return native_rtp_bridge_start(bridge, NULL);
416 }
417
418 static void native_rtp_bridge_unsuspend(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
419 {
420         native_rtp_bridge_join(bridge, bridge_channel);
421 }
422
423 static void native_rtp_bridge_leave(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
424 {
425         struct ast_rtp_glue *glue;
426         RAII_VAR(struct ast_rtp_instance *, instance, NULL, ao2_cleanup);
427         RAII_VAR(struct ast_rtp_instance *, vinstance, NULL, ao2_cleanup);
428         RAII_VAR(struct ast_rtp_instance *, tinstance, NULL, ao2_cleanup);
429
430         native_rtp_bridge_framehook_detach(bridge_channel);
431
432         glue = ast_rtp_instance_get_glue(ast_channel_tech(bridge_channel->chan)->type);
433         glue->get_rtp_info(bridge_channel->chan, &instance);
434         glue->get_vrtp_info ? glue->get_vrtp_info(bridge_channel->chan, &vinstance) : AST_RTP_GLUE_RESULT_FORBID;
435         glue->get_trtp_info ? glue->get_trtp_info(bridge_channel->chan, &tinstance) : AST_RTP_GLUE_RESULT_FORBID;
436
437         /* Tear down P2P bridges */
438         if (instance) {
439                 ast_rtp_instance_set_bridged(instance, NULL);
440         }
441         if (vinstance) {
442                 ast_rtp_instance_set_bridged(vinstance, NULL);
443         }
444         if (tinstance) {
445                 ast_rtp_instance_set_bridged(tinstance, NULL);
446         }
447
448         /* Direct RTP may have occurred, tear it down */
449         glue->update_peer(bridge_channel->chan, NULL, NULL, NULL, NULL, 0);
450
451         native_rtp_bridge_stop(bridge, NULL);
452 }
453
454 static int native_rtp_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
455 {
456         return ast_bridge_queue_everyone_else(bridge, bridge_channel, frame);
457 }
458
459 static struct ast_bridge_technology native_rtp_bridge = {
460         .name = "native_rtp",
461         .capabilities = AST_BRIDGE_CAPABILITY_NATIVE,
462         .preference = AST_BRIDGE_PREFERENCE_BASE_NATIVE,
463         .join = native_rtp_bridge_join,
464         .unsuspend = native_rtp_bridge_unsuspend,
465         .leave = native_rtp_bridge_leave,
466         .suspend = native_rtp_bridge_leave,
467         .write = native_rtp_bridge_write,
468         .compatible = native_rtp_bridge_compatible,
469 };
470
471 static int unload_module(void)
472 {
473         ast_format_cap_destroy(native_rtp_bridge.format_capabilities);
474         return ast_bridge_technology_unregister(&native_rtp_bridge);
475 }
476
477 static int load_module(void)
478 {
479         if (!(native_rtp_bridge.format_capabilities = ast_format_cap_alloc(0))) {
480                 return AST_MODULE_LOAD_DECLINE;
481         }
482         ast_format_cap_add_all_by_type(native_rtp_bridge.format_capabilities, AST_FORMAT_TYPE_AUDIO);
483         ast_format_cap_add_all_by_type(native_rtp_bridge.format_capabilities, AST_FORMAT_TYPE_VIDEO);
484         ast_format_cap_add_all_by_type(native_rtp_bridge.format_capabilities, AST_FORMAT_TYPE_TEXT);
485
486         return ast_bridge_technology_register(&native_rtp_bridge);
487 }
488
489 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Native RTP bridging module");