Enhancements from MODEVENT-13
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7529 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
1369cdf235
commit
6547e4c09a
|
@ -182,6 +182,14 @@ static switch_status_t my_on_ring(switch_core_session_t *session)
|
|||
profile = switch_channel_get_caller_profile(channel);
|
||||
|
||||
if(profile) {
|
||||
if(profile->username) {
|
||||
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);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
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) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
|
@ -214,6 +222,54 @@ static switch_status_t my_on_ring(switch_core_session_t *session)
|
|||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->network_addr) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *)profile->network_addr, -1, 0) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"failed adding Framed-IP-Address: %s\n", profile->network_addr);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->rdnis) {
|
||||
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);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->context) {
|
||||
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);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->ani) {
|
||||
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);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->aniii) {
|
||||
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);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->source) {
|
||||
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);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->caller_extension && profile->caller_extension->last_application->application_name) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP,
|
||||
(void *)profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
|
||||
|
@ -330,6 +386,14 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
|
|||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Finished calculating billable time\n");
|
||||
|
||||
if(profile->username) {
|
||||
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);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
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) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
|
@ -362,6 +426,54 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
|
|||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->network_addr) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *)profile->network_addr, -1, 0) == NULL) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"failed adding Framed-IP-Address: %s\n", profile->network_addr);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->rdnis) {
|
||||
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);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->context) {
|
||||
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);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->ani) {
|
||||
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);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->aniii) {
|
||||
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);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->source) {
|
||||
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);
|
||||
rc_destroy(rad_config);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
}
|
||||
if(profile->caller_extension && profile->caller_extension->last_application->application_name) {
|
||||
if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP,
|
||||
(void *)profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
|
||||
|
|
|
@ -51,9 +51,13 @@
|
|||
#define PW_FS_HANGUPCAUSE 13
|
||||
#define PW_FS_BILLUSEC 15
|
||||
#define PW_FS_AMAFLAGS 16
|
||||
#define PW_FS_RDNIS 17
|
||||
#define PW_FS_CONTEXT 18
|
||||
#define PW_FS_SOURCE 19
|
||||
#define PW_FS_CALLSTARTDATE 20
|
||||
#define PW_FS_CALLANSWERDATE 21
|
||||
#define PW_FS_CALLTRANSFERDATE 22
|
||||
#define PW_FS_CALLENDDATE 23
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -266,10 +266,12 @@ ATTRIBUTE Freeswitch-Aniii 9 string Freeswitch
|
|||
ATTRIBUTE Freeswitch-Lastapp 10 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Lastdata 11 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Disposition 12 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Hangupcause 13 integer Freeswitch
|
||||
ATTRIBUTE Freeswitch-Billusec 15 integer Freeswitch
|
||||
ATTRIBUTE Freeswitch-AMAFlags 16 integer Freeswitch
|
||||
|
||||
ATTRIBUTE Freeswitch-Hangupcause 13 integer Freeswitch
|
||||
ATTRIBUTE Freeswitch-Billusec 15 integer Freeswitch
|
||||
ATTRIBUTE Freeswitch-AMAFlags 16 integer Freeswitch
|
||||
ATTRIBUTE Freeswitch-RDNIS 17 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Context 18 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Source 19 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Callstartdate 20 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Callanswerdate 21 string Freeswitch
|
||||
ATTRIBUTE Freeswitch-Calltransferdate 22 string Freeswitch
|
||||
|
|
Loading…
Reference in New Issue