static apt_bool_t mrcp_client_on_termination_subtract(mrcp_client_session_t *session, const mpf_message_t *mpf_message)
{
	rtp_termination_slot_t *termination_slot;
	if(!session) {
		return FALSE;
	}
	apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Subtracted "APT_NAMESIDRES_FMT, 
		MRCP_SESSION_NAMESID(session),
		mpf_termination_name_get(mpf_message->termination));
	termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination);
	if(termination_slot) {
		/* rtp termination */
		if(termination_slot->waiting == FALSE) {
			return FALSE;
		}
		termination_slot->waiting = FALSE;
		if(mrcp_client_session_subrequest_remove(session) == TRUE) {
			mrcp_app_session_terminate_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS);
		}
	}
	else {
		/* channel termination */
		mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination);
		if(channel && channel->waiting_for_termination == TRUE) {
			channel->waiting_for_termination = FALSE;
			if(mrcp_client_session_subrequest_remove(session) == TRUE) {
				/* raise app response */
				mrcp_app_sig_response_raise(session,TRUE);
			}
		}
	}
	return TRUE;
}
static apt_bool_t mrcp_client_on_termination_subtract(mrcp_client_session_t *session, const mpf_message_t *mpf_message)
{
	rtp_termination_slot_t *termination_slot;
	if(!session) {
		return FALSE;
	}
	termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination);
	if(termination_slot) {
		/* rtp termination */
		if(termination_slot->waiting == FALSE) {
			return FALSE;
		}
		termination_slot->waiting = FALSE;
		if(mrcp_client_session_subrequest_remove(session) == TRUE) {
			mrcp_app_session_terminate_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS);
		}
	}
	else {
		/* channel termination */
		mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination);
		if(channel && channel->waiting_for_termination == TRUE) {
			channel->waiting_for_termination = FALSE;
			if(mrcp_client_session_subrequest_remove(session) == TRUE) {
				/* raise app response */
				mrcp_app_sig_response_raise(session,TRUE);
			}
		}
	}
	return TRUE;
}
static apt_bool_t mrcp_client_on_termination_add(mrcp_client_session_t *session, mpf_message_t *mpf_message)
{
	rtp_termination_slot_t *termination_slot;
	if(!session) {
		return FALSE;
	}
	termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination);
	if(termination_slot) {
		/* rtp termination */
		mpf_rtp_termination_descriptor_t *rtp_descriptor;
		if(termination_slot->waiting == FALSE) {
			return FALSE;
		}
		termination_slot->waiting = FALSE;
		rtp_descriptor = mpf_message->descriptor;
		if(rtp_descriptor->audio.local) {
			session->offer->ip = rtp_descriptor->audio.local->base.ip;
			rtp_descriptor->audio.local->base.id = mrcp_session_audio_media_add(session->offer,rtp_descriptor->audio.local);
			rtp_descriptor->audio.local->mid = session->offer->audio_media_arr->nelts;
		}
		if(session->offer_flag_count) {
			session->offer_flag_count--;
			if(!session->offer_flag_count) {
				/* send offer to server */
				mrcp_client_session_offer_send(session);
			}
		}
	}
	else {
		/* channel termination */
		mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination);
		if(channel && channel->waiting_for_termination == TRUE) {
			channel->waiting_for_termination = FALSE;
			if(session->offer_flag_count) {
				session->offer_flag_count--;
				if(!session->offer_flag_count) {
					/* send offer to server */
					mrcp_client_session_offer_send(session);
				}
			}
		}
	}
	return TRUE;
}
static apt_bool_t mrcp_client_on_termination_add(mrcp_client_session_t *session, const mpf_message_t *mpf_message)
{
	rtp_termination_slot_t *termination_slot;
	if(!session) {
		return FALSE;
	}
	apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Added "APT_NAMESIDRES_FMT, 
		MRCP_SESSION_NAMESID(session),
		mpf_termination_name_get(mpf_message->termination));
	termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination);
	if(termination_slot) {
		/* rtp termination */
		mpf_rtp_termination_descriptor_t *rtp_descriptor;
		if(termination_slot->waiting == FALSE) {
			return FALSE;
		}
		termination_slot->waiting = FALSE;
		rtp_descriptor = mpf_message->descriptor;
		if(rtp_descriptor->audio.local) {
			session->offer->ip = rtp_descriptor->audio.local->ip;
			session->offer->ext_ip = rtp_descriptor->audio.local->ext_ip;
			rtp_descriptor->audio.local->id = mrcp_session_audio_media_add(session->offer,rtp_descriptor->audio.local);
			rtp_descriptor->audio.local->mid = session->offer->audio_media_arr->nelts;
			termination_slot->id = session->offer->audio_media_arr->nelts - 1;
		}
		if(mrcp_client_session_subrequest_remove(session) == TRUE) {
			/* send offer to server */
			mrcp_client_session_offer_send(session);
		}
	}
	else {
		/* channel termination */
		mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination);
		if(channel && channel->waiting_for_termination == TRUE) {
			channel->waiting_for_termination = FALSE;
			if(mrcp_client_session_subrequest_remove(session) == TRUE) {
				/* send offer to server */
				mrcp_client_session_offer_send(session);
			}
		}
	}
	return TRUE;
}