Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
818021cf
提交
818021cf
authored
5月 06, 2011
作者:
Giovanni Maruzzelli
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
ssh://git.freeswitch.org:222/freeswitch
上级
2af0dc00
b7da0020
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
87 行增加
和
62 行删除
+87
-62
mod_freetdm.c
libs/freetdm/mod_freetdm/mod_freetdm.c
+6
-6
mod_radius_cdr.c
src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
+77
-56
mod_radius_cdr.h
src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h
+2
-0
dictionary
src/mod/event_handlers/mod_radius_cdr/radius/dictionary
+2
-0
没有找到文件。
libs/freetdm/mod_freetdm/mod_freetdm.c
浏览文件 @
818021cf
...
@@ -3518,12 +3518,12 @@ void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stre
...
@@ -3518,12 +3518,12 @@ void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stre
"physical_span_id: %u
\n
"
"physical_span_id: %u
\n
"
"physical_chan_id: %u
\n
"
"physical_chan_id: %u
\n
"
"physical_status: %s
\n
"
"physical_status: %s
\n
"
"physical_status_red:
$
d
\n
"
"physical_status_red:
%
d
\n
"
"physical_status_yellow:
$
d
\n
"
"physical_status_yellow:
%
d
\n
"
"physical_status_rai:
$
d
\n
"
"physical_status_rai:
%
d
\n
"
"physical_status_blue:
$
d
\n
"
"physical_status_blue:
%
d
\n
"
"physical_status_ais:
$
d
\n
"
"physical_status_ais:
%
d
\n
"
"physical_status_general:
$
d
\n
"
"physical_status_general:
%
d
\n
"
"signaling_status: %s
\n
"
"signaling_status: %s
\n
"
"type: %s
\n
"
"type: %s
\n
"
"state: %s
\n
"
"state: %s
\n
"
...
...
src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
浏览文件 @
818021cf
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
* Contributor(s):
* Contributor(s):
*
*
* Chris Parker <cparker@segv.org>
* Chris Parker <cparker@segv.org>
* Mathieu Rene <mrene@avgs.ca>
*
*
*
*
* mod_radius_cdr.c -- RADIUS CDR Module
* mod_radius_cdr.c -- RADIUS CDR Module
...
@@ -145,13 +146,14 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -145,13 +146,14 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
switch_time_t
callanswerdate
=
0
;
switch_time_t
callanswerdate
=
0
;
switch_time_t
callenddate
=
0
;
switch_time_t
callenddate
=
0
;
switch_time_t
calltransferdate
=
0
;
switch_time_t
calltransferdate
=
0
;
const
char
*
signal_bond
=
NULL
;
char
*
uuid_str
;
char
*
uuid_str
;
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
;
...
@@ -160,7 +162,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -160,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
;
}
}
}
}
...
@@ -170,14 +172,14 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -170,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
;
}
}
...
@@ -185,13 +187,13 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -185,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
;
}
}
...
@@ -205,11 +207,19 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -205,11 +207,19 @@ 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;
}
}
*/
*/
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
)
{
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
);
goto
end
;
}
}
profile
=
switch_channel_get_caller_profile
(
channel
);
profile
=
switch_channel_get_caller_profile
(
channel
);
...
@@ -222,35 +232,35 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -222,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
;
}
}
...
@@ -259,42 +269,42 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -259,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
;
}
}
...
@@ -305,7 +315,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -305,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
;
}
}
...
@@ -317,7 +327,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -317,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
;
}
}
...
@@ -329,7 +339,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -329,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
;
}
}
...
@@ -341,7 +351,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -341,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
;
}
}
...
@@ -350,21 +360,21 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
...
@@ -350,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
);
...
@@ -404,26 +414,26 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -404,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
;
}
}
...
@@ -431,13 +441,13 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -431,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
;
}
}
...
@@ -450,7 +460,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -450,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
;
}
}
...
@@ -459,7 +469,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -459,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
;
...
@@ -480,39 +490,39 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -480,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
;
}
}
...
@@ -521,42 +531,42 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -521,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
;
}
}
...
@@ -564,13 +574,13 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -564,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
;
}
}
...
@@ -581,7 +591,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -581,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
;
}
}
...
@@ -593,7 +603,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -593,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
;
}
}
...
@@ -605,7 +615,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -605,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
;
}
}
...
@@ -617,27 +627,38 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
...
@@ -617,27 +627,38 @@ 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
;
}
}
{
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
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"failed adding Freeswitch-Direction: %s
\n
"
,
direction_str
);
rc_destroy
(
rad_config
);
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
);
...
...
src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h
浏览文件 @
818021cf
...
@@ -58,6 +58,8 @@
...
@@ -58,6 +58,8 @@
#define PW_FS_CALLANSWERDATE 21
#define PW_FS_CALLANSWERDATE 21
#define PW_FS_CALLTRANSFERDATE 22
#define PW_FS_CALLTRANSFERDATE 22
#define PW_FS_CALLENDDATE 23
#define PW_FS_CALLENDDATE 23
#define PW_FS_DIRECTION 24
#define PW_FS_OTHER_LEG_ID 25
#endif
#endif
src/mod/event_handlers/mod_radius_cdr/radius/dictionary
浏览文件 @
818021cf
...
@@ -276,6 +276,8 @@ ATTRIBUTE Freeswitch-Callstartdate 20 string Freeswitch
...
@@ -276,6 +276,8 @@ ATTRIBUTE Freeswitch-Callstartdate 20 string Freeswitch
ATTRIBUTE Freeswitch-Callanswerdate 21 string Freeswitch
ATTRIBUTE Freeswitch-Callanswerdate 21 string Freeswitch
ATTRIBUTE Freeswitch-Calltransferdate 22 string Freeswitch
ATTRIBUTE Freeswitch-Calltransferdate 22 string Freeswitch
ATTRIBUTE Freeswitch-Callenddate 23 string Freeswitch
ATTRIBUTE Freeswitch-Callenddate 23 string Freeswitch
ATTRIBUTE Freeswitch-Direction 24 string Freeswitch
ATTRIBUTE Freeswitch-Other-Leg-Id 25 string Freeswitch
#
#
# Freeswitch-Hangupcause
# Freeswitch-Hangupcause
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论