Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
90c040ec
提交
90c040ec
authored
5月 11, 2010
作者:
Michael S Collins
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
git://git.freeswitch.org/freeswitch
上级
b85e015b
383e272c
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
660 行增加
和
74 行删除
+660
-74
Makefile
libs/freetdm/sample/boost/Makefile
+10
-0
ftdmstart.c
libs/freetdm/sample/boost/ftdmstart.c
+476
-0
ftdm_dso.c
libs/freetdm/src/ftdm_dso.c
+14
-4
ftdm_io.c
libs/freetdm/src/ftdm_io.c
+65
-41
ftdm_sangoma_boost.h
...reetdm/src/ftmod/ftmod_sangoma_boost/ftdm_sangoma_boost.h
+2
-1
ftmod_sangoma_boost.c
...eetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c
+32
-7
freetdm.h
libs/freetdm/src/include/freetdm.h
+57
-4
ftdm_dso.h
libs/freetdm/src/include/private/ftdm_dso.h
+2
-1
ftdm_types.h
libs/freetdm/src/include/private/ftdm_types.h
+0
-14
switch_utils.c
src/switch_utils.c
+2
-2
没有找到文件。
libs/freetdm/sample/boost/Makefile
0 → 100644
浏览文件 @
90c040ec
CC
=
gcc
CFLAGS
=
-Wall
-I
/usr/local/freeswitch/include
LDFLAGS
=
-L
/usr/local/freeswitch/lib
-lfreetdm
ftdmstart
:
ftdmstart.o
clean
:
rm
-rf
ftdmstart.o
libs/freetdm/sample/boost/ftdmstart.c
0 → 100644
浏览文件 @
90c040ec
差异被折叠。
点击展开。
libs/freetdm/src/ftdm_dso.c
浏览文件 @
90c040ec
...
...
@@ -27,11 +27,12 @@
#include <stdio.h>
FT_DECLARE
(
void
)
ftdm_dso_destroy
(
ftdm_dso_lib_t
*
lib
)
{
FT_DECLARE
(
ftdm_status_t
)
ftdm_dso_destroy
(
ftdm_dso_lib_t
*
lib
)
{
if
(
lib
&&
*
lib
)
{
FreeLibrary
(
*
lib
);
*
lib
=
NULL
;
}
return
FTDM_SUCCESS
;
}
FT_DECLARE
(
ftdm_dso_lib_t
)
ftdm_dso_open
(
const
char
*
path
,
char
**
err
)
{
...
...
@@ -78,11 +79,20 @@ FT_DECLARE(void*) ftdm_dso_func_sym(ftdm_dso_lib_t lib, const char *sym, char **
#include <dlfcn.h>
FT_DECLARE
(
void
)
ftdm_dso_destroy
(
ftdm_dso_lib_t
*
lib
)
{
FT_DECLARE
(
ftdm_status_t
)
ftdm_dso_destroy
(
ftdm_dso_lib_t
*
lib
)
{
int
rc
;
if
(
lib
&&
*
lib
)
{
dlclose
(
*
lib
);
rc
=
dlclose
(
*
lib
);
if
(
rc
)
{
ftdm_log
(
FTDM_LOG_ERROR
,
"Failed to close lib %p: %s
\n
"
,
*
lib
,
dlerror
());
return
FTDM_FAIL
;
}
ftdm_log
(
FTDM_LOG_DEBUG
,
"lib %p was closed with success
\n
"
,
*
lib
);
*
lib
=
NULL
;
return
FTDM_SUCCESS
;
}
ftdm_log
(
FTDM_LOG_ERROR
,
"Invalid pointer provided to ftdm_dso_destroy
\n
"
);
return
FTDM_FAIL
;
}
FT_DECLARE
(
ftdm_dso_lib_t
)
ftdm_dso_open
(
const
char
*
path
,
char
**
err
)
{
...
...
@@ -93,7 +103,7 @@ FT_DECLARE(ftdm_dso_lib_t) ftdm_dso_open(const char *path, char **err) {
return
lib
;
}
FT_DECLARE
(
void
*
)
ftdm_dso_func_sym
(
ftdm_dso_lib_t
lib
,
const
char
*
sym
,
char
**
err
)
{
FT_DECLARE
(
void
*
)
ftdm_dso_func_sym
(
ftdm_dso_lib_t
lib
,
const
char
*
sym
,
char
**
err
)
{
void
*
func
=
dlsym
(
lib
,
sym
);
if
(
!
func
)
{
*
err
=
ftdm_strdup
(
dlerror
());
...
...
libs/freetdm/src/ftdm_io.c
浏览文件 @
90c040ec
...
...
@@ -522,17 +522,41 @@ FT_DECLARE(ftdm_status_t) ftdm_span_stop(ftdm_span_t *span)
return
FTDM_FAIL
;
}
FT_DECLARE
(
ftdm_status_t
)
ftdm_span_create
(
ftdm_io_interface_t
*
fio
,
ftdm_span_t
**
span
,
const
char
*
name
)
FT_DECLARE
(
ftdm_status_t
)
ftdm_span_create
(
const
char
*
iotype
,
const
char
*
name
,
ftdm_span_t
**
span
)
{
ftdm_span_t
*
new_span
=
NULL
;
ftdm_io_interface_t
*
fio
=
NULL
;
ftdm_status_t
status
=
FTDM_FAIL
;
char
buf
[
128
]
=
""
;
ftdm_assert
(
fio
!=
NULL
,
"No IO provided
\n
"
);
ftdm_assert_return
(
iotype
!=
NULL
,
FTDM_FAIL
,
"No IO type provided
\n
"
);
ftdm_assert_return
(
name
!=
NULL
,
FTDM_FAIL
,
"No span name provided
\n
"
);
*
span
=
NULL
;
ftdm_mutex_lock
(
globals
.
mutex
);
if
(
!
(
fio
=
(
ftdm_io_interface_t
*
)
hashtable_search
(
globals
.
interface_hash
,
(
void
*
)
iotype
)))
{
ftdm_load_module_assume
(
iotype
);
if
((
fio
=
(
ftdm_io_interface_t
*
)
hashtable_search
(
globals
.
interface_hash
,
(
void
*
)
iotype
)))
{
ftdm_log
(
FTDM_LOG_INFO
,
"Auto-loaded I/O module '%s'
\n
"
,
iotype
);
}
}
ftdm_mutex_unlock
(
globals
.
mutex
);
if
(
!
fio
)
{
ftdm_log
(
FTDM_LOG_CRIT
,
"failure creating span, no such I/O type '%s'
\n
"
,
iotype
);
return
FTDM_FAIL
;
}
if
(
!
fio
->
configure_span
)
{
ftdm_log
(
FTDM_LOG_CRIT
,
"failure creating span, no configure_span method for I/O type '%s'
\n
"
,
iotype
);
return
FTDM_FAIL
;
}
ftdm_mutex_lock
(
globals
.
mutex
);
if
(
globals
.
span_index
<
FTDM_MAX_SPANS_INTERFACE
)
{
new_span
=
ftdm_calloc
(
sizeof
(
*
new_span
),
1
);
ftdm_assert
(
new_span
,
"allocating span failed
\n
"
);
status
=
ftdm_mutex_create
(
&
new_span
->
mutex
);
...
...
@@ -556,11 +580,11 @@ FT_DECLARE(ftdm_status_t) ftdm_span_create(ftdm_io_interface_t *fio, ftdm_span_t
ftdm_mutex_unlock
(
globals
.
span_mutex
);
if
(
!
name
)
{
char
buf
[
128
]
=
""
;
snprintf
(
buf
,
sizeof
(
buf
),
"span%d"
,
new_span
->
span_id
);
name
=
buf
;
}
new_span
->
name
=
ftdm_strdup
(
name
);
new_span
->
type
=
ftdm_strdup
(
iotype
);
ftdm_span_add
(
new_span
);
*
span
=
new_span
;
status
=
FTDM_SUCCESS
;
...
...
@@ -1657,6 +1681,16 @@ FT_DECLARE(const char *) ftdm_channel_get_span_name(const ftdm_channel_t *ftdmch
return
ftdmchan
->
span
->
name
;
}
FT_DECLARE
(
void
)
ftdm_span_set_trunk_type
(
ftdm_span_t
*
span
,
ftdm_trunk_type_t
type
)
{
span
->
trunk_type
=
type
;
}
FT_DECLARE
(
ftdm_trunk_type_t
)
ftdm_span_get_trunk_type
(
const
ftdm_span_t
*
span
)
{
return
span
->
trunk_type
;
}
FT_DECLARE
(
uint32_t
)
ftdm_span_get_id
(
const
ftdm_span_t
*
span
)
{
return
span
->
span_id
;
...
...
@@ -3227,7 +3261,15 @@ static ftdm_status_t ftdm_set_channels_alarms(ftdm_span_t *span, int currindex)
FT_DECLARE
(
ftdm_status_t
)
ftdm_configure_span_channels
(
ftdm_span_t
*
span
,
const
char
*
str
,
ftdm_channel_config_t
*
chan_config
,
unsigned
*
configured
)
{
int
currindex
=
span
->
chan_count
;
int
currindex
;
ftdm_assert_return
(
span
!=
NULL
,
FTDM_EINVAL
,
"span is null
\n
"
);
ftdm_assert_return
(
chan_config
!=
NULL
,
FTDM_EINVAL
,
"config is null
\n
"
);
ftdm_assert_return
(
configured
!=
NULL
,
FTDM_EINVAL
,
"configured pointer is null
\n
"
);
ftdm_assert_return
(
span
->
fio
!=
NULL
,
FTDM_EINVAL
,
"span with no I/O configured
\n
"
);
ftdm_assert_return
(
span
->
fio
->
configure_span
!=
NULL
,
FTDM_NOTIMPL
,
"span I/O with no channel configuration implemented
\n
"
);
currindex
=
span
->
chan_count
;
*
configured
=
0
;
*
configured
=
span
->
fio
->
configure_span
(
span
,
str
,
chan_config
->
type
,
chan_config
->
name
,
chan_config
->
number
);
if
(
!*
configured
)
{
...
...
@@ -3235,18 +3277,24 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_channels(ftdm_span_t *span, const
return
FTDM_FAIL
;
}
if
(
ftdm_group_add_channels
(
span
,
currindex
,
chan_config
->
group_name
)
!=
FTDM_SUCCESS
)
{
ftdm_log
(
FTDM_LOG_ERROR
,
"%d:Failed to add channels to group %s
\n
"
,
span
->
span_id
,
chan_config
->
group_name
);
if
(
chan_config
->
group_name
[
0
])
{
if
(
ftdm_group_add_channels
(
span
,
currindex
,
chan_config
->
group_name
)
!=
FTDM_SUCCESS
)
{
ftdm_log
(
FTDM_LOG_ERROR
,
"%d:Failed to add channels to group %s
\n
"
,
span
->
span_id
,
chan_config
->
group_name
);
return
FTDM_FAIL
;
}
}
if
(
ftdm_set_channels_gains
(
span
,
currindex
,
chan_config
->
rxgain
,
chan_config
->
txgain
)
!=
FTDM_SUCCESS
)
{
ftdm_log
(
FTDM_LOG_ERROR
,
"%d:Failed to set channel gains
\n
"
,
span
->
span_id
);
return
FTDM_FAIL
;
}
if
(
ftdm_set_channels_alarms
(
span
,
currindex
)
!=
FTDM_SUCCESS
)
{
ftdm_log
(
FTDM_LOG_ERROR
,
"%d:Failed to set channel alarms
\n
"
,
span
->
span_id
);
return
FTDM_FAIL
;
}
if
(
ftdm_set_channels_gains
(
span
,
currindex
,
chan_config
->
rxgain
,
chan_config
->
txgain
)
!=
FTDM_SUCCESS
)
{
ftdm_log
(
FTDM_LOG_ERROR
,
"%d:Failed to set channel gains
\n
"
,
span
->
span_id
);
return
FTDM_FAIL
;
}
return
FTDM_SUCCESS
;
}
...
...
@@ -3260,7 +3308,6 @@ static ftdm_status_t load_config(void)
int
intparam
=
0
;
ftdm_span_t
*
span
=
NULL
;
unsigned
configured
=
0
,
d
=
0
;
ftdm_io_interface_t
*
fio
=
NULL
;
ftdm_analog_start_type_t
tmp
;
ftdm_size_t
len
=
0
;
ftdm_channel_config_t
chan_config
;
...
...
@@ -3271,7 +3318,7 @@ static ftdm_status_t load_config(void)
if
(
!
ftdm_config_open_file
(
&
cfg
,
cfg_name
))
{
return
FTDM_FAIL
;
}
ftdm_log
(
FTDM_LOG_DEBUG
,
"Reading FreeTDM configuration file
\n
"
);
while
(
ftdm_config_next_pair
(
&
cfg
,
&
var
,
&
val
))
{
if
(
*
cfg
.
category
==
'#'
)
{
if
(
cfg
.
catno
!=
catno
)
{
...
...
@@ -3300,33 +3347,9 @@ static ftdm_status_t load_config(void)
*
name
++
=
'\0'
;
}
ftdm_mutex_lock
(
globals
.
mutex
);
if
(
!
(
fio
=
(
ftdm_io_interface_t
*
)
hashtable_search
(
globals
.
interface_hash
,
type
)))
{
ftdm_load_module_assume
(
type
);
if
((
fio
=
(
ftdm_io_interface_t
*
)
hashtable_search
(
globals
.
interface_hash
,
type
)))
{
ftdm_log
(
FTDM_LOG_INFO
,
"auto-loaded '%s'
\n
"
,
type
);
}
}
ftdm_mutex_unlock
(
globals
.
mutex
);
if
(
!
fio
)
{
ftdm_log
(
FTDM_LOG_CRIT
,
"failure creating span, no such type '%s'
\n
"
,
type
);
span
=
NULL
;
continue
;
}
if
(
!
fio
->
configure_span
)
{
ftdm_log
(
FTDM_LOG_CRIT
,
"failure creating span, no configure_span method for '%s'
\n
"
,
type
);
span
=
NULL
;
continue
;
}
if
(
ftdm_span_create
(
fio
,
&
span
,
name
)
==
FTDM_SUCCESS
)
{
span
->
type
=
ftdm_strdup
(
type
);
d
=
0
;
if
(
ftdm_span_create
(
type
,
name
,
&
span
)
==
FTDM_SUCCESS
)
{
ftdm_log
(
FTDM_LOG_DEBUG
,
"created span %d (%s) of type %s
\n
"
,
span
->
span_id
,
span
->
name
,
type
);
d
=
0
;
}
else
{
ftdm_log
(
FTDM_LOG_CRIT
,
"failure creating span of type %s
\n
"
,
type
);
span
=
NULL
;
...
...
@@ -3341,8 +3364,9 @@ static ftdm_status_t load_config(void)
ftdm_log
(
FTDM_LOG_DEBUG
,
"span %d [%s]=[%s]
\n
"
,
span
->
span_id
,
var
,
val
);
if
(
!
strcasecmp
(
var
,
"trunk_type"
))
{
span
->
trunk_type
=
ftdm_str2ftdm_trunk_type
(
val
);
ftdm_log
(
FTDM_LOG_DEBUG
,
"setting trunk type to '%s'
\n
"
,
ftdm_trunk_type2str
(
span
->
trunk_type
));
ftdm_trunk_type_t
trtype
=
ftdm_str2ftdm_trunk_type
(
val
);
ftdm_span_set_trunk_type
(
span
,
trtype
);
ftdm_log
(
FTDM_LOG_DEBUG
,
"setting trunk type to '%s'
\n
"
,
ftdm_trunk_type2str
(
trtype
));
}
else
if
(
!
strcasecmp
(
var
,
"name"
))
{
if
(
!
strcasecmp
(
val
,
"undef"
))
{
chan_config
.
name
[
0
]
=
'\0'
;
...
...
@@ -3371,7 +3395,7 @@ static ftdm_status_t load_config(void)
ftdm_analog_start_type2str
(
span
->
start_type
));
}
if
(
span
->
trunk_type
==
FTDM_TRUNK_FXO
)
{
unsigned
chans_configured
=
0
;
unsigned
chans_configured
=
0
;
chan_config
.
type
=
FTDM_CHAN_TYPE_FXO
;
if
(
ftdm_configure_span_channels
(
span
,
val
,
&
chan_config
,
&
chans_configured
)
==
FTDM_SUCCESS
)
{
configured
+=
chans_configured
;
...
...
libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftdm_sangoma_boost.h
浏览文件 @
90c040ec
...
...
@@ -40,7 +40,8 @@
typedef
enum
{
FTDM_SANGOMA_BOOST_RUNNING
=
(
1
<<
0
),
FTDM_SANGOMA_BOOST_RESTARTING
=
(
1
<<
1
)
FTDM_SANGOMA_BOOST_RESTARTING
=
(
1
<<
1
),
FTDM_SANGOMA_BOOST_EVENTS_RUNNING
=
(
1
<<
2
),
}
ftdm_sangoma_boost_flag_t
;
typedef
struct
ftdm_sangoma_boost_data
{
...
...
libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c
浏览文件 @
90c040ec
...
...
@@ -1721,18 +1721,22 @@ static __inline__ ftdm_status_t check_events(ftdm_span_t *span, int ms_timeout)
*/
static
void
*
ftdm_sangoma_events_run
(
ftdm_thread_t
*
me
,
void
*
obj
)
{
ftdm_span_t
*
span
=
(
ftdm_span_t
*
)
obj
;
ftdm_span_t
*
span
=
(
ftdm_span_t
*
)
obj
;
ftdm_sangoma_boost_data_t
*
sangoma_boost_data
=
span
->
signal_data
;
unsigned
errs
=
0
;
while
(
ftdm_test_flag
(
sangoma_boost_data
,
FTDM_SANGOMA_BOOST_RUNNING
)
&&
ftdm_running
())
{
if
(
check_events
(
span
,
100
)
!=
FTDM_SUCCESS
)
{
while
(
ftdm_test_flag
(
sangoma_boost_data
,
FTDM_SANGOMA_BOOST_
EVENTS_
RUNNING
)
&&
ftdm_running
())
{
if
(
check_events
(
span
,
100
)
!=
FTDM_SUCCESS
)
{
if
(
errs
++
>
50
)
{
ftdm_log
(
FTDM_LOG_ERROR
,
"Too many event errors, quitting sangoma events thread
\n
"
);
return
NULL
;
}
}
}
ftdm_log
(
FTDM_LOG_DEBUG
,
"Sangoma Boost Events thread ended.
\n
"
);
ftdm_clear_flag
(
sangoma_boost_data
,
FTDM_SANGOMA_BOOST_EVENTS_RUNNING
);
return
NULL
;
}
...
...
@@ -2138,12 +2142,13 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_boost_destroy)
const
void
*
key
=
NULL
;
void
*
val
=
NULL
;
ftdm_dso_lib_t
lib
;
ftdm_log
(
FTDM_LOG_DEBUG
,
"Destroying sangoma boost module
\n
"
);
for
(
i
=
hashtable_first
(
g_boost_modules_hash
);
i
;
i
=
hashtable_next
(
i
))
{
hashtable_this
(
i
,
&
key
,
NULL
,
&
val
);
if
(
key
&&
val
)
{
sigmod
=
val
;
lib
=
sigmod
->
pvt
;
ftdm_log
(
FTDM_LOG_DEBUG
,
"destroying sigmod %s
\n
"
,
sigmod
->
name
);
ftdm_dso_destroy
(
&
lib
);
}
}
...
...
@@ -2159,18 +2164,23 @@ static ftdm_status_t ftdm_sangoma_boost_start(ftdm_span_t *span)
int
err
;
ftdm_sangoma_boost_data_t
*
sangoma_boost_data
=
span
->
signal_data
;
ftdm_set_flag
(
sangoma_boost_data
,
FTDM_SANGOMA_BOOST_RUNNING
);
err
=
ftdm_thread_create_detached
(
ftdm_sangoma_boost_run
,
span
);
err
=
ftdm_thread_create_detached
(
ftdm_sangoma_boost_run
,
span
);
if
(
err
)
{
ftdm_clear_flag
(
sangoma_boost_data
,
FTDM_SANGOMA_BOOST_RUNNING
);
return
err
;
}
// launch the events thread to handle HW DTMF and possibly
// other events in the future
err
=
ftdm_thread_create_detached
(
ftdm_sangoma_events_run
,
span
);
ftdm_set_flag
(
sangoma_boost_data
,
FTDM_SANGOMA_BOOST_EVENTS_RUNNING
);
err
=
ftdm_thread_create_detached
(
ftdm_sangoma_events_run
,
span
);
if
(
err
)
{
ftdm_clear_flag
(
sangoma_boost_data
,
FTDM_SANGOMA_BOOST_EVENTS_RUNNING
);
ftdm_clear_flag
(
sangoma_boost_data
,
FTDM_SANGOMA_BOOST_RUNNING
);
}
return
err
;
}
...
...
@@ -2179,12 +2189,16 @@ static ftdm_status_t ftdm_sangoma_boost_stop(ftdm_span_t *span)
int
cnt
=
50
;
ftdm_status_t
status
=
FTDM_SUCCESS
;
ftdm_sangoma_boost_data_t
*
sangoma_boost_data
=
span
->
signal_data
;
if
(
sangoma_boost_data
->
sigmod
)
{
/* I think stopping the span before destroying the queue makes sense
otherwise may be boost events would still arrive when the queue is already destroyed! */
status
=
sangoma_boost_data
->
sigmod
->
stop_span
(
span
);
if
(
status
!=
FTDM_SUCCESS
)
{
ftdm_log
(
FTDM_LOG_CRIT
,
"Failed to stop span %s boost signaling
\n
"
,
span
->
name
);
return
FTDM_FAIL
;
}
ftdm_queue_enqueue
(
sangoma_boost_data
->
boost_queue
,
NULL
);
return
status
;
}
while
(
ftdm_test_flag
(
sangoma_boost_data
,
FTDM_SANGOMA_BOOST_RUNNING
)
&&
cnt
--
>
0
)
{
...
...
@@ -2197,6 +2211,17 @@ static ftdm_status_t ftdm_sangoma_boost_stop(ftdm_span_t *span)
return
FTDM_FAIL
;
}
cnt
=
50
;
while
(
ftdm_test_flag
(
sangoma_boost_data
,
FTDM_SANGOMA_BOOST_EVENTS_RUNNING
)
&&
cnt
--
>
0
)
{
ftdm_log
(
FTDM_LOG_DEBUG
,
"Waiting for boost events thread
\n
"
);
ftdm_sleep
(
100
);
}
if
(
!
cnt
)
{
ftdm_log
(
FTDM_LOG_CRIT
,
"it seems boost events thread in span %s may be stuck, we may segfault :-(
\n
"
,
span
->
name
);
return
FTDM_FAIL
;
}
if
(
sangoma_boost_data
->
sigmod
)
{
ftdm_queue_destroy
(
&
sangoma_boost_data
->
boost_queue
);
}
...
...
libs/freetdm/src/include/freetdm.h
浏览文件 @
90c040ec
...
...
@@ -67,7 +67,8 @@ typedef enum {
FTDM_MEMERR
,
/*!< Memory error, most likely allocation failure */
FTDM_TIMEOUT
,
/*!< Operation timed out (ie: polling on a device)*/
FTDM_NOTIMPL
,
/*!< Operation not implemented */
FTDM_BREAK
/*!< Request the caller to perform a break (context-dependant, ie: stop getting DNIS/ANI) */
FTDM_BREAK
,
/*!< Request the caller to perform a break (context-dependant, ie: stop getting DNIS/ANI) */
FTDM_EINVAL
/*!< Invalid argument */
}
ftdm_status_t
;
/*! \brief FreeTDM bool type. */
...
...
@@ -299,6 +300,23 @@ typedef enum {
/*! \brief Move from string to ftdm_signal_event_t and viceversa */
FTDM_STR2ENUM_P
(
ftdm_str2ftdm_signal_event
,
ftdm_signal_event2str
,
ftdm_signal_event_t
)
/*! \brief Span trunk types */
typedef
enum
{
FTDM_TRUNK_E1
,
FTDM_TRUNK_T1
,
FTDM_TRUNK_J1
,
FTDM_TRUNK_BRI
,
FTDM_TRUNK_BRI_PTMP
,
FTDM_TRUNK_FXO
,
FTDM_TRUNK_FXS
,
FTDM_TRUNK_EM
,
FTDM_TRUNK_NONE
}
ftdm_trunk_type_t
;
#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "NONE"
/*! \brief Move from string to ftdm_trunk_type_t and viceversa */
FTDM_STR2ENUM_P
(
ftdm_str2ftdm_trunk_type
,
ftdm_trunk_type2str
,
ftdm_trunk_type_t
)
/*! \brief Basic channel configuration provided to ftdm_configure_span_channels */
typedef
struct
ftdm_channel_config
{
char
name
[
FTDM_MAX_NAME_STR_SZ
];
...
...
@@ -809,14 +827,18 @@ FT_DECLARE(const char *) ftdm_span_get_last_error(const ftdm_span_t *span);
/*!
* \brief Create a new span (not needed if you are using freetdm.conf)
*
* \param fio The I/O interface the span will use
* \param span Pointer to store the create span
* \param iotype The I/O interface type this span will use.
* This depends on the available I/O modules
* ftmod_wanpipe = "wanpipe" (Sangoma)
* ftmod_zt = "zt" (DAHDI or Zaptel)
* ftmod_pika "pika" (this one is most likely broken)
* \param name Name for the span
* \param span Pointer to store the create span
*
* \retval FTDM_SUCCESS success (the span was created)
* \retval FTDM_FAIL failure (span was not created)
*/
FT_DECLARE
(
ftdm_status_t
)
ftdm_span_create
(
ftdm_io_interface_t
*
fio
,
ftdm_span_t
**
span
,
const
char
*
name
);
FT_DECLARE
(
ftdm_status_t
)
ftdm_span_create
(
const
char
*
iotype
,
const
char
*
name
,
ftdm_span_t
**
span
);
/*!
* \brief Add a new channel to a span
...
...
@@ -1144,8 +1166,39 @@ FT_DECLARE(ftdm_status_t) ftdm_conf_node_add_param(ftdm_conf_node_t *node, const
* \return FTDM_FAIL failure
*/
FT_DECLARE
(
ftdm_status_t
)
ftdm_conf_node_destroy
(
ftdm_conf_node_t
*
node
);
/*!
* \brief Create and configure channels in the given span
*
* \param span The span container
* \param str The channel range null terminated string. "1-10", "24" etc
* \param chan_config The basic channel configuration for each channel within the range
* \param configured Pointer where the number of channels configured will be stored
*
* \return FTDM_SUCCESS success
* \return FTDM_FAIL failure
*/
FT_DECLARE
(
ftdm_status_t
)
ftdm_configure_span_channels
(
ftdm_span_t
*
span
,
const
char
*
str
,
ftdm_channel_config_t
*
chan_config
,
unsigned
*
configured
);
/*!
* \brief Set the trunk type for a span
* This must be called before configuring any channels within the span
*
* \param span The span
* \param type The trunk type
*
*/
FT_DECLARE
(
void
)
ftdm_span_set_trunk_type
(
ftdm_span_t
*
span
,
ftdm_trunk_type_t
type
);
/*!
* \brief Get the trunk type for a span
*
* \param span The span
*
* \return The span trunk type
*/
FT_DECLARE
(
ftdm_trunk_type_t
)
ftdm_span_get_trunk_type
(
const
ftdm_span_t
*
span
);
/*!
* \brief Return the channel identified by the provided id
*
...
...
libs/freetdm/src/include/private/ftdm_dso.h
浏览文件 @
90c040ec
...
...
@@ -17,6 +17,7 @@
*
*/
#include "freetdm.h"
#ifndef _FTDM_DSO_H
#define _FTDM_DSO_H
...
...
@@ -28,7 +29,7 @@ extern "C" {
typedef
void
(
*
ftdm_func_ptr_t
)
(
void
);
typedef
void
*
ftdm_dso_lib_t
;
FT_DECLARE
(
void
)
ftdm_dso_destroy
(
ftdm_dso_lib_t
*
lib
);
FT_DECLARE
(
ftdm_status_t
)
ftdm_dso_destroy
(
ftdm_dso_lib_t
*
lib
);
FT_DECLARE
(
ftdm_dso_lib_t
)
ftdm_dso_open
(
const
char
*
path
,
char
**
err
);
FT_DECLARE
(
void
*
)
ftdm_dso_func_sym
(
ftdm_dso_lib_t
lib
,
const
char
*
sym
,
char
**
err
);
...
...
libs/freetdm/src/include/private/ftdm_types.h
浏览文件 @
90c040ec
...
...
@@ -111,20 +111,6 @@ typedef enum {
#define TONEMAP_STRINGS "NONE", "DIAL", "RING", "BUSY", "FAIL1", "FAIL2", "FAIL3", "ATTN", "CALLWAITING-CAS", "CALLWAITING-SAS", "CALLWAITING-ACK", "INVALID"
FTDM_STR2ENUM_P
(
ftdm_str2ftdm_tonemap
,
ftdm_tonemap2str
,
ftdm_tonemap_t
)
typedef
enum
{
FTDM_TRUNK_E1
,
FTDM_TRUNK_T1
,
FTDM_TRUNK_J1
,
FTDM_TRUNK_BRI
,
FTDM_TRUNK_BRI_PTMP
,
FTDM_TRUNK_FXO
,
FTDM_TRUNK_FXS
,
FTDM_TRUNK_EM
,
FTDM_TRUNK_NONE
}
ftdm_trunk_type_t
;
#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "NONE"
FTDM_STR2ENUM_P
(
ftdm_str2ftdm_trunk_type
,
ftdm_trunk_type2str
,
ftdm_trunk_type_t
)
typedef
enum
{
FTDM_ANALOG_START_KEWL
,
FTDM_ANALOG_START_LOOP
,
...
...
src/switch_utils.c
浏览文件 @
90c040ec
...
...
@@ -1331,7 +1331,7 @@ static const char *switch_inet_ntop4(const unsigned char *src, char *dst, size_t
return
strcpy
(
dst
,
tmp
);
}
#if HAVE_SIN6 ||
(defined(NTDDI_VERSION) && (NTDDI_VERSION < NTDDI_VISTA)
)
#if HAVE_SIN6 ||
defined(NTDDI_VERSION
)
/* const char *
* inet_ntop6(src, dst, size)
* convert IPv6 binary address into presentation (printable) format
...
...
@@ -1488,7 +1488,7 @@ SWITCH_DECLARE(char *) get_addr6(char *buf, switch_size_t len, struct sockaddr_i
*
buf
=
'\0'
;
if
(
sa
)
{
#if defined(NTDDI_VERSION)
&& (NTDDI_VERSION < NTDDI_VISTA)
#if defined(NTDDI_VERSION)
switch_inet_ntop6
((
unsigned
char
*
)
sa
,
buf
,
len
);
#else
inet_ntop
(
AF_INET6
,
sa
,
buf
,
len
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论