/* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * Copyright (C) 2005-2020, Anthony Minessale II * * Version: MPL 1.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is * Anthony Minessale II * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * Chris Rienzo * * * switch_core_session.c -- tests sessions * */ #include #include FST_CORE_BEGIN("./conf") { FST_SUITE_BEGIN(switch_core_session) { FST_SETUP_BEGIN() { } FST_SETUP_END() FST_TEARDOWN_BEGIN() { } FST_TEARDOWN_END() FST_SESSION_BEGIN(session_external_id) { switch_core_session_t *session; fst_check(switch_core_session_set_external_id(fst_session, switch_core_session_get_uuid(fst_session)) == SWITCH_STATUS_SUCCESS); fst_check_string_equals(switch_core_session_get_external_id(fst_session), switch_core_session_get_uuid(fst_session)); fst_check(switch_core_session_set_external_id(fst_session, "foo") == SWITCH_STATUS_SUCCESS); session = switch_core_session_locate("foo"); fst_requires(session); fst_check_string_equals(switch_core_session_get_uuid(session), switch_core_session_get_uuid(fst_session)); fst_check_string_equals(switch_core_session_get_external_id(session), "foo"); fst_check(switch_core_session_set_external_id(fst_session, "bar") == SWITCH_STATUS_SUCCESS); fst_check_string_equals(switch_core_session_get_external_id(session), "bar"); fst_requires(switch_core_session_locate("foo") == NULL); switch_core_session_rwunlock(session); session = switch_core_session_locate("bar"); fst_requires(session); switch_core_session_rwunlock(session); session = switch_core_session_locate(switch_core_session_get_uuid(fst_session)); fst_requires(session); switch_core_session_rwunlock(session); switch_channel_hangup(fst_channel, SWITCH_CAUSE_NORMAL_CLEARING); session = switch_core_session_locate("bar"); fst_check(session == NULL); } FST_SESSION_END() } FST_SUITE_END() } FST_CORE_END()