Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f83a8ecf
提交
f83a8ecf
authored
8月 26, 2006
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@2401
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
ac2b1e22
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
75 行增加
和
66 行删除
+75
-66
mod_playback.c
src/mod/applications/mod_playback/mod_playback.c
+1
-1
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+74
-65
没有找到文件。
src/mod/applications/mod_playback/mod_playback.c
浏览文件 @
f83a8ecf
...
@@ -111,7 +111,7 @@ static void playback_function(switch_core_session_t *session, char *data)
...
@@ -111,7 +111,7 @@ static void playback_function(switch_core_session_t *session, char *data)
channel
=
switch_core_session_get_channel
(
session
);
channel
=
switch_core_session_get_channel
(
session
);
assert
(
channel
!=
NULL
);
assert
(
channel
!=
NULL
);
switch_channel_answer
(
channel
);
switch_channel_
pre_
answer
(
channel
);
if
(
switch_ivr_play_file
(
session
,
NULL
,
file_name
,
timer_name
,
on_dtmf
,
NULL
,
0
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_ivr_play_file
(
session
,
NULL
,
file_name
,
timer_name
,
on_dtmf
,
NULL
,
0
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_channel_hangup
(
channel
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
switch_channel_hangup
(
channel
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
...
...
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
f83a8ecf
...
@@ -180,13 +180,13 @@ static switch_status_t sofia_on_loopback(switch_core_session_t *session);
...
@@ -180,13 +180,13 @@ static switch_status_t sofia_on_loopback(switch_core_session_t *session);
static
switch_status_t
sofia_on_transmit
(
switch_core_session_t
*
session
);
static
switch_status_t
sofia_on_transmit
(
switch_core_session_t
*
session
);
static
switch_status_t
sofia_outgoing_channel
(
switch_core_session_t
*
session
,
switch_caller_profile_t
*
outbound_profile
,
static
switch_status_t
sofia_outgoing_channel
(
switch_core_session_t
*
session
,
switch_caller_profile_t
*
outbound_profile
,
switch_core_session_t
**
new_session
,
switch_memory_pool_t
*
pool
);
switch_core_session_t
**
new_session
,
switch_memory_pool_t
*
pool
);
static
switch_status_t
sofia_read_frame
(
switch_core_session_t
*
session
,
switch_frame_t
**
frame
,
int
timeout
,
static
switch_status_t
sofia_read_frame
(
switch_core_session_t
*
session
,
switch_frame_t
**
frame
,
int
timeout
,
switch_io_flag_t
flags
,
int
stream_id
);
switch_io_flag_t
flags
,
int
stream_id
);
static
switch_status_t
sofia_write_frame
(
switch_core_session_t
*
session
,
switch_frame_t
*
frame
,
int
timeout
,
static
switch_status_t
sofia_write_frame
(
switch_core_session_t
*
session
,
switch_frame_t
*
frame
,
int
timeout
,
switch_io_flag_t
flags
,
int
stream_id
);
switch_io_flag_t
flags
,
int
stream_id
);
static
switch_status_t
config_sofia
(
int
reload
);
static
switch_status_t
config_sofia
(
int
reload
);
...
@@ -205,7 +205,7 @@ static void attach_private(switch_core_session_t *session,
...
@@ -205,7 +205,7 @@ static void attach_private(switch_core_session_t *session,
private_object_t
*
tech_pvt
,
private_object_t
*
tech_pvt
,
char
*
channame
);
char
*
channame
);
static
void
terminate_session
(
switch_core_session_t
**
session
,
switch_call_cause_t
cause
);
static
void
terminate_session
(
switch_core_session_t
**
session
,
switch_call_cause_t
cause
,
int
line
);
static
switch_status_t
tech_choose_port
(
private_object_t
*
tech_pvt
);
static
switch_status_t
tech_choose_port
(
private_object_t
*
tech_pvt
);
...
@@ -358,32 +358,33 @@ static void attach_private(switch_core_session_t *session,
...
@@ -358,32 +358,33 @@ static void attach_private(switch_core_session_t *session,
switch_channel_set_name
(
channel
,
name
);
switch_channel_set_name
(
channel
,
name
);
}
}
static
void
terminate_session
(
switch_core_session_t
**
session
,
switch_call_cause_t
cause
)
static
void
terminate_session
(
switch_core_session_t
**
session
,
switch_call_cause_t
cause
,
int
line
)
{
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Term called from line: %d
\n
"
,
line
);
if
(
*
session
)
{
if
(
*
session
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
*
session
);
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
*
session
);
switch_channel_state_t
state
=
switch_channel_get_state
(
channel
);
switch_channel_state_t
state
=
switch_channel_get_state
(
channel
);
struct
private_object
*
tech_pvt
=
NULL
;
struct
private_object
*
tech_pvt
=
NULL
;
tech_pvt
=
switch_core_session_get_private
(
*
session
);
tech_pvt
=
switch_core_session_get_private
(
*
session
);
assert
(
tech_pvt
!=
NULL
);
if
(
state
>
CS_INIT
&&
state
<
CS_HANGUP
)
{
if
(
tech_pvt
)
{
switch_channel_hangup
(
channel
,
cause
);
}
if
(
!
switch_test_flag
(
tech_pvt
,
TFLAG_READY
))
{
if
(
state
>
CS_INIT
&&
state
<
CS_HANGUP
)
{
if
(
state
>
CS_INIT
&&
state
<
CS_HANGUP
)
{
sofia_on_hangup
(
*
session
);
switch_channel_hangup
(
channel
,
cause
);
}
if
(
!
switch_test_flag
(
tech_pvt
,
TFLAG_READY
))
{
if
(
state
>
CS_INIT
&&
state
<
CS_HANGUP
)
{
sofia_on_hangup
(
*
session
);
}
switch_core_session_destroy
(
session
);
}
}
}
else
{
switch_core_session_destroy
(
session
);
switch_core_session_destroy
(
session
);
}
}
}
}
}
}
static
switch_status_t
tech_choose_port
(
private_object_t
*
tech_pvt
)
static
switch_status_t
tech_choose_port
(
private_object_t
*
tech_pvt
)
{
{
char
*
ip
=
tech_pvt
->
profile
->
rtpip
;
char
*
ip
=
tech_pvt
->
profile
->
rtpip
;
...
@@ -404,7 +405,7 @@ static switch_status_t tech_choose_port(private_object_t *tech_pvt)
...
@@ -404,7 +405,7 @@ static switch_status_t tech_choose_port(private_object_t *tech_pvt)
char
*
stun_ip
=
tech_pvt
->
profile
->
extrtpip
+
5
;
char
*
stun_ip
=
tech_pvt
->
profile
->
extrtpip
+
5
;
if
(
!
stun_ip
)
{
if
(
!
stun_ip
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Stun Failed! NO STUN SERVER
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Stun Failed! NO STUN SERVER
\n
"
);
terminate_session
(
&
tech_pvt
->
session
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
terminate_session
(
&
tech_pvt
->
session
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
,
__LINE__
);
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
if
(
switch_stun_lookup
(
&
ip
,
if
(
switch_stun_lookup
(
&
ip
,
...
@@ -414,7 +415,7 @@ static switch_status_t tech_choose_port(private_object_t *tech_pvt)
...
@@ -414,7 +415,7 @@ static switch_status_t tech_choose_port(private_object_t *tech_pvt)
&
err
,
&
err
,
switch_core_session_get_pool
(
tech_pvt
->
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_core_session_get_pool
(
tech_pvt
->
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Stun Failed! %s:%d [%s]
\n
"
,
stun_ip
,
SWITCH_STUN_DEFAULT_PORT
,
err
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Stun Failed! %s:%d [%s]
\n
"
,
stun_ip
,
SWITCH_STUN_DEFAULT_PORT
,
err
);
terminate_session
(
&
tech_pvt
->
session
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
terminate_session
(
&
tech_pvt
->
session
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
,
__LINE__
);
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Stun Success [%s]:[%d]
\n
"
,
ip
,
sdp_port
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Stun Success [%s]:[%d]
\n
"
,
ip
,
sdp_port
);
...
@@ -457,9 +458,9 @@ static void do_invite(switch_core_session_t *session)
...
@@ -457,9 +458,9 @@ static void do_invite(switch_core_session_t *session)
}
}
/*
/*
State methods they get called when the state changes to the specific state
State methods they get called when the state changes to the specific state
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
*/
*/
static
switch_status_t
sofia_on_init
(
switch_core_session_t
*
session
)
static
switch_status_t
sofia_on_init
(
switch_core_session_t
*
session
)
{
{
...
@@ -595,7 +596,7 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt)
...
@@ -595,7 +596,7 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt)
assert
(
tech_pvt
->
codecs
[
tech_pvt
->
codec_index
]
!=
NULL
);
assert
(
tech_pvt
->
codecs
[
tech_pvt
->
codec_index
]
!=
NULL
);
if
(
tech_pvt
->
rtp_session
)
{
if
(
tech_pvt
->
rtp_session
)
{
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
@@ -608,7 +609,7 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt)
...
@@ -608,7 +609,7 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt)
NULL
,
NULL
,
switch_core_session_get_pool
(
tech_pvt
->
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_core_session_get_pool
(
tech_pvt
->
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't load codec?
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't load codec?
\n
"
);
terminate_session
(
&
tech_pvt
->
session
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
terminate_session
(
&
tech_pvt
->
session
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
,
__LINE__
);
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
else
{
}
else
{
if
(
switch_core_codec_init
(
&
tech_pvt
->
write_codec
,
if
(
switch_core_codec_init
(
&
tech_pvt
->
write_codec
,
...
@@ -620,7 +621,7 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt)
...
@@ -620,7 +621,7 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt)
NULL
,
NULL
,
switch_core_session_get_pool
(
tech_pvt
->
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_core_session_get_pool
(
tech_pvt
->
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't load codec?
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Can't load codec?
\n
"
);
terminate_session
(
&
tech_pvt
->
session
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
terminate_session
(
&
tech_pvt
->
session
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
,
__LINE__
);
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
else
{
}
else
{
int
ms
;
int
ms
;
...
@@ -683,7 +684,7 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt)
...
@@ -683,7 +684,7 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt)
}
}
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"RTP REPORTS ERROR: [%s]
\n
"
,
err
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"RTP REPORTS ERROR: [%s]
\n
"
,
err
);
terminate_session
(
&
tech_pvt
->
session
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
terminate_session
(
&
tech_pvt
->
session
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
,
__LINE__
);
switch_clear_flag_locked
(
tech_pvt
,
TFLAG_IO
);
switch_clear_flag_locked
(
tech_pvt
,
TFLAG_IO
);
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
...
@@ -721,7 +722,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
...
@@ -721,7 +722,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
static
switch_status_t
sofia_read_frame
(
switch_core_session_t
*
session
,
switch_frame_t
**
frame
,
int
timeout
,
static
switch_status_t
sofia_read_frame
(
switch_core_session_t
*
session
,
switch_frame_t
**
frame
,
int
timeout
,
switch_io_flag_t
flags
,
int
stream_id
)
switch_io_flag_t
flags
,
int
stream_id
)
{
{
private_object_t
*
tech_pvt
=
NULL
;
private_object_t
*
tech_pvt
=
NULL
;
size_t
bytes
=
0
,
samples
=
0
,
frames
=
0
,
ms
=
0
;
size_t
bytes
=
0
,
samples
=
0
,
frames
=
0
,
ms
=
0
;
...
@@ -826,7 +827,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
...
@@ -826,7 +827,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
static
switch_status_t
sofia_write_frame
(
switch_core_session_t
*
session
,
switch_frame_t
*
frame
,
int
timeout
,
static
switch_status_t
sofia_write_frame
(
switch_core_session_t
*
session
,
switch_frame_t
*
frame
,
int
timeout
,
switch_io_flag_t
flags
,
int
stream_id
)
switch_io_flag_t
flags
,
int
stream_id
)
{
{
private_object_t
*
tech_pvt
;
private_object_t
*
tech_pvt
;
switch_channel_t
*
channel
=
NULL
;
switch_channel_t
*
channel
=
NULL
;
...
@@ -958,17 +959,17 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
...
@@ -958,17 +959,17 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
switch
(
msg
->
message_id
)
{
switch
(
msg
->
message_id
)
{
case
SWITCH_MESSAGE_INDICATE_BRIDGE
:
case
SWITCH_MESSAGE_INDICATE_BRIDGE
:
if
(
tech_pvt
->
rtp_session
&&
switch_test_flag
(
tech_pvt
,
TFLAG_TIMER
))
{
if
(
tech_pvt
->
rtp_session
&&
switch_test_flag
(
tech_pvt
,
TFLAG_TIMER
))
{
switch_rtp_clear_flag
(
tech_pvt
->
rtp_session
,
SWITCH_RTP_FLAG_USE_TIMER
);
switch_rtp_clear_flag
(
tech_pvt
->
rtp_session
,
SWITCH_RTP_FLAG_USE_TIMER
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"De-activate timed RTP!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"De-activate timed RTP!
\n
"
);
}
}
break
;
break
;
case
SWITCH_MESSAGE_INDICATE_UNBRIDGE
:
case
SWITCH_MESSAGE_INDICATE_UNBRIDGE
:
if
(
tech_pvt
->
rtp_session
&&
switch_test_flag
(
tech_pvt
,
TFLAG_TIMER
))
{
if
(
tech_pvt
->
rtp_session
&&
switch_test_flag
(
tech_pvt
,
TFLAG_TIMER
))
{
switch_rtp_set_flag
(
tech_pvt
->
rtp_session
,
SWITCH_RTP_FLAG_USE_TIMER
);
switch_rtp_set_flag
(
tech_pvt
->
rtp_session
,
SWITCH_RTP_FLAG_USE_TIMER
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Re-activate timed RTP!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Re-activate timed RTP!
\n
"
);
}
}
break
;
break
;
case
SWITCH_MESSAGE_INDICATE_PROGRESS
:
{
case
SWITCH_MESSAGE_INDICATE_PROGRESS
:
{
struct
private_object
*
tech_pvt
;
struct
private_object
*
tech_pvt
;
switch_channel_t
*
channel
=
NULL
;
switch_channel_t
*
channel
=
NULL
;
...
@@ -980,13 +981,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
...
@@ -980,13 +981,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
assert
(
tech_pvt
!=
NULL
);
assert
(
tech_pvt
!=
NULL
);
if
(
!
switch_test_flag
(
tech_pvt
,
TFLAG_EARLY_MEDIA
))
{
if
(
!
switch_test_flag
(
tech_pvt
,
TFLAG_EARLY_MEDIA
))
{
switch_set_flag_locked
(
tech_pvt
,
TFLAG_EARLY_MEDIA
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Asked to send early media by %s
\n
"
,
msg
->
from
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Asked to send early media by %s
\n
"
,
msg
->
from
);
/* Transmit 183 Progress with SDP */
/* Transmit 183 Progress with SDP */
tech_choose_port
(
tech_pvt
);
tech_choose_port
(
tech_pvt
);
set_local_sdp
(
tech_pvt
);
set_local_sdp
(
tech_pvt
);
activate_rtp
(
tech_pvt
);
activate_rtp
(
tech_pvt
);
//help me this 183 line will not work. The resulting 183 has no sdp, sigh...
nua_respond
(
tech_pvt
->
nh
,
SIP_183_SESSION_PROGRESS
,
SOATAG_USER_SDP_STR
(
tech_pvt
->
local_sdp_str
),
TAG_END
());
nua_respond
(
tech_pvt
->
nh
,
SIP_183_SESSION_PROGRESS
,
SOATAG_LOCAL_SDP_STR
(
tech_pvt
->
local_sdp_str
),
TAG_END
());
//nua_respond(tech_pvt->nh, SIP_200_OK, SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), TAG_END());
//nua_respond(tech_pvt->nh, SIP_200_OK, SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), TAG_END());
}
}
}
}
...
@@ -1037,7 +1038,7 @@ static const switch_loadable_module_interface_t sofia_module_interface = {
...
@@ -1037,7 +1038,7 @@ static const switch_loadable_module_interface_t sofia_module_interface = {
};
};
static
switch_status_t
sofia_outgoing_channel
(
switch_core_session_t
*
session
,
switch_caller_profile_t
*
outbound_profile
,
static
switch_status_t
sofia_outgoing_channel
(
switch_core_session_t
*
session
,
switch_caller_profile_t
*
outbound_profile
,
switch_core_session_t
**
new_session
,
switch_memory_pool_t
*
pool
)
switch_core_session_t
**
new_session
,
switch_memory_pool_t
*
pool
)
{
{
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
switch_core_session_t
*
nsession
;
switch_core_session_t
*
nsession
;
...
@@ -1056,7 +1057,7 @@ static switch_status_t sofia_outgoing_channel(switch_core_session_t *session, sw
...
@@ -1056,7 +1057,7 @@ static switch_status_t sofia_outgoing_channel(switch_core_session_t *session, sw
if
(
!
(
tech_pvt
=
(
struct
private_object
*
)
switch_core_session_alloc
(
nsession
,
sizeof
(
*
tech_pvt
))))
{
if
(
!
(
tech_pvt
=
(
struct
private_object
*
)
switch_core_session_alloc
(
nsession
,
sizeof
(
*
tech_pvt
))))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Error Creating Session
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Error Creating Session
\n
"
);
terminate_session
(
&
nsession
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
terminate_session
(
&
nsession
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
,
__LINE__
);
goto
done
;
goto
done
;
}
}
...
@@ -1065,7 +1066,7 @@ static switch_status_t sofia_outgoing_channel(switch_core_session_t *session, sw
...
@@ -1065,7 +1066,7 @@ static switch_status_t sofia_outgoing_channel(switch_core_session_t *session, sw
if
(
!
(
dest
=
strchr
(
profile_name
,
'/'
)))
{
if
(
!
(
dest
=
strchr
(
profile_name
,
'/'
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invalid URL
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invalid URL
\n
"
);
terminate_session
(
&
nsession
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
terminate_session
(
&
nsession
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
,
__LINE__
);
goto
done
;
goto
done
;
}
}
...
@@ -1073,7 +1074,7 @@ static switch_status_t sofia_outgoing_channel(switch_core_session_t *session, sw
...
@@ -1073,7 +1074,7 @@ static switch_status_t sofia_outgoing_channel(switch_core_session_t *session, sw
if
(
!
(
profile
=
(
sofia_profile_t
*
)
switch_core_hash_find
(
globals
.
profile_hash
,
profile_name
)))
{
if
(
!
(
profile
=
(
sofia_profile_t
*
)
switch_core_hash_find
(
globals
.
profile_hash
,
profile_name
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invalid Profile
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invalid Profile
\n
"
);
terminate_session
(
&
nsession
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
terminate_session
(
&
nsession
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
,
__LINE__
);
goto
done
;
goto
done
;
}
}
...
@@ -1224,7 +1225,7 @@ static void sip_i_state(int status,
...
@@ -1224,7 +1225,7 @@ static void sip_i_state(int status,
if
(
match
)
{
if
(
match
)
{
tech_choose_port
(
tech_pvt
);
tech_choose_port
(
tech_pvt
);
activate_rtp
(
tech_pvt
);
activate_rtp
(
tech_pvt
);
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"
PROGRESS
"
);
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"
EARLY MEDIA
"
);
switch_channel_pre_answer
(
channel
);
switch_channel_pre_answer
(
channel
);
return
;
return
;
}
}
...
@@ -1273,30 +1274,36 @@ static void sip_i_state(int status,
...
@@ -1273,30 +1274,36 @@ static void sip_i_state(int status,
case
nua_callstate_completed
:
case
nua_callstate_completed
:
break
;
break
;
case
nua_callstate_ready
:
case
nua_callstate_ready
:
if
(
session
&&
r_sdp
)
{
if
(
session
)
{
su_home_t
home
[
1
]
=
{
SU_HOME_INIT
(
home
)
};
if
(
r_sdp
)
{
sdp_parser_t
*
parser
=
sdp_parse
(
home
,
r_sdp
,
(
int
)
strlen
(
r_sdp
),
0
);
su_home_t
home
[
1
]
=
{
SU_HOME_INIT
(
home
)
};
sdp_session_t
*
sdp
;
sdp_parser_t
*
parser
=
sdp_parse
(
home
,
r_sdp
,
(
int
)
strlen
(
r_sdp
),
0
);
uint8_t
match
=
0
;
sdp_session_t
*
sdp
;
uint8_t
match
=
0
;
if
(
tech_pvt
->
num_codecs
)
{
if
((
sdp
=
sdp_session
(
parser
)))
{
if
(
tech_pvt
->
num_codecs
)
{
match
=
negotiate_sdp
(
session
,
sdp
);
if
((
sdp
=
sdp_session
(
parser
)))
{
match
=
negotiate_sdp
(
session
,
sdp
);
}
}
}
}
if
(
parser
)
{
if
(
parser
)
{
sdp_parser_free
(
parser
);
sdp_parser_free
(
parser
);
}
}
if
(
home
)
{
if
(
home
)
{
su_home_deinit
(
home
);
su_home_deinit
(
home
);
}
}
if
(
match
)
{
if
(
match
)
{
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"ANSWER"
);
tech_choose_port
(
tech_pvt
);
activate_rtp
(
tech_pvt
);
switch_channel_answer
(
channel
);
return
;
}
}
else
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_EARLY_MEDIA
))
{
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"ANSWER"
);
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"ANSWER"
);
tech_choose_port
(
tech_pvt
);
activate_rtp
(
tech_pvt
);
switch_channel_answer
(
channel
);
switch_channel_answer
(
channel
);
return
;
return
;
}
}
...
@@ -1309,7 +1316,7 @@ static void sip_i_state(int status,
...
@@ -1309,7 +1316,7 @@ static void sip_i_state(int status,
case
nua_callstate_terminated
:
case
nua_callstate_terminated
:
if
(
session
)
{
if
(
session
)
{
switch_set_flag_locked
(
tech_pvt
,
TFLAG_BYE
);
switch_set_flag_locked
(
tech_pvt
,
TFLAG_BYE
);
terminate_session
(
&
session
,
SWITCH_CAUSE_NORMAL_CLEARING
);
terminate_session
(
&
session
,
SWITCH_CAUSE_NORMAL_CLEARING
,
__LINE__
);
}
}
break
;
break
;
}
}
...
@@ -1338,7 +1345,7 @@ static void sip_i_invite(nua_t *nua,
...
@@ -1338,7 +1345,7 @@ static void sip_i_invite(nua_t *nua,
if
(
!
(
tech_pvt
=
(
private_object_t
*
)
switch_core_session_alloc
(
session
,
sizeof
(
private_object_t
))))
{
if
(
!
(
tech_pvt
=
(
private_object_t
*
)
switch_core_session_alloc
(
session
,
sizeof
(
private_object_t
))))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Hey where is my memory pool?
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Hey where is my memory pool?
\n
"
);
terminate_session
(
&
session
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
);
terminate_session
(
&
session
,
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
,
__LINE__
);
return
;
return
;
}
}
...
@@ -1522,7 +1529,8 @@ static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t *thread, void
...
@@ -1522,7 +1529,8 @@ static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t *thread, void
event_callback
,
/* Callback for processing events */
event_callback
,
/* Callback for processing events */
profile
,
/* Additional data to pass to callback */
profile
,
/* Additional data to pass to callback */
NUTAG_URL
(
profile
->
url
),
NUTAG_URL
(
profile
->
url
),
NUTAG_EARLY_MEDIA
(
1
),
NUTAG_EARLY_MEDIA
(
1
),
SIPTAG_SUPPORTED_STR
(
"100rel, precondition"
),
TAG_END
());
/* Last tag should always finish the sequence */
TAG_END
());
/* Last tag should always finish the sequence */
for
(
node
=
profile
->
aliases
;
node
;
node
=
node
->
next
)
{
for
(
node
=
profile
->
aliases
;
node
;
node
=
node
->
next
)
{
...
@@ -1531,6 +1539,7 @@ static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t *thread, void
...
@@ -1531,6 +1539,7 @@ static void *SWITCH_THREAD_FUNC profile_thread_run(switch_thread_t *thread, void
profile
,
/* Additional data to pass to callback */
profile
,
/* Additional data to pass to callback */
NUTAG_URL
(
node
->
url
),
NUTAG_URL
(
node
->
url
),
NUTAG_EARLY_MEDIA
(
1
),
NUTAG_EARLY_MEDIA
(
1
),
SIPTAG_SUPPORTED_STR
(
"100rel, precondition"
),
TAG_END
());
/* Last tag should always finish the sequence */
TAG_END
());
/* Last tag should always finish the sequence */
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论