Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a3922ed7
提交
a3922ed7
authored
9月 26, 2008
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add name to spans
git-svn-id:
http://svn.openzap.org/svn/openzap/trunk@565
a93c3328-9c30-0410-af19-c9cd2b2d52af
上级
7c004d59
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
68 行增加
和
6 行删除
+68
-6
mod_openzap.c
libs/freetdm/mod_openzap/mod_openzap.c
+22
-3
openzap.h
libs/freetdm/src/include/openzap.h
+2
-0
zap_io.c
libs/freetdm/src/zap_io.c
+44
-3
没有找到文件。
libs/freetdm/mod_openzap/mod_openzap.c
浏览文件 @
a3922ed7
...
...
@@ -1528,6 +1528,7 @@ static switch_status_t load_config(void)
if
((
spans
=
switch_xml_child
(
cfg
,
"analog_spans"
)))
{
for
(
myspan
=
switch_xml_child
(
spans
,
"span"
);
myspan
;
myspan
=
myspan
->
next
)
{
char
*
id
=
(
char
*
)
switch_xml_attr_soft
(
myspan
,
"id"
);
char
*
name
=
(
char
*
)
switch_xml_attr
(
myspan
,
"name"
);
char
*
context
=
"default"
;
char
*
dialplan
=
"XML"
;
char
*
tonegroup
=
NULL
;
...
...
@@ -1539,7 +1540,8 @@ static switch_status_t load_config(void)
uint32_t
span_id
=
0
,
to
=
0
,
max
=
0
;
zap_span_t
*
span
=
NULL
;
analog_option_t
analog_options
=
ANALOG_OPTION_NONE
;
zap_status_t
zstatus
=
ZAP_FAIL
;
for
(
param
=
switch_xml_child
(
myspan
,
"param"
);
param
;
param
=
param
->
next
)
{
char
*
var
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"name"
);
char
*
val
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"value"
);
...
...
@@ -1570,7 +1572,7 @@ static switch_status_t load_config(void)
continue
;
}
span_id
=
atoi
(
id
);
if
(
!
tonegroup
)
{
tonegroup
=
"us"
;
...
...
@@ -1584,10 +1586,27 @@ static switch_status_t load_config(void)
max
=
atoi
(
max_digits
);
}
if
(
zap_span_find
(
span_id
,
&
span
)
!=
ZAP_SUCCESS
)
{
if
(
name
)
{
zstatus
=
zap_span_find_by_name
(
name
,
&
span
);
}
else
{
if
(
switch_is_number
(
id
))
{
span_id
=
atoi
(
id
);
zstatus
=
zap_span_find
(
span_id
,
&
span
);
}
if
(
zstatus
!=
ZAP_SUCCESS
)
{
zstatus
=
zap_span_find_by_name
(
id
,
&
span
);
}
}
if
(
zstatus
!=
ZAP_SUCCESS
)
{
zap_log
(
ZAP_LOG_ERROR
,
"Error finding OpenZAP span %d
\n
"
,
span_id
);
continue
;
}
if
(
!
span_id
)
{
span_id
=
span
->
span_id
;
}
if
(
zap_configure_span
(
"analog"
,
span
,
on_analog_signal
,
"tonemap"
,
tonegroup
,
...
...
libs/freetdm/src/include/openzap.h
浏览文件 @
a3922ed7
...
...
@@ -466,6 +466,7 @@ struct zap_analog_data {
struct
zap_span
{
zap_data_type_t
data_type
;
char
*
name
;
uint32_t
span_id
;
uint32_t
chan_count
;
uint32_t
active_count
;
...
...
@@ -592,6 +593,7 @@ zap_status_t zap_configure_span(const char *type, zap_span_t *span, zio_signal_c
zap_status_t
zap_span_start
(
zap_span_t
*
span
);
int
zap_load_module
(
const
char
*
name
);
int
zap_load_module_assume
(
const
char
*
name
);
zap_status_t
zap_span_find_by_name
(
const
char
*
name
,
zap_span_t
**
span
);
ZIO_CODEC_FUNCTION
(
zio_slin2ulaw
);
ZIO_CODEC_FUNCTION
(
zio_ulaw2slin
);
...
...
libs/freetdm/src/zap_io.c
浏览文件 @
a3922ed7
...
...
@@ -76,6 +76,7 @@ zap_time_t zap_current_time_in_ms(void)
static
struct
{
zap_hash_t
*
interface_hash
;
zap_hash_t
*
module_hash
;
zap_hash_t
*
span_hash
;
zap_mutex_t
*
mutex
;
struct
zap_span
*
spans
[
ZAP_MAX_SPANS_INTERFACE
+
1
];
uint32_t
span_index
;
...
...
@@ -460,6 +461,19 @@ zap_status_t zap_span_add_channel(zap_span_t *span, zap_socket_t sockfd, zap_cha
return
ZAP_FAIL
;
}
zap_status_t
zap_span_find_by_name
(
const
char
*
name
,
zap_span_t
**
span
)
{
zap_status_t
status
=
ZAP_FAIL
;
zap_mutex_lock
(
globals
.
mutex
);
if
(
!
zap_strlen_zero
(
name
)
&&
(
*
span
=
hashtable_search
(
globals
.
span_hash
,
(
void
*
)
name
)))
{
status
=
ZAP_SUCCESS
;
}
zap_mutex_unlock
(
globals
.
mutex
);
return
status
;
}
zap_status_t
zap_span_find
(
uint32_t
id
,
zap_span_t
**
span
)
{
zap_span_t
*
fspan
;
...
...
@@ -1965,10 +1979,12 @@ static zap_status_t load_config(void)
if
(
!
strncasecmp
(
cfg
.
category
,
"span"
,
4
))
{
if
(
cfg
.
catno
!=
catno
)
{
char
*
type
=
cfg
.
category
+
4
;
char
*
name
;
if
(
*
type
==
' '
)
{
type
++
;
}
zap_log
(
ZAP_LOG_DEBUG
,
"found config for span
\n
"
);
catno
=
cfg
.
catno
;
...
...
@@ -1977,7 +1993,9 @@ static zap_status_t load_config(void)
span
=
NULL
;
continue
;
}
name
=
strchr
(
type
,
' '
);
zap_mutex_lock
(
globals
.
mutex
);
if
(
!
(
zio
=
(
zap_io_interface_t
*
)
hashtable_search
(
globals
.
interface_hash
,
type
)))
{
zap_load_module_assume
(
type
);
...
...
@@ -2001,8 +2019,25 @@ static zap_status_t load_config(void)
if
(
zap_span_create
(
zio
,
&
span
)
==
ZAP_SUCCESS
)
{
span
->
type
=
strdup
(
type
);
zap_log
(
ZAP_LOG_DEBUG
,
"created span %d of type %s
\n
"
,
span
->
span_id
,
type
);
d
=
0
;
zap_mutex_lock
(
globals
.
mutex
);
if
(
!
zap_strlen_zero
(
name
)
&&
hashtable_search
(
globals
.
span_hash
,
(
void
*
)
name
))
{
zap_log
(
ZAP_LOG_WARNING
,
"name %s is already used, substituting 'span%d' as the name
\n
"
,
span
->
span_id
);
name
=
NULL
;
}
if
(
!
name
)
{
char
buf
[
128
]
=
""
;
snprintf
(
buf
,
sizeof
(
buf
),
"span%d"
,
span
->
span_id
);
name
=
buf
;
}
span
->
name
=
strdup
(
name
);
hashtable_insert
(
globals
.
span_hash
,
(
void
*
)
span
->
name
,
span
);
zap_mutex_unlock
(
globals
.
mutex
);
zap_log
(
ZAP_LOG_DEBUG
,
"created span %d (%s) of type %s
\n
"
,
span
->
span_id
,
span
->
name
,
type
);
}
else
{
zap_log
(
ZAP_LOG_CRIT
,
"failure creating span of type %s
\n
"
,
type
);
span
=
NULL
;
...
...
@@ -2342,6 +2377,7 @@ zap_status_t zap_global_init(void)
memset
(
&
interfaces
,
0
,
sizeof
(
interfaces
));
globals
.
interface_hash
=
create_hashtable
(
16
,
zap_hash_hashfromstring
,
zap_hash_equalkeys
);
globals
.
module_hash
=
create_hashtable
(
16
,
zap_hash_hashfromstring
,
zap_hash_equalkeys
);
globals
.
span_hash
=
create_hashtable
(
16
,
zap_hash_hashfromstring
,
zap_hash_equalkeys
);
modcount
=
0
;
zap_mutex_create
(
&
globals
.
mutex
);
...
...
@@ -2397,7 +2433,11 @@ zap_status_t zap_global_destroy(void)
zap_safe_free
(
cur_span
->
signal_data
);
zap_span_destroy
(
cur_span
);
}
zap_mutex_lock
(
globals
.
mutex
);
hashtable_remove
(
globals
.
span_hash
,
(
void
*
)
cur_span
->
name
);
zap_mutex_unlock
(
globals
.
mutex
);
zap_safe_free
(
cur_span
->
type
);
zap_safe_free
(
cur_span
->
name
);
free
(
cur_span
);
cur_span
=
NULL
;
}
...
...
@@ -2409,6 +2449,7 @@ zap_status_t zap_global_destroy(void)
zap_mutex_lock
(
globals
.
mutex
);
hashtable_destroy
(
globals
.
interface_hash
,
0
,
0
);
hashtable_destroy
(
globals
.
module_hash
,
0
,
0
);
hashtable_destroy
(
globals
.
span_hash
,
0
,
0
);
zap_mutex_unlock
(
globals
.
mutex
);
zap_mutex_destroy
(
&
globals
.
mutex
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论