[Freeswitch-dev] [POST-1.0.2][RFC][PATCH 2/2] Per-session logging, convert mod_sofia.c

stkn at freeswitch.org stkn at freeswitch.org
Mon Dec 15 06:26:55 PST 2008


diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c
index 86f4d55..a3f1fc2 100644
--- a/src/mod/endpoints/mod_sofia/mod_sofia.c
+++ b/src/mod/endpoints/mod_sofia/mod_sofia.c
@@ -80,7 +80,7 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
 	tech_pvt->read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN;
 	switch_mutex_lock(tech_pvt->sofia_mutex);
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA INIT\n", switch_channel_get_name(channel));
+	switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA INIT\n", switch_channel_get_name(channel));
 	if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 		sofia_glue_tech_absorb_sdp(tech_pvt);
 	}
@@ -127,7 +127,7 @@ static switch_status_t sofia_on_routing(switch_core_session_t *session)
 		switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA ROUTING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA ROUTING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -142,7 +142,7 @@ static switch_status_t sofia_on_reset(switch_core_session_t *session)
 		switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA RESET\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA RESET\n", switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -157,7 +157,7 @@ static switch_status_t sofia_on_hibernate(switch_core_session_t *session)
 		switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA HIBERNATE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA HIBERNATE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -170,7 +170,7 @@ static switch_status_t sofia_on_execute(switch_core_session_t *session)
 	if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
 		switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 	}
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -250,7 +250,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
 	if (!switch_strlen_zero(ps_cause) && (!strncasecmp(ps_cause, "sip:", 4) || !strncasecmp(ps_cause, "sips:", 5))) {
 		int new_cause = atoi(sofia_glue_strip_proto(ps_cause));
 		if (new_cause) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Overriding SIP cause %d with %d from the other leg\n",
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Overriding SIP cause %d with %d from the other leg\n",
 							  switch_channel_get_name(channel), sip_cause, new_cause);
 			sip_cause = new_cause;
 		}
@@ -284,7 +284,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
 
 	sofia_glue_deactivate_rtp(tech_pvt);
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %s hanging up, cause: %s\n",
+	switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %s hanging up, cause: %s\n",
 					  switch_channel_get_name(channel), switch_channel_cause2str(cause));
 
 	if (tech_pvt->hash_key) {
@@ -341,14 +341,14 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
 			if (!tech_pvt->got_bye) {
 				switch_channel_set_variable(channel, "sip_hangup_disposition", "send_bye");
 			}
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
 			nua_bye(tech_pvt->nh, 
 					SIPTAG_REASON_STR(reason),
 					TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
 					TAG_END());
 		} else {
 			if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", switch_channel_get_name(channel));
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", switch_channel_get_name(channel));
 				if (!tech_pvt->got_bye) {
 					switch_channel_set_variable(channel, "sip_hangup_disposition", "send_cancel");
 				}
@@ -358,7 +358,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
 						   TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
 						   TAG_END());
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause);
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause);
 				if (!tech_pvt->got_bye) {
 					switch_channel_set_variable(channel, "sip_hangup_disposition", "send_refuse");
 				}
@@ -400,13 +400,13 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
 
 static switch_status_t sofia_on_exchange_media(switch_core_session_t *session)
 {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SOFIA LOOPBACK\n");
+	switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SOFIA LOOPBACK\n");
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t sofia_on_soft_execute(switch_core_session_t *session)
 {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SOFIA TRANSMIT\n");
+	switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SOFIA TRANSMIT\n");
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -447,7 +447,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
 				SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
 				SOATAG_REUSE_REJECTED(1),
 				SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "3PCC-PROXY, Sent a 200 OK, waiting for ACK\n");
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "3PCC-PROXY, Sent a 200 OK, waiting for ACK\n");
 			
 			/* Unlock the session signal to allow the ack to make it in */
 			// Maybe we should timeout?
@@ -460,14 +460,14 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
 			/*  Regain lock on sofia */
 			switch_mutex_lock(tech_pvt->sofia_mutex);
 			
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for ACK\n");
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for ACK\n");
 		}
 
 		if ((is_proxy && !b_sdp) || switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
 			switch_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
 
 			if (is_proxy) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disabling proxy mode due to call answer with no bridge\n");
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disabling proxy mode due to call answer with no bridge\n");
 				switch_channel_clear_flag(channel, CF_PROXY_MEDIA);
 				switch_channel_clear_flag(channel, CF_PROXY_MODE);
 			}
@@ -499,7 +499,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
 
 		if (tech_pvt->nh) {
 			if (tech_pvt->local_sdp_str) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Local SDP %s:\n%s\n", switch_channel_get_name(channel), tech_pvt->local_sdp_str);
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Local SDP %s:\n%s\n", switch_channel_get_name(channel), tech_pvt->local_sdp_str);
 			}
 		}
 	}
@@ -731,7 +731,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
 									int rtp_hold_timeout_sec = 0;
 									
 									tech_pvt->codec_ms = codec_ms;
-									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+									switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
 													  "Changing codec ptime to %d. I bet you have a linksys/sipura =D\n", tech_pvt->codec_ms);
 									switch_core_codec_destroy(&tech_pvt->read_codec);
 									switch_core_codec_destroy(&tech_pvt->write_codec);
@@ -937,7 +937,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 	switch (msg->message_id) {
 	case SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY:
 		if (tech_pvt->rtp_session && switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot pass 2833 on a transcoded call.\n");
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot pass 2833 on a transcoded call.\n");
 			switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
 		}
 		goto end;
@@ -1035,7 +1035,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 
 	case SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT:
 		{
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending media re-direct:\n%s\n", msg->string_arg);
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending media re-direct:\n%s\n", msg->string_arg);
 			tech_pvt->local_sdp_str = switch_core_session_strdup(session, msg->string_arg);
 			switch_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
 			sofia_glue_do_invite(session);
@@ -1111,11 +1111,11 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 	case SWITCH_MESSAGE_INDICATE_REDIRECT:
 		if (!switch_strlen_zero(msg->string_arg)) {
 			if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Redirecting to %s\n", msg->string_arg);
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Redirecting to %s\n", msg->string_arg);
 				nua_respond(tech_pvt->nh, SIP_302_MOVED_TEMPORARILY, SIPTAG_CONTACT_STR(msg->string_arg), TAG_END());
 				switch_set_flag_locked(tech_pvt, TFLAG_BYE);
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Too late for redirecting to %s, already answered\n", msg->string_arg);
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Too late for redirecting to %s, already answered\n", msg->string_arg);
 			}
 		}
 		break;
@@ -1178,7 +1178,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 				if (switch_strlen_zero(to_host)) {
 					to_host = switch_channel_get_variable(channel, "sip_to_host");
 				}
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Challenging call %s\n", to_uri);
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Challenging call %s\n", to_uri);
 				sofia_reg_auth_challenge(NULL, tech_pvt->profile, tech_pvt->nh, REG_INVITE, to_host, 0);
 				switch_channel_hangup(channel, SWITCH_CAUSE_USER_CHALLENGE);
 			} else if (code == 484 && msg->numeric_arg) {
@@ -1195,7 +1195,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 					}
 				}
 
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Overlap Dial with %d %s\n", code, reason);
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Overlap Dial with %d %s\n", code, reason);
 				nua_respond(tech_pvt->nh, code, su_strdup(tech_pvt->nh->nh_home, reason), TAG_IF(to_uri, SIPTAG_CONTACT_STR(to_uri)),
 							SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL),
 							TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END());
@@ -1210,7 +1210,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 				switch_core_session_receive_message(session, msg);
 				goto end_lock;
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason);
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason);
 
 				if (!switch_strlen_zero(((char *) msg->pointer_arg))) {
 					tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, (char *) msg->pointer_arg);
@@ -1250,7 +1250,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 			if (!switch_test_flag(tech_pvt, TFLAG_ANS) && !switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
 
 				switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from);
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from);
 
 				/* Transmit 183 Progress with SDP */
 				if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
@@ -1291,7 +1291,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 						switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 					}
 					if (tech_pvt->local_sdp_str) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ring SDP:\n%s\n", tech_pvt->local_sdp_str);
+						switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ring SDP:\n%s\n", tech_pvt->local_sdp_str);
 					}
 				}
 				switch_channel_mark_pre_answered(channel);
@@ -2284,7 +2284,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
 	}
 
 	if (!(tech_pvt = (struct private_object *) switch_core_session_alloc(nsession, sizeof(*tech_pvt)))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n");
+		switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n");
 		goto error;
 	}
 	switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(nsession));
@@ -2303,7 +2303,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
 		sofia_gateway_t *gateway_ptr = NULL;
 
 		if (!(gw = strchr(profile_name, '/'))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
 			cause = SWITCH_CAUSE_INVALID_NUMBER_FORMAT;
 			goto error;
 		}
@@ -2311,7 +2311,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
 		*gw++ = '\0';
 
 		if (!(dest = strchr(gw, '/'))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
 			cause = SWITCH_CAUSE_INVALID_NUMBER_FORMAT;
 			goto error;
 		}
@@ -2319,13 +2319,13 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
 		*dest++ = '\0';
 
 		if (!(gateway_ptr = sofia_reg_find_gateway(gw))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Gateway\n");
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Gateway\n");
 			cause = SWITCH_CAUSE_INVALID_NUMBER_FORMAT;
 			goto error;
 		}
 
 		if (gateway_ptr->status != SOFIA_GATEWAY_UP) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway is down!\n");
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway is down!\n");
 			cause = SWITCH_CAUSE_NETWORK_OUT_OF_ORDER;
 			sofia_reg_release_gateway(gateway_ptr);
 			gateway_ptr = NULL;
@@ -2357,7 +2357,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
 		}
 
 		if (tech_pvt->transport != gateway_ptr->register_transport) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
 							  "You are trying to use a different transport type for this gateway (overriding the register-transport), this is unsupported!\n");
 			cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 			goto error;
@@ -2386,7 +2386,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
 		if (gateway_ptr->vars) {
 			switch_event_header_t *hp;
 			for(hp = gateway_ptr->vars->headers; hp; hp = hp->next) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s setting variable [%s]=[%s]\n",
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s setting variable [%s]=[%s]\n",
 								  switch_channel_get_name(nchannel), hp->name, hp->value);
 				switch_channel_set_variable(nchannel, hp->name, hp->value);
 			}
@@ -2394,14 +2394,14 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
 
 	} else {
 		if (!(dest = strchr(profile_name, '/'))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
 			cause = SWITCH_CAUSE_INVALID_NUMBER_FORMAT;
 			goto error;
 		}
 		*dest++ = '\0';
 
 		if (!(profile = sofia_glue_find_profile(profile_name))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Profile\n");
+			switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Profile\n");
 			cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 			goto error;
 		}
@@ -2421,7 +2421,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
 				tech_pvt->dest = switch_core_session_strdup(nsession, buf);
 				tech_pvt->local_url = switch_core_session_sprintf(nsession, "%s@%s", dest, host);
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate registered user %s@%s\n", dest, host);
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate registered user %s@%s\n", dest, host);
 				cause = SWITCH_CAUSE_USER_NOT_REGISTERED;
 				goto error;
 			}
@@ -2433,7 +2433,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
 				tech_pvt->local_url = switch_core_session_sprintf(nsession, "%s@%s", dest, profile_name);
 				host = profile_name;
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate registered user %s@%s\n", dest, profile_name);
+				switch_core_session_log_printf(session, SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate registered user %s@%s\n", dest, profile_name);
 				cause = SWITCH_CAUSE_USER_NOT_REGISTERED;
 				goto error;
 			}



More information about the Freeswitch-dev mailing list