Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
0c1e874d
提交
0c1e874d
authored
8月 28, 2006
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WIP
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@2416
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
d4da2570
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
23 行增加
和
21 行删除
+23
-21
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+23
-21
没有找到文件。
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
0c1e874d
...
@@ -52,6 +52,7 @@ typedef struct private_object private_object_t;
...
@@ -52,6 +52,7 @@ typedef struct private_object private_object_t;
#include <sofia-sip/nua.h>
#include <sofia-sip/nua.h>
#include <sofia-sip/sip_status.h>
#include <sofia-sip/sip_status.h>
#include <sofia-sip/sdp.h>
#include <sofia-sip/sdp.h>
#include <sofia-sip/sip_protos.h>
#define DBFILE "sofia"
#define DBFILE "sofia"
static
const
char
modname
[]
=
"mod_sofia"
;
static
const
char
modname
[]
=
"mod_sofia"
;
...
@@ -167,6 +168,8 @@ struct private_object {
...
@@ -167,6 +168,8 @@ struct private_object {
switch_mutex_t
*
flag_mutex
;
switch_mutex_t
*
flag_mutex
;
switch_payload_t
te
;
switch_payload_t
te
;
nua_handle_t
*
nh
;
nua_handle_t
*
nh
;
su_home_t
*
home
;
sip_contact_t
*
contact
;
};
};
/* Function Prototypes */
/* Function Prototypes */
...
@@ -351,6 +354,10 @@ static void attach_private(switch_core_session_t *session,
...
@@ -351,6 +354,10 @@ static void attach_private(switch_core_session_t *session,
tech_pvt
->
profile
=
profile
;
tech_pvt
->
profile
=
profile
;
tech_pvt
->
te
=
profile
->
te
;
tech_pvt
->
te
=
profile
->
te
;
tech_pvt
->
session
=
session
;
tech_pvt
->
session
=
session
;
tech_pvt
->
home
=
su_home_new
(
sizeof
(
*
tech_pvt
->
home
));
su_home_init
(
tech_pvt
->
home
);
switch_core_session_set_private
(
session
,
tech_pvt
);
switch_core_session_set_private
(
session
,
tech_pvt
);
tech_set_codecs
(
tech_pvt
);
tech_set_codecs
(
tech_pvt
);
...
@@ -535,6 +542,10 @@ static switch_status_t sofia_on_hangup(switch_core_session_t *session)
...
@@ -535,6 +542,10 @@ static switch_status_t sofia_on_hangup(switch_core_session_t *session)
deactivate_rtp
(
tech_pvt
);
deactivate_rtp
(
tech_pvt
);
su_home_deinit
(
tech_pvt
->
home
);
if
(
tech_pvt
->
nh
)
{
if
(
tech_pvt
->
nh
)
{
if
(
!
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
))
{
if
(
!
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
))
{
nua_bye
(
tech_pvt
->
nh
,
TAG_END
());
nua_bye
(
tech_pvt
->
nh
,
TAG_END
());
...
@@ -712,7 +723,8 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
...
@@ -712,7 +723,8 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
set_local_sdp
(
tech_pvt
);
set_local_sdp
(
tech_pvt
);
activate_rtp
(
tech_pvt
);
activate_rtp
(
tech_pvt
);
if
(
tech_pvt
->
nh
)
{
if
(
tech_pvt
->
nh
)
{
nua_respond
(
tech_pvt
->
nh
,
SIP_200_OK
,
SOATAG_USER_SDP_STR
(
tech_pvt
->
local_sdp_str
),
TAG_END
());
tech_pvt
->
contact
=
sip_contact_create
(
tech_pvt
->
home
,
URL_STRING_MAKE
(
"sip:1000@208.64.200.40"
),
NULL
);
nua_respond
(
tech_pvt
->
nh
,
SIP_200_OK
,
SIPTAG_CONTACT
(
tech_pvt
->
contact
),
SOATAG_USER_SDP_STR
(
tech_pvt
->
local_sdp_str
),
TAG_END
());
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Local SDP:
\n
%s
\n
"
,
tech_pvt
->
local_sdp_str
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Local SDP:
\n
%s
\n
"
,
tech_pvt
->
local_sdp_str
);
}
}
}
}
...
@@ -987,7 +999,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
...
@@ -987,7 +999,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
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
);
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
,
S
IPTAG_CONTACT
(
tech_pvt
->
contact
),
S
OATAG_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());
//nua_respond(tech_pvt->nh, SIP_200_OK, SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), TAG_END());
}
}
}
}
...
@@ -1203,8 +1215,7 @@ static void sip_i_state(int status,
...
@@ -1203,8 +1215,7 @@ static void sip_i_state(int status,
break
;
break
;
case
nua_callstate_proceeding
:
case
nua_callstate_proceeding
:
if
(
session
&&
r_sdp
)
{
if
(
session
&&
r_sdp
)
{
su_home_t
home
[
1
]
=
{
SU_HOME_INIT
(
home
)
};
sdp_parser_t
*
parser
=
sdp_parse
(
tech_pvt
->
home
,
r_sdp
,
(
int
)
strlen
(
r_sdp
),
0
);
sdp_parser_t
*
parser
=
sdp_parse
(
home
,
r_sdp
,
(
int
)
strlen
(
r_sdp
),
0
);
sdp_session_t
*
sdp
;
sdp_session_t
*
sdp
;
uint8_t
match
=
0
;
uint8_t
match
=
0
;
...
@@ -1218,9 +1229,6 @@ static void sip_i_state(int status,
...
@@ -1218,9 +1229,6 @@ static void sip_i_state(int status,
sdp_parser_free
(
parser
);
sdp_parser_free
(
parser
);
}
}
if
(
home
)
{
su_home_deinit
(
home
);
}
if
(
match
)
{
if
(
match
)
{
tech_choose_port
(
tech_pvt
);
tech_choose_port
(
tech_pvt
);
...
@@ -1231,17 +1239,17 @@ static void sip_i_state(int status,
...
@@ -1231,17 +1239,17 @@ static void sip_i_state(int status,
}
}
}
}
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"NO CODECS"
);
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"NO CODECS"
);
nua_respond
(
nh
,
SIP_488_NOT_ACCEPTABLE
,
TAG_END
());
nua_respond
(
nh
,
SIP_488_NOT_ACCEPTABLE
,
SIPTAG_CONTACT
(
tech_pvt
->
contact
),
TAG_END
());
break
;
break
;
case
nua_callstate_completing
:
case
nua_callstate_completing
:
nua_ack
(
nh
,
TAG_END
());
nua_ack
(
nh
,
TAG_END
());
break
;
break
;
case
nua_callstate_received
:
case
nua_callstate_received
:
if
(
session
&&
r_sdp
)
{
if
(
session
&&
r_sdp
)
{
su_home_t
home
[
1
]
=
{
SU_HOME_INIT
(
home
)
};
sdp_parser_t
*
parser
=
sdp_parse
(
tech_pvt
->
home
,
r_sdp
,
(
int
)
strlen
(
r_sdp
),
0
);
sdp_parser_t
*
parser
=
sdp_parse
(
home
,
r_sdp
,
(
int
)
strlen
(
r_sdp
),
0
);
sdp_session_t
*
sdp
;
sdp_session_t
*
sdp
;
uint8_t
match
=
0
;
uint8_t
match
=
0
;
if
(
tech_pvt
->
num_codecs
)
{
if
(
tech_pvt
->
num_codecs
)
{
if
((
sdp
=
sdp_session
(
parser
)))
{
if
((
sdp
=
sdp_session
(
parser
)))
{
...
@@ -1253,12 +1261,9 @@ static void sip_i_state(int status,
...
@@ -1253,12 +1261,9 @@ static void sip_i_state(int status,
sdp_parser_free
(
parser
);
sdp_parser_free
(
parser
);
}
}
if
(
home
)
{
su_home_deinit
(
home
);
}
if
(
match
)
{
if
(
match
)
{
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"
ANSWER
"
);
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"
RECEIVED
"
);
switch_channel_set_state
(
channel
,
CS_INIT
);
switch_channel_set_state
(
channel
,
CS_INIT
);
switch_set_flag_locked
(
tech_pvt
,
TFLAG_READY
);
switch_set_flag_locked
(
tech_pvt
,
TFLAG_READY
);
switch_core_session_thread_launch
(
session
);
switch_core_session_thread_launch
(
session
);
...
@@ -1267,7 +1272,7 @@ static void sip_i_state(int status,
...
@@ -1267,7 +1272,7 @@ static void sip_i_state(int status,
}
}
}
}
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"NO CODECS"
);
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"NO CODECS"
);
nua_respond
(
nh
,
SIP_488_NOT_ACCEPTABLE
,
TAG_END
());
nua_respond
(
nh
,
SIP_488_NOT_ACCEPTABLE
,
SIPTAG_CONTACT
(
tech_pvt
->
contact
),
TAG_END
());
break
;
break
;
case
nua_callstate_early
:
case
nua_callstate_early
:
break
;
break
;
...
@@ -1276,8 +1281,7 @@ static void sip_i_state(int status,
...
@@ -1276,8 +1281,7 @@ static void sip_i_state(int status,
case
nua_callstate_ready
:
case
nua_callstate_ready
:
if
(
session
)
{
if
(
session
)
{
if
(
r_sdp
)
{
if
(
r_sdp
)
{
su_home_t
home
[
1
]
=
{
SU_HOME_INIT
(
home
)
};
sdp_parser_t
*
parser
=
sdp_parse
(
tech_pvt
->
home
,
r_sdp
,
(
int
)
strlen
(
r_sdp
),
0
);
sdp_parser_t
*
parser
=
sdp_parse
(
home
,
r_sdp
,
(
int
)
strlen
(
r_sdp
),
0
);
sdp_session_t
*
sdp
;
sdp_session_t
*
sdp
;
uint8_t
match
=
0
;
uint8_t
match
=
0
;
...
@@ -1291,11 +1295,9 @@ static void sip_i_state(int status,
...
@@ -1291,11 +1295,9 @@ static void sip_i_state(int status,
sdp_parser_free
(
parser
);
sdp_parser_free
(
parser
);
}
}
if
(
home
)
{
su_home_deinit
(
home
);
}
if
(
match
)
{
if
(
match
)
{
switch_set_flag_locked
(
tech_pvt
,
TFLAG_ANS
);
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"ANSWER"
);
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"ANSWER"
);
tech_choose_port
(
tech_pvt
);
tech_choose_port
(
tech_pvt
);
activate_rtp
(
tech_pvt
);
activate_rtp
(
tech_pvt
);
...
@@ -1309,7 +1311,7 @@ static void sip_i_state(int status,
...
@@ -1309,7 +1311,7 @@ static void sip_i_state(int status,
}
}
}
}
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"NO CODECS"
);
switch_channel_set_variable
(
channel
,
"endpoint_disposition"
,
"NO CODECS"
);
nua_respond
(
nh
,
SIP_488_NOT_ACCEPTABLE
,
TAG_END
());
nua_respond
(
nh
,
SIP_488_NOT_ACCEPTABLE
,
SIPTAG_CONTACT
(
tech_pvt
->
contact
),
TAG_END
());
break
;
break
;
case
nua_callstate_terminating
:
case
nua_callstate_terminating
:
break
;
break
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论