forked from traud/asterisk-alaw16
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alaw16_pass_through.patch
66 lines (62 loc) · 2 KB
/
alaw16_pass_through.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--- include/asterisk/format_cache.h (Asterisk 13.13.1)
+++ include/asterisk/format_cache.h (working copy)
@@ -234,2 +234,7 @@ extern struct ast_format *ast_format_sil
/*!
+ * \brief Built-in PCMA 16 format.
+ */
+extern struct ast_format *ast_format_alaw16;
+
+/*!
* \brief Initialize format cache support within the core.
--- main/codec_builtin.c (Asterisk 13.13.1)
+++ main/codec_builtin.c (working copy)
@@ -169,2 +169,16 @@ static struct ast_codec alaw = {
+static struct ast_codec alaw16 = {
+ .name = "alaw16",
+ .description = "PCMA 16",
+ .type = AST_MEDIA_TYPE_AUDIO,
+ .sample_rate = 16000,
+ .minimum_ms = 10,
+ .maximum_ms = 150,
+ .default_ms = 10,
+ .minimum_bytes = 160,
+ .samples_count = ulaw_samples,
+ .get_length = ulaw_length,
+ .smooth = 1,
+};
+
static int gsm_samples(struct ast_frame *frame)
@@ -887,2 +901,4 @@ int ast_codec_builtin_init(void)
res |= CODEC_REGISTER_AND_CACHE(codec2);
+ res |= CODEC_REGISTER_AND_CACHE(alaw16);
+
res |= CODEC_REGISTER_AND_CACHE(g723);
--- main/format_cache.c (Asterisk 13.13.1)
+++ main/format_cache.c (working copy)
@@ -220,2 +220,7 @@ struct ast_format *ast_format_opus;
/*!
+ * \brief Built-in cached PCMA 16 format.
+ */
+struct ast_format *ast_format_alaw16;
+
+/*!
* \brief Built-in cached t140 format.
@@ -302,2 +307,4 @@ static void format_cache_shutdown(void)
+ ao2_replace(ast_format_alaw16, NULL);
+
ao2_replace(ast_format_g723, NULL);
@@ -368,2 +375,4 @@ static void set_cached_format(const char
ao2_replace(ast_format_alaw, format);
+ } else if (!strcmp(name, "alaw16")) {
+ ao2_replace(ast_format_alaw16, format);
} else if (!strcmp(name, "gsm")) {
--- main/rtp_engine.c (Asterisk 13.13.1)
+++ main/rtp_engine.c (working copy)
@@ -2264,2 +2264,4 @@ int ast_rtp_engine_init(void)
+ set_next_mime_type(ast_format_alaw16, 0, "audio", "PCMA", 16000);
+
/* Define the static rtp payload mappings */
@@ -2307,2 +2309,4 @@ int ast_rtp_engine_init(void)
add_static_payload(107, ast_format_opus, 0);
+
+ add_static_payload(-1, ast_format_alaw16, 0);