Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
fee49b16
提交
fee49b16
authored
5月 05, 2011
作者:
Mathieu Rene
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mod_radius_cdr: log errors with the call's uuid
上级
18d29b46
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
58 行增加
和
58 行删除
+58
-58
mod_radius_cdr.c
src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
+58
-58
没有找到文件。
src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
浏览文件 @
fee49b16
...
@@ -153,7 +153,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -153,7 +153,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
switch_time_exp_t
tm
;
switch_time_exp_t
tm
;
char
buffer
[
32
];
char
buffer
[
32
];
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] Entering my_on_routing
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] Entering my_on_routing
\n
"
);
if
(
globals
.
shutdown
)
{
if
(
globals
.
shutdown
)
{
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
...
@@ -162,7 +162,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -162,7 +162,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
if
(
channel
)
{
if
(
channel
)
{
const
char
*
disable_flag
=
switch_channel_get_variable
(
channel
,
"disable_radius_start"
);
const
char
*
disable_flag
=
switch_channel_get_variable
(
channel
,
"disable_radius_start"
);
if
(
switch_true
(
disable_flag
))
{
if
(
switch_true
(
disable_flag
))
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] Not Sending RADIUS Start
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] Not Sending RADIUS Start
\n
"
);
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
}
}
...
@@ -172,14 +172,14 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -172,14 +172,14 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
rad_config
=
my_radius_init
();
rad_config
=
my_radius_init
();
if
(
rad_config
==
NULL
)
{
if
(
rad_config
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Error initializing radius, Start packet not logged.
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Error initializing radius, Start packet not logged.
\n
"
);
goto
end
;
goto
end
;
}
}
if
(
switch_ivr_generate_xml_cdr
(
session
,
&
cdr
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_ivr_generate_xml_cdr
(
session
,
&
cdr
)
==
SWITCH_STATUS_SUCCESS
)
{
uuid_str
=
switch_core_session_get_uuid
(
session
);
uuid_str
=
switch_core_session_get_uuid
(
session
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Error Generating Data!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Error Generating Data!
\n
"
);
goto
end
;
goto
end
;
}
}
...
@@ -187,13 +187,13 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -187,13 +187,13 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
/* Set Status Type */
/* Set Status Type */
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_ACCT_STATUS_TYPE
,
&
status_type
,
-
1
,
0
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_ACCT_STATUS_TYPE
,
&
status_type
,
-
1
,
0
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Failed setting Acct-Status-Type: Start
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Failed setting Acct-Status-Type: Start
\n
"
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_ACCT_SESSION_ID
,
uuid_str
,
-
1
,
0
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_ACCT_SESSION_ID
,
uuid_str
,
-
1
,
0
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Failed adding Acct-Session-ID: %s
\n
"
,
uuid_str
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Failed adding Acct-Session-ID: %s
\n
"
,
uuid_str
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -207,7 +207,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -207,7 +207,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
/*
/*
cause = switch_channel_get_cause(channel);
cause = switch_channel_get_cause(channel);
if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) {
if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) {
switch_log_printf(SWITCH_CHANNEL_
LOG
, SWITCH_LOG_ERROR, "failed adding Freeswitch-Hangupcause: %d\n", cause);
switch_log_printf(SWITCH_CHANNEL_
SESSION_LOG(session)
, SWITCH_LOG_ERROR, "failed adding Freeswitch-Hangupcause: %d\n", cause);
rc_destroy(rad_config);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
return SWITCH_STATUS_TERM;
}
}
...
@@ -215,7 +215,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -215,7 +215,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
if
((
signal_bond
=
switch_channel_get_variable
(
channel
,
SWITCH_SIGNAL_BOND_VARIABLE
))
&&
!
zstr
(
signal_bond
))
{
if
((
signal_bond
=
switch_channel_get_variable
(
channel
,
SWITCH_SIGNAL_BOND_VARIABLE
))
&&
!
zstr
(
signal_bond
))
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_OTHER_LEG_ID
,
(
void
*
)
signal_bond
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_OTHER_LEG_ID
,
(
void
*
)
signal_bond
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Failed adding Freeswitch-Other-Leg-Id: %s
\n
"
,
uuid_str
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Failed adding Freeswitch-Other-Leg-Id: %s
\n
"
,
uuid_str
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -232,35 +232,35 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -232,35 +232,35 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
if
(
profile
->
username
)
{
if
(
profile
->
username
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_USER_NAME
,
(
void
*
)
profile
->
username
,
-
1
,
0
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_USER_NAME
,
(
void
*
)
profile
->
username
,
-
1
,
0
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding User-Name: %s
\n
"
,
profile
->
username
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding User-Name: %s
\n
"
,
profile
->
username
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
caller_id_number
)
{
if
(
profile
->
caller_id_number
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_SRC
,
(
void
*
)
profile
->
caller_id_number
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_SRC
,
(
void
*
)
profile
->
caller_id_number
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Src: %s
\n
"
,
profile
->
caller_id_number
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Src: %s
\n
"
,
profile
->
caller_id_number
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
caller_id_name
)
{
if
(
profile
->
caller_id_name
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CLID
,
(
void
*
)
profile
->
caller_id_name
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CLID
,
(
void
*
)
profile
->
caller_id_name
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-CLID: %s
\n
"
,
profile
->
caller_id_name
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-CLID: %s
\n
"
,
profile
->
caller_id_name
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
destination_number
)
{
if
(
profile
->
destination_number
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_DST
,
(
void
*
)
profile
->
destination_number
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_DST
,
(
void
*
)
profile
->
destination_number
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Dst: %s
\n
"
,
profile
->
destination_number
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Dst: %s
\n
"
,
profile
->
destination_number
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
dialplan
)
{
if
(
profile
->
dialplan
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_DIALPLAN
,
(
void
*
)
profile
->
dialplan
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_DIALPLAN
,
(
void
*
)
profile
->
dialplan
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Dialplan: %s
\n
"
,
profile
->
dialplan
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Dialplan: %s
\n
"
,
profile
->
dialplan
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -269,42 +269,42 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -269,42 +269,42 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
inet_pton
(
AF_INET
,
(
void
*
)
profile
->
network_addr
,
&
framed_addr
);
inet_pton
(
AF_INET
,
(
void
*
)
profile
->
network_addr
,
&
framed_addr
);
framed_addr
=
htonl
(
framed_addr
);
framed_addr
=
htonl
(
framed_addr
);
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FRAMED_IP_ADDRESS
,
&
framed_addr
,
-
1
,
0
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FRAMED_IP_ADDRESS
,
&
framed_addr
,
-
1
,
0
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Framed-IP-Address: %s
\n
"
,
profile
->
network_addr
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Framed-IP-Address: %s
\n
"
,
profile
->
network_addr
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
rdnis
)
{
if
(
profile
->
rdnis
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_RDNIS
,
(
void
*
)
profile
->
rdnis
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_RDNIS
,
(
void
*
)
profile
->
rdnis
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-RDNIS: %s
\n
"
,
profile
->
rdnis
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-RDNIS: %s
\n
"
,
profile
->
rdnis
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
context
)
{
if
(
profile
->
context
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CONTEXT
,
(
void
*
)
profile
->
context
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CONTEXT
,
(
void
*
)
profile
->
context
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Context: %s
\n
"
,
profile
->
context
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Context: %s
\n
"
,
profile
->
context
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
ani
)
{
if
(
profile
->
ani
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_ANI
,
(
void
*
)
profile
->
ani
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_ANI
,
(
void
*
)
profile
->
ani
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-ANI: %s
\n
"
,
profile
->
ani
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-ANI: %s
\n
"
,
profile
->
ani
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
aniii
)
{
if
(
profile
->
aniii
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_ANIII
,
(
void
*
)
profile
->
aniii
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_ANIII
,
(
void
*
)
profile
->
aniii
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-ANIII: %s
\n
"
,
profile
->
aniii
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-ANIII: %s
\n
"
,
profile
->
aniii
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
source
)
{
if
(
profile
->
source
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_SOURCE
,
(
void
*
)
profile
->
source
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_SOURCE
,
(
void
*
)
profile
->
source
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Source: %s
\n
"
,
profile
->
source
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Source: %s
\n
"
,
profile
->
source
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -315,7 +315,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -315,7 +315,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLSTARTDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLSTARTDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Callstartdate: %s
\n
"
,
buffer
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Callstartdate: %s
\n
"
,
buffer
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -327,7 +327,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -327,7 +327,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLANSWERDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLANSWERDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Callanswerdate: %s
\n
"
,
buffer
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Callanswerdate: %s
\n
"
,
buffer
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -339,7 +339,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -339,7 +339,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLTRANSFERDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLTRANSFERDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Calltransferdate: %s
\n
"
,
buffer
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Calltransferdate: %s
\n
"
,
buffer
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -351,7 +351,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -351,7 +351,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLENDDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLENDDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Callenddate: %s
\n
"
,
buffer
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Callenddate: %s
\n
"
,
buffer
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -360,21 +360,21 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -360,21 +360,21 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
if
(
profile
->
caller_extension
&&
profile
->
caller_extension
->
last_application
&&
profile
->
caller_extension
->
last_application
->
application_name
)
{
if
(
profile
->
caller_extension
&&
profile
->
caller_extension
->
last_application
&&
profile
->
caller_extension
->
last_application
->
application_name
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_LASTAPP
,
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_LASTAPP
,
(
void
*
)
profile
->
caller_extension
->
last_application
->
application_name
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
(
void
*
)
profile
->
caller_extension
->
last_application
->
application_name
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Lastapp: %s
\n
"
,
profile
->
source
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Lastapp: %s
\n
"
,
profile
->
source
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"profile == NULL
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"profile == NULL
\n
"
);
}
}
}
}
if
(
rc_acct
(
rad_config
,
client_port
,
send
)
==
OK_RC
)
{
if
(
rc_acct
(
rad_config
,
client_port
,
send
)
==
OK_RC
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] RADIUS Accounting OK
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] RADIUS Accounting OK
\n
"
);
retval
=
SWITCH_STATUS_SUCCESS
;
retval
=
SWITCH_STATUS_SUCCESS
;
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] RADIUS Accounting Failed
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] RADIUS Accounting Failed
\n
"
);
retval
=
SWITCH_STATUS_TERM
;
retval
=
SWITCH_STATUS_TERM
;
}
}
rc_avpair_free
(
send
);
rc_avpair_free
(
send
);
...
@@ -414,26 +414,26 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -414,26 +414,26 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
if
(
channel
)
{
if
(
channel
)
{
const
char
*
disable_flag
=
switch_channel_get_variable
(
channel
,
"disable_radius_stop"
);
const
char
*
disable_flag
=
switch_channel_get_variable
(
channel
,
"disable_radius_stop"
);
if
(
switch_true
(
disable_flag
))
{
if
(
switch_true
(
disable_flag
))
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] Not Sending RADIUS Stop
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] Not Sending RADIUS Stop
\n
"
);
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
}
}
switch_thread_rwlock_rdlock
(
globals
.
rwlock
);
switch_thread_rwlock_rdlock
(
globals
.
rwlock
);
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] Entering my_on_reporting
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] Entering my_on_reporting
\n
"
);
rad_config
=
my_radius_init
();
rad_config
=
my_radius_init
();
if
(
rad_config
==
NULL
)
{
if
(
rad_config
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Error initializing radius, session not logged.
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Error initializing radius, session not logged.
\n
"
);
goto
end
;
goto
end
;
}
}
if
(
switch_ivr_generate_xml_cdr
(
session
,
&
cdr
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_ivr_generate_xml_cdr
(
session
,
&
cdr
)
==
SWITCH_STATUS_SUCCESS
)
{
uuid_str
=
switch_core_session_get_uuid
(
session
);
uuid_str
=
switch_core_session_get_uuid
(
session
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Error Generating Data!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"[mod_radius_cdr] Error Generating Data!
\n
"
);
goto
end
;
goto
end
;
}
}
...
@@ -441,13 +441,13 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -441,13 +441,13 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
/* Set Status Type */
/* Set Status Type */
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_ACCT_STATUS_TYPE
,
&
status_type
,
-
1
,
0
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_ACCT_STATUS_TYPE
,
&
status_type
,
-
1
,
0
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Acct-Session-ID: %s
\n
"
,
uuid_str
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Acct-Session-ID: %s
\n
"
,
uuid_str
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_ACCT_SESSION_ID
,
uuid_str
,
-
1
,
0
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_ACCT_SESSION_ID
,
uuid_str
,
-
1
,
0
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Acct-Session-ID: %s
\n
"
,
uuid_str
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Acct-Session-ID: %s
\n
"
,
uuid_str
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -460,7 +460,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -460,7 +460,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
cause
=
switch_channel_get_cause
(
channel
);
cause
=
switch_channel_get_cause
(
channel
);
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_HANGUPCAUSE
,
&
cause
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_HANGUPCAUSE
,
&
cause
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Hangupcause: %d
\n
"
,
cause
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Hangupcause: %d
\n
"
,
cause
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -469,7 +469,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -469,7 +469,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
if
(
profile
)
{
if
(
profile
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] Calculating billable time
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] Calculating billable time
\n
"
);
/* calculate billable time */
/* calculate billable time */
callstartdate
=
profile
->
times
->
created
;
callstartdate
=
profile
->
times
->
created
;
...
@@ -490,39 +490,39 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -490,39 +490,39 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
}
}
billsec
=
(
billusec
/
1000000
);
billsec
=
(
billusec
/
1000000
);
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] Finished calculating billable time
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_DEBUG
,
"[mod_radius_cdr] Finished calculating billable time
\n
"
);
if
(
profile
->
username
)
{
if
(
profile
->
username
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_USER_NAME
,
(
void
*
)
profile
->
username
,
-
1
,
0
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_USER_NAME
,
(
void
*
)
profile
->
username
,
-
1
,
0
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding User-Name: %s
\n
"
,
profile
->
username
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding User-Name: %s
\n
"
,
profile
->
username
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
caller_id_number
)
{
if
(
profile
->
caller_id_number
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_SRC
,
(
void
*
)
profile
->
caller_id_number
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_SRC
,
(
void
*
)
profile
->
caller_id_number
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Src: %s
\n
"
,
profile
->
caller_id_number
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Src: %s
\n
"
,
profile
->
caller_id_number
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
caller_id_name
)
{
if
(
profile
->
caller_id_name
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CLID
,
(
void
*
)
profile
->
caller_id_name
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CLID
,
(
void
*
)
profile
->
caller_id_name
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-CLID: %s
\n
"
,
profile
->
caller_id_name
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-CLID: %s
\n
"
,
profile
->
caller_id_name
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
destination_number
)
{
if
(
profile
->
destination_number
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_DST
,
(
void
*
)
profile
->
destination_number
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_DST
,
(
void
*
)
profile
->
destination_number
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Dst: %s
\n
"
,
profile
->
destination_number
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Dst: %s
\n
"
,
profile
->
destination_number
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
dialplan
)
{
if
(
profile
->
dialplan
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_DIALPLAN
,
(
void
*
)
profile
->
dialplan
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_DIALPLAN
,
(
void
*
)
profile
->
dialplan
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Dialplan: %s
\n
"
,
profile
->
dialplan
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Dialplan: %s
\n
"
,
profile
->
dialplan
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -531,42 +531,42 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -531,42 +531,42 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
inet_pton
(
AF_INET
,
(
void
*
)
profile
->
network_addr
,
&
framed_addr
);
inet_pton
(
AF_INET
,
(
void
*
)
profile
->
network_addr
,
&
framed_addr
);
framed_addr
=
htonl
(
framed_addr
);
framed_addr
=
htonl
(
framed_addr
);
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FRAMED_IP_ADDRESS
,
&
framed_addr
,
-
1
,
0
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FRAMED_IP_ADDRESS
,
&
framed_addr
,
-
1
,
0
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Framed-IP-Address: %s
\n
"
,
profile
->
network_addr
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Framed-IP-Address: %s
\n
"
,
profile
->
network_addr
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
rdnis
)
{
if
(
profile
->
rdnis
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_RDNIS
,
(
void
*
)
profile
->
rdnis
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_RDNIS
,
(
void
*
)
profile
->
rdnis
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-RDNIS: %s
\n
"
,
profile
->
rdnis
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-RDNIS: %s
\n
"
,
profile
->
rdnis
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
context
)
{
if
(
profile
->
context
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CONTEXT
,
(
void
*
)
profile
->
context
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CONTEXT
,
(
void
*
)
profile
->
context
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Context: %s
\n
"
,
profile
->
context
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Context: %s
\n
"
,
profile
->
context
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
ani
)
{
if
(
profile
->
ani
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_ANI
,
(
void
*
)
profile
->
ani
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_ANI
,
(
void
*
)
profile
->
ani
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-ANI: %s
\n
"
,
profile
->
ani
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-ANI: %s
\n
"
,
profile
->
ani
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
aniii
)
{
if
(
profile
->
aniii
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_ANIII
,
(
void
*
)
profile
->
aniii
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_ANIII
,
(
void
*
)
profile
->
aniii
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-ANIII: %s
\n
"
,
profile
->
aniii
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-ANIII: %s
\n
"
,
profile
->
aniii
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
profile
->
source
)
{
if
(
profile
->
source
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_SOURCE
,
(
void
*
)
profile
->
source
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_SOURCE
,
(
void
*
)
profile
->
source
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Source: %s
\n
"
,
profile
->
source
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Source: %s
\n
"
,
profile
->
source
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -574,13 +574,13 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -574,13 +574,13 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
if
(
profile
->
caller_extension
&&
profile
->
caller_extension
->
last_application
&&
profile
->
caller_extension
->
last_application
->
application_name
)
{
if
(
profile
->
caller_extension
&&
profile
->
caller_extension
->
last_application
&&
profile
->
caller_extension
->
last_application
->
application_name
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_LASTAPP
,
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_LASTAPP
,
(
void
*
)
profile
->
caller_extension
->
last_application
->
application_name
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
(
void
*
)
profile
->
caller_extension
->
last_application
->
application_name
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Lastapp: %s
\n
"
,
profile
->
source
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Lastapp: %s
\n
"
,
profile
->
source
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_BILLUSEC
,
&
billusec
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_BILLUSEC
,
&
billusec
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Billusec: %u
\n
"
,
(
uint32_t
)
billusec
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Billusec: %u
\n
"
,
(
uint32_t
)
billusec
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -591,7 +591,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -591,7 +591,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLSTARTDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLSTARTDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Callstartdate: %s
\n
"
,
buffer
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Callstartdate: %s
\n
"
,
buffer
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -603,7 +603,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -603,7 +603,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLANSWERDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLANSWERDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Callanswerdate: %s
\n
"
,
buffer
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Callanswerdate: %s
\n
"
,
buffer
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -615,7 +615,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -615,7 +615,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLTRANSFERDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLTRANSFERDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Calltransferdate: %s
\n
"
,
buffer
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Calltransferdate: %s
\n
"
,
buffer
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -627,14 +627,14 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -627,14 +627,14 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_year
+
1900
,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
,
tm
.
tm_usec
,
tm
.
tm_gmtoff
/
3600
,
tm
.
tm_gmtoff
%
3600
);
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLENDDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_CALLENDDATE
,
&
buffer
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Callenddate: %s
\n
"
,
buffer
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Callenddate: %s
\n
"
,
buffer
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_ACCT_SESSION_TIME
,
&
billsec
,
-
1
,
0
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_ACCT_SESSION_TIME
,
&
billsec
,
-
1
,
0
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Acct-Session-Time: %u
\n
"
,
billsec
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Acct-Session-Time: %u
\n
"
,
billsec
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
...
@@ -643,22 +643,22 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -643,22 +643,22 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
const
char
*
direction_str
=
profile
->
direction
==
SWITCH_CALL_DIRECTION_INBOUND
?
"inbound"
:
"outbound"
;
const
char
*
direction_str
=
profile
->
direction
==
SWITCH_CALL_DIRECTION_INBOUND
?
"inbound"
:
"outbound"
;
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_DIRECTION
,
(
void
*
)
direction_str
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
if
(
rc_avpair_add
(
rad_config
,
&
send
,
PW_FS_DIRECTION
,
(
void
*
)
direction_str
,
-
1
,
PW_FS_PEC
)
==
NULL
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Direction: %s
\n
"
,
direction_str
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Direction: %s
\n
"
,
direction_str
);
rc_destroy
(
rad_config
);
rc_destroy
(
rad_config
);
goto
end
;
goto
end
;
}
}
}
}
}
else
{
/* no profile, can't create data to send */
}
else
{
/* no profile, can't create data to send */
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"profile == NULL
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"profile == NULL
\n
"
);
}
}
}
}
if
(
rc_acct
(
rad_config
,
client_port
,
send
)
==
OK_RC
)
{
if
(
rc_acct
(
rad_config
,
client_port
,
send
)
==
OK_RC
)
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_DEBUG
,
"RADIUS Accounting OK
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_DEBUG
,
"RADIUS Accounting OK
\n
"
);
retval
=
SWITCH_STATUS_SUCCESS
;
retval
=
SWITCH_STATUS_SUCCESS
;
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_
LOG
,
SWITCH_LOG_ERROR
,
"RADIUS Accounting Failed
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_
SESSION_LOG
(
session
)
,
SWITCH_LOG_ERROR
,
"RADIUS Accounting Failed
\n
"
);
retval
=
SWITCH_STATUS_TERM
;
retval
=
SWITCH_STATUS_TERM
;
}
}
rc_avpair_free
(
send
);
rc_avpair_free
(
send
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论