[Freeswitch-svn] [commit] r7643 - in freeswitch/trunk/src/mod: applications/mod_conference applications/mod_dptools applications/mod_expr applications/mod_voicemail asr_tts/mod_openmrcp endpoints/mod_wanpipe event_handlers/mod_radius_cdr

Freeswitch SVN brian at freeswitch.org
Fri Feb 15 18:24:00 EST 2008


Author: brian
Date: Fri Feb 15 18:23:59 2008
New Revision: 7643

Modified:
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c
   freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
   freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
   freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
   freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c

Log:
cleanup

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Fri Feb 15 18:23:59 2008
@@ -555,11 +555,11 @@
 		}
 
 		if (conference->count > 1) {
-			if(conference->moh_sound) {
+			if (conference->moh_sound) {
 				/* stop MoH if any */
 				conference_stop_file(conference, FILE_STOP_ASYNC);
 			}
-			if(conference->enter_sound) {
+			if (conference->enter_sound) {
 				conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 1);
 			}
 		}

Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	Fri Feb 15 18:23:59 2008
@@ -877,7 +877,7 @@
 SWITCH_STANDARD_APP(system_session_function)
 {
     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Executing command: %s\n",data);
-    if(!system(data)) {
+    if (!system(data)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Failed to execute command: %s\n",data);
 	}
 }

Modified: freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c	Fri Feb 15 18:23:59 2008
@@ -82,43 +82,43 @@
 
     /* Create function list */
     err = exprFuncListCreate(&f);
-    if(err != EXPR_ERROR_NOERROR)
+    if (err != EXPR_ERROR_NOERROR)
         goto error;
 
     /* Init function list with internal functions */
     err = exprFuncListInit(f);
-    if(err != EXPR_ERROR_NOERROR)
+    if (err != EXPR_ERROR_NOERROR)
         goto error;
 
     /* Add custom function */
     //err = exprFuncListAdd(f, my_func, "myfunc", 1, 1, 1, 1);
-    //if(err != EXPR_ERROR_NOERROR)
+    //if (err != EXPR_ERROR_NOERROR)
 	//goto error;
 
     /* Create constant list */
     err = exprValListCreate(&c);
-    if(err != EXPR_ERROR_NOERROR)
+    if (err != EXPR_ERROR_NOERROR)
         goto error;
 
     /* Init constant list with internal constants */
     err = exprValListInit(c);
-    if(err != EXPR_ERROR_NOERROR)
+    if (err != EXPR_ERROR_NOERROR)
         goto error;
 
     /* Create variable list */
     err = exprValListCreate(&v);
-    if(err != EXPR_ERROR_NOERROR)
+    if (err != EXPR_ERROR_NOERROR)
         goto error;
 
     /* Create expression object */
     err = exprCreate(&e, f, v, c, breaker, NULL);
-    if(err != EXPR_ERROR_NOERROR)
+    if (err != EXPR_ERROR_NOERROR)
         goto error;
 
     /* Parse expression */
     err = exprParse(e, (char *)expr);
 
-    if(err != EXPR_ERROR_NOERROR)
+    if (err != EXPR_ERROR_NOERROR)
         goto error;
 
     /* Enable soft errors */
@@ -153,19 +153,19 @@
 
  done:
     /* Do cleanup */
-    if(e) {
+    if (e) {
         exprFree(e); 
     }
 
-    if(f) {
+    if (f) {
         exprFuncListFree(f);
     }
 
-    if(v) {
+    if (v) {
         exprValListFree(v);
     }
 
-    if(c) {
+    if (c) {
         exprValListFree(c);
     }
 

Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	Fri Feb 15 18:23:59 2008
@@ -1046,7 +1046,7 @@
 	switch_file_handle_t fh = { 0 };
 	cc_t cc = { 0 };
 
-	if(switch_channel_ready(channel)) {
+	if (switch_channel_ready(channel)) {
 
 		args.input_callback = cancel_on_dtmf;
 
@@ -1160,13 +1160,13 @@
 					switch_channel_set_variable(channel, "voicemail_message_len", duration_str);
 					switch_channel_set_variable(channel, "voicemail_email", cbt->email);
 
-					if(switch_strlen_zero(profile->email_headers)) {
+					if (switch_strlen_zero(profile->email_headers)) {
 						from = switch_core_session_sprintf(session, "%s@%s", cbt->user, cbt->domain);
 					} else {
 						from = switch_channel_expand_variables(channel,profile->email_from);
 					}
 
-					if(switch_strlen_zero(profile->email_headers)) {
+					if (switch_strlen_zero(profile->email_headers)) {
 						headers = switch_core_session_sprintf(session, 
 							"From: FreeSWITCH mod_voicemail <%s@%s>\nSubject: Voicemail from %s %s\nX-Priority: %d", 
 							cbt->user, cbt->domain, cbt->cid_name, cbt->cid_number, priority);
@@ -1617,7 +1617,7 @@
 
 		if (auth || !thepass || (thepass && mypass && !strcmp(thepass, mypass))) {
 			if (!dir_path) {
-				if(switch_strlen_zero(profile->storage_dir)) {
+				if (switch_strlen_zero(profile->storage_dir)) {
 					dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, 
 						SWITCH_PATH_SEPARATOR,
 						SWITCH_PATH_SEPARATOR,
@@ -1710,7 +1710,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if(switch_strlen_zero(profile->storage_dir)) {
+	if (switch_strlen_zero(profile->storage_dir)) {
 		dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, 
 			SWITCH_PATH_SEPARATOR,
 			SWITCH_PATH_SEPARATOR,
@@ -1819,14 +1819,14 @@
 	if (*buf != '\0') {
 		if (!strcasecmp(buf, profile->main_menu_key)) {
 			voicemail_check_main(session, profile_name, domain_name, id, 0);
-		} else if(!strcasecmp(buf, profile->operator_key) && !switch_strlen_zero(profile->operator_key)) {
+		} else if (!strcasecmp(buf, profile->operator_key) && !switch_strlen_zero(profile->operator_key)) {
 			int argc;
 			char *argv[4];
 			char *mycmd;
 
 			if (!switch_strlen_zero(profile->operator_ext) && (mycmd = switch_core_session_strdup(session, profile->operator_ext))) {
 				argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-				if(argc >= 1 && argc <= 4) {
+				if (argc >= 1 && argc <= 4) {
 					switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
 					/* the application still runs after we leave it so we need to make sure that we dont do anything evil */
 					send_mail=0;
@@ -1877,7 +1877,7 @@
 		}
 	}
 
-	if(!send_mail && switch_file_exists(file_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+	if (!send_mail && switch_file_exists(file_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
 		char *usql;
 		switch_event_t *event;
 		char *mwi_id = NULL;

Modified: freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
==============================================================================
--- freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c	(original)
+++ freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c	Fri Feb 15 18:23:59 2008
@@ -114,12 +114,12 @@
 	openmrcp_session_t *openmrcp_session;
 	apr_pool_t *session_pool;
 
-	if(!profile) {
+	if (!profile) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no profile specified\n");
 		return NULL;
 	}
 
-	if(apr_pool_create(&session_pool, NULL) != APR_SUCCESS) {
+	if (apr_pool_create(&session_pool, NULL) != APR_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create session_pool\n");
 		return NULL;
 	}
@@ -150,7 +150,7 @@
 
 static void openmrcp_session_destroy(openmrcp_session_t *openmrcp_session)
 {
-	if(openmrcp_session && openmrcp_session->pool) {
+	if (openmrcp_session && openmrcp_session->pool) {
 		mrcp_client_context_session_destroy(openmrcp_session->profile->mrcp_context, openmrcp_session->client_session);
 		apr_pool_destroy(openmrcp_session->pool);
 	}
@@ -166,7 +166,7 @@
 {
 	openmrcp_session_t *openmrcp_session = mrcp_client_context_session_object_get(session);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "on_session_terminate called\n");
-	if(!openmrcp_session) {
+	if (!openmrcp_session) {
 		return MRCP_STATUS_FAILURE;
 	}
 
@@ -183,7 +183,7 @@
 {
 	openmrcp_session_t *openmrcp_session = mrcp_client_context_session_object_get(session);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "on_channel_add called\n");
-	if(!openmrcp_session) {
+	if (!openmrcp_session) {
 		return MRCP_STATUS_FAILURE;
 	}
 	switch_mutex_lock(openmrcp_session->flag_mutex);
@@ -245,7 +245,7 @@
 	
 	mrcp_message_t *mrcp_message = mrcp_client_context_message_get(context, asr_session->client_session, asr_session->control_channel, RECOGNIZER_RECOGNIZE);
 
-	if(!mrcp_message) {
+	if (!mrcp_message) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create mrcp msg\n");
 		return MRCP_STATUS_FAILURE;
 	}
@@ -264,7 +264,7 @@
 	buf1[bytes2read] = '\0';
 
 	generic_header = mrcp_generic_header_prepare(mrcp_message);
-	if(!generic_header) {
+	if (!generic_header) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not prepare generic_header\n");
 		return MRCP_STATUS_FAILURE;
 	}
@@ -336,11 +336,11 @@
 
 	switch_mutex_lock(asr_session->flag_mutex);
 	mrcp_client_context_channel_add(asr_session->profile->mrcp_context, asr_session->client_session, asr_channel, NULL);
-	if(switch_thread_cond_timedwait(asr_session->wait_object, asr_session->flag_mutex, 5000*1000) != APR_SUCCESS) {
+	if (switch_thread_cond_timedwait(asr_session->wait_object, asr_session->flag_mutex, 5000*1000) != APR_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No response from client stack\n");
 	}
 	switch_mutex_unlock(asr_session->flag_mutex);
-	if(!asr_session->control_channel) {
+	if (!asr_session->control_channel) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No recognizer channel available\n");
 		return SWITCH_STATUS_FALSE;
 	}
@@ -404,7 +404,7 @@
 		len -= (unsigned int)media_frame.codec_frame.size;
 		media_frame.codec_frame.buffer = (char*)media_frame.codec_frame.buffer + media_frame.codec_frame.size;
 	}
-	if(len > 0) {
+	if (len > 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "None frame alligned data len [%d]\n", len);
 	}
 	return SWITCH_STATUS_SUCCESS;
@@ -514,7 +514,7 @@
 			  </result>
 			*/
 
-			if(message->body) {
+			if (message->body) {
 				char *marker = "?>";  // FIXME -- lame and brittle way of doing this.  use regex or better.
 				char *position = strstr(message->body, marker);
 				if (!position) {
@@ -577,12 +577,12 @@
 	text2speak = switch_core_sprintf(tts_session->pool, "%s%s%s", xml_head, text, xml_tail);
 	mrcp_message = mrcp_client_context_message_get(context, tts_session->client_session, tts_session->control_channel, SYNTHESIZER_SPEAK);
 
-	if(!mrcp_message) {
+	if (!mrcp_message) {
 		goto end;
 	}
 
 	generic_header = mrcp_generic_header_prepare(mrcp_message);
-	if(!generic_header) {
+	if (!generic_header) {
 		goto end;
 	}
 
@@ -601,7 +601,7 @@
 static mrcp_status_t synth_stop(mrcp_client_context_t *context, openmrcp_session_t *tts_session)
 {
 	mrcp_message_t *mrcp_message = mrcp_client_context_message_get(context, tts_session->client_session, tts_session->control_channel, SYNTHESIZER_STOP);
-	if(!mrcp_message) {
+	if (!mrcp_message) {
 		return MRCP_STATUS_FAILURE;
 	}
 
@@ -642,11 +642,11 @@
 	}
 	switch_mutex_lock(tts_session->flag_mutex);
 	mrcp_client_context_channel_add(tts_session->profile->mrcp_context, tts_session->client_session, tts_channel, NULL);
-	if(switch_thread_cond_timedwait(tts_session->wait_object, tts_session->flag_mutex, 5000*1000) != APR_SUCCESS) {
+	if (switch_thread_cond_timedwait(tts_session->wait_object, tts_session->flag_mutex, 5000*1000) != APR_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No response from client stack\n");
 	}
 	switch_mutex_unlock(tts_session->flag_mutex);
-	if(!tts_session->control_channel) {
+	if (!tts_session->control_channel) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No synthesizer channel available\n");
 		return SWITCH_STATUS_FALSE;
 	}
@@ -673,7 +673,7 @@
 	openmrcp_session_t *tts_session = (openmrcp_session_t *) sh->private_info;
 	mrcp_client_context_t *context = tts_session->profile->mrcp_context;
 
-	if(!tts_session->control_channel) {
+	if (!tts_session->control_channel) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no synthesizer channel too feed tts\n");
 		return SWITCH_STATUS_FALSE;
 	}
@@ -719,13 +719,13 @@
 	}
 
 	audio_source = mrcp_client_audio_source_get(tts_session->audio_channel);
-	if(!audio_source) {
+	if (!audio_source) {
 		return SWITCH_STATUS_BREAK;
 	}
 
 	if (!switch_test_flag(tts_session, FLAG_FEED_STARTED)) {
 		switch_set_flag(tts_session, FLAG_FEED_STARTED);  // shouldn't this use set_flag_locked? -tl
-		if(audio_source->method_set->open) {
+		if (audio_source->method_set->open) {
 			audio_source->method_set->open(audio_source);
 		}
 	}
@@ -736,7 +736,7 @@
 	while(return_len < *datalen) {
 		media_frame.codec_frame.buffer = (char*)data + return_len;
 		audio_source->method_set->read_frame(audio_source, &media_frame);
-		if(media_frame.type != MEDIA_FRAME_TYPE_AUDIO) {
+		if (media_frame.type != MEDIA_FRAME_TYPE_AUDIO) {
 			memset(media_frame.codec_frame.buffer, 0, media_frame.codec_frame.size);
 		}
 		return_len += media_frame.codec_frame.size;
@@ -808,7 +808,7 @@
 			mrcp_profile->mrcp_client = NULL;
 			mrcp_profile->mrcp_context = NULL;
 			mrcp_profile->name = "noname";
-			if(profile_name) {
+			if (profile_name) {
 				mrcp_profile->name = switch_core_strdup(openmrcp_module.pool, profile_name);
 			}
 
@@ -838,7 +838,7 @@
 			
 			/* add profile */
 			if (!switch_core_hash_find(openmrcp_module.profile_hash, mrcp_profile->name)) {
-				if(openmrcp_profile_run(mrcp_profile) == SWITCH_STATUS_SUCCESS) {
+				if (openmrcp_profile_run(mrcp_profile) == SWITCH_STATUS_SUCCESS) {
 					switch_core_hash_insert(openmrcp_module.profile_hash, mrcp_profile->name, mrcp_profile);
 				}
 			}
@@ -880,7 +880,7 @@
 
 	// create client context, which must be passed to client engine 
 	mrcp_context = mrcp_client_context_create(&openmrcp_module, mrcp_event_handler);
-	if(!mrcp_context) {
+	if (!mrcp_context) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mrcp_client_context creation failed\n");
 		return SWITCH_STATUS_GENERR;
 	}
@@ -889,7 +889,7 @@
 	// this basically starts a thread that pulls events from the event queue
 	// and handles them 
 	mrcp_client = openmrcp_client_start(profile->mrcp_options, mrcp_context);
-	if(!mrcp_client) {
+	if (!mrcp_client) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "openmrcp_client_start FAILED\n");
 		mrcp_client_context_destroy(mrcp_context);
 		return SWITCH_STATUS_GENERR;

Modified: freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	Fri Feb 15 18:23:59 2008
@@ -809,7 +809,7 @@
 		teletone_dtmf_detect (&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples);
 		teletone_dtmf_get(&tech_pvt->dtmf_detect, digit_str, sizeof(digit_str));
 	
-		if(digit_str[0]) {
+		if (digit_str[0]) {
 			char *p = digit_str;
 			switch_dtmf_t dtmf = {0, globals.dtmf_on};
 			while(p && *p) {
@@ -1141,7 +1141,7 @@
 	if (is_raw) {
 		int chan, span;
 
-		if (sangoma_span_chan_fromif(bchan, &span, &chan)) {
+		if (sangoma_span_chan_fromif (bchan, &span, &chan)) {
 			if (!(tech_pvt->wpsock = wp_open(span, chan))) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n", span, chan, strerror(errno));
 				switch_core_session_destroy(new_session);
@@ -1744,7 +1744,7 @@
     res = poll(pfds, 1, timeout);
 
     if (res > 0) {
-	if(pfds[0].revents & POLLIN) {
+	if (pfds[0].revents & POLLIN) {
 		res = 1;
 	} else if ((pfds[0].revents & POLLERR)) {
 		res = -1;
@@ -2314,7 +2314,7 @@
 			continue;
 		}
 
-		if (!sangoma_span_chan_fromif(c_dev, &span, &chan)) {
+		if (!sangoma_span_chan_fromif (c_dev, &span, &chan)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid device name '%s'\n", c_dev);
 			continue;
 		}

Modified: freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	Fri Feb 15 18:23:59 2008
@@ -166,7 +166,7 @@
 
 	/* Add VSAs */
 
-	if(channel) {
+	if (channel) {
 		/*switch_call_cause_t	cause;*/
 		switch_caller_profile_t	*profile;
 
@@ -181,8 +181,8 @@
 		
 		profile = switch_channel_get_caller_profile(channel);
 
-		if(profile) {
-			if(profile->username) {
+		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);
@@ -190,7 +190,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			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) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
 							"failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
@@ -198,7 +198,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			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) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
 							"failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
@@ -206,7 +206,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			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) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
 							"failed adding Freeswitch-Dst: %s\n", profile->destination_number);
@@ -214,7 +214,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->dialplan) {
+			if (profile->dialplan) {
 				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);
@@ -222,7 +222,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->network_addr) {
+			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);
@@ -230,7 +230,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->rdnis) {
+			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);
@@ -238,7 +238,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->context) {
+			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);
@@ -246,7 +246,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->ani) {
+			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);
@@ -254,7 +254,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->aniii) {
+			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);
@@ -262,7 +262,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->source) {
+			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);
@@ -270,7 +270,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->caller_extension && profile->caller_extension->last_application->application_name) {
+			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) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
@@ -284,7 +284,7 @@
 		}
 	}
 
-	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");
 		retval = SWITCH_STATUS_SUCCESS;
 	} else {
@@ -347,7 +347,7 @@
 
 	/* Add VSAs */
 
-	if(channel) {
+	if (channel) {
 		switch_call_cause_t	cause;
 		switch_caller_profile_t	*profile;
 
@@ -360,7 +360,7 @@
 		
 		profile = switch_channel_get_caller_profile(channel);
 
-		if(profile) {
+		if (profile) {
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Calculating billable time\n");
 
@@ -370,23 +370,23 @@
 			calltransferdate = profile->times->transferred;
 			callenddate = profile->times->hungup;
 
-			if(switch_channel_test_flag(channel,CF_ANSWERED)) {
-				if(callstartdate && callanswerdate) {
-					if(callenddate)
+			if (switch_channel_test_flag(channel,CF_ANSWERED)) {
+				if (callstartdate && callanswerdate) {
+					if (callenddate)
 						billusec = callenddate - callanswerdate;
-					else if(calltransferdate)
+					else if (calltransferdate)
 						billusec = calltransferdate - callanswerdate;
 				}
 			}
-			else if(switch_channel_test_flag(channel,CF_TRANSFER)) {
-				if(callanswerdate && calltransferdate)
+			else if (switch_channel_test_flag(channel,CF_TRANSFER)) {
+				if (callanswerdate && calltransferdate)
 					billusec = calltransferdate - callanswerdate;
 			}
 			billsec = (billusec / 1000000);
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, 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) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
 							"failed adding User-Name: %s\n", profile->username);
@@ -394,7 +394,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			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) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
 							"failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
@@ -402,7 +402,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			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) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
 							"failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
@@ -410,7 +410,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			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) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
 							"failed adding Freeswitch-Dst: %s\n", profile->destination_number);
@@ -418,7 +418,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->dialplan) {
+			if (profile->dialplan) {
 				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);
@@ -426,7 +426,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->network_addr) {
+			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);
@@ -434,7 +434,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->rdnis) {
+			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);
@@ -442,7 +442,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->context) {
+			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);
@@ -450,7 +450,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->ani) {
+			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);
@@ -458,7 +458,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->aniii) {
+			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);
@@ -466,7 +466,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->source) {
+			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);
@@ -474,7 +474,7 @@
 					return SWITCH_STATUS_TERM;
 				}
 			} 
-			if(profile->caller_extension && profile->caller_extension->last_application->application_name) {
+			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) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
@@ -500,7 +500,7 @@
 		}
 	}
 
-	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");
 		retval = SWITCH_STATUS_SUCCESS;
 	} else {
@@ -558,7 +558,7 @@
 
 	switch_xml_free(xml);
 
-	if(num_servers < 1) {
+	if (num_servers < 1) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
 				"you must specify at least 1 radius server\n");
 		return SWITCH_STATUS_TERM;



More information about the Freeswitch-svn mailing list