Merge "rtp_engine/res_rtp_asterisk: Fix RTP struct reentrancy crashes."
[asterisk/asterisk.git] / res / res_sdp_translator_pjmedia.c
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2017, Digium, Inc.
5  *
6  * Mark Michelson <mmichelson@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 #include "asterisk.h"
20 #include "asterisk/sdp_translator.h"
21 #include "asterisk/sdp_options.h"
22 #include "asterisk/vector.h"
23 #include "asterisk/netsock2.h"
24 #include "asterisk/utils.h"
25 #include "asterisk/config.h"
26 #include "asterisk/test.h"
27 #include "asterisk/module.h"
28
29 #include "../include/asterisk/sdp.h"
30 #ifdef HAVE_PJPROJECT
31 #include <pjlib.h>
32 #include <pjmedia.h>
33 #endif
34
35 /*** MODULEINFO
36         <depend>pjproject</depend>
37         <support_level>core</support_level>
38  ***/
39
40 static pj_caching_pool sdp_caching_pool;
41
42
43 static void *pjmedia_new(void)
44 {
45         pj_pool_t *pool;
46
47         pool = pj_pool_create(&sdp_caching_pool.factory, "pjmedia sdp translator", 1024, 1024, NULL);
48
49         return pool;
50 }
51
52 static void pjmedia_free(void *translator_priv)
53 {
54         pj_pool_t *pool = translator_priv;
55
56         pj_pool_release(pool);
57 }
58
59 #define dupa_pj_str(pjstr) \
60 ({ \
61         char *dest = ast_alloca(pjstr.slen + 1); \
62         memcpy(dest, pjstr.ptr, pjstr.slen); \
63         dest[pjstr.slen] = '\0'; \
64         dest; \
65 })
66
67 static struct ast_sdp_m_line *pjmedia_copy_m_line(struct pjmedia_sdp_media *pjmedia_m_line)
68 {
69         int i;
70
71         struct ast_sdp_c_line *c_line = pjmedia_m_line->conn ?
72                 ast_sdp_c_alloc(dupa_pj_str(pjmedia_m_line->conn->addr_type),
73                 dupa_pj_str(pjmedia_m_line->conn->addr)) : NULL;
74
75         struct ast_sdp_m_line *m_line = ast_sdp_m_alloc(dupa_pj_str(pjmedia_m_line->desc.media),
76                 pjmedia_m_line->desc.port, pjmedia_m_line->desc.port_count,
77                 dupa_pj_str(pjmedia_m_line->desc.transport), c_line);
78
79         for (i = 0; i < pjmedia_m_line->desc.fmt_count; ++i) {
80                 ast_sdp_m_add_payload(m_line,
81                         ast_sdp_payload_alloc(dupa_pj_str(pjmedia_m_line->desc.fmt[i])));
82         }
83
84         for (i = 0; i < pjmedia_m_line->attr_count; ++i) {
85                 ast_sdp_m_add_a(m_line, ast_sdp_a_alloc(dupa_pj_str(pjmedia_m_line->attr[i]->name),
86                         dupa_pj_str(pjmedia_m_line->attr[i]->value)));
87         }
88
89         return m_line;
90 }
91
92 static void pjmedia_copy_a_lines(struct ast_sdp *new_sdp, pjmedia_sdp_session *pjmedia_sdp)
93 {
94         int i;
95
96         for (i = 0; i < pjmedia_sdp->attr_count; ++i) {
97                 ast_sdp_add_a(new_sdp, ast_sdp_a_alloc(dupa_pj_str(pjmedia_sdp->attr[i]->name),
98                         dupa_pj_str(pjmedia_sdp->attr[i]->value)));
99         }
100 }
101
102 static void pjmedia_copy_m_lines(struct ast_sdp *new_sdp,
103         struct pjmedia_sdp_session *pjmedia_sdp)
104 {
105         int i;
106
107         for (i = 0; i < pjmedia_sdp->media_count; ++i) {
108                 ast_sdp_add_m(new_sdp, pjmedia_copy_m_line(pjmedia_sdp->media[i]));
109         }
110 }
111
112 static struct ast_sdp *pjmedia_to_sdp(void *in, void *translator_priv)
113 {
114         struct pjmedia_sdp_session *pjmedia_sdp = in;
115
116         struct ast_sdp_o_line *o_line = ast_sdp_o_alloc(dupa_pj_str(pjmedia_sdp->origin.user),
117                 pjmedia_sdp->origin.id, pjmedia_sdp->origin.version,
118                 dupa_pj_str(pjmedia_sdp->origin.addr_type), dupa_pj_str(pjmedia_sdp->origin.addr));
119
120         struct ast_sdp_c_line *c_line = pjmedia_sdp->conn ?
121                 ast_sdp_c_alloc(dupa_pj_str(pjmedia_sdp->conn->addr_type),
122                         dupa_pj_str(pjmedia_sdp->conn->addr)) : NULL;
123
124         struct ast_sdp_s_line *s_line = ast_sdp_s_alloc(dupa_pj_str(pjmedia_sdp->name));
125
126         struct ast_sdp_t_line *t_line = ast_sdp_t_alloc(pjmedia_sdp->time.start,
127                 pjmedia_sdp->time.stop);
128
129         struct ast_sdp *new_sdp = ast_sdp_alloc(o_line, c_line, s_line, t_line);
130
131         pjmedia_copy_a_lines(new_sdp, pjmedia_sdp);
132         pjmedia_copy_m_lines(new_sdp, pjmedia_sdp);
133
134         return new_sdp;
135 }
136
137 static void copy_o_line_pjmedia(pj_pool_t *pool, pjmedia_sdp_session *pjmedia_sdp,
138         struct ast_sdp_o_line *o_line)
139 {
140         pjmedia_sdp->origin.id = o_line->session_id;
141         pjmedia_sdp->origin.version = o_line->session_version;
142         pj_strdup2(pool, &pjmedia_sdp->origin.user, o_line->username);
143         pj_strdup2(pool, &pjmedia_sdp->origin.addr_type, o_line->address_type);
144         pj_strdup2(pool, &pjmedia_sdp->origin.addr, o_line->address);
145         pj_strdup2(pool, &pjmedia_sdp->origin.net_type, "IN");
146 }
147
148 static void copy_s_line_pjmedia(pj_pool_t *pool, pjmedia_sdp_session *pjmedia_sdp,
149         struct ast_sdp_s_line *s_line)
150 {
151         pj_strdup2(pool, &pjmedia_sdp->name, s_line->session_name);
152 }
153
154 static void copy_t_line_pjmedia(pj_pool_t *pool, pjmedia_sdp_session *pjmedia_sdp,
155         struct ast_sdp_t_line *t_line)
156 {
157         pjmedia_sdp->time.start = t_line->start_time;
158         pjmedia_sdp->time.stop = t_line->stop_time;
159 }
160
161 static void copy_c_line_pjmedia(pj_pool_t *pool, pjmedia_sdp_conn **conn,
162         struct ast_sdp_c_line *c_line)
163 {
164         pjmedia_sdp_conn *local_conn;
165         local_conn = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_conn);
166         pj_strdup2(pool, &local_conn->addr_type, c_line->address_type);
167         pj_strdup2(pool, &local_conn->addr, c_line->address);
168         pj_strdup2(pool, &local_conn->net_type, "IN");
169
170         *conn = local_conn;
171 }
172
173 static void copy_a_lines_pjmedia(pj_pool_t *pool, pjmedia_sdp_session *pjmedia_sdp,
174         const struct ast_sdp *sdp)
175 {
176         int i;
177
178         for (i = 0; i < ast_sdp_get_a_count(sdp); ++i) {
179                 pjmedia_sdp_attr *attr;
180                 pj_str_t value;
181                 struct ast_sdp_a_line *a_line;
182
183                 a_line = ast_sdp_get_a(sdp, i);
184                 pj_strdup2(pool, &value, a_line->value);
185                 attr = pjmedia_sdp_attr_create(pool, a_line->name, &value);
186                 pjmedia_sdp_session_add_attr(pjmedia_sdp, attr);
187         }
188 }
189
190 static void copy_a_lines_pjmedia_media(pj_pool_t *pool, pjmedia_sdp_media *media,
191         struct ast_sdp_m_line *m_line)
192 {
193         int i;
194
195         for (i = 0; i < ast_sdp_m_get_a_count(m_line); ++i) {
196                 pjmedia_sdp_attr *attr;
197                 pj_str_t value;
198                 struct ast_sdp_a_line *a_line;
199
200                 a_line = ast_sdp_m_get_a(m_line, i);
201                 pj_strdup2(pool, &value, a_line->value);
202                 attr = pjmedia_sdp_attr_create(pool, a_line->name, &value);
203                 pjmedia_sdp_media_add_attr(media, attr);
204         }
205 }
206
207 static void copy_m_line_pjmedia(pj_pool_t *pool, pjmedia_sdp_media *media,
208         struct ast_sdp_m_line *m_line)
209 {
210         int i;
211
212         media->desc.port = m_line->port;
213         media->desc.port_count = m_line->port_count;
214         pj_strdup2(pool, &media->desc.transport, m_line->proto);
215         pj_strdup2(pool, &media->desc.media, m_line->type);
216
217         for (i = 0; i < ast_sdp_m_get_payload_count(m_line); ++i) {
218                 pj_strdup2(pool, &media->desc.fmt[i], ast_sdp_m_get_payload(m_line, i)->fmt);
219                 ++media->desc.fmt_count;
220         }
221         if (m_line->c_line && m_line->c_line->address) {
222                 copy_c_line_pjmedia(pool, &media->conn, m_line->c_line);
223         }
224         copy_a_lines_pjmedia_media(pool, media, m_line);
225 }
226
227 static void copy_m_lines_pjmedia(pj_pool_t *pool, pjmedia_sdp_session *pjmedia_sdp,
228         const struct ast_sdp *sdp)
229 {
230         int i;
231
232         for (i = 0; i < ast_sdp_get_m_count(sdp); ++i) {
233                 pjmedia_sdp_media *media;
234
235                 media = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_media);
236                 copy_m_line_pjmedia(pool, media, ast_sdp_get_m(sdp, i));
237                 pjmedia_sdp->media[pjmedia_sdp->media_count] = media;
238                 ++pjmedia_sdp->media_count;
239         }
240 }
241
242 static void *sdp_to_pjmedia(const struct ast_sdp *sdp, void *translator_priv)
243 {
244         pj_pool_t *pool = translator_priv;
245         pjmedia_sdp_session *pjmedia_sdp;
246
247         pjmedia_sdp = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_session);
248         copy_o_line_pjmedia(pool, pjmedia_sdp, sdp->o_line);
249         copy_s_line_pjmedia(pool, pjmedia_sdp, sdp->s_line);
250         copy_t_line_pjmedia(pool, pjmedia_sdp, sdp->t_line);
251         copy_c_line_pjmedia(pool, &pjmedia_sdp->conn, sdp->c_line);
252         copy_a_lines_pjmedia(pool, pjmedia_sdp, sdp);
253         copy_m_lines_pjmedia(pool, pjmedia_sdp, sdp);
254         return pjmedia_sdp;
255 }
256
257 static struct ast_sdp_translator_ops pjmedia_translator = {
258         .repr = AST_SDP_IMPL_PJMEDIA,
259         .translator_new = pjmedia_new,
260         .translator_free = pjmedia_free,
261         .to_sdp = pjmedia_to_sdp,
262         .from_sdp = sdp_to_pjmedia,
263 };
264
265 #ifdef TEST_FRAMEWORK
266
267 static int verify_s_line(struct ast_sdp_s_line *s_line, char *expected)
268 {
269         return strcmp(s_line->session_name, expected) == 0;
270 }
271
272 static int verify_c_line(struct ast_sdp_c_line *c_line, char *family, char *addr)
273 {
274         return strcmp(c_line->address_type, family) == 0 && strcmp(c_line->address, addr) == 0;
275 }
276
277 static int verify_t_line(struct ast_sdp_t_line *t_line, uint32_t start, uint32_t end)
278 {
279         return t_line->start_time == start && t_line->stop_time == end;
280 }
281
282 static int verify_m_line(struct ast_sdp *sdp, int index, char *type, int port,
283         int port_count, char *profile, ...)
284 {
285         struct ast_sdp_m_line *m_line;
286         int res;
287         va_list ap;
288         int i;
289
290         m_line = ast_sdp_get_m(sdp, index);
291
292         res = strcmp(m_line->type, type) == 0;
293         res |= m_line->port == port;
294         res |= m_line->port_count == port_count;
295         res |= strcmp(m_line->proto, profile) == 0;
296
297         va_start(ap, profile);
298         for (i = 0; i < ast_sdp_m_get_payload_count(m_line); ++i) {
299                 char *payload;
300
301                 payload = va_arg(ap, char *);
302                 if (!payload) {
303                         res = -1;
304                         break;
305                 }
306                 res |= strcmp(ast_sdp_m_get_payload(m_line, i)->fmt, payload) == 0;
307         }
308         va_end(ap);
309         return res;
310 }
311
312 static int verify_a_line(struct ast_sdp *sdp, int m_index, int a_index, char *name,
313         char *value)
314 {
315         struct ast_sdp_m_line *m_line;
316         struct ast_sdp_a_line *a_line;
317
318         m_line = ast_sdp_get_m(sdp, m_index);
319         a_line = ast_sdp_m_get_a(m_line, a_index);
320
321         return strcmp(a_line->name, name) == 0 && strcmp(a_line->value, value) == 0;
322 }
323
324 AST_TEST_DEFINE(pjmedia_to_sdp_test)
325 {
326         struct ast_sdp_translator *translator;
327         pj_pool_t *pool;
328         char *sdp_str =
329       "v=0\r\n"
330       "o=alice 2890844526 2890844527 IN IP4 host.atlanta.example.com\r\n"
331       "s= \r\n"
332       "c=IN IP4 host.atlanta.example.com\r\n"
333       "t=123 456\r\n"
334       "m=audio 49170 RTP/AVP 0 8 97\r\n"
335       "a=rtpmap:0 PCMU/8000\r\n"
336       "a=rtpmap:8 PCMA/8000\r\n"
337       "a=rtpmap:97 iLBC/8000\r\n"
338           "a=sendrecv\r\n"
339       "m=video 51372 RTP/AVP 31 32\r\n"
340       "a=rtpmap:31 H261/90000\r\n"
341       "a=rtpmap:32 MPV/90000\r\n";
342         pjmedia_sdp_session *pjmedia_sdp;
343         struct ast_sdp *sdp = NULL;
344         pj_status_t status;
345         enum ast_test_result_state res = AST_TEST_PASS;
346
347         switch (cmd) {
348         case TEST_INIT:
349                 info->name = "pjmedia_to_sdp";
350                 info->category = "/main/sdp/";
351                 info->summary = "PJMEDIA to SDP unit test";
352                 info->description =
353                         "Ensures PJMEDIA SDPs are translated correctly";
354                 return AST_TEST_NOT_RUN;
355         case TEST_EXECUTE:
356                 break;
357         }
358
359         pool = pj_pool_create(&sdp_caching_pool.factory, "pjmedia to sdp test", 1024, 1024, NULL);
360
361         translator = ast_sdp_translator_new(AST_SDP_IMPL_PJMEDIA);
362         if (!translator) {
363                 ast_test_status_update(test, "Failed to create SDP translator\n");
364                 res = AST_TEST_FAIL;
365                 goto cleanup;
366         }
367
368         status = pjmedia_sdp_parse(pool, sdp_str, strlen(sdp_str), &pjmedia_sdp);
369         if (status != PJ_SUCCESS) {
370                 ast_test_status_update(test, "Error parsing SDP\n");
371                 res = AST_TEST_FAIL;
372                 goto cleanup;
373         }
374
375         sdp = ast_sdp_translator_to_sdp(translator, pjmedia_sdp);
376
377         if (strcmp(sdp->o_line->username, "alice")) {
378                 ast_test_status_update(test, "Unexpected SDP user '%s'\n", sdp->o_line->username);
379                 res = AST_TEST_FAIL;
380                 goto cleanup;
381         } else if (sdp->o_line->session_id != 2890844526UL) {
382                 ast_test_status_update(test, "Unexpected SDP id '%" PRId64 "lu'\n", sdp->o_line->session_id);
383                 res = AST_TEST_FAIL;
384                 goto cleanup;
385         } else if (sdp->o_line->session_version != 2890844527UL) {
386                 ast_test_status_update(test, "Unexpected SDP version '%" PRId64 "'\n", sdp->o_line->session_version);
387                 res = AST_TEST_FAIL;
388                 goto cleanup;
389         } else if (strcmp(sdp->o_line->address_type, "IP4")) {
390                 ast_test_status_update(test, "Unexpected address family '%s'\n", sdp->o_line->address_type);
391                 res = AST_TEST_FAIL;
392                 goto cleanup;
393         } else if (strcmp(sdp->o_line->address, "host.atlanta.example.com")) {
394                 ast_test_status_update(test, "Unexpected address '%s'\n", sdp->o_line->address);
395                 res = AST_TEST_FAIL;
396                 goto cleanup;
397         }
398
399         if (!verify_s_line(sdp->s_line, " ")) {
400                 ast_test_status_update(test, "Bad s line\n");
401                 res = AST_TEST_FAIL;
402                 goto cleanup;
403         } else if (!verify_c_line(sdp->c_line, "IP4", "host.atlanta.example.com")) {
404                 ast_test_status_update(test, "Bad c line\n");
405                 res = AST_TEST_FAIL;
406                 goto cleanup;
407         } else if (!verify_t_line(sdp->t_line, 123, 456)) {
408                 ast_test_status_update(test, "Bad t line\n");
409                 res = AST_TEST_FAIL;
410                 goto cleanup;
411         }
412
413         if (!verify_m_line(sdp, 0, "audio", 49170, 1, "RTP/AVP", "0", "8", "97", NULL)) {
414                 ast_test_status_update(test, "Bad m line 1\n");
415                 res = AST_TEST_FAIL;
416                 goto cleanup;
417         } else if (!verify_a_line(sdp, 0, 0, "rtpmap", "0 PCMU/8000")) {
418                 ast_test_status_update(test, "Bad a line 1\n");
419                 res = AST_TEST_FAIL;
420                 goto cleanup;
421         } else if (!verify_a_line(sdp, 0, 1, "rtpmap", "8 PCMA/8000")) {
422                 ast_test_status_update(test, "Bad a line 2\n");
423                 res = AST_TEST_FAIL;
424                 goto cleanup;
425         } else if (!verify_a_line(sdp, 0, 2, "rtpmap", "97 iLBC/8000")) {
426                 ast_test_status_update(test, "Bad a line 3\n");
427                 res = AST_TEST_FAIL;
428                 goto cleanup;
429         } else if (!verify_a_line(sdp, 0, 3, "sendrecv", "")) {
430                 ast_test_status_update(test, "Bad a line 3\n");
431                 res = AST_TEST_FAIL;
432                 goto cleanup;
433         } else if (!verify_m_line(sdp, 1, "video", 51372, 1, "RTP/AVP", "31", "32", NULL)) {
434                 ast_test_status_update(test, "Bad m line 2\n");
435                 res = AST_TEST_FAIL;
436                 goto cleanup;
437         } else if (!verify_a_line(sdp, 1, 0, "rtpmap", "31 H261/90000")) {
438                 ast_test_status_update(test, "Bad a line 4\n");
439                 res = AST_TEST_FAIL;
440                 goto cleanup;
441         } else if (!verify_a_line(sdp, 1, 1, "rtpmap", "32 MPV/90000")) {
442                 ast_test_status_update(test, "Bad a line 5\n");
443                 res = AST_TEST_FAIL;
444                 goto cleanup;
445         }
446
447 cleanup:
448         ast_sdp_free(sdp);
449         ast_sdp_translator_free(translator);
450         pj_pool_release(pool);
451         return res;
452 }
453
454 AST_TEST_DEFINE(sdp_to_pjmedia_test)
455 {
456         struct ast_sdp_translator *translator;
457         char *sdp_str =
458       "v=0\r\n"
459       "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n"
460       "s= \r\n"
461       "c=IN IP4 host.atlanta.example.com\r\n"
462       "t=123 456\r\n"
463       "m=audio 49170 RTP/AVP 0 8 97\r\n"
464       "a=rtpmap:0 PCMU/8000\r\n"
465       "a=rtpmap:8 PCMA/8000\r\n"
466       "a=rtpmap:97 iLBC/8000\r\n"
467           "a=sendrecv\r\n"
468       "m=video 51372 RTP/AVP 31 32\r\n"
469       "a=rtpmap:31 H261/90000\r\n"
470       "a=rtpmap:32 MPV/90000\r\n\r\n";
471         pj_pool_t *pool;
472         pjmedia_sdp_session *pjmedia_sdp_orig;
473         pjmedia_sdp_session *pjmedia_sdp_dup;
474         struct ast_sdp *sdp = NULL;
475         pj_status_t status;
476         enum ast_test_result_state res = AST_TEST_PASS;
477         char buf[2048];
478         char errbuf[256];
479
480         switch (cmd) {
481         case TEST_INIT:
482                 info->name = "sdp_to_pjmedia";
483                 info->category = "/main/sdp/";
484                 info->summary = "SDP to PJMEDIA unit test";
485                 info->description =
486                         "Ensures PJMEDIA SDPs are translated correctly";
487                 return AST_TEST_NOT_RUN;
488         case TEST_EXECUTE:
489                 break;
490         }
491
492         pool = pj_pool_create(&sdp_caching_pool.factory, "pjmedia to sdp test", 1024, 1024, NULL);
493
494         translator = ast_sdp_translator_new(AST_SDP_IMPL_PJMEDIA);
495         if (!translator) {
496                 ast_test_status_update(test, "Failed to create SDP translator\n");
497                 res = AST_TEST_FAIL;
498                 goto cleanup;
499         }
500
501         status = pjmedia_sdp_parse(pool, sdp_str, strlen(sdp_str), &pjmedia_sdp_orig);
502         if (status != PJ_SUCCESS) {
503                 ast_test_status_update(test, "Error parsing SDP\n");
504                 res = AST_TEST_FAIL;
505                 goto cleanup;
506         }
507
508         sdp = ast_sdp_translator_to_sdp(translator, pjmedia_sdp_orig);
509         pjmedia_sdp_dup = ast_sdp_translator_from_sdp(translator, sdp);
510
511         if ((status = pjmedia_sdp_session_cmp(pjmedia_sdp_orig, pjmedia_sdp_dup, 0)) != PJ_SUCCESS) {
512                 ast_test_status_update(test, "SDPs aren't equal\n");
513                 pjmedia_sdp_print(pjmedia_sdp_orig, buf, sizeof(buf));
514                 ast_test_status_update(test, "Original SDP is %s\n", buf);
515                 pjmedia_sdp_print(pjmedia_sdp_dup, buf, sizeof(buf));
516                 ast_test_status_update(test, "New SDP is %s\n", buf);
517                 pjmedia_strerror(status, errbuf, sizeof(errbuf));
518                 ast_test_status_update(test, "PJMEDIA says %d: '%s'\n", status, errbuf);
519                 res = AST_TEST_FAIL;
520                 goto cleanup;
521         }
522
523 cleanup:
524         ast_sdp_free(sdp);
525         ast_sdp_translator_free(translator);
526         pj_pool_release(pool);
527         return res;
528 }
529
530 #endif /* TEST_FRAMEWORK */
531
532 static int load_module(void)
533 {
534         if (ast_sdp_register_translator(&pjmedia_translator)) {
535                 return AST_MODULE_LOAD_DECLINE;
536         }
537         pj_caching_pool_init(&sdp_caching_pool, NULL, 1024 * 1024);
538         AST_TEST_REGISTER(pjmedia_to_sdp_test);
539         AST_TEST_REGISTER(sdp_to_pjmedia_test);
540
541         return AST_MODULE_LOAD_SUCCESS;
542 }
543
544 static int unload_module(void)
545 {
546         ast_sdp_unregister_translator(&pjmedia_translator);
547         pj_caching_pool_destroy(&sdp_caching_pool);
548         AST_TEST_UNREGISTER(pjmedia_to_sdp_test);
549         AST_TEST_REGISTER(sdp_to_pjmedia_test);
550         return 0;
551 }
552
553 static int reload_module(void)
554 {
555         return 0;
556 }
557
558 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "PJMEDIA SDP Translator",
559         .support_level = AST_MODULE_SUPPORT_CORE,
560         .load = load_module,
561         .unload = unload_module,
562         .reload = reload_module,
563         .load_pri = AST_MODPRI_CHANNEL_DEPEND,
564 );