Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
d14909d4
提交
d14909d4
authored
12月 24, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@6971
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
6cd5f4de
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
104 行增加
和
52 行删除
+104
-52
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+54
-7
sofia.c
src/mod/endpoints/mod_sofia/sofia.c
+50
-45
没有找到文件。
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
d14909d4
...
...
@@ -84,7 +84,7 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
tech_pvt
->
read_frame
.
buflen
=
SWITCH_RTP_MAX_BUF_LEN
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"
SOFIA INIT
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"
%s SOFIA INIT
\n
"
,
switch_channel_get_name
(
channel
)
);
if
(
switch_channel_test_flag
(
channel
,
CF_BYPASS_MEDIA
))
{
sofia_glue_tech_absorb_sdp
(
tech_pvt
);
}
...
...
@@ -112,7 +112,47 @@ static switch_status_t sofia_on_ring(switch_core_session_t *session)
tech_pvt
=
(
private_object_t
*
)
switch_core_session_get_private
(
session
);
switch_assert
(
tech_pvt
!=
NULL
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"SOFIA RING
\n
"
);
switch_clear_flag_locked
(
tech_pvt
,
TFLAG_SIP_HOLD
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s SOFIA RING
\n
"
,
switch_channel_get_name
(
channel
));
return
SWITCH_STATUS_SUCCESS
;
}
static
switch_status_t
sofia_on_reset
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
NULL
;
private_object_t
*
tech_pvt
=
NULL
;
channel
=
switch_core_session_get_channel
(
session
);
switch_assert
(
channel
!=
NULL
);
tech_pvt
=
(
private_object_t
*
)
switch_core_session_get_private
(
session
);
switch_assert
(
tech_pvt
!=
NULL
);
switch_clear_flag_locked
(
tech_pvt
,
TFLAG_SIP_HOLD
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s SOFIA RESET
\n
"
,
switch_channel_get_name
(
channel
));
return
SWITCH_STATUS_SUCCESS
;
}
static
switch_status_t
sofia_on_hibernate
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
NULL
;
private_object_t
*
tech_pvt
=
NULL
;
channel
=
switch_core_session_get_channel
(
session
);
switch_assert
(
channel
!=
NULL
);
tech_pvt
=
(
private_object_t
*
)
switch_core_session_get_private
(
session
);
switch_assert
(
tech_pvt
!=
NULL
);
switch_clear_flag_locked
(
tech_pvt
,
TFLAG_SIP_HOLD
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s SOFIA HIBERNATE
\n
"
,
switch_channel_get_name
(
channel
));
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -128,7 +168,8 @@ static switch_status_t sofia_on_execute(switch_core_session_t *session)
tech_pvt
=
(
private_object_t
*
)
switch_core_session_get_private
(
session
);
switch_assert
(
tech_pvt
!=
NULL
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"SOFIA EXECUTE
\n
"
);
switch_clear_flag_locked
(
tech_pvt
,
TFLAG_SIP_HOLD
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s SOFIA EXECUTE
\n
"
,
switch_channel_get_name
(
channel
));
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -206,7 +247,10 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
switch_rtp_release_port
(
tech_pvt
->
profile
->
rtpip
,
tech_pvt
->
local_sdp_audio_port
);
}
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_SIP_HOLD
))
{
cause
=
switch_channel_get_cause
(
channel
);
#if 0
if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
const char *buuid;
switch_core_session_t *bsession;
switch_channel_t *bchannel;
...
...
@@ -232,8 +276,8 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
}
#endif
cause
=
switch_channel_get_cause
(
channel
);
sip_cause
=
hangup_cause_to_sip
(
cause
);
sofia_glue_deactivate_rtp
(
tech_pvt
);
...
...
@@ -1495,7 +1539,10 @@ switch_state_handler_table_t sofia_event_handlers = {
/*.on_execute */
sofia_on_execute
,
/*.on_hangup */
sofia_on_hangup
,
/*.on_loopback */
sofia_on_loopback
,
/*.on_transmit */
sofia_on_transmit
/*.on_transmit */
sofia_on_transmit
,
/*.on_hold */
NULL
,
/*.on_hibernate*/
sofia_on_hibernate
,
/*.on_reset*/
sofia_on_reset
};
static
switch_status_t
sofia_manage
(
char
*
relative_oid
,
switch_management_action_t
action
,
char
*
data
,
switch_size_t
datalen
)
...
...
src/mod/endpoints/mod_sofia/sofia.c
浏览文件 @
d14909d4
...
...
@@ -1462,6 +1462,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
if
(
br_b
)
{
switch_ivr_uuid_bridge
(
br_a
,
br_b
);
switch_channel_set_variable
(
channel
,
SWITCH_ENDPOINT_DISPOSITION_VARIABLE
,
"ATTENDED_TRANSFER"
);
switch_clear_flag_locked
(
tech_pvt
,
TFLAG_SIP_HOLD
);
switch_channel_hangup
(
channel
,
SWITCH_CAUSE_ATTENDED_TRANSFER
);
}
else
{
switch_channel_set_variable
(
channel
,
SWITCH_ENDPOINT_DISPOSITION_VARIABLE
,
"ATTENDED_TRANSFER_ERROR"
);
...
...
@@ -1763,6 +1764,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
nua_notify
(
tech_pvt
->
nh
,
NUTAG_NEWSUB
(
1
),
SIPTAG_CONTENT_TYPE_STR
(
"message/sipfrag"
),
NUTAG_SUBSTATE
(
nua_substate_terminated
),
SIPTAG_PAYLOAD_STR
(
"SIP/2.0 200 OK"
),
SIPTAG_EVENT_STR
(
etmp
),
TAG_END
());
switch_clear_flag_locked
(
b_tech_pvt
,
TFLAG_SIP_HOLD
);
switch_channel_hangup
(
channel_b
,
SWITCH_CAUSE_ATTENDED_TRANSFER
);
}
else
{
if
(
!
br_a
&&
!
br_b
)
{
...
...
@@ -1786,8 +1788,11 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
t_session
=
switch_core_session_locate
(
br_a
);
hup_channel
=
channel_b
;
}
else
{
private_object_t
*
h_tech_pvt
=
(
private_object_t
*
)
switch_core_session_get_private
(
b_session
);
t_session
=
switch_core_session_locate
(
br_b
);
hup_channel
=
channel_a
;
switch_clear_flag_locked
(
tech_pvt
,
TFLAG_SIP_HOLD
);
switch_clear_flag_locked
(
h_tech_pvt
,
TFLAG_SIP_HOLD
);
switch_channel_hangup
(
channel_b
,
SWITCH_CAUSE_ATTENDED_TRANSFER
);
}
...
...
@@ -1936,8 +1941,9 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
struct
private_object
*
tech_pvt
=
NULL
;
switch_channel_t
*
channel
=
NULL
;
/* placeholder for string searching */
char
*
signal_ptr
;
c
onst
c
har
*
signal_ptr
;
const
char
*
rec_header
;
switch_dtmf_t
dtmf
=
{
0
,
SWITCH_DEFAULT_DTMF_DURATION
};
if
(
session
)
{
/* Get the channel */
...
...
@@ -1952,37 +1958,20 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
/* Barf if we didn't get it */
switch_assert
(
tech_pvt
!=
NULL
);
if
(
sip
&&
sip
->
sip_payload
&&
sip
->
sip_payload
->
pl_data
)
{
switch_dtmf_t
dtmf
=
{
0
,
SWITCH_DEFAULT_DTMF_DURATION
};
if
(
sip
&&
sip
->
sip_content_type
&&
sip
->
sip_content_type
->
c_type
&&
sip
->
sip_content_type
->
c_subtype
&&
sip
->
sip_payload
&&
sip
->
sip_payload
->
pl_data
)
{
if
(
!
strcasecmp
(
sip
->
sip_content_type
->
c_type
,
"dtmf"
)
&&
!
strcasecmp
(
sip
->
sip_content_type
->
c_subtype
,
"relay"
))
{
/* Try and find signal information in the payload */
if
((
signal_ptr
=
strstr
(
sip
->
sip_payload
->
pl_data
,
"Signal="
)))
{
if
((
signal_ptr
=
switch_stristr
(
"Signal="
,
sip
->
sip_payload
->
pl_data
)))
{
/* move signal_ptr where we need it (right past Signal=) */
signal_ptr
=
signal_ptr
+
7
;
dtmf
.
digit
=
*
signal_ptr
;
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Bad signal
\n
"
);
return
;
goto
fail
;
}
/* unknown info type */
if
(
!
signal_ptr
)
{
sip_from_t
const
*
from
=
sip
->
sip_from
;
/* print in the logs if something comes through we don't understand */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Unknown INFO Recieved: %s%s"
URL_PRINT_FORMAT
"[%s]
\n
"
,
from
->
a_display
?
from
->
a_display
:
""
,
from
->
a_display
?
" "
:
""
,
URL_PRINT_ARGS
(
from
->
a_url
),
sip
->
sip_payload
->
pl_data
);
/* Send 415 Unsupported Media response */
nua_respond
(
nh
,
SIP_415_UNSUPPORTED_MEDIA
,
NUTAG_WITH_THIS
(
nua
),
TAG_END
());
return
;
}
dtmf
.
digit
=
*
signal_ptr
;
if
((
signal_ptr
=
strstr
(
sip
->
sip_payload
->
pl_data
,
"Duration="
)))
{
if
((
signal_ptr
=
switch_stristr
(
"Duration="
,
sip
->
sip_payload
->
pl_data
)))
{
int
tmp
;
signal_ptr
+=
8
;
if
((
tmp
=
atoi
(
signal_ptr
))
<
0
)
{
...
...
@@ -1990,7 +1979,13 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
}
dtmf
.
duration
=
tmp
;
}
}
else
if
(
!
strcasecmp
(
sip
->
sip_content_type
->
c_type
,
"application"
)
&&
!
strcasecmp
(
sip
->
sip_content_type
->
c_subtype
,
"dtmf"
))
{
dtmf
.
digit
=
*
sip
->
sip_payload
->
pl_data
;
}
else
{
goto
fail
;
}
if
(
dtmf
.
digit
)
{
/* queue it up */
switch_channel_queue_dtmf
(
channel
,
&
dtmf
);
...
...
@@ -2001,6 +1996,9 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
nua_respond
(
nh
,
SIP_200_OK
,
NUTAG_WITH_THIS
(
nua
),
TAG_END
());
return
;
}
else
{
goto
fail
;
}
}
if
((
rec_header
=
sofia_glue_get_unknown_header
(
sip
,
"record"
)))
{
...
...
@@ -2037,6 +2035,13 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
}
}
return
;
fail:
nua_respond
(
nh
,
488
,
"Unsupported Request"
,
NUTAG_WITH_THIS
(
nua
),
TAG_END
());
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论