Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
9cdf5515
提交
9cdf5515
authored
5月 31, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.openzap.org/svn/openzap/trunk@187
a93c3328-9c30-0410-af19-c9cd2b2d52af
上级
4b5e0836
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
78 行增加
和
24 行删除
+78
-24
mod_openzap.c
libs/freetdm/mod_openzap/mod_openzap.c
+47
-24
openzap.h
libs/freetdm/src/include/openzap.h
+2
-0
zap_analog.c
libs/freetdm/src/zap_analog.c
+9
-0
zap_io.c
libs/freetdm/src/zap_io.c
+20
-0
没有找到文件。
libs/freetdm/mod_openzap/mod_openzap.c
浏览文件 @
9cdf5515
...
...
@@ -49,11 +49,10 @@ static struct span_config SPAN_CONFIG[ZAP_MAX_SPANS_INTERFACE] = {0};
typedef
enum
{
TFLAG_IO
=
(
1
<<
0
),
TFLAG_OUTBOUND
=
(
1
<<
1
),
TFLAG_DTMF
=
(
1
<<
2
),
TFLAG_CODEC
=
(
1
<<
3
),
TFLAG_BREAK
=
(
1
<<
4
),
TFLAG_HOLD
=
(
1
<<
5
)
TFLAG_DTMF
=
(
1
<<
1
),
TFLAG_CODEC
=
(
1
<<
2
),
TFLAG_BREAK
=
(
1
<<
3
),
TFLAG_HOLD
=
(
1
<<
4
)
}
TFLAGS
;
static
struct
{
...
...
@@ -540,6 +539,33 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
switch_caller_profile_t
*
outbound_profile
,
switch_core_session_t
**
new_session
,
switch_memory_pool_t
**
pool
)
{
char
*
dest
;
int
span_id
=
0
;
zap_channel_t
*
zchan
=
NULL
;
switch_call_cause_t
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
char
name
[
128
];
if
(
!
outbound_profile
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Missing caller profile
\n
"
);
return
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
}
if
((
dest
=
strchr
(
'/'
,
outbound_profile
->
destination_number
)))
{
dest
++
;
span_id
=
atoi
(
outbound_profile
->
destination_number
);
}
if
(
!
span_id
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Missing span
\n
"
);
return
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
}
if
(
zap_channel_open_any
(
span_id
,
ZAP_TOP_DOWN
,
&
zchan
)
!=
ZAP_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"No channels available
\n
"
);
return
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
}
if
((
*
new_session
=
switch_core_session_request
(
&
channel_endpoint_interface
,
pool
))
!=
0
)
{
private_t
*
tech_pvt
;
switch_channel_t
*
channel
;
...
...
@@ -548,36 +574,33 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
switch_core_session_add_stream
(
*
new_session
,
NULL
);
if
((
tech_pvt
=
(
private_t
*
)
switch_core_session_alloc
(
*
new_session
,
sizeof
(
private_t
)))
!=
0
)
{
channel
=
switch_core_session_get_channel
(
*
new_session
);
tech_init
(
tech_pvt
,
*
new_session
,
NULL
);
tech_init
(
tech_pvt
,
*
new_session
,
zchan
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Hey where is my memory pool?
\n
"
);
switch_core_session_destroy
(
new_session
);
return
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
}
if
(
outbound_profile
)
{
char
name
[
128
];
snprintf
(
name
,
sizeof
(
name
),
"OPENZAP/%s-%04x"
,
outbound_profile
->
destination_number
,
rand
()
&
0xffff
);
switch_channel_set_name
(
channel
,
name
);
caller_profile
=
switch_caller_profile_clone
(
*
new_session
,
outbound_profile
);
switch_channel_set_caller_profile
(
channel
,
caller_profile
);
tech_pvt
->
caller_profile
=
caller_profile
;
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Doh! no caller profile
\n
"
);
switch_core_session_destroy
(
new_session
);
return
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
goto
fail
;
}
snprintf
(
name
,
sizeof
(
name
),
"OPENZAP/%s"
,
outbound_profile
->
destination_number
);
switch_channel_set_name
(
channel
,
name
);
caller_profile
=
switch_caller_profile_clone
(
*
new_session
,
outbound_profile
);
switch_channel_set_caller_profile
(
channel
,
caller_profile
);
tech_pvt
->
caller_profile
=
caller_profile
;
switch_channel_set_flag
(
channel
,
CF_OUTBOUND
);
switch_set_flag_locked
(
tech_pvt
,
TFLAG_OUTBOUND
);
switch_channel_set_state
(
channel
,
CS_INIT
);
return
SWITCH_CAUSE_SUCCESS
;
}
return
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
fail:
if
(
zchan
)
{
zap_channel_done
(
zchan
);
}
return
cause
;
}
...
...
libs/freetdm/src/include/openzap.h
浏览文件 @
9cdf5515
...
...
@@ -346,6 +346,8 @@ zap_status_t zap_channel_open(uint32_t span_id, uint32_t chan_id, zap_channel_t
zap_status_t
zap_channel_open_chan
(
zap_channel_t
*
zchan
);
zap_status_t
zap_channel_open_any
(
uint32_t
span_id
,
zap_direction_t
direction
,
zap_channel_t
**
zchan
);
zap_status_t
zap_channel_close
(
zap_channel_t
**
zchan
);
zap_status_t
zap_channel_done
(
zap_channel_t
*
zchan
);
zap_status_t
zap_channel_use
(
zap_channel_t
*
zchan
);
zap_status_t
zap_channel_command
(
zap_channel_t
*
zchan
,
zap_command_t
command
,
void
*
obj
);
zap_status_t
zap_channel_wait
(
zap_channel_t
*
zchan
,
zap_wait_flag_t
*
flags
,
int32_t
to
);
zap_status_t
zap_channel_read
(
zap_channel_t
*
zchan
,
void
*
data
,
zap_size_t
*
datalen
);
...
...
libs/freetdm/src/zap_analog.c
浏览文件 @
9cdf5515
...
...
@@ -167,6 +167,7 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
break
;
case
ZAP_CHANNEL_STATE_DOWN
:
{
zap_channel_done
(
chan
);
goto
done
;
}
break
;
...
...
@@ -180,6 +181,7 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
switch
(
chan
->
state
)
{
case
ZAP_CHANNEL_STATE_UP
:
{
zap_channel_use
(
chan
);
if
(
zap_test_flag
(
chan
,
ZAP_CHANNEL_HOLD
))
{
zap_clear_flag
(
chan
,
ZAP_CHANNEL_HOLD
);
sig
.
event_id
=
ZAP_SIGEVENT_FLASH
;
...
...
@@ -193,6 +195,7 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
break
;
case
ZAP_CHANNEL_STATE_IDLE
:
{
zap_channel_use
(
chan
);
sig
.
event_id
=
ZAP_SIGEVENT_START
;
zap_copy_string
(
sig
.
dnis
,
dtmf
,
sizeof
(
sig
.
dnis
));
data
->
sig_cb
(
&
sig
);
...
...
@@ -201,6 +204,7 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
break
;
case
ZAP_CHANNEL_STATE_DOWN
:
{
zap_channel_done
(
chan
);
sig
.
event_id
=
ZAP_SIGEVENT_STOP
;
data
->
sig_cb
(
&
sig
);
goto
done
;
...
...
@@ -208,6 +212,7 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
break
;
case
ZAP_CHANNEL_STATE_DIALTONE
:
{
zap_channel_done
(
chan
);
*
dtmf
=
'\0'
;
dtmf_offset
=
0
;
zap_buffer_zero
(
dt_buffer
);
...
...
@@ -217,6 +222,7 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
break
;
case
ZAP_CHANNEL_STATE_RING
:
{
zap_channel_done
(
chan
);
zap_buffer_zero
(
dt_buffer
);
teletone_run
(
&
ts
,
chan
->
span
->
tone_map
[
ZAP_TONEMAP_RING
]);
indicate
=
1
;
...
...
@@ -224,6 +230,7 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
break
;
case
ZAP_CHANNEL_STATE_BUSY
:
{
zap_channel_done
(
chan
);
zap_buffer_zero
(
dt_buffer
);
teletone_run
(
&
ts
,
chan
->
span
->
tone_map
[
ZAP_TONEMAP_BUSY
]);
indicate
=
1
;
...
...
@@ -231,12 +238,14 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
break
;
case
ZAP_CHANNEL_STATE_ATTN
:
{
zap_channel_done
(
chan
);
zap_buffer_zero
(
dt_buffer
);
teletone_run
(
&
ts
,
chan
->
span
->
tone_map
[
ZAP_TONEMAP_ATTN
]);
indicate
=
1
;
}
break
;
default:
zap_channel_done
(
chan
);
break
;
}
}
...
...
libs/freetdm/src/zap_io.c
浏览文件 @
9cdf5515
...
...
@@ -644,6 +644,26 @@ zap_status_t zap_channel_open(uint32_t span_id, uint32_t chan_id, zap_channel_t
return
status
;
}
zap_status_t
zap_channel_done
(
zap_channel_t
*
zchan
)
{
assert
(
zchan
!=
NULL
);
zap_clear_flag_locked
(
zchan
,
ZAP_CHANNEL_INUSE
);
return
ZAP_SUCCESS
;
}
zap_status_t
zap_channel_use
(
zap_channel_t
*
zchan
)
{
assert
(
zchan
!=
NULL
);
zap_set_flag_locked
(
zchan
,
ZAP_CHANNEL_INUSE
);
return
ZAP_SUCCESS
;
}
zap_status_t
zap_channel_close
(
zap_channel_t
**
zchan
)
{
zap_channel_t
*
check
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论