Revision
15197
Author
cparker
Date
2009-10-22 11:35:14 -0500 (Thu, 22 Oct 2009)

Log Message

Apply framed-ip-address patch from MODEVENT-52

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c (15196 => 15197)


--- freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	2009-10-22 16:34:58 UTC (rev 15196)
+++ freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	2009-10-22 16:35:14 UTC (rev 15197)
@@ -138,6 +138,7 @@
 	switch_status_t retval = SWITCH_STATUS_TERM;
 	VALUE_PAIR *send = NULL;
 	uint32_t client_port = 0;
+	uint32_t framed_addr = 0;
 	uint32_t status_type = PW_STATUS_START;
 	switch_time_t callstartdate = 0;
 	switch_time_t callanswerdate = 0;
@@ -254,7 +255,9 @@
 				}
 			}
 			if (profile->network_addr) {
-				if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *) profile->network_addr, -1, 0) == NULL) {
+				inet_pton(AF_INET, (void *) profile->network_addr, &framed_addr);
+				framed_addr = htonl(framed_addr);
+				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);
 					rc_destroy(rad_config);
 					goto end;
@@ -379,6 +382,7 @@
 	switch_status_t retval = SWITCH_STATUS_TERM;
 	VALUE_PAIR *send = NULL;
 	uint32_t client_port = 0;
+	uint32_t framed_addr = 0;
 	uint32_t status_type = PW_STATUS_STOP;
 	switch_time_t callstartdate = 0;
 	switch_time_t callanswerdate = 0;
@@ -513,7 +517,9 @@
 				}
 			}
 			if (profile->network_addr) {
-				if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *) profile->network_addr, -1, 0) == NULL) {
+				inet_pton(AF_INET, (void *) profile->network_addr, &framed_addr);
+				framed_addr = htonl(framed_addr);
+				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);
 					rc_destroy(rad_config);
 					goto end;