Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
e6129e04
提交
e6129e04
authored
3月 30, 2010
作者:
root
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added load/noload options for the supported codecs
上级
91feec30
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
59 行增加
和
7 行删除
+59
-7
sangoma_codec.conf.xml
conf/autoload_configs/sangoma_codec.conf.xml
+13
-1
Makefile
src/mod/codecs/mod_sangoma_codec/Makefile
+1
-1
mod_sangoma_codec.c
src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c
+45
-5
没有找到文件。
conf/autoload_configs/sangoma_codec.conf.xml
浏览文件 @
e6129e04
<configuration
name=
"sangoma_codec.conf"
description=
"Sangoma Codec Configuration"
>
<configuration
name=
"sangoma_codec.conf"
description=
"Sangoma Codec Configuration"
>
<settings>
<settings>
<!-- nothing to put here yet -->
<!--
Comma separated list of codecs to register with FreeSWITCH,
by default (if this parameter is not set) all available codecs are registered.
Valid codec values are: PCMU,PCMA,L16,G729,G726-32,GSM
<param name="load" value="all"/>
-->
<!-- List of codecs to not register with FreeSWITCH, by default this is empty,
but you may want to not load PCMU and PCMA or may be others to not use your
vocallo resources in codecs that are done well and fast in software.
<param name="noload" value="PCMU,PCMA"/>
-->
</settings>
</settings>
<vocallos>
<vocallos>
<!-- The name of the vocallo is the ethernet device name as displayed by ifconfig -->
<vocallo
name=
"eth5"
>
<vocallo
name=
"eth5"
>
<!-- Starting UDP port for the vocallo -->
<!-- Starting UDP port for the vocallo -->
<param
name=
"baseudp"
value=
"5000"
/>
<param
name=
"baseudp"
value=
"5000"
/>
...
...
src/mod/codecs/mod_sangoma_codec/Makefile
浏览文件 @
e6129e04
BASE
=
../../../..
BASE
=
../../../..
LOCAL_LDFLAGS
+=
-ls
angoma_transcode
LOCAL_LDFLAGS
+=
-ls
ng-tc
include
$(BASE)/build/modmake.rules
include
$(BASE)/build/modmake.rules
src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c
浏览文件 @
e6129e04
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
#include "switch.h"
#include "switch.h"
#include "g711.h"
#include "g711.h"
#include <s
angoma_transcode
.h>
#include <s
ng_tc/sng_tc
.h>
#ifdef __linux__
#ifdef __linux__
/* for ethernet device query */
/* for ethernet device query */
...
@@ -101,13 +101,21 @@ vocallo_codec_t g_codec_map[] =
...
@@ -101,13 +101,21 @@ vocallo_codec_t g_codec_map[] =
{
SNGTC_CODEC_G729AB
,
18
,
"G729"
,
"Sangoma G729"
,
40
,
8000
,
10000
,
80
,
160
,
10
,
1
},
{
SNGTC_CODEC_G729AB
,
18
,
"G729"
,
"Sangoma G729"
,
40
,
8000
,
10000
,
80
,
160
,
10
,
1
},
{
SNGTC_CODEC_G726_32
,
122
,
"G726-32"
,
"Sangoma G.726 32k"
,
40
,
32000
,
10000
,
80
,
160
,
40
,
1
},
{
SNGTC_CODEC_G726_32
,
122
,
"G726-32"
,
"Sangoma G.726 32k"
,
40
,
32000
,
10000
,
80
,
160
,
40
,
1
},
{
SNGTC_CODEC_GSM_FR
,
3
,
"GSM"
,
"Sangoma GSM"
,
20
,
13200
,
20000
,
160
,
320
,
33
,
0
},
{
SNGTC_CODEC_GSM_FR
,
3
,
"GSM"
,
"Sangoma GSM"
,
20
,
13200
,
20000
,
160
,
320
,
33
,
0
},
#if 0
/* FIXME: grandstream crashes with iLBC implementation */
/* FIXME: grandstream crashes with iLBC implementation */
{ SNGTC_CODEC_ILBC, 97, "iLBC", "Sangoma ILBC", -1, -1, -1, -1, -1, -1, 0 },
{ SNGTC_CODEC_ILBC, 97, "iLBC", "Sangoma ILBC", -1, -1, -1, -1, -1, -1, 0 },
/* FIXME: sampling rate seems wrong with this, audioooo soooundssssss sloooooow ... */
/* FIXME: sampling rate seems wrong with this, audioooo soooundssssss sloooooow ... */
{ SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 20000, 160, 640, 160, 0 },
{ SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 20000, 160, 640, 160, 0 },
#endif
{
-
1
,
-
1
,
NULL
,
NULL
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
},
{
-
1
,
-
1
,
NULL
,
NULL
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
},
};
};
/* default codec list to load, users may override, special codec 'all' loads everything available unless listed in noload */
static
char
g_codec_load_list
[
1024
]
=
"all"
;
/* default codec list to NOT load, users may override */
static
char
g_codec_noload_list
[
1024
]
=
""
;
struct
codec_data
{
struct
codec_data
{
/* sngtc request and reply */
/* sngtc request and reply */
sngtc_codec_request_t
request
;
sngtc_codec_request_t
request
;
...
@@ -206,8 +214,8 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r
...
@@ -206,8 +214,8 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r
rtp_session
=
switch_rtp_new
(
local_ip
,
rtp_port
,
rtp_session
=
switch_rtp_new
(
local_ip
,
rtp_port
,
codec_ip
,
codec_reply_leg
->
codec_udp_port
,
codec_ip
,
codec_reply_leg
->
codec_udp_port
,
iana
,
iana
,
codec_reg_leg
->
ms
*
8
,
/* samples per interval, FIXME: do based on sampling rate */
sess
->
impl
->
samples_per_packet
,
codec_reg_leg
->
ms
*
1000
,
/* ms per packet */
codec_reg_leg
->
ms
*
1000
,
/* m
icrosecond
s per packet */
flags
,
NULL
,
&
err
,
g_pool
);
flags
,
NULL
,
&
err
,
g_pool
);
if
(
!
rtp_session
)
{
if
(
!
rtp_session
)
{
...
@@ -845,6 +853,21 @@ static int sangoma_parse_config(void)
...
@@ -845,6 +853,21 @@ static int sangoma_parse_config(void)
if
((
settings
=
switch_xml_child
(
cfg
,
"settings"
)))
{
if
((
settings
=
switch_xml_child
(
cfg
,
"settings"
)))
{
/* nothing here yet */
/* nothing here yet */
for
(
param
=
switch_xml_child
(
settings
,
"param"
);
param
;
param
=
param
->
next
)
{
char
*
var
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"name"
);
char
*
val
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"value"
);
/* this parameter overrides the default list of codecs to load */
if
(
!
strcasecmp
(
var
,
"load"
))
{
strncpy
(
g_codec_load_list
,
val
,
sizeof
(
g_codec_load_list
)
-
1
);
g_codec_load_list
[
sizeof
(
g_codec_load_list
)
-
1
]
=
0
;
}
else
if
(
!
strcasecmp
(
var
,
"noload"
))
{
strncpy
(
g_codec_noload_list
,
val
,
sizeof
(
g_codec_noload_list
)
-
1
);
g_codec_noload_list
[
sizeof
(
g_codec_noload_list
)
-
1
]
=
0
;
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Ignored unknown Sangoma codec setting %s
\n
"
,
var
);
}
}
}
}
if
((
vocallos
=
switch_xml_child
(
cfg
,
"vocallos"
)))
{
if
((
vocallos
=
switch_xml_child
(
cfg
,
"vocallos"
)))
{
...
@@ -888,7 +911,7 @@ static int sangoma_parse_config(void)
...
@@ -888,7 +911,7 @@ static int sangoma_parse_config(void)
}
}
g_init_cfg
.
host_nic_vocallo_cfg
[
vidx
].
vocallo_ip
=
ntohl
(
vocallo_base_ip
.
s_addr
);
g_init_cfg
.
host_nic_vocallo_cfg
[
vidx
].
vocallo_ip
=
ntohl
(
vocallo_base_ip
.
s_addr
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Ignored unknown Sangoma
codec setting %s
\n
"
,
val
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Ignored unknown Sangoma
vocallo setting %s
\n
"
,
var
);
}
}
}
}
...
@@ -966,11 +989,28 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load)
...
@@ -966,11 +989,28 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load)
*
module_interface
=
switch_loadable_module_create_module_interface
(
pool
,
modname
);
*
module_interface
=
switch_loadable_module_create_module_interface
(
pool
,
modname
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Loading codecs, load='%s', noload='%s'
\n
"
,
g_codec_load_list
,
g_codec_noload_list
);
for
(
c
=
0
;
g_codec_map
[
c
].
codec_id
!=
-
1
;
c
++
)
{
for
(
c
=
0
;
g_codec_map
[
c
].
codec_id
!=
-
1
;
c
++
)
{
/* check if the codec is in the load list, otherwise skip it */
if
(
strcasecmp
(
g_codec_load_list
,
"all"
)
&&
!
strcasestr
(
g_codec_load_list
,
g_codec_map
[
c
].
iana_name
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Not loading codec %s because was not found in the load list
\n
"
,
g_codec_map
[
c
].
iana_name
);
continue
;
}
/* load it unless is named in the noload list */
if
(
strcasestr
(
g_codec_noload_list
,
g_codec_map
[
c
].
iana_name
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Not loading codec %s because was not found in the noload list
\n
"
,
g_codec_map
[
c
].
iana_name
);
continue
;
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Registering implementations for codec %s
\n
"
,
g_codec_map
[
c
].
iana_name
);
/* let know the library which iana to use */
/* let know the library which iana to use */
sngtc_set_iana_code_based_on_codec_id
(
g_codec_map
[
c
].
codec_id
,
g_codec_map
[
c
].
iana
);
sngtc_set_iana_code_based_on_codec_id
(
g_codec_map
[
c
].
codec_id
,
g_codec_map
[
c
].
iana
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"Mapped codec %d to IANA %d
\n
"
,
g_codec_map
[
c
].
codec_id
,
g_codec_map
[
c
].
iana
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"Mapped codec %d to IANA %d
\n
"
,
g_codec_map
[
c
].
codec_id
,
g_codec_map
[
c
].
iana
);
/* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface
/* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface
* list the core keeps, gets a codec id and set the given codec name to it.
* list the core keeps, gets a codec id and set the given codec name to it.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论