Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
bf7144b2
提交
bf7144b2
authored
4月 16, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
...
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@4945
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
f40f87eb
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
220 行增加
和
218 行删除
+220
-218
mod_wanpipe.c
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
+177
-174
switch_ivr_bridge.c
src/switch_ivr_bridge.c
+3
-8
switch_ivr_originate.c
src/switch_ivr_originate.c
+40
-36
没有找到文件。
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
浏览文件 @
bf7144b2
...
@@ -1016,7 +1016,15 @@ static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *sessi
...
@@ -1016,7 +1016,15 @@ static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *sessi
char
*
protocol
=
NULL
;
char
*
protocol
=
NULL
;
char
*
dest
;
char
*
dest
;
int
ready
=
0
,
is_pri
=
0
,
is_boost
=
0
,
is_raw
=
0
;
int
ready
=
0
,
is_pri
=
0
,
is_boost
=
0
,
is_raw
=
0
;
switch_call_cause_t
cause
=
SWITCH_CAUSE_SUCCESS
;
switch_call_cause_t
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
private_object_t
*
tech_pvt
;
switch_channel_t
*
channel
;
switch_caller_profile_t
*
caller_profile
=
NULL
;
int
callno
=
0
;
struct
sangoma_pri
*
spri
;
int
span
=
0
,
autospan
=
0
,
autochan
=
0
;
char
*
num
,
*
p
;
struct
channel_map
*
chanmap
=
NULL
;
if
(
!
outbound_profile
)
{
if
(
!
outbound_profile
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Doh! no caller profile
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Doh! no caller profile
\n
"
);
...
@@ -1025,6 +1033,7 @@ static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *sessi
...
@@ -1025,6 +1033,7 @@ static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *sessi
}
}
protocol
=
strdup
(
outbound_profile
->
destination_number
);
protocol
=
strdup
(
outbound_profile
->
destination_number
);
assert
(
protocol
!=
NULL
);
if
(
!
(
dest
=
strchr
(
protocol
,
'/'
)))
{
if
(
!
(
dest
=
strchr
(
protocol
,
'/'
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error No protocol specified!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error No protocol specified!
\n
"
);
...
@@ -1059,225 +1068,219 @@ static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *sessi
...
@@ -1059,225 +1068,219 @@ static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *sessi
outbound_profile
->
destination_number
=
dest
;
outbound_profile
->
destination_number
=
dest
;
if
((
*
new_session
=
switch_core_session_request
(
&
wanpipe_endpoint_interface
,
pool
)))
{
if
(
!
(
*
new_session
=
switch_core_session_request
(
&
wanpipe_endpoint_interface
,
pool
)))
{
private_object_t
*
tech_pvt
;
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
switch_channel_t
*
channel
;
goto
error
;
switch_caller_profile_t
*
caller_profile
=
NULL
;
}
int
callno
=
0
;
struct
sangoma_pri
*
spri
;
int
span
=
0
,
autospan
=
0
,
autochan
=
0
;
char
*
num
,
*
p
;
struct
channel_map
*
chanmap
=
NULL
;
switch_core_session_add_stream
(
*
new_session
,
NULL
);
switch_core_session_add_stream
(
*
new_session
,
NULL
);
if
((
tech_pvt
=
(
private_object_t
*
)
switch_core_session_alloc
(
*
new_session
,
sizeof
(
private_object_t
))))
{
if
((
tech_pvt
=
(
private_object_t
*
)
switch_core_session_alloc
(
*
new_session
,
sizeof
(
private_object_t
))))
{
memset
(
tech_pvt
,
0
,
sizeof
(
*
tech_pvt
));
memset
(
tech_pvt
,
0
,
sizeof
(
*
tech_pvt
));
switch_mutex_init
(
&
tech_pvt
->
flag_mutex
,
SWITCH_MUTEX_NESTED
,
switch_core_session_get_pool
(
*
new_session
));
switch_mutex_init
(
&
tech_pvt
->
flag_mutex
,
SWITCH_MUTEX_NESTED
,
switch_core_session_get_pool
(
*
new_session
));
channel
=
switch_core_session_get_channel
(
*
new_session
);
channel
=
switch_core_session_get_channel
(
*
new_session
);
switch_core_session_set_private
(
*
new_session
,
tech_pvt
);
switch_core_session_set_private
(
*
new_session
,
tech_pvt
);
tech_pvt
->
session
=
*
new_session
;
tech_pvt
->
session
=
*
new_session
;
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Memory Error!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Memory Error!
\n
"
);
switch_core_session_destroy
(
new_session
);
switch_core_session_destroy
(
new_session
);
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
goto
error
;
goto
error
;
}
}
caller_profile
=
switch_caller_profile_clone
(
*
new_session
,
outbound_profile
);
caller_profile
=
switch_caller_profile_clone
(
*
new_session
,
outbound_profile
);
if
(
is_pri
)
{
if
(
is_pri
)
{
num
=
caller_profile
->
destination_number
;
num
=
caller_profile
->
destination_number
;
if
((
p
=
strchr
(
num
,
'/'
)))
{
*
p
++
=
'\0'
;
if
(
*
num
==
'a'
)
{
span
=
1
;
autospan
=
1
;
}
else
if
(
*
num
==
'A'
)
{
span
=
MAX_SPANS
-
1
;
autospan
=
-
1
;
}
else
{
if
(
num
&&
*
num
>
47
&&
*
num
<
58
)
{
span
=
atoi
(
num
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invlid Syntax
\n
"
);
switch_core_session_destroy
(
new_session
);
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
goto
error
;
}
}
num
=
p
;
if
((
p
=
strchr
(
num
,
'/'
)))
{
if
((
p
=
strchr
(
num
,
'/'
)))
{
*
p
++
=
'\0'
;
*
p
++
=
'\0'
;
if
(
*
num
==
'a'
)
{
if
(
*
num
==
'a'
)
{
span
=
1
;
autochan
=
1
;
autospan
=
1
;
}
else
if
(
*
num
==
'A'
)
{
}
else
if
(
*
num
==
'A'
)
{
span
=
MAX_SPANS
-
1
;
autochan
=
-
1
;
autospan
=
-
1
;
}
else
if
(
num
&&
*
num
>
47
&&
*
num
<
58
)
{
}
else
{
callno
=
atoi
(
num
);
if
(
num
&&
*
num
>
47
&&
*
num
<
58
)
{
span
=
atoi
(
num
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invlid Syntax
\n
"
);
switch_core_session_destroy
(
new_session
);
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
goto
error
;
}
}
num
=
p
;
if
((
p
=
strchr
(
num
,
'/'
)))
{
*
p
++
=
'\0'
;
if
(
*
num
==
'a'
)
{
autochan
=
1
;
}
else
if
(
*
num
==
'A'
)
{
autochan
=
-
1
;
}
else
if
(
num
&&
*
num
>
47
&&
*
num
<
58
)
{
callno
=
atoi
(
num
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invlid Syntax
\n
"
);
switch_core_session_destroy
(
new_session
);
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
goto
error
;
}
caller_profile
->
destination_number
=
p
;
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invlid Syntax
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invlid Syntax
\n
"
);
switch_core_session_destroy
(
new_session
);
switch_core_session_destroy
(
new_session
);
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
goto
error
;
goto
error
;
}
}
caller_profile
->
destination_number
=
p
;
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invlid Syntax
\n
"
);
switch_core_session_destroy
(
new_session
);
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
goto
error
;
}
}
}
}
}
tech_pvt
->
caller_profile
=
caller_profile
;
tech_pvt
->
caller_profile
=
caller_profile
;
if
(
is_raw
)
{
if
(
is_raw
)
{
int
chan
,
span
;
int
chan
,
span
;
if
(
sangoma_span_chan_fromif
(
bchan
,
&
span
,
&
chan
))
{
if
(
sangoma_span_chan_fromif
(
bchan
,
&
span
,
&
chan
))
{
if
(
!
wp_open
(
tech_pvt
,
span
,
chan
))
{
if
(
!
wp_open
(
tech_pvt
,
span
,
chan
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't open fd for s%dc%d! [%s]
\n
"
,
span
,
chan
,
strerror
(
errno
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't open fd for s%dc%d! [%s]
\n
"
,
span
,
chan
,
strerror
(
errno
));
switch_core_session_destroy
(
new_session
);
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
goto
error
;
}
switch_set_flag_locked
(
tech_pvt
,
TFLAG_NOSIG
);
snprintf
(
name
,
sizeof
(
name
),
"wanpipe/%s/nosig"
,
bchan
);
switch_channel_set_name
(
channel
,
name
);
switch_channel_set_caller_profile
(
channel
,
caller_profile
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invalid address
\n
"
);
switch_core_session_destroy
(
new_session
);
switch_core_session_destroy
(
new_session
);
cause
=
SWITCH_CAUSE_
REQUESTED_CHAN_UNAVAIL
;
cause
=
SWITCH_CAUSE_
DESTINATION_OUT_OF_ORDER
;
goto
error
;
goto
error
;
}
}
}
else
if
(
is_pri
)
{
switch_set_flag_locked
(
tech_pvt
,
TFLAG_NOSIG
);
switch_mutex_lock
(
globals
.
channel_mutex
);
snprintf
(
name
,
sizeof
(
name
),
"wanpipe/%s/nosig"
,
bchan
);
callno
=
0
;
switch_channel_set_name
(
channel
,
name
);
while
(
!
callno
)
{
switch_channel_set_caller_profile
(
channel
,
caller_profile
);
if
(
autospan
>
0
&&
span
==
MAX_SPANS
-
1
)
{
}
else
{
break
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invalid address
\n
"
);
}
switch_core_session_destroy
(
new_session
);
cause
=
SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL
;
goto
error
;
}
}
else
if
(
is_pri
)
{
switch_mutex_lock
(
globals
.
channel_mutex
);
callno
=
0
;
while
(
!
callno
)
{
if
(
autospan
>
0
&&
span
==
MAX_SPANS
-
1
)
{
break
;
}
if
(
autospan
<
0
&&
span
==
0
)
{
if
(
autospan
<
0
&&
span
==
0
)
{
break
;
break
;
}
}
if
(
SPANS
[
span
]
&&
(
spri
=
&
SPANS
[
span
]
->
spri
)
&&
switch_test_flag
(
spri
,
SANGOMA_PRI_READY
))
{
if
(
SPANS
[
span
]
&&
(
spri
=
&
SPANS
[
span
]
->
spri
)
&&
switch_test_flag
(
spri
,
SANGOMA_PRI_READY
))
{
chanmap
=
spri
->
private_info
;
chanmap
=
spri
->
private_info
;
if
(
autochan
>
0
)
{
if
(
autochan
>
0
)
{
for
(
callno
=
1
;
callno
<
SANGOMA_MAX_CHAN_PER_SPAN
;
callno
++
)
{
for
(
callno
=
1
;
callno
<
SANGOMA_MAX_CHAN_PER_SPAN
;
callno
++
)
{
if
((
SPANS
[
span
]
->
bchans
&
(
1
<<
callno
))
&&
!
*
chanmap
->
map
[
callno
])
{
if
((
SPANS
[
span
]
->
bchans
&
(
1
<<
callno
))
&&
!
*
chanmap
->
map
[
callno
])
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Choosing channel s%dc%d
\n
"
,
span
,
callno
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Choosing channel s%dc%d
\n
"
,
span
,
callno
);
goto
done
;
goto
done
;
}
}
}
callno
=
0
;
}
}
else
if
(
autochan
<
0
)
{
callno
=
0
;
for
(
callno
=
SANGOMA_MAX_CHAN_PER_SPAN
;
callno
>
0
;
callno
--
)
{
}
else
if
(
autochan
<
0
)
{
if
((
SPANS
[
span
]
->
bchans
&
(
1
<<
callno
))
&&
!
*
chanmap
->
map
[
callno
]
)
{
for
(
callno
=
SANGOMA_MAX_CHAN_PER_SPAN
;
callno
>
0
;
callno
--
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Choosing channel s%dc%d
\n
"
,
span
,
callno
);
if
((
SPANS
[
span
]
->
bchans
&
(
1
<<
callno
))
&&
!
*
chanmap
->
map
[
callno
])
{
goto
done
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Choosing channel s%dc%d
\n
"
,
span
,
callno
)
;
}
goto
done
;
}
}
callno
=
0
;
}
}
}
callno
=
0
;
if
(
autospan
>
0
)
{
span
++
;
}
else
if
(
autospan
<
0
)
{
span
--
;
}
}
}
}
done:
switch_mutex_unlock
(
globals
.
channel_mutex
);
if
(
!
spri
||
callno
==
0
||
callno
==
(
SANGOMA_MAX_CHAN_PER_SPAN
))
{
if
(
autospan
>
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"No Free Channels!
\n
"
);
span
++
;
switch_core_session_destroy
(
new_session
);
}
else
if
(
autospan
<
0
)
{
cause
=
SWITCH_CAUSE_SWITCH_CONGESTION
;
span
--
;
goto
error
;
}
}
}
done:
switch_mutex_unlock
(
globals
.
channel_mutex
);
if
(
!
spri
||
callno
==
0
||
callno
==
(
SANGOMA_MAX_CHAN_PER_SPAN
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"No Free Channels!
\n
"
);
switch_core_session_destroy
(
new_session
);
cause
=
SWITCH_CAUSE_SWITCH_CONGESTION
;
goto
error
;
}
tech_pvt
->
callno
=
callno
;
tech_pvt
->
callno
=
callno
;
if
(
spri
&&
(
tech_pvt
->
call
=
pri_new_call
(
spri
->
pri
)))
{
if
(
spri
&&
(
tech_pvt
->
call
=
pri_new_call
(
spri
->
pri
)))
{
struct
pri_sr
*
sr
;
struct
pri_sr
*
sr
;
snprintf
(
name
,
sizeof
(
name
),
"wanpipe/pri/s%dc%d/%s"
,
spri
->
span
,
callno
,
caller_profile
->
destination_number
);
snprintf
(
name
,
sizeof
(
name
),
"wanpipe/pri/s%dc%d/%s"
,
spri
->
span
,
callno
,
caller_profile
->
destination_number
);
switch_channel_set_name
(
channel
,
name
);
switch_channel_set_name
(
channel
,
name
);
switch_channel_set_caller_profile
(
channel
,
caller_profile
);
switch_channel_set_caller_profile
(
channel
,
caller_profile
);
sr
=
pri_sr_new
();
sr
=
pri_sr_new
();
pri_sr_set_channel
(
sr
,
callno
,
0
,
0
);
pri_sr_set_channel
(
sr
,
callno
,
0
,
0
);
pri_sr_set_bearer
(
sr
,
0
,
SPANS
[
span
]
->
l1
);
pri_sr_set_bearer
(
sr
,
0
,
SPANS
[
span
]
->
l1
);
pri_sr_set_called
(
sr
,
caller_profile
->
destination_number
,
SPANS
[
span
]
->
dp
,
1
);
pri_sr_set_called
(
sr
,
caller_profile
->
destination_number
,
SPANS
[
span
]
->
dp
,
1
);
pri_sr_set_caller
(
sr
,
pri_sr_set_caller
(
sr
,
caller_profile
->
caller_id_number
,
caller_profile
->
caller_id_number
,
caller_profile
->
caller_id_name
,
caller_profile
->
caller_id_name
,
SPANS
[
span
]
->
dp
,
SPANS
[
span
]
->
dp
,
PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN
);
PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN
);
pri_sr_set_redirecting
(
sr
,
pri_sr_set_redirecting
(
sr
,
caller_profile
->
caller_id_number
,
caller_profile
->
caller_id_number
,
SPANS
[
span
]
->
dp
,
SPANS
[
span
]
->
dp
,
PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN
,
PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN
,
PRI_REDIR_UNCONDITIONAL
);
PRI_REDIR_UNCONDITIONAL
);
if
(
pri_setup
(
spri
->
pri
,
tech_pvt
->
call
,
sr
))
{
if
(
pri_setup
(
spri
->
pri
,
tech_pvt
->
call
,
sr
))
{
switch_core_session_destroy
(
new_session
);
switch_core_session_destroy
(
new_session
);
pri_sr_free
(
sr
);
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
goto
error
;
}
if
(
!
wp_open
(
tech_pvt
,
spri
->
span
,
callno
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't open fd!
\n
"
);
switch_core_session_destroy
(
new_session
);
pri_sr_free
(
sr
);
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
goto
error
;
}
pri_sr_free
(
sr
);
pri_sr_free
(
sr
);
switch_copy_string
(
chanmap
->
map
[
callno
],
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
switch_core_session_get_uuid
(
*
new_session
),
goto
error
;
sizeof
(
chanmap
->
map
[
callno
]));
tech_pvt
->
spri
=
spri
;
}
}
}
else
if
(
is_boost
)
{
char
*
p
;
if
((
p
=
strchr
(
caller_profile
->
destination_number
,
'/'
)))
{
if
(
!
wp_open
(
tech_pvt
,
spri
->
span
,
callno
))
{
char
*
grp
=
caller_profile
->
destination_number
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't open fd!
\n
"
);
*
p
=
'\0'
;
switch_core_session_destroy
(
new_session
);
caller_profile
->
destination_number
=
p
+
1
;
pri_sr_free
(
sr
);
tech_pvt
->
boost_trunk_group
=
atoi
(
grp
+
1
)
-
1
;
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
if
(
tech_pvt
->
boost_trunk_group
<
0
)
{
goto
error
;
tech_pvt
->
boost_trunk_group
=
0
;
}
}
}
sprintf
(
name
,
"wanpipe/ss7boost/%s"
,
caller_profile
->
destination_number
);
pri_sr_free
(
sr
);
switch_channel_set_name
(
channel
,
name
);
switch_copy_string
(
chanmap
->
map
[
callno
],
tech_pvt
->
ss7boost_handle
=
globals
.
ss7boost_handle
;
switch_core_session_get_uuid
(
*
new_session
),
sizeof
(
chanmap
->
map
[
callno
]));
tech_pvt
->
spri
=
spri
;
}
}
else
if
(
is_boost
)
{
char
*
p
;
if
(
session
&&
switch_core_session_compare
(
session
,
*
new_session
))
{
if
((
p
=
strchr
(
caller_profile
->
destination_number
,
'/'
)))
{
private_object_t
*
otech_pvt
=
switch_core_session_get_private
(
session
);
char
*
grp
=
caller_profile
->
destination_number
;
tech_pvt
->
boost_pres
=
otech_pvt
->
boost_pres
;
*
p
=
'\0'
;
caller_profile
->
destination_number
=
p
+
1
;
tech_pvt
->
boost_trunk_group
=
atoi
(
grp
+
1
)
-
1
;
if
(
tech_pvt
->
boost_trunk_group
<
0
)
{
tech_pvt
->
boost_trunk_group
=
0
;
}
}
}
sprintf
(
name
,
"wanpipe/ss7boost/%s"
,
caller_profile
->
destination_number
);
switch_channel_set_name
(
channel
,
name
);
tech_pvt
->
ss7boost_handle
=
globals
.
ss7boost_handle
;
if
(
session
&&
switch_core_session_compare
(
session
,
*
new_session
))
{
private_object_t
*
otech_pvt
=
switch_core_session_get_private
(
session
);
tech_pvt
->
boost_pres
=
otech_pvt
->
boost_pres
;
}
}
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
);
cause
=
SWITCH_CAUSE_SUCCESS
;
}
}
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
);
cause
=
SWITCH_CAUSE_SUCCESS
;
error:
error:
switch_safe_free
(
protocol
);
switch_safe_free
(
protocol
);
return
cause
;
return
cause
;
...
...
src/switch_ivr_bridge.c
浏览文件 @
bf7144b2
...
@@ -81,18 +81,13 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
...
@@ -81,18 +81,13 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
switch_channel_state_t
b_state
;
switch_channel_state_t
b_state
;
switch_status_t
status
;
switch_status_t
status
;
switch_event_t
*
event
;
switch_event_t
*
event
;
/* if you really want to make sure it's not ready, test it twice because it might be just a break */
/* if you really want to make sure it's not ready, test it twice because it might be just a break */
if
(
!
switch_channel_ready
(
chan_a
)
&&
!
switch_channel_ready
(
chan_a
))
{
if
(
!
switch_channel_ready
(
chan_a
)
&&
!
switch_channel_ready
(
chan_a
))
{
break
;
break
;
}
}
b_state
=
switch_channel_get_state
(
chan_b
);
if
((
b_state
=
switch_channel_get_state
(
chan_b
))
>=
CS_HANGUP
)
{
switch
(
b_state
)
{
case
CS_HANGUP
:
case
CS_DONE
:
default:
break
;
break
;
}
}
...
@@ -181,11 +176,11 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
...
@@ -181,11 +176,11 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
}
}
}
}
switch_core_session_kill_channel
(
session_b
,
SWITCH_SIG_BREAK
);
msg
.
string_arg
=
data
->
b_uuid
;
msg
.
string_arg
=
data
->
b_uuid
;
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_UNBRIDGE
;
msg
.
message_id
=
SWITCH_MESSAGE_INDICATE_UNBRIDGE
;
msg
.
from
=
__FILE__
;
msg
.
from
=
__FILE__
;
switch_core_session_receive_message
(
session_a
,
&
msg
);
switch_core_session_receive_message
(
session_a
,
&
msg
);
switch_core_session_kill_channel
(
session_b
,
SWITCH_SIG_BREAK
);
switch_channel_set_variable
(
chan_a
,
SWITCH_BRIDGE_VARIABLE
,
NULL
);
switch_channel_set_variable
(
chan_a
,
SWITCH_BRIDGE_VARIABLE
,
NULL
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"BRIDGE THREAD DONE [%s]
\n
"
,
switch_channel_get_name
(
chan_a
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"BRIDGE THREAD DONE [%s]
\n
"
,
switch_channel_get_name
(
chan_a
));
...
...
src/switch_ivr_originate.c
浏览文件 @
bf7144b2
...
@@ -246,8 +246,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
...
@@ -246,8 +246,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_channel_t
*
caller_channel
=
NULL
;
switch_channel_t
*
caller_channel
=
NULL
;
char
*
peer_names
[
MAX_PEERS
]
=
{
0
};
char
*
peer_names
[
MAX_PEERS
]
=
{
0
};
switch_core_session_t
*
peer_session
,
*
peer_sessions
[
MAX_PEERS
]
=
{
0
};
switch_core_session_t
*
new_session
=
NULL
,
*
peer_session
,
*
peer_sessions
[
MAX_PEERS
]
=
{
0
};
switch_caller_profile_t
*
caller_profiles
[
MAX_PEERS
]
=
{
0
},
*
caller_caller_profile
;
switch_caller_profile_t
*
new_profile
=
NULL
,
*
caller_profiles
[
MAX_PEERS
]
=
{
0
},
*
caller_caller_profile
;
char
*
chan_type
=
NULL
,
*
chan_data
;
char
*
chan_type
=
NULL
,
*
chan_data
;
switch_channel_t
*
peer_channel
=
NULL
,
*
peer_channels
[
MAX_PEERS
]
=
{
0
};
switch_channel_t
*
peer_channel
=
NULL
,
*
peer_channels
[
MAX_PEERS
]
=
{
0
};
ringback_t
ringback
=
{
0
};
ringback_t
ringback
=
{
0
};
...
@@ -427,6 +427,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
...
@@ -427,6 +427,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
memset
(
peer_sessions
,
0
,
sizeof
(
peer_sessions
));
memset
(
peer_sessions
,
0
,
sizeof
(
peer_sessions
));
memset
(
peer_channels
,
0
,
sizeof
(
peer_channels
));
memset
(
peer_channels
,
0
,
sizeof
(
peer_channels
));
memset
(
caller_profiles
,
0
,
sizeof
(
caller_profiles
));
memset
(
caller_profiles
,
0
,
sizeof
(
caller_profiles
));
new_profile
=
NULL
;
new_session
=
NULL
;
chan_type
=
NULL
;
chan_type
=
NULL
;
chan_data
=
NULL
;
chan_data
=
NULL
;
peer_channel
=
NULL
;
peer_channel
=
NULL
;
...
@@ -474,16 +476,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
...
@@ -474,16 +476,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
cid_num_override
=
caller_caller_profile
->
caller_id_number
;
cid_num_override
=
caller_caller_profile
->
caller_id_number
;
}
}
caller_profiles
[
i
]
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
new_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
caller_caller_profile
->
username
,
caller_caller_profile
->
username
,
caller_caller_profile
->
dialplan
,
caller_caller_profile
->
dialplan
,
cid_name_override
,
cid_name_override
,
cid_num_override
,
cid_num_override
,
caller_caller_profile
->
network_addr
,
caller_caller_profile
->
network_addr
,
NULL
,
NULL
,
NULL
,
NULL
,
caller_caller_profile
->
rdnis
,
caller_caller_profile
->
rdnis
,
caller_caller_profile
->
source
,
caller_caller_profile
->
context
,
chan_data
);
caller_caller_profile
->
source
,
caller_caller_profile
->
context
,
chan_data
);
caller_profiles
[
i
]
->
flags
=
caller_caller_profile
->
flags
;
caller_profiles
[
i
]
->
flags
=
caller_caller_profile
->
flags
;
pool
=
NULL
;
pool
=
NULL
;
}
else
{
}
else
{
...
@@ -501,42 +503,44 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
...
@@ -501,42 +503,44 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
}
}
if
(
caller_profile_override
)
{
if
(
caller_profile_override
)
{
caller_profiles
[
i
]
=
switch_caller_profile_new
(
pool
,
new_profile
=
switch_caller_profile_new
(
pool
,
caller_profile_override
->
username
,
caller_profile_override
->
username
,
caller_profile_override
->
dialplan
,
caller_profile_override
->
dialplan
,
caller_profile_override
->
caller_id_name
,
caller_profile_override
->
caller_id_name
,
caller_profile_override
->
caller_id_number
,
caller_profile_override
->
caller_id_number
,
caller_profile_override
->
network_addr
,
caller_profile_override
->
network_addr
,
caller_profile_override
->
ani
,
caller_profile_override
->
ani
,
caller_profile_override
->
aniii
,
caller_profile_override
->
aniii
,
caller_profile_override
->
rdnis
,
caller_profile_override
->
rdnis
,
caller_profile_override
->
source
,
caller_profile_override
->
context
,
chan_data
);
caller_profile_override
->
source
,
caller_profile_override
->
context
,
chan_data
);
}
else
{
}
else
{
caller_profiles
[
i
]
=
switch_caller_profile_new
(
pool
,
new_profile
=
switch_caller_profile_new
(
pool
,
NULL
,
NULL
,
NULL
,
NULL
,
cid_name_override
,
cid_num_override
,
NULL
,
NULL
,
NULL
,
NULL
,
__FILE__
,
NULL
,
cid_name_override
,
cid_num_override
,
NULL
,
NULL
,
NULL
,
NULL
,
__FILE__
,
NULL
,
chan_data
);
chan_data
);
}
}
}
}
if
((
reason
=
caller_profiles
[
i
]
=
NULL
;
switch_core_session_outgoing_channel
(
session
,
chan_type
,
caller_profiles
[
i
],
&
peer_sessions
[
i
],
&
pool
))
!=
SWITCH_CAUSE_SUCCESS
)
{
peer_channels
[
i
]
=
NULL
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Cannot Create Outgoing Channel! cause: %s
\n
"
,
peer_sessions
[
i
]
=
NULL
;
switch_channel_cause2str
(
reason
));
new_session
=
NULL
;
if
((
reason
=
switch_core_session_outgoing_channel
(
session
,
chan_type
,
new_profile
,
&
new_session
,
&
pool
))
!=
SWITCH_CAUSE_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Cannot Create Outgoing Channel! cause: %s
\n
"
,
switch_channel_cause2str
(
reason
));
if
(
pool
)
{
if
(
pool
)
{
switch_core_destroy_memory_pool
(
&
pool
);
switch_core_destroy_memory_pool
(
&
pool
);
}
}
caller_profiles
[
i
]
=
NULL
;
peer_channels
[
i
]
=
NULL
;
peer_sessions
[
i
]
=
NULL
;
continue
;
continue
;
}
}
switch_core_session_read_lock
(
peer_sessions
[
i
]);
switch_core_session_read_lock
(
peer_sessions
[
i
]);
pool
=
NULL
;
pool
=
NULL
;
peer_channels
[
i
]
=
switch_core_session_get_channel
(
peer_sessions
[
i
]);
caller_profiles
[
i
]
=
new_profile
;
peer_sessions
[
i
]
=
new_session
;
peer_channels
[
i
]
=
switch_core_session_get_channel
(
new_session
);
assert
(
peer_channels
[
i
]
!=
NULL
);
assert
(
peer_channels
[
i
]
!=
NULL
);
if
(
!
table
)
{
if
(
!
table
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论