Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
152e42aa
提交
152e42aa
authored
4月 26, 2006
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@1272
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
842ae3a2
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
68 行增加
和
27 行删除
+68
-27
mod_exosip.c
src/mod/endpoints/mod_exosip/mod_exosip.c
+32
-10
switch_channel.c
src/switch_channel.c
+2
-1
switch_core.c
src/switch_core.c
+9
-7
switch_ivr.c
src/switch_ivr.c
+25
-9
没有找到文件。
src/mod/endpoints/mod_exosip/mod_exosip.c
浏览文件 @
152e42aa
...
...
@@ -1385,10 +1385,11 @@ static switch_status exosip_create_call(eXosip_event_t * event)
}
static
void
destroy_call_by_event
(
eXosip_event_t
*
event
)
static
void
destroy_call_by_event
(
eXosip_event_t
*
event
)
{
struct
private_object
*
tech_pvt
;
switch_channel
*
channel
=
NULL
;
switch_call_cause_t
cause
;
if
((
tech_pvt
=
get_pvt_by_call_id
(
event
->
cid
))
==
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"cannot destroy nonexistant call [%d]!
\n
"
,
event
->
cid
);
...
...
@@ -1400,7 +1401,28 @@ static void destroy_call_by_event(eXosip_event_t * event)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"destroy %s
\n
"
,
switch_channel_get_name
(
channel
));
exosip_kill_channel
(
tech_pvt
->
session
,
SWITCH_SIG_KILL
);
switch_channel_hangup
(
channel
,
SWITCH_CAUSE_NORMAL_CLEARING
);
switch
(
event
->
type
)
{
case
EXOSIP_CALL_RELEASED
:
case
EXOSIP_CALL_CLOSED
:
cause
=
SWITCH_CAUSE_NORMAL_CLEARING
;
break
;
case
EXOSIP_CALL_NOANSWER
:
cause
=
SWITCH_CAUSE_NO_ANSWER
;
break
;
case
EXOSIP_CALL_REQUESTFAILURE
:
cause
=
SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL
;
break
;
case
EXOSIP_CALL_SERVERFAILURE
:
case
EXOSIP_CALL_GLOBALFAILURE
:
cause
=
SWITCH_CAUSE_CALL_REJECTED
;
break
;
default
:
cause
=
SWITCH_CAUSE_SWITCH_CONGESTION
;
break
;
}
switch_channel_hangup
(
channel
,
cause
);
}
...
...
@@ -1825,7 +1847,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
case
EXOSIP_CALL_REINVITE
:
/* See what the reinvite is about - on hold or whatever */
//handle_reinvite(event);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"Got a reinvite.
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"Got a reinvite.
\n
"
);
break
;
case
EXOSIP_CALL_MESSAGE_NEW
:
if
(
event
->
request
!=
NULL
&&
MSG_IS_REFER
(
event
->
request
))
{
...
...
@@ -1836,7 +1858,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
/* If audio is not flowing and this has SDP - fire it up! */
break
;
case
EXOSIP_CALL_ANSWERED
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"The call was answered.
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"The call was answered.
\n
"
);
handle_answer
(
event
);
break
;
case
EXOSIP_CALL_PROCEEDING
:
...
...
@@ -1846,7 +1868,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
//handle_ringing(event);
break
;
case
EXOSIP_CALL_REDIRECTED
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"Call was redirect
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"Call was redirect
\n
"
);
break
;
case
EXOSIP_CALL_CLOSED
:
destroy_call_by_event
(
event
);
...
...
@@ -1855,24 +1877,24 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
destroy_call_by_event
(
event
);
break
;
case
EXOSIP_CALL_NOANSWER
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"The call was not answered.
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"The call was not answered.
\n
"
);
destroy_call_by_event
(
event
);
break
;
case
EXOSIP_CALL_REQUESTFAILURE
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"Request failure
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"Request failure
\n
"
);
destroy_call_by_event
(
event
);
break
;
case
EXOSIP_CALL_SERVERFAILURE
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"Server failure
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"Server failure
\n
"
);
destroy_call_by_event
(
event
);
break
;
case
EXOSIP_CALL_GLOBALFAILURE
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"Global failure
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"Global failure
\n
"
);
destroy_call_by_event
(
event
);
break
;
/* Registration related stuff */
case
EXOSIP_REGISTRATION_NEW
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"Received registration attempt
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"Received registration attempt
\n
"
);
break
;
default
:
/* Unknown event... casually absorb it for now */
...
...
src/switch_channel.c
浏览文件 @
152e42aa
...
...
@@ -297,6 +297,7 @@ SWITCH_DECLARE(switch_status) switch_channel_set_name(switch_channel *channel, c
channel
->
name
=
NULL
;
if
(
name
)
{
channel
->
name
=
switch_core_session_strdup
(
channel
->
session
,
name
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"New Channel %s
\n
"
,
name
);
}
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -700,7 +701,7 @@ SWITCH_DECLARE(switch_channel_state) switch_channel_hangup(switch_channel *chann
channel
->
state
=
CS_HANGUP
;
channel
->
hangup_cause
=
hangup_cause
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
INFO
,
"Hangup %s [%s] [%s]
\n
"
,
channel
->
name
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"Hangup %s [%s] [%s]
\n
"
,
channel
->
name
,
state_names
[
last_state
],
switch_channel_cause2str
(
channel
->
hangup_cause
));
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_CHANNEL_STATE
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_channel_event_set_data
(
channel
,
event
);
...
...
src/switch_core.c
浏览文件 @
152e42aa
...
...
@@ -1847,12 +1847,12 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
switch
(
state
)
{
case
CS_NEW
:
/* Just created, Waiting for first instructions */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"(%s) State NEW
\n
"
,
switch_channel_get_name
(
session
->
channel
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"(%s) State NEW
\n
"
,
switch_channel_get_name
(
session
->
channel
));
break
;
case
CS_DONE
:
continue
;
case
CS_HANGUP
:
/* Deactivate and end the thread */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"(%s) State HANGUP
\n
"
,
switch_channel_get_name
(
session
->
channel
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"(%s) State HANGUP
\n
"
,
switch_channel_get_name
(
session
->
channel
));
if
(
!
driver_state_handler
->
on_hangup
||
(
driver_state_handler
->
on_hangup
&&
driver_state_handler
->
on_hangup
(
session
)
==
SWITCH_STATUS_SUCCESS
&&
...
...
@@ -1891,7 +1891,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
midstate
=
switch_channel_get_state
(
session
->
channel
);
break
;
case
CS_INIT
:
/* Basic setup tasks */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"(%s) State INIT
\n
"
,
switch_channel_get_name
(
session
->
channel
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"(%s) State INIT
\n
"
,
switch_channel_get_name
(
session
->
channel
));
if
(
!
driver_state_handler
->
on_init
||
(
driver_state_handler
->
on_init
&&
driver_state_handler
->
on_init
(
session
)
==
SWITCH_STATUS_SUCCESS
&&
...
...
@@ -1927,7 +1927,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
}
break
;
case
CS_RING
:
/* Look for a dialplan and find something to do */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"(%s) State RING
\n
"
,
switch_channel_get_name
(
session
->
channel
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"(%s) State RING
\n
"
,
switch_channel_get_name
(
session
->
channel
));
if
(
!
driver_state_handler
->
on_ring
||
(
driver_state_handler
->
on_ring
&&
driver_state_handler
->
on_ring
(
session
)
==
SWITCH_STATUS_SUCCESS
&&
...
...
@@ -1963,7 +1963,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
}
break
;
case
CS_EXECUTE
:
/* Execute an Operation */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"(%s) State EXECUTE
\n
"
,
switch_channel_get_name
(
session
->
channel
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"(%s) State EXECUTE
\n
"
,
switch_channel_get_name
(
session
->
channel
));
if
(
!
driver_state_handler
->
on_execute
||
(
driver_state_handler
->
on_execute
&&
driver_state_handler
->
on_execute
(
session
)
==
SWITCH_STATUS_SUCCESS
&&
...
...
@@ -1999,7 +1999,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
}
break
;
case
CS_LOOPBACK
:
/* loop all data back to source */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"(%s) State LOOPBACK
\n
"
,
switch_channel_get_name
(
session
->
channel
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"(%s) State LOOPBACK
\n
"
,
switch_channel_get_name
(
session
->
channel
));
if
(
!
driver_state_handler
->
on_loopback
||
(
driver_state_handler
->
on_loopback
&&
driver_state_handler
->
on_loopback
(
session
)
==
SWITCH_STATUS_SUCCESS
&&
...
...
@@ -2035,7 +2035,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
}
break
;
case
CS_TRANSMIT
:
/* send/recieve data to/from another channel */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
NOTICE
,
"(%s) State TRANSMIT
\n
"
,
switch_channel_get_name
(
session
->
channel
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_
DEBUG
,
"(%s) State TRANSMIT
\n
"
,
switch_channel_get_name
(
session
->
channel
));
if
(
!
driver_state_handler
->
on_transmit
||
(
driver_state_handler
->
on_transmit
&&
driver_state_handler
->
on_transmit
(
session
)
==
SWITCH_STATUS_SUCCESS
&&
...
...
@@ -2093,6 +2093,8 @@ SWITCH_DECLARE(void) switch_core_session_destroy(switch_core_session **session)
switch_memory_pool
*
pool
;
switch_event
*
event
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"Close Channel %s
\n
"
,
switch_channel_get_name
((
*
session
)
->
channel
));
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_CHANNEL_DESTROY
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_channel_event_set_data
((
*
session
)
->
channel
,
event
);
switch_event_fire
(
&
event
);
...
...
src/switch_ivr.c
浏览文件 @
152e42aa
...
...
@@ -802,7 +802,7 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj)
return
NULL
;
}
static
switch_status
audio_bridge_on_
transmit
(
switch_core_session
*
session
)
static
switch_status
audio_bridge_on_
loopback
(
switch_core_session
*
session
)
{
switch_channel
*
channel
=
NULL
;
void
*
arg
;
...
...
@@ -829,13 +829,21 @@ static switch_status audio_bridge_on_ring(switch_core_session *session)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"CUSTOM RING
\n
"
);
/* put the channel in a passive state so we can loop audio to it */
if
(
switch_channel_test_flag
(
channel
,
CF_OUTBOUND
))
{
//switch_channel_set_state(channel, CS_TRANSMIT);
return
SWITCH_STATUS_FALSE
;
}
switch_channel_set_state
(
channel
,
CS_TRANSMIT
);
return
SWITCH_STATUS_FALSE
;
}
static
switch_status
audio_bridge_on_transmit
(
switch_core_session
*
session
)
{
switch_channel
*
channel
=
NULL
;
return
SWITCH_STATUS_SUCCESS
;
channel
=
switch_core_session_get_channel
(
session
);
assert
(
channel
!=
NULL
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"CUSTOM TRANSMIT
\n
"
);
/* put the channel in a passive state so we can loop audio to it */
return
SWITCH_STATUS_FALSE
;
}
static
const
switch_state_handler_table
audio_bridge_peer_state_handlers
=
{
...
...
@@ -843,8 +851,8 @@ static const switch_state_handler_table audio_bridge_peer_state_handlers = {
/*.on_ring */
audio_bridge_on_ring
,
/*.on_execute */
NULL
,
/*.on_hangup */
NULL
,
/*.on_loopback */
NULL
,
/*.on_transmit */
audio_bridge_on_transmit
/*.on_loopback */
audio_bridge_on_loopback
,
/*.on_transmit */
audio_bridge_on_transmit
,
};
...
...
@@ -953,6 +961,8 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
switch_event
*
event
;
switch_core_session_message
msg
=
{
0
};
switch_channel_set_state
(
peer_channel
,
CS_TRANSMIT
);
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_CHANNEL_BRIDGE
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_channel_event_set_data
(
caller_channel
,
event
);
switch_event_fire
(
&
event
);
...
...
@@ -968,7 +978,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
switch_channel_set_flag
(
peer_channel
,
CF_LOCK_THREAD
);
switch_channel_set_private
(
peer_channel
,
&
other_audio_thread
);
switch_channel_set_state
(
peer_channel
,
CS_
TRANSMIT
);
switch_channel_set_state
(
peer_channel
,
CS_
LOOPBACK
);
audio_bridge_thread
(
NULL
,
(
void
*
)
&
this_audio_thread
);
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_CHANNEL_UNBRIDGE
)
==
SWITCH_STATUS_SUCCESS
)
{
...
...
@@ -976,6 +986,12 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
switch_event_fire
(
&
event
);
}
switch_channel_clear_flag
(
peer_channel
,
CF_LOCK_THREAD
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Bridge Failed %s->%s
\n
"
,
switch_channel_get_name
(
caller_channel
),
switch_channel_get_name
(
peer_channel
)
);
return
SWITCH_STATUS_FALSE
;
}
return
SWITCH_STATUS_SUCCESS
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论