Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
441b4873
提交
441b4873
authored
6月 18, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update analog
git-svn-id:
http://svn.openzap.org/svn/openzap/trunk@273
a93c3328-9c30-0410-af19-c9cd2b2d52af
上级
93b8880e
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
131 行增加
和
27 行删除
+131
-27
openzap.h
libs/freetdm/src/include/openzap.h
+1
-0
zap_types.h
libs/freetdm/src/include/zap_types.h
+9
-0
zap_zt.h
libs/freetdm/src/include/zap_zt.h
+22
-21
zap_analog.c
libs/freetdm/src/zap_analog.c
+1
-1
zap_io.c
libs/freetdm/src/zap_io.c
+34
-5
zap_wanpipe.c
libs/freetdm/src/zap_wanpipe.c
+2
-0
zap_zt.c
libs/freetdm/src/zap_zt.c
+62
-0
没有找到文件。
libs/freetdm/src/include/openzap.h
浏览文件 @
441b4873
...
...
@@ -386,6 +386,7 @@ struct zap_span {
zio_event_cb_t
event_callback
;
zap_mutex_t
*
mutex
;
zap_trunk_type_t
trunk_type
;
zap_analog_start_type_t
start_type
;
zap_signal_type_t
signal_type
;
struct
zap_isdn_data
*
isdn_data
;
struct
zap_analog_data
*
analog_data
;
...
...
libs/freetdm/src/include/zap_types.h
浏览文件 @
441b4873
...
...
@@ -119,6 +119,15 @@ typedef enum {
#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "FXO", "FXS", "NONE"
ZAP_STR2ENUM_P
(
zap_str2zap_trunk_type
,
zap_trunk_type2str
,
zap_trunk_type_t
)
typedef
enum
{
ZAP_ANALOG_START_KEWL
,
ZAP_ANALOG_START_LOOP
,
ZAP_ANALOG_START_GROUND
,
ZAP_ANALOG_START_INVALID
}
zap_analog_start_type_t
;
#define START_TYPE_STRINGS "KEWL", "LOOP", "GROUND", "INVALID"
ZAP_STR2ENUM_P
(
zap_str2zap_analog_start_type
,
zap_analog_start_type2str
,
zap_analog_start_type_t
)
typedef
enum
{
ZAP_OOB_DTMF
,
ZAP_OOB_ONHOOK
,
...
...
libs/freetdm/src/include/zap_zt.h
浏览文件 @
441b4873
...
...
@@ -110,26 +110,26 @@ struct zt_maintinfo {
int
span_no
;
/* span number */
int
command
;
/* Maintenance mode to set (from zt_maintenance_mode_t) */
};
struct
zt_lineconfig
{
/* Used in ZT_SPANCONFIG */
int
span
;
/* Which span number (0 to use name) */
char
name
[
20
];
/* Name of span to use */
int
lbo
;
/* line build-outs */
int
lineconfig
;
/* line config parameters (framing, coding) */
int
sync
;
/* what level of sync source we are */
}
struct
zt_chanconfig
{
/* Used in ZT_CHANCONFIG */
int
chan
;
/* Channel we're applying this to (0 to use name) */
char
name
[
40
];
/* Name of channel to use */
int
sigtype
;
/* Signal type */
int
deflaw
;
/* Default law (ZT_LAW_DEFAULT, ZT_LAW_MULAW, or ZT_LAW_ALAW */
int
master
;
/* Master channel if sigtype is ZT_SLAVE */
int
idlebits
;
/* Idle bits (if this is a CAS channel) or channel to monitor (if this is DACS channel) */
char
netdev_name
[
16
];
/* name for the hdlc network device */
}
struct
zt_lineconfig
{
/* Used in ZT_SPANCONFIG */
int
span
;
/* Which span number (0 to use name) */
char
name
[
20
];
/* Name of span to use */
int
lbo
;
/* line build-outs */
int
lineconfig
;
/* line config parameters (framing, coding) */
int
sync
;
/* what level of sync source we are */
}
;
struct
zt_chanconfig
{
/* Used in ZT_CHANCONFIG */
int
chan
;
/* Channel we're applying this to (0 to use name) */
char
name
[
40
];
/* Name of channel to use */
int
sigtype
;
/* Signal type */
int
deflaw
;
/* Default law (ZT_LAW_DEFAULT, ZT_LAW_MULAW, or ZT_LAW_ALAW */
int
master
;
/* Master channel if sigtype is ZT_SLAVE */
int
idlebits
;
/* Idle bits (if this is a CAS channel) or channel to monitor (if this is DACS channel) */
char
netdev_name
[
16
];
/* name for the hdlc network device */
}
;
/* Enumerations */
...
...
@@ -238,7 +238,8 @@ ZT_SIG_EM = (1 << 6) /* E&M */
#define ZT_GETGAINS _IOWR (ZT_CODE, 16, struct zt_gains)
/* Get Channel audio gains */
#define ZT_SETGAINS _IOWR (ZT_CODE, 17, struct zt_gains)
/* Set Channel audio gains */
#define ZT_SPANCONFIG _IOW (ZT_CODE, 18, struct zt_lineconfig)
/*Set Line (T1) Configurations and start system */
#define ZT_CHANCONFIG _IOW (ZT_CODE, 19, struct zt_chanconfig)
/* Set Channel Configuration */
#define ZT_AUDIOMODE _IOW (ZT_CODE, 32, int)
/* Set a clear channel into audio mode */
#define ZT_ECHOCANCEL _IOW (ZT_CODE, 33, int)
/* Control Echo Canceller */
#define ZT_HDLCRAWMODE _IOW (ZT_CODE, 36, int)
/* Set a clear channel into HDLC w/out FCS checking/calculation mode */
...
...
libs/freetdm/src/zap_analog.c
浏览文件 @
441b4873
...
...
@@ -44,6 +44,7 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj);
static
ZIO_CHANNEL_OUTGOING_CALL_FUNCTION
(
analog_fxo_outgoing_call
)
{
if
(
!
zap_test_flag
(
zchan
,
ZAP_CHANNEL_OFFHOOK
)
&&
!
zap_test_flag
(
zchan
,
ZAP_CHANNEL_INTHREAD
))
{
//zap_channel_command(zchan, ZAP_COMMAND_TRACE_INPUT, "/tmp/inbound.ul");
zap_channel_command
(
zchan
,
ZAP_COMMAND_OFFHOOK
,
NULL
);
zap_channel_command
(
zchan
,
ZAP_COMMAND_ENABLE_PROGRESS_DETECT
,
NULL
);
zchan
->
needed_tones
[
ZAP_TONEMAP_DIAL
]
=
1
;
...
...
@@ -424,7 +425,6 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
case
ZAP_CHANNEL_STATE_GENRING
:
{
send_caller_id
(
chan
);
//zap_channel_command(chan, ZAP_COMMAND_TRACE_OUTPUT, "/tmp/outbound.ul");
zap_channel_command
(
chan
,
ZAP_COMMAND_GENERATE_RING_ON
,
NULL
);
}
break
;
...
...
libs/freetdm/src/zap_io.c
浏览文件 @
441b4873
...
...
@@ -95,6 +95,9 @@ ZAP_STR2ENUM(zap_str2zap_oob_event, zap_oob_event2str, zap_oob_event_t, OOB_NAME
ZAP_ENUM_NAMES
(
TRUNK_TYPE_NAMES
,
TRUNK_STRINGS
)
ZAP_STR2ENUM
(
zap_str2zap_trunk_type
,
zap_trunk_type2str
,
zap_trunk_type_t
,
TRUNK_TYPE_NAMES
,
ZAP_TRUNK_NONE
)
ZAP_ENUM_NAMES
(
START_TYPE_NAMES
,
START_TYPE_STRINGS
)
ZAP_STR2ENUM
(
zap_str2zap_analog_start_type
,
zap_analog_start_type2str
,
zap_analog_start_type_t
,
START_TYPE_NAMES
,
ZAP_ANALOG_START_INVALID
)
ZAP_ENUM_NAMES
(
SIGNAL_NAMES
,
SIGNAL_STRINGS
)
ZAP_STR2ENUM
(
zap_str2zap_signal_event
,
zap_signal_event2str
,
zap_signal_event_t
,
SIGNAL_NAMES
,
ZAP_SIGEVENT_INVALID
)
...
...
@@ -1719,10 +1722,23 @@ static zap_status_t load_config(void)
}
else
{
zap_copy_string
(
number
,
val
,
sizeof
(
number
));
}
}
else
if
(
!
str
casecmp
(
var
,
"fxo-channel"
))
{
}
else
if
(
!
str
ncasecmp
(
var
,
"fxo-channel"
,
11
))
{
if
(
span
->
trunk_type
==
ZAP_TRUNK_NONE
)
{
span
->
trunk_type
=
ZAP_TRUNK_FXO
;
zap_log
(
ZAP_LOG_DEBUG
,
"setting trunk type to '%s'
\n
"
,
zap_trunk_type2str
(
span
->
trunk_type
));
char
*
stype
=
var
+
11
;
zap_analog_start_type_t
tmp
,
start_type
=
ZAP_ANALOG_START_KEWL
;
span
->
trunk_type
=
ZAP_TRUNK_FXO
;
if
(
stype
)
{
while
(
*
stype
==
'-'
)
stype
++
;
if
((
tmp
=
zap_str2zap_analog_start_type
(
stype
))
!=
ZAP_ANALOG_START_INVALID
)
{
start_type
=
tmp
;
}
}
span
->
start_type
=
start_type
;
zap_log
(
ZAP_LOG_DEBUG
,
"setting trunk type to '%s' (%s)
\n
"
,
zap_trunk_type2str
(
span
->
trunk_type
),
zap_analog_start_type2str
(
start_type
));
}
if
(
span
->
trunk_type
==
ZAP_TRUNK_FXO
)
{
configured
+=
zio
->
configure_span
(
span
,
val
,
ZAP_CHAN_TYPE_FXO
,
name
,
number
);
...
...
@@ -1731,8 +1747,21 @@ static zap_status_t load_config(void)
}
}
else
if
(
!
strcasecmp
(
var
,
"fxs-channel"
))
{
if
(
span
->
trunk_type
==
ZAP_TRUNK_NONE
)
{
span
->
trunk_type
=
ZAP_TRUNK_FXS
;
zap_log
(
ZAP_LOG_DEBUG
,
"setting trunk type to '%s'
\n
"
,
zap_trunk_type2str
(
span
->
trunk_type
));
char
*
stype
=
var
+
11
;
zap_analog_start_type_t
tmp
,
start_type
=
ZAP_ANALOG_START_KEWL
;
span
->
trunk_type
=
ZAP_TRUNK_FXS
;
if
(
stype
)
{
while
(
*
stype
==
'-'
)
stype
++
;
if
((
tmp
=
zap_str2zap_analog_start_type
(
stype
))
!=
ZAP_ANALOG_START_INVALID
)
{
start_type
=
tmp
;
}
}
span
->
start_type
=
start_type
;
zap_log
(
ZAP_LOG_DEBUG
,
"setting trunk type to '%s' (%s)
\n
"
,
zap_trunk_type2str
(
span
->
trunk_type
),
zap_analog_start_type2str
(
start_type
));
}
if
(
span
->
trunk_type
==
ZAP_TRUNK_FXS
)
{
configured
+=
zio
->
configure_span
(
span
,
val
,
ZAP_CHAN_TYPE_FXS
,
name
,
number
);
...
...
libs/freetdm/src/zap_wanpipe.c
浏览文件 @
441b4873
...
...
@@ -801,12 +801,14 @@ ZIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event)
break
;
case
WP_TDMAPI_EVENT_RING_DETECT
:
{
printf
(
"you fucking suck: ring
\n
"
);
event_id
=
tdm_api
.
wp_tdm_cmd
.
event
.
wp_tdm_api_event_ring_state
&
WP_TDMAPI_EVENT_RING_PRESENT
?
ZAP_OOB_RING_START
:
ZAP_OOB_RING_STOP
;
}
break
;
case
WP_TDMAPI_EVENT_RING_TRIP_DETECT
:
{
printf
(
"you fucking suck: trip
\n
"
);
event_id
=
tdm_api
.
wp_tdm_cmd
.
event
.
wp_tdm_api_event_ring_state
&
WP_TDMAPI_EVENT_RING_PRESENT
?
ZAP_OOB_ONHOOK
:
ZAP_OOB_OFFHOOK
;
}
...
...
libs/freetdm/src/zap_zt.c
浏览文件 @
441b4873
...
...
@@ -48,8 +48,16 @@ static struct {
static
unsigned
zt_open_range
(
zap_span_t
*
span
,
unsigned
start
,
unsigned
end
,
zap_chan_type_t
type
,
char
*
name
,
char
*
number
)
{
unsigned
configured
=
0
,
x
;
const
char
ctlpath
[]
=
"/dev/zap/ctl"
;
char
path
[
128
]
=
""
;
zt_params_t
ztp
;
zap_socket_t
ctlfd
=
ZT_INVALID_SOCKET
;
if
((
ctlfd
=
open
(
ctlpath
,
O_RDWR
))
<
0
)
{
zap_log
(
ZAP_LOG_ERROR
,
"Cannot open control device
\n
"
);
return
0
;
}
memset
(
&
ztp
,
0
,
sizeof
(
ztp
));
...
...
@@ -62,6 +70,56 @@ static unsigned zt_open_range(zap_span_t *span, unsigned start, unsigned end, za
sockfd
=
open
(
path
,
O_RDWR
);
if
(
sockfd
!=
ZT_INVALID_SOCKET
&&
zap_span_add_channel
(
span
,
sockfd
,
type
,
&
chan
)
==
ZAP_SUCCESS
)
{
if
(
type
==
ZAP_CHAN_TYPE_FXS
||
type
==
ZAP_CHAN_TYPE_FXO
)
{
struct
zt_chanconfig
cc
;
memset
(
&
cc
,
0
,
sizeof
(
cc
));
cc
.
chan
=
cc
.
master
=
x
;
switch
(
type
)
{
case
ZAP_CHAN_TYPE_FXS
:
{
switch
(
span
->
start_type
)
{
case
ZAP_ANALOG_START_KEWL
:
cc
.
sigtype
=
ZT_SIG_FXOKS
;
break
;
case
ZAP_ANALOG_START_LOOP
:
cc
.
sigtype
=
ZT_SIG_FXOLS
;
break
;
case
ZAP_ANALOG_START_GROUND
:
cc
.
sigtype
=
ZT_SIG_FXOGS
;
break
;
default:
break
;
}
}
break
;
case
ZAP_CHAN_TYPE_FXO
:
{
switch
(
span
->
start_type
)
{
case
ZAP_ANALOG_START_KEWL
:
cc
.
sigtype
=
ZT_SIG_FXSKS
;
break
;
case
ZAP_ANALOG_START_LOOP
:
cc
.
sigtype
=
ZT_SIG_FXSLS
;
break
;
case
ZAP_ANALOG_START_GROUND
:
cc
.
sigtype
=
ZT_SIG_FXSGS
;
break
;
default:
break
;
}
}
break
;
default:
break
;
}
if
(
ioctl
(
ctlfd
,
ZT_CHANCONFIG
,
&
cc
))
{
zap_log
(
ZAP_LOG_INFO
,
"failure configuring device %s chan %d fd %d (%s)
\n
"
,
path
,
x
,
ctlfd
,
strerror
(
errno
));
close
(
sockfd
);
break
;
}
}
len
=
zt_globals
.
eclevel
;
if
(
ioctl
(
chan
->
sockfd
,
ZT_ECHOCANCEL
,
&
len
))
{
zap_log
(
ZAP_LOG_INFO
,
"failure configuring device %s as OpenZAP device %d:%d fd:%d err:%s
\n
"
,
...
...
@@ -92,6 +150,8 @@ static unsigned zt_open_range(zap_span_t *span, unsigned start, unsigned end, za
}
zap_log
(
ZAP_LOG_INFO
,
"configuring device %s as OpenZAP device %d:%d fd:%d
\n
"
,
path
,
chan
->
span_id
,
chan
->
chan_id
,
sockfd
);
chan
->
rate
=
8000
;
chan
->
physical_span_id
=
ztp
.
span_no
;
chan
->
physical_chan_id
=
ztp
.
chan_no
;
...
...
@@ -125,6 +185,8 @@ static unsigned zt_open_range(zap_span_t *span, unsigned start, unsigned end, za
}
}
close
(
ctlfd
);
return
configured
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论