Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f2ea3ee3
提交
f2ea3ee3
authored
6月 30, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
indent run
上级
4f235af8
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
123 行增加
和
67 行删除
+123
-67
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+25
-18
mod_sofia.h
src/mod/endpoints/mod_sofia/mod_sofia.h
+8
-5
sofia.c
src/mod/endpoints/mod_sofia/sofia.c
+7
-2
sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_glue.c
+64
-24
switch_core_sqldb.c
src/switch_core_sqldb.c
+19
-18
没有找到文件。
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
f2ea3ee3
...
@@ -121,7 +121,7 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
...
@@ -121,7 +121,7 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
}
}
}
}
end:
end:
switch_mutex_unlock
(
tech_pvt
->
sofia_mutex
);
switch_mutex_unlock
(
tech_pvt
->
sofia_mutex
);
...
@@ -245,7 +245,7 @@ char *generate_pai_str(switch_core_session_t *session)
...
@@ -245,7 +245,7 @@ char *generate_pai_str(switch_core_session_t *session)
const
char
*
var
,
*
header
,
*
ua
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"sip_user_agent"
);
const
char
*
var
,
*
header
,
*
ua
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"sip_user_agent"
);
char
*
pai
=
NULL
;
char
*
pai
=
NULL
;
if
(
!
sofia_test_pflag
(
tech_pvt
->
profile
,
PFLAG_CID_IN_1XX
)
||
if
(
!
sofia_test_pflag
(
tech_pvt
->
profile
,
PFLAG_CID_IN_1XX
)
||
((
var
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"sip_cid_in_1xx"
))
&&
switch_false
(
var
)))
{
((
var
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"sip_cid_in_1xx"
))
&&
switch_false
(
var
)))
{
return
NULL
;
return
NULL
;
}
}
...
@@ -518,7 +518,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
...
@@ -518,7 +518,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
}
}
if
(
!
sofia_test_flag
(
tech_pvt
,
TFLAG_BYE
))
{
if
(
!
sofia_test_flag
(
tech_pvt
,
TFLAG_BYE
))
{
char
*
cid
=
generate_pai_str
(
session
);
char
*
cid
=
generate_pai_str
(
session
);
nua_respond
(
tech_pvt
->
nh
,
sip_cause
,
sip_status_phrase
(
sip_cause
),
nua_respond
(
tech_pvt
->
nh
,
sip_cause
,
sip_status_phrase
(
sip_cause
),
TAG_IF
(
!
zstr
(
reason
),
SIPTAG_REASON_STR
(
reason
)),
TAG_IF
(
!
zstr
(
reason
),
SIPTAG_REASON_STR
(
reason
)),
TAG_IF
(
cid
,
SIPTAG_HEADER_STR
(
cid
)),
TAG_IF
(
!
zstr
(
bye_headers
),
SIPTAG_HEADER_STR
(
bye_headers
)),
TAG_END
());
TAG_IF
(
cid
,
SIPTAG_HEADER_STR
(
cid
)),
TAG_IF
(
!
zstr
(
bye_headers
),
SIPTAG_HEADER_STR
(
bye_headers
)),
TAG_END
());
...
@@ -702,7 +702,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
...
@@ -702,7 +702,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
if
(
switch_channel_test_flag
(
tech_pvt
->
channel
,
CF_PROXY_MODE
)
&&
tech_pvt
->
early_sdp
&&
strcmp
(
tech_pvt
->
early_sdp
,
tech_pvt
->
local_sdp_str
))
{
if
(
switch_channel_test_flag
(
tech_pvt
->
channel
,
CF_PROXY_MODE
)
&&
tech_pvt
->
early_sdp
&&
strcmp
(
tech_pvt
->
early_sdp
,
tech_pvt
->
local_sdp_str
))
{
/* The SIP RFC for SOA forbids sending a 183 with one sdp then a 200 with another but it won't do us much good unless
/* The SIP RFC for SOA forbids sending a 183 with one sdp then a 200 with another but it won't do us much good unless
we do so in this case we will abandon the SOA rules and go rogue.
we do so in this case we will abandon the SOA rules and go rogue.
*/
*/
sofia_clear_flag
(
tech_pvt
,
TFLAG_ENABLE_SOA
);
sofia_clear_flag
(
tech_pvt
,
TFLAG_ENABLE_SOA
);
}
}
...
@@ -1100,7 +1100,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
...
@@ -1100,7 +1100,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
tech_pvt
->
mismatch_count
=
0
;
tech_pvt
->
mismatch_count
=
0
;
tech_pvt
->
last_ts
=
0
;
tech_pvt
->
last_ts
=
0
;
}
}
skip:
skip:
if
((
bytes
=
tech_pvt
->
read_impl
.
encoded_bytes_per_packet
))
{
if
((
bytes
=
tech_pvt
->
read_impl
.
encoded_bytes_per_packet
))
{
frames
=
(
tech_pvt
->
read_frame
.
datalen
/
bytes
);
frames
=
(
tech_pvt
->
read_frame
.
datalen
/
bytes
);
...
@@ -2162,7 +2162,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
...
@@ -2162,7 +2162,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
tech_pvt
->
early_sdp
&&
strcmp
(
tech_pvt
->
early_sdp
,
tech_pvt
->
local_sdp_str
))
{
tech_pvt
->
early_sdp
&&
strcmp
(
tech_pvt
->
early_sdp
,
tech_pvt
->
local_sdp_str
))
{
/* The SIP RFC for SOA forbids sending a 183 with one sdp then a 200 with another but it won't do us much good unless
/* The SIP RFC for SOA forbids sending a 183 with one sdp then a 200 with another but it won't do us much good unless
we do so in this case we will abandon the SOA rules and go rogue.
we do so in this case we will abandon the SOA rules and go rogue.
*/
*/
sofia_clear_flag
(
tech_pvt
,
TFLAG_ENABLE_SOA
);
sofia_clear_flag
(
tech_pvt
,
TFLAG_ENABLE_SOA
);
}
}
...
@@ -2207,7 +2207,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
...
@@ -2207,7 +2207,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
break
;
break
;
}
}
end_lock:
end_lock:
//if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
//if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
//sofia_send_callee_id(session, NULL, NULL);
//sofia_send_callee_id(session, NULL, NULL);
...
@@ -2215,7 +2215,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
...
@@ -2215,7 +2215,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
switch_mutex_unlock
(
tech_pvt
->
sofia_mutex
);
switch_mutex_unlock
(
tech_pvt
->
sofia_mutex
);
end:
end:
if
(
switch_channel_down
(
channel
)
||
!
tech_pvt
||
sofia_test_flag
(
tech_pvt
,
TFLAG_BYE
))
{
if
(
switch_channel_down
(
channel
)
||
!
tech_pvt
||
sofia_test_flag
(
tech_pvt
,
TFLAG_BYE
))
{
status
=
SWITCH_STATUS_FALSE
;
status
=
SWITCH_STATUS_FALSE
;
...
@@ -3158,7 +3158,7 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
...
@@ -3158,7 +3158,7 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
stream
->
write_function
(
stream
,
"-ERR Unknown command!
\n
"
);
stream
->
write_function
(
stream
,
"-ERR Unknown command!
\n
"
);
done:
done:
if
(
profile
)
{
if
(
profile
)
{
sofia_glue_release_profile
(
profile
);
sofia_glue_release_profile
(
profile
);
}
}
...
@@ -3456,7 +3456,7 @@ SWITCH_STANDARD_API(sofia_gateway_data_function)
...
@@ -3456,7 +3456,7 @@ SWITCH_STANDARD_API(sofia_gateway_data_function)
sofia_reg_release_gateway
(
gateway
);
sofia_reg_release_gateway
(
gateway
);
end
:
end
:
switch_safe_free
(
mydata
);
switch_safe_free
(
mydata
);
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
@@ -3559,7 +3559,7 @@ SWITCH_STANDARD_API(sofia_function)
...
@@ -3559,7 +3559,7 @@ SWITCH_STANDARD_API(sofia_function)
stream
->
write_function
(
stream
,
"Unknown Command [%s]
\n
"
,
argv
[
0
]);
stream
->
write_function
(
stream
,
"Unknown Command [%s]
\n
"
,
argv
[
0
]);
}
}
done
:
done
:
switch_safe_free
(
mycmd
);
switch_safe_free
(
mycmd
);
return
status
;
return
status
;
}
}
...
@@ -3946,7 +3946,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
...
@@ -3946,7 +3946,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
if
(
switch_core_session_compare
(
session
,
nsession
))
{
if
(
switch_core_session_compare
(
session
,
nsession
))
{
/* It's another sofia channel! so lets cache what they use as a pt for telephone event so
/* It's another sofia channel! so lets cache what they use as a pt for telephone event so
we can keep it the same
we can keep it the same
*/
*/
private_object_t
*
ctech_pvt
;
private_object_t
*
ctech_pvt
;
ctech_pvt
=
switch_core_session_get_private
(
session
);
ctech_pvt
=
switch_core_session_get_private
(
session
);
switch_assert
(
ctech_pvt
!=
NULL
);
switch_assert
(
ctech_pvt
!=
NULL
);
...
@@ -3979,14 +3979,14 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
...
@@ -3979,14 +3979,14 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
goto
done
;
goto
done
;
error:
error:
if
(
nsession
)
{
if
(
nsession
)
{
switch_core_session_destroy
(
&
nsession
);
switch_core_session_destroy
(
&
nsession
);
}
}
if
(
pool
)
{
if
(
pool
)
{
*
pool
=
NULL
;
*
pool
=
NULL
;
}
}
done:
done:
if
(
profile
)
{
if
(
profile
)
{
if
(
cause
==
SWITCH_CAUSE_SUCCESS
)
{
if
(
cause
==
SWITCH_CAUSE_SUCCESS
)
{
...
@@ -4140,12 +4140,12 @@ static void general_event_handler(switch_event_t *event)
...
@@ -4140,12 +4140,12 @@ static void general_event_handler(switch_event_t *event)
sql
=
switch_mprintf
(
"select sip_user,sip_host,contact,profile_name,'%q','%q','%q' "
sql
=
switch_mprintf
(
"select sip_user,sip_host,contact,profile_name,'%q','%q','%q' "
"from sip_registrations where mwi_user='%s' and mwi_host='%q'"
,
"from sip_registrations where mwi_user='%s' and mwi_host='%q'"
,
ct
,
es
,
switch_str_nil
(
body
),
switch_str_nil
(
user
),
switch_str_nil
(
host
)
ct
,
es
,
switch_str_nil
(
body
),
switch_str_nil
(
user
),
switch_str_nil
(
host
)
);
);
}
else
{
}
else
{
sql
=
switch_mprintf
(
"select sip_user,sip_host,contact,profile_name,'%q','%q','%q' "
sql
=
switch_mprintf
(
"select sip_user,sip_host,contact,profile_name,'%q','%q','%q' "
"from sip_registrations where sip_user='%s' and sip_host='%q'"
,
"from sip_registrations where sip_user='%s' and sip_host='%q'"
,
ct
,
es
,
switch_str_nil
(
body
),
switch_str_nil
(
user
),
switch_str_nil
(
host
)
ct
,
es
,
switch_str_nil
(
body
),
switch_str_nil
(
user
),
switch_str_nil
(
host
)
);
);
}
}
}
}
...
@@ -4299,7 +4299,7 @@ static void general_event_handler(switch_event_t *event)
...
@@ -4299,7 +4299,7 @@ static void general_event_handler(switch_event_t *event)
sofia_glue_release_profile
(
profile
);
sofia_glue_release_profile
(
profile
);
}
}
done:
done:
switch_safe_free
(
local_dup
);
switch_safe_free
(
local_dup
);
...
@@ -4463,7 +4463,7 @@ static switch_status_t list_profile_gateway(const char *line, const char *cursor
...
@@ -4463,7 +4463,7 @@ static switch_status_t list_profile_gateway(const char *line, const char *cursor
status
=
SWITCH_STATUS_SUCCESS
;
status
=
SWITCH_STATUS_SUCCESS
;
}
}
end:
end:
switch_safe_free
(
dup
);
switch_safe_free
(
dup
);
...
@@ -4553,6 +4553,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
...
@@ -4553,6 +4553,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
return
SWITCH_STATUS_GENERR
;
return
SWITCH_STATUS_GENERR
;
}
}
if
(
switch_event_bind_removable
(
modname
,
SWITCH_EVENT_CUSTOM
,
MY_EVENT_RECOVERY
,
sofia_glue_track_event_handler
,
NULL
,
&
mod_sofia_globals
.
recovery_node
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
return
SWITCH_STATUS_GENERR
;
}
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_TRAP
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_bind
(
modname
,
SWITCH_EVENT_TRAP
,
SWITCH_EVENT_SUBCLASS_ANY
,
general_event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
return
SWITCH_STATUS_GENERR
;
return
SWITCH_STATUS_GENERR
;
...
@@ -4647,6 +4653,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
...
@@ -4647,6 +4653,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
switch_event_unbind
(
&
mod_sofia_globals
.
roster_node
);
switch_event_unbind
(
&
mod_sofia_globals
.
roster_node
);
switch_event_unbind
(
&
mod_sofia_globals
.
custom_node
);
switch_event_unbind
(
&
mod_sofia_globals
.
custom_node
);
switch_event_unbind
(
&
mod_sofia_globals
.
mwi_node
);
switch_event_unbind
(
&
mod_sofia_globals
.
mwi_node
);
switch_event_unbind
(
&
mod_sofia_globals
.
recovery_node
);
switch_event_unbind_callback
(
general_event_handler
);
switch_event_unbind_callback
(
general_event_handler
);
while
(
mod_sofia_globals
.
threads
)
{
while
(
mod_sofia_globals
.
threads
)
{
...
...
src/mod/endpoints/mod_sofia/mod_sofia.h
浏览文件 @
f2ea3ee3
...
@@ -83,6 +83,8 @@ typedef struct private_object private_object_t;
...
@@ -83,6 +83,8 @@ typedef struct private_object private_object_t;
#define MY_EVENT_REINVITE "sofia::reinvite"
#define MY_EVENT_REINVITE "sofia::reinvite"
#define MY_EVENT_GATEWAY_ADD "sofia::gateway_add"
#define MY_EVENT_GATEWAY_ADD "sofia::gateway_add"
#define MY_EVENT_GATEWAY_DEL "sofia::gateway_delete"
#define MY_EVENT_GATEWAY_DEL "sofia::gateway_delete"
#define MY_EVENT_RECOVERY "sofia::recovery"
#define MY_EVENT_RECOVERY_SEND "sofia::recovery_send"
#define MULTICAST_EVENT "multicast::event"
#define MULTICAST_EVENT "multicast::event"
#define SOFIA_REPLACES_HEADER "_sofia_replaces_"
#define SOFIA_REPLACES_HEADER "_sofia_replaces_"
...
@@ -209,6 +211,7 @@ typedef enum {
...
@@ -209,6 +211,7 @@ typedef enum {
PFLAG_PASS_CALLEE_ID
,
PFLAG_PASS_CALLEE_ID
,
PFLAG_LOG_AUTH_FAIL
,
PFLAG_LOG_AUTH_FAIL
,
PFLAG_TRACK_CALLS
,
PFLAG_TRACK_CALLS
,
PFLAG_TRACK_CALLS_EVENTS
,
PFLAG_DESTROY
,
PFLAG_DESTROY
,
PFLAG_EXTENDED_INFO_PARSING
,
PFLAG_EXTENDED_INFO_PARSING
,
PFLAG_T38_PASSTHRU
,
PFLAG_T38_PASSTHRU
,
...
@@ -295,6 +298,7 @@ struct mod_sofia_globals {
...
@@ -295,6 +298,7 @@ struct mod_sofia_globals {
switch_event_node_t
*
roster_node
;
switch_event_node_t
*
roster_node
;
switch_event_node_t
*
custom_node
;
switch_event_node_t
*
custom_node
;
switch_event_node_t
*
mwi_node
;
switch_event_node_t
*
mwi_node
;
switch_event_node_t
*
recovery_node
;
int
guess_mask
;
int
guess_mask
;
char
guess_mask_str
[
16
];
char
guess_mask_str
[
16
];
int
debug_presence
;
int
debug_presence
;
...
@@ -761,8 +765,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
...
@@ -761,8 +765,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
void
sofia_handle_sip_i_info
(
nua_t
*
nua
,
sofia_profile_t
*
profile
,
nua_handle_t
*
nh
,
switch_core_session_t
*
session
,
sip_t
const
*
sip
,
tagi_t
tags
[]);
void
sofia_handle_sip_i_info
(
nua_t
*
nua
,
sofia_profile_t
*
profile
,
nua_handle_t
*
nh
,
switch_core_session_t
*
session
,
sip_t
const
*
sip
,
tagi_t
tags
[]);
void
sofia_handle_sip_i_invite
(
nua_t
*
nua
,
sofia_profile_t
*
profile
,
nua_handle_t
*
nh
,
sofia_private_t
*
sofia_private
,
sip_t
const
*
sip
,
void
sofia_handle_sip_i_invite
(
nua_t
*
nua
,
sofia_profile_t
*
profile
,
nua_handle_t
*
nh
,
sofia_private_t
*
sofia_private
,
sip_t
const
*
sip
,
tagi_t
tags
[]);
tagi_t
tags
[]);
void
sofia_reg_handle_sip_i_register
(
nua_t
*
nua
,
sofia_profile_t
*
profile
,
nua_handle_t
*
nh
,
sofia_private_t
*
sofia_private
,
sip_t
const
*
sip
,
void
sofia_reg_handle_sip_i_register
(
nua_t
*
nua
,
sofia_profile_t
*
profile
,
nua_handle_t
*
nh
,
sofia_private_t
*
sofia_private
,
sip_t
const
*
sip
,
tagi_t
tags
[]);
tagi_t
tags
[]);
...
@@ -792,6 +795,7 @@ char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const c
...
@@ -792,6 +795,7 @@ char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const c
void
event_handler
(
switch_event_t
*
event
);
void
event_handler
(
switch_event_t
*
event
);
void
sofia_presence_event_handler
(
switch_event_t
*
event
);
void
sofia_presence_event_handler
(
switch_event_t
*
event
);
void
sofia_presence_mwi_event_handler
(
switch_event_t
*
event
);
void
sofia_presence_mwi_event_handler
(
switch_event_t
*
event
);
void
sofia_glue_track_event_handler
(
switch_event_t
*
event
);
void
sofia_presence_cancel
(
void
);
void
sofia_presence_cancel
(
void
);
switch_status_t
config_sofia
(
int
reload
,
char
*
profile_name
);
switch_status_t
config_sofia
(
int
reload
,
char
*
profile_name
);
void
sofia_reg_auth_challenge
(
nua_t
*
nua
,
sofia_profile_t
*
profile
,
nua_handle_t
*
nh
,
sofia_regtype_t
regtype
,
const
char
*
realm
,
int
stale
);
void
sofia_reg_auth_challenge
(
nua_t
*
nua
,
sofia_profile_t
*
profile
,
nua_handle_t
*
nh
,
sofia_regtype_t
regtype
,
const
char
*
realm
,
int
stale
);
...
@@ -910,7 +914,7 @@ void sofia_reg_release_gateway__(const char *file, const char *func, int line, s
...
@@ -910,7 +914,7 @@ void sofia_reg_release_gateway__(const char *file, const char *func, int line, s
/*
/*
* Transport handling helper functions
* Transport handling helper functions
*/
*/
sofia_transport_t
sofia_glue_via2transport
(
const
sip_via_t
*
via
);
sofia_transport_t
sofia_glue_via2transport
(
const
sip_via_t
*
via
);
sofia_transport_t
sofia_glue_url2transport
(
const
url_t
*
url
);
sofia_transport_t
sofia_glue_url2transport
(
const
url_t
*
url
);
sofia_transport_t
sofia_glue_str2transport
(
const
char
*
str
);
sofia_transport_t
sofia_glue_str2transport
(
const
char
*
str
);
...
@@ -922,8 +926,7 @@ char *sofia_glue_strip_uri(const char *str);
...
@@ -922,8 +926,7 @@ char *sofia_glue_strip_uri(const char *str);
int
sofia_glue_check_nat
(
sofia_profile_t
*
profile
,
const
char
*
network_ip
);
int
sofia_glue_check_nat
(
sofia_profile_t
*
profile
,
const
char
*
network_ip
);
int
sofia_glue_transport_has_tls
(
const
sofia_transport_t
tp
);
int
sofia_glue_transport_has_tls
(
const
sofia_transport_t
tp
);
const
char
*
sofia_glue_get_unknown_header
(
sip_t
const
*
sip
,
const
char
*
name
);
const
char
*
sofia_glue_get_unknown_header
(
sip_t
const
*
sip
,
const
char
*
name
);
switch_status_t
sofia_glue_build_crypto
(
private_object_t
*
tech_pvt
,
int
index
,
switch_rtp_crypto_key_type_t
type
,
switch_status_t
sofia_glue_build_crypto
(
private_object_t
*
tech_pvt
,
int
index
,
switch_rtp_crypto_key_type_t
type
,
switch_rtp_crypto_direction_t
direction
);
switch_rtp_crypto_direction_t
direction
);
void
sofia_glue_tech_patch_sdp
(
private_object_t
*
tech_pvt
);
void
sofia_glue_tech_patch_sdp
(
private_object_t
*
tech_pvt
);
switch_status_t
sofia_glue_tech_proxy_remote_addr
(
private_object_t
*
tech_pvt
);
switch_status_t
sofia_glue_tech_proxy_remote_addr
(
private_object_t
*
tech_pvt
);
void
sofia_presence_event_thread_start
(
void
);
void
sofia_presence_event_thread_start
(
void
);
...
...
src/mod/endpoints/mod_sofia/sofia.c
浏览文件 @
f2ea3ee3
...
@@ -2949,8 +2949,13 @@ switch_status_t config_sofia(int reload, char *profile_name)
...
@@ -2949,8 +2949,13 @@ switch_status_t config_sofia(int reload, char *profile_name)
}
else
{
}
else
{
sofia_clear_pflag
(
profile
,
PFLAG_UUID_AS_CALLID
);
sofia_clear_pflag
(
profile
,
PFLAG_UUID_AS_CALLID
);
}
}
}
else
if
(
!
strcasecmp
(
var
,
"track-calls"
)
&&
switch_true
(
val
))
{
}
else
if
(
!
strcasecmp
(
var
,
"track-calls"
))
{
sofia_set_pflag
(
profile
,
PFLAG_TRACK_CALLS
);
if
(
switch_true
(
val
))
{
sofia_set_pflag
(
profile
,
PFLAG_TRACK_CALLS
);
}
else
if
(
!
strcasecmp
(
val
,
"events"
))
{
sofia_set_pflag
(
profile
,
PFLAG_TRACK_CALLS
);
sofia_set_pflag
(
profile
,
PFLAG_TRACK_CALLS_EVENTS
);
}
}
else
if
(
!
strcasecmp
(
var
,
"NDLB-received-in-nat-reg-contact"
)
&&
switch_true
(
val
))
{
}
else
if
(
!
strcasecmp
(
var
,
"NDLB-received-in-nat-reg-contact"
)
&&
switch_true
(
val
))
{
sofia_set_pflag
(
profile
,
PFLAG_RECIEVED_IN_NAT_REG_CONTACT
);
sofia_set_pflag
(
profile
,
PFLAG_RECIEVED_IN_NAT_REG_CONTACT
);
}
else
if
(
!
strcasecmp
(
var
,
"aggressive-nat-detection"
)
&&
switch_true
(
val
))
{
}
else
if
(
!
strcasecmp
(
var
,
"aggressive-nat-detection"
)
&&
switch_true
(
val
))
{
...
...
src/mod/endpoints/mod_sofia/sofia_glue.c
浏览文件 @
f2ea3ee3
...
@@ -4403,7 +4403,6 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
...
@@ -4403,7 +4403,6 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
}
}
switch_channel_set_variable
(
channel
,
"sip_invite_call_id"
,
switch_channel_get_variable
(
channel
,
"sip_call_id"
));
switch_channel_set_variable
(
channel
,
"sip_invite_call_id"
,
switch_channel_get_variable
(
channel
,
"sip_call_id"
));
switch_channel_set_variable
(
channel
,
"sip_invite_cseq"
,
switch_channel_get_variable
(
channel
,
"sip_cseq"
));
if
(
switch_true
(
switch_channel_get_variable
(
channel
,
"sip_nat_detected"
)))
{
if
(
switch_true
(
switch_channel_get_variable
(
channel
,
"sip_nat_detected"
)))
{
switch_channel_set_variable_printf
(
channel
,
"sip_route_uri"
,
"sip:%s@%s:%s"
,
switch_channel_set_variable_printf
(
channel
,
"sip_route_uri"
,
"sip:%s@%s:%s"
,
...
@@ -4575,9 +4574,28 @@ int sofia_glue_recover(switch_bool_t flush)
...
@@ -4575,9 +4574,28 @@ int sofia_glue_recover(switch_bool_t flush)
return
r
;
return
r
;
}
}
void
sofia_glue_track_event_handler
(
switch_event_t
*
event
)
{
char
*
sql
,
*
buf
=
NULL
;
char
*
profile_name
=
NULL
;
switch_assert
(
event
);
// Just a sanity check
if
((
buf
=
switch_event_get_header_nil
(
event
,
"sql"
))
&&
(
profile_name
=
switch_event_get_header_nil
(
event
,
"profile_name"
)))
{
sofia_profile_t
*
profile
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s
\n
"
,
switch_event_get_header_nil
(
event
,
"Event-Calling-Function"
));
if
((
profile
=
sofia_glue_find_profile
(
profile_name
)))
{
sql
=
switch_mprintf
(
"%s"
,
buf
);
sofia_glue_execute_sql_now
(
profile
,
&
sql
,
SWITCH_TRUE
);
sofia_glue_release_profile
(
profile
);
}
}
return
;
}
void
sofia_glue_tech_untrack
(
sofia_profile_t
*
profile
,
switch_core_session_t
*
session
,
switch_bool_t
force
)
void
sofia_glue_tech_untrack
(
sofia_profile_t
*
profile
,
switch_core_session_t
*
session
,
switch_bool_t
force
)
{
{
char
*
sql
;
char
*
sql
=
NULL
;
private_object_t
*
tech_pvt
=
(
private_object_t
*
)
switch_core_session_get_private
(
session
);
private_object_t
*
tech_pvt
=
(
private_object_t
*
)
switch_core_session_get_private
(
session
);
if
(
!
sofia_test_pflag
(
profile
,
PFLAG_TRACK_CALLS
)
||
(
sofia_test_flag
(
tech_pvt
,
TFLAG_RECOVERING
)))
{
if
(
!
sofia_test_pflag
(
profile
,
PFLAG_TRACK_CALLS
)
||
(
sofia_test_flag
(
tech_pvt
,
TFLAG_RECOVERING
)))
{
...
@@ -4585,23 +4603,38 @@ void sofia_glue_tech_untrack(sofia_profile_t *profile, switch_core_session_t *se
...
@@ -4585,23 +4603,38 @@ void sofia_glue_tech_untrack(sofia_profile_t *profile, switch_core_session_t *se
}
}
if
(
sofia_test_pflag
(
profile
,
PFLAG_TRACK_CALLS
)
&&
(
sofia_test_flag
(
tech_pvt
,
TFLAG_TRACKED
)
||
force
))
{
if
(
sofia_test_pflag
(
profile
,
PFLAG_TRACK_CALLS
)
&&
(
sofia_test_flag
(
tech_pvt
,
TFLAG_TRACKED
)
||
force
))
{
switch_event_t
*
event
=
NULL
;
if
(
force
)
{
if
(
force
)
{
sql
=
switch_mprintf
(
"delete from sip_recovery where uuid='%q'"
,
switch_core_session_get_uuid
(
session
));
sql
=
switch_mprintf
(
"delete from sip_recovery where uuid='%q'"
,
switch_core_session_get_uuid
(
session
));
}
else
{
}
else
{
sql
=
switch_mprintf
(
"delete from sip_recovery where runtime_uuid='%q' and uuid='%q'"
,
sql
=
switch_mprintf
(
"delete from sip_recovery where runtime_uuid='%q' and uuid='%q'"
,
switch_core_get_uuid
(),
switch_core_session_get_uuid
(
session
));
switch_core_get_uuid
(),
switch_core_session_get_uuid
(
session
));
}
}
if
(
sofia_test_pflag
(
profile
,
PFLAG_TRACK_CALLS_EVENTS
))
{
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
MY_EVENT_RECOVERY_SEND
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"sql"
,
sql
);
switch_event_fire
(
&
event
);
}
}
sofia_glue_execute_sql_now
(
profile
,
&
sql
,
SWITCH_TRUE
);
sofia_glue_execute_sql_now
(
profile
,
&
sql
,
SWITCH_TRUE
);
sofia_clear_flag
(
tech_pvt
,
TFLAG_TRACKED
);
sofia_clear_flag
(
tech_pvt
,
TFLAG_TRACKED
);
switch_safe_free
(
sql
);
}
}
}
}
void
sofia_glue_tech_track
(
sofia_profile_t
*
profile
,
switch_core_session_t
*
session
)
void
sofia_glue_tech_track
(
sofia_profile_t
*
profile
,
switch_core_session_t
*
session
)
{
{
switch_event_t
*
event
;
private_object_t
*
tech_pvt
=
(
private_object_t
*
)
switch_core_session_get_private
(
session
);
private_object_t
*
tech_pvt
=
(
private_object_t
*
)
switch_core_session_get_private
(
session
);
switch_xml_t
cdr
=
NULL
;
char
*
xml_cdr_text
=
NULL
;
char
*
sql
=
NULL
;
if
(
!
sofia_test_pflag
(
profile
,
PFLAG_TRACK_CALLS
)
||
sofia_test_flag
(
tech_pvt
,
TFLAG_RECOVERING
))
{
if
(
!
sofia_test_pflag
(
profile
,
PFLAG_TRACK_CALLS
)
||
sofia_test_flag
(
tech_pvt
,
TFLAG_RECOVERING
))
{
return
;
return
;
...
@@ -4611,26 +4644,33 @@ void sofia_glue_tech_track(sofia_profile_t *profile, switch_core_session_t *sess
...
@@ -4611,26 +4644,33 @@ void sofia_glue_tech_track(sofia_profile_t *profile, switch_core_session_t *sess
sofia_glue_tech_untrack
(
profile
,
session
,
SWITCH_TRUE
);
sofia_glue_tech_untrack
(
profile
,
session
,
SWITCH_TRUE
);
}
}
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_CHANNEL_DATA
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_ivr_generate_xml_cdr
(
session
,
&
cdr
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_xml_t
cdr
=
NULL
;
xml_cdr_text
=
switch_xml_toxml
(
cdr
,
SWITCH_FALSE
);
char
*
xml_cdr_text
=
NULL
;
switch_xml_free
(
cdr
);
}
if
(
switch_ivr_generate_xml_cdr
(
session
,
&
cdr
)
==
SWITCH_STATUS_SUCCESS
)
{
xml_cdr_text
=
switch_xml_toxml
(
cdr
,
SWITCH_FALSE
);
switch_xml_free
(
cdr
);
}
if
(
xml_cdr_text
)
{
char
*
sql
;
sql
=
switch_mprintf
(
"insert into sip_recovery (runtime_uuid, profile_name, hostname, uuid, metadata) values ('%q','%q','%q','%q','%q')"
,
switch_core_get_uuid
(),
profile
->
name
,
mod_sofia_globals
.
hostname
,
switch_core_session_get_uuid
(
session
),
xml_cdr_text
);
sofia_glue_execute_sql_now
(
profile
,
&
sql
,
SWITCH_TRUE
);
if
(
xml_cdr_text
)
{
free
(
xml_cdr_text
);
sql
=
switch_mprintf
(
"insert into sip_recovery (runtime_uuid, profile_name, hostname, uuid, metadata) values ('%q','%q','%q','%q','%q')"
,
sofia_set_flag
(
tech_pvt
,
TFLAG_TRACKED
);
switch_core_get_uuid
(),
profile
->
name
,
mod_sofia_globals
.
hostname
,
switch_core_session_get_uuid
(
session
),
xml_cdr_text
);
if
(
sofia_test_pflag
(
profile
,
PFLAG_TRACK_CALLS_EVENTS
))
{
switch_event_t
*
event
=
NULL
;
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
MY_EVENT_RECOVERY_SEND
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"sql"
,
sql
);
switch_event_fire
(
&
event
);
}
}
}
sofia_glue_execute_sql_now
(
profile
,
&
sql
,
SWITCH_TRUE
);
free
(
xml_cdr_text
);
sofia_set_flag
(
tech_pvt
,
TFLAG_TRACKED
);
}
}
switch_safe_free
(
sql
);
}
}
...
@@ -5135,7 +5175,7 @@ void sofia_glue_actually_execute_sql_trans(sofia_profile_t *profile, char *sql,
...
@@ -5135,7 +5175,7 @@ void sofia_glue_actually_execute_sql_trans(sofia_profile_t *profile, char *sql,
switch_cache_db_persistant_execute_trans
(
dbh
,
sql
,
1
);
switch_cache_db_persistant_execute_trans
(
dbh
,
sql
,
1
);
end:
end:
switch_cache_db_release_db_handle
(
&
dbh
);
switch_cache_db_release_db_handle
(
&
dbh
);
...
@@ -5159,7 +5199,7 @@ void sofia_glue_actually_execute_sql(sofia_profile_t *profile, char *sql, switch
...
@@ -5159,7 +5199,7 @@ void sofia_glue_actually_execute_sql(sofia_profile_t *profile, char *sql, switch
switch_cache_db_execute_sql
(
dbh
,
sql
,
NULL
);
switch_cache_db_execute_sql
(
dbh
,
sql
,
NULL
);
end:
end:
switch_cache_db_release_db_handle
(
&
dbh
);
switch_cache_db_release_db_handle
(
&
dbh
);
...
@@ -5191,7 +5231,7 @@ switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
...
@@ -5191,7 +5231,7 @@ switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
free
(
errmsg
);
free
(
errmsg
);
}
}
end:
end:
switch_cache_db_release_db_handle
(
&
dbh
);
switch_cache_db_release_db_handle
(
&
dbh
);
...
@@ -5324,7 +5364,7 @@ sofia_destination_t *sofia_glue_get_destination(char *data)
...
@@ -5324,7 +5364,7 @@ sofia_destination_t *sofia_glue_get_destination(char *data)
dst
->
route_uri
=
route_uri
;
dst
->
route_uri
=
route_uri
;
return
dst
;
return
dst
;
mem_fail:
mem_fail:
switch_safe_free
(
contact
);
switch_safe_free
(
contact
);
switch_safe_free
(
to
);
switch_safe_free
(
to
);
switch_safe_free
(
route
);
switch_safe_free
(
route
);
...
...
src/switch_core_sqldb.c
浏览文件 @
f2ea3ee3
...
@@ -53,7 +53,7 @@ static struct {
...
@@ -53,7 +53,7 @@ static struct {
/*!
/*!
\brief Open the default system database
\brief Open the default system database
*/
*/
SWITCH_DECLARE
(
switch_status_t
)
_switch_core_db_handle
(
switch_cache_db_handle_t
**
dbh
,
const
char
*
file
,
const
char
*
func
,
int
line
)
SWITCH_DECLARE
(
switch_status_t
)
_switch_core_db_handle
(
switch_cache_db_handle_t
**
dbh
,
const
char
*
file
,
const
char
*
func
,
int
line
)
{
{
switch_cache_db_connection_options_t
options
=
{
{
0
}
};
switch_cache_db_connection_options_t
options
=
{
{
0
}
};
switch_status_t
r
;
switch_status_t
r
;
...
@@ -152,7 +152,7 @@ SWITCH_DECLARE(void) switch_cache_db_flush_handles(void)
...
@@ -152,7 +152,7 @@ SWITCH_DECLARE(void) switch_cache_db_flush_handles(void)
SWITCH_DECLARE
(
void
)
switch_cache_db_release_db_handle
(
switch_cache_db_handle_t
**
dbh
)
SWITCH_DECLARE
(
void
)
switch_cache_db_release_db_handle
(
switch_cache_db_handle_t
**
dbh
)
{
{
if
(
dbh
&&
*
dbh
)
{
if
(
dbh
&&
*
dbh
)
{
...
@@ -165,14 +165,14 @@ SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t
...
@@ -165,14 +165,14 @@ SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t
default
:
default
:
break
;
break
;
}
}
switch_mutex_unlock
((
*
dbh
)
->
mutex
);
switch_mutex_unlock
((
*
dbh
)
->
mutex
);
*
dbh
=
NULL
;
*
dbh
=
NULL
;
}
}
}
}
SWITCH_DECLARE
(
void
)
switch_cache_db_dismiss_db_handle
(
switch_cache_db_handle_t
**
dbh
)
SWITCH_DECLARE
(
void
)
switch_cache_db_dismiss_db_handle
(
switch_cache_db_handle_t
**
dbh
)
{
{
if
(
dbh
&&
*
dbh
)
{
if
(
dbh
&&
*
dbh
)
{
...
@@ -188,7 +188,7 @@ SWITCH_DECLARE(void) switch_cache_db_dismiss_db_handle(switch_cache_db_handle_t
...
@@ -188,7 +188,7 @@ SWITCH_DECLARE(void) switch_cache_db_dismiss_db_handle(switch_cache_db_handle_t
}
}
SWITCH_DECLARE
(
void
)
switch_cache_db_destroy_db_handle
(
switch_cache_db_handle_t
**
dbh
)
SWITCH_DECLARE
(
void
)
switch_cache_db_destroy_db_handle
(
switch_cache_db_handle_t
**
dbh
)
{
{
if
(
dbh
&&
*
dbh
)
{
if
(
dbh
&&
*
dbh
)
{
switch_mutex_lock
(
sql_manager
.
dbh_mutex
);
switch_mutex_lock
(
sql_manager
.
dbh_mutex
);
...
@@ -251,7 +251,7 @@ SWITCH_DECLARE(void) switch_cache_db_detach(void)
...
@@ -251,7 +251,7 @@ SWITCH_DECLARE(void) switch_cache_db_detach(void)
switch_mutex_unlock
(
sql_manager
.
dbh_mutex
);
switch_mutex_unlock
(
sql_manager
.
dbh_mutex
);
}
}
SWITCH_DECLARE
(
switch_status_t
)
_switch_cache_db_get_db_handle
(
switch_cache_db_handle_t
**
dbh
,
SWITCH_DECLARE
(
switch_status_t
)
_switch_cache_db_get_db_handle
(
switch_cache_db_handle_t
**
dbh
,
switch_cache_db_handle_type_t
type
,
switch_cache_db_handle_type_t
type
,
switch_cache_db_connection_options_t
*
connection_options
,
switch_cache_db_connection_options_t
*
connection_options
,
const
char
*
file
,
const
char
*
func
,
int
line
)
const
char
*
file
,
const
char
*
func
,
int
line
)
...
@@ -312,7 +312,7 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
...
@@ -312,7 +312,7 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h
if
((
new_dbh
=
(
switch_cache_db_handle_t
*
)
val
))
{
if
((
new_dbh
=
(
switch_cache_db_handle_t
*
)
val
))
{
if
(
hash
==
new_dbh
->
hash
&&
!
strncasecmp
(
new_dbh
->
name
,
db_str
,
strlen
(
db_str
))
&&
if
(
hash
==
new_dbh
->
hash
&&
!
strncasecmp
(
new_dbh
->
name
,
db_str
,
strlen
(
db_str
))
&&
!
switch_test_flag
(
new_dbh
,
CDF_INUSE
)
&&
!
switch_test_flag
(
new_dbh
,
CDF_PRUNE
)
!
switch_test_flag
(
new_dbh
,
CDF_INUSE
)
&&
!
switch_test_flag
(
new_dbh
,
CDF_PRUNE
)
&&
switch_mutex_trylock
(
new_dbh
->
mutex
)
==
SWITCH_STATUS_SUCCESS
)
{
&&
switch_mutex_trylock
(
new_dbh
->
mutex
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_set_flag
(
new_dbh
,
CDF_INUSE
);
switch_set_flag
(
new_dbh
,
CDF_INUSE
);
switch_set_string
(
new_dbh
->
name
,
thread_str
);
switch_set_string
(
new_dbh
->
name
,
thread_str
);
...
@@ -857,7 +857,8 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread,
...
@@ -857,7 +857,8 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread,
}
}
while
(
!
sql_manager
.
event_db
)
{
while
(
!
sql_manager
.
event_db
)
{
if
(
switch_core_db_handle
(
&
sql_manager
.
event_db
)
==
SWITCH_STATUS_SUCCESS
&&
sql_manager
.
event_db
)
break
;
if
(
switch_core_db_handle
(
&
sql_manager
.
event_db
)
==
SWITCH_STATUS_SUCCESS
&&
sql_manager
.
event_db
)
break
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Error getting core db, Retrying
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Error getting core db, Retrying
\n
"
);
switch_yield
(
500000
);
switch_yield
(
500000
);
sanity
--
;
sanity
--
;
...
@@ -957,7 +958,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread,
...
@@ -957,7 +958,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread,
}
}
#define MAX_SQL 5
#define MAX_SQL 5
#define new_sql() switch_assert(sql_idx+1 < MAX_SQL); sql[sql_idx++]
#define new_sql() switch_assert(sql_idx+1 < MAX_SQL); sql[sql_idx++]
static
void
core_event_handler
(
switch_event_t
*
event
)
static
void
core_event_handler
(
switch_event_t
*
event
)
{
{
...
@@ -994,7 +995,8 @@ static void core_event_handler(switch_event_t *event)
...
@@ -994,7 +995,8 @@ static void core_event_handler(switch_event_t *event)
if
(
id
)
{
if
(
id
)
{
new_sql
()
=
switch_mprintf
(
"update tasks set task_desc='%q',task_group='%q', task_sql_manager=%q where task_id=%q and hostname='%q'"
,
new_sql
()
=
switch_mprintf
(
"update tasks set task_desc='%q',task_group='%q', task_sql_manager=%q where task_id=%q and hostname='%q'"
,
switch_event_get_header_nil
(
event
,
"task-desc"
),
switch_event_get_header_nil
(
event
,
"task-desc"
),
switch_event_get_header_nil
(
event
,
"task-group"
),
manager
?
manager
:
"0"
,
id
,
switch_core_get_variable
(
"hostname"
));
switch_event_get_header_nil
(
event
,
"task-group"
),
manager
?
manager
:
"0"
,
id
,
switch_core_get_variable
(
"hostname"
));
}
}
}
}
break
;
break
;
...
@@ -1076,7 +1078,7 @@ static void core_event_handler(switch_event_t *event)
...
@@ -1076,7 +1078,7 @@ static void core_event_handler(switch_event_t *event)
if
(
!
name
)
{
if
(
!
name
)
{
name
=
switch_event_get_header
(
event
,
"caller-callee-id-name"
);
name
=
switch_event_get_header
(
event
,
"caller-callee-id-name"
);
}
}
if
(
!
number
)
{
if
(
!
number
)
{
number
=
switch_event_get_header
(
event
,
"caller-callee-id-number"
);
number
=
switch_event_get_header
(
event
,
"caller-callee-id-number"
);
}
}
...
@@ -1097,9 +1099,8 @@ static void core_event_handler(switch_event_t *event)
...
@@ -1097,9 +1099,8 @@ static void core_event_handler(switch_event_t *event)
{
{
new_sql
()
=
switch_mprintf
(
"update channels set callstate='%q' where uuid='%q' and hostname='%q'"
,
new_sql
()
=
switch_mprintf
(
"update channels set callstate='%q' where uuid='%q' and hostname='%q'"
,
switch_event_get_header_nil
(
event
,
"channel-call-state"
),
switch_event_get_header_nil
(
event
,
"channel-call-state"
),
switch_event_get_header_nil
(
event
,
"unique-id"
),
switch_event_get_header_nil
(
event
,
"unique-id"
),
switch_core_get_variable
(
"hostname"
));
switch_core_get_variable
(
"hostname"
));
}
}
break
;
break
;
case
SWITCH_EVENT_CHANNEL_STATE
:
case
SWITCH_EVENT_CHANNEL_STATE
:
...
@@ -1244,7 +1245,7 @@ static void core_event_handler(switch_event_t *event)
...
@@ -1244,7 +1245,7 @@ static void core_event_handler(switch_event_t *event)
if
(
sql_idx
)
{
if
(
sql_idx
)
{
int
i
=
0
;
int
i
=
0
;
for
(
i
=
0
;
i
<
sql_idx
;
i
++
)
{
for
(
i
=
0
;
i
<
sql_idx
;
i
++
)
{
if
(
switch_stristr
(
"update channels"
,
sql
[
i
])
||
switch_stristr
(
"delete from channels"
,
sql
[
i
]))
{
if
(
switch_stristr
(
"update channels"
,
sql
[
i
])
||
switch_stristr
(
"delete from channels"
,
sql
[
i
]))
{
switch_queue_push
(
sql_manager
.
sql_queue
[
1
],
sql
[
i
]);
switch_queue_push
(
sql_manager
.
sql_queue
[
1
],
sql
[
i
]);
}
else
{
}
else
{
...
@@ -1330,10 +1331,10 @@ static char create_calls_sql[] =
...
@@ -1330,10 +1331,10 @@ static char create_calls_sql[] =
" callee_chan_name VARCHAR(1024),
\n
"
" callee_chan_name VARCHAR(1024),
\n
"
" callee_uuid VARCHAR(256),
\n
"
" callee_uuid VARCHAR(256),
\n
"
" hostname VARCHAR(256)
\n
"
" hostname VARCHAR(256)
\n
"
");
\n
"
"create index eruuindex on calls (caller_uuid,hostname);
\n
"
");
\n
"
"create index eruuindex on calls (caller_uuid,hostname);
\n
"
"create index eeuuindex on calls (callee_uuid,hostname);
\n
"
"create index eeuuindex on calls (callee_uuid,hostname);
\n
"
"create index eeuuindex2 on calls (call_uuid,hostname);
\n
"
"create index eeuuindex2 on calls (call_uuid,hostname);
\n
"
;
;
static
char
create_interfaces_sql
[]
=
static
char
create_interfaces_sql
[]
=
"CREATE TABLE interfaces (
\n
"
"CREATE TABLE interfaces (
\n
"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论