[Freeswitch-branches] [commit] r3878 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference
Author: knhor Date: Sun Dec 31 15:02:01 2006 New Revision: 3878 Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c Log: oops.. don't keep the xml config registry locked! Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c ============================================================================== --- freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c (original) +++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c Sun Dec 31 15:02:01 2006 @@ -199,7 +199,6 @@ uint32_t count; int32_t energy_level; uint8_t min; - conf_xml_cfg_t xml_cfg; switch_hash_t *chat_permissions_map; } conference_obj_t; @@ -1679,31 +1678,6 @@ /* Start the input thread */ launch_conference_loop_input(member, switch_core_session_get_pool(member->session)); - /* caller control configuration chores */ - if (switch_ivr_digit_stream_parser_new(member->pool, &member->dtmf_parser) == SWITCH_STATUS_SUCCESS) { - switch_status_t status = SWITCH_STATUS_FALSE; - - /* if no controls, or default controls specified, install default */ - if (member->conference->caller_controls == NULL || *member->conference->caller_controls == '\0' || strcasecmp(member->conference->caller_controls, "default") == 0) { - status = caller_control_build_default(member); - } else if (strcasecmp(member->conference->caller_controls, "none") != 0) { - /* try to build caller control if the group has been specified and != "none" */ - switch_xml_t xml_controls = switch_xml_find_child(member->conference->xml_cfg.controls, "group", "name", member->conference->caller_controls); -#ifdef OPTION_IVR_MENU_SUPPORT - status = caller_control_build_custom(member, xml_controls, member->conference->xml_cfg.menus); -#else - status = caller_control_build_custom(member, xml_controls, NULL); -#endif - if (status != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to install caller controls group '%s'\n", member->conference->caller_controls); - } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "no caller controls intalled.\n"); - } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate caller control digit parser.\n"); - } - /* build a digit stream object */ if (member->dtmf_parser != NULL && switch_ivr_digit_stream_new(member->dtmf_parser, &member->digit_stream) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning Will Robinson, there is no digit parser stream object\n"); @@ -3174,10 +3148,6 @@ if (pool != NULL) { switch_core_destroy_memory_pool(&pool); } - /* Release the config registry handle */ - if (xml_cfg.cxml) { - switch_xml_free(xml_cfg.cxml); - } goto done; } @@ -3189,6 +3159,12 @@ /* Start the conference thread for this conference */ launch_conference_thread(new_conference); + + /* Release the config registry thread lock */ + if (xml_cfg.cxml) { + switch_xml_free(xml_cfg.cxml); + memset(&xml_cfg,0,sizeof(xml_cfg)); + } } /* move the member from the old conference to the new one */ @@ -3952,6 +3928,37 @@ msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE; switch_core_session_receive_message(session, &msg); + /* caller control configuration chores */ + if (switch_ivr_digit_stream_parser_new(member.pool, &member.dtmf_parser) == SWITCH_STATUS_SUCCESS) { + switch_status_t status = SWITCH_STATUS_FALSE; + + /* if no controls, or default controls specified, install default */ + if (member.conference->caller_controls == NULL || *member.conference->caller_controls == '\0' || strcasecmp(member.conference->caller_controls, "default") == 0) { + status = caller_control_build_default(&member); + } else if (strcasecmp(member.conference->caller_controls, "none") != 0) { + /* try to build caller control if the group has been specified and != "none" */ + switch_xml_t xml_controls = switch_xml_find_child(xml_cfg.controls, "group", "name", member.conference->caller_controls); +#ifdef OPTION_IVR_MENU_SUPPORT + status = caller_control_build_custom(&member, xml_controls, xml_cfg.menus); +#else + status = caller_control_build_custom(&member, xml_controls, NULL); +#endif + if (status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to install caller controls group '%s'\n", member.conference->caller_controls); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "no caller controls intalled.\n"); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate caller control digit parser.\n"); + } + + /* Release the config registry thread lock */ + if (xml_cfg.cxml) { + switch_xml_free(xml_cfg.cxml); + memset(&xml_cfg,0,sizeof(xml_cfg)); + } + /* Run the confernece loop */ conference_loop_output(&member); @@ -3976,11 +3983,6 @@ switch_buffer_destroy(&member.audio_buffer); switch_buffer_destroy(&member.mux_buffer); - /* Release the config registry handle */ - if (xml_cfg.cxml) { - switch_xml_free(xml_cfg.cxml); - } - if (freepool) { switch_core_destroy_memory_pool(&freepool); } @@ -4154,15 +4156,15 @@ /*.chat_interface */ &conference_chat_interface }; -switch_status_t chat_permissions_get(conference_obj_t *conference) +switch_status_t chat_permissions_get(conference_obj_t *conference, conf_xml_cfg_t *xml_cfg) { - switch_status_t status = SWITCH_STATUS_FALSE; int count = 0; assert(conference != NULL); + assert(xml_cfg != NULL); - if (conference->xml_cfg.chat_permissions != NULL && !switch_strlen_zero(conference->chat_permissions)) { - switch_xml_t profile = switch_xml_find_child(conference->xml_cfg.chat_permissions, "profile", "name", conference->chat_permissions); + if (xml_cfg->chat_permissions != NULL && !switch_strlen_zero(conference->chat_permissions)) { + switch_xml_t profile = switch_xml_find_child(xml_cfg->chat_permissions, "profile", "name", conference->chat_permissions); if (profile != NULL) { switch_xml_t xml_kvp; @@ -4183,14 +4185,11 @@ count ++; } } - if (count != 0) { - status = SWITCH_STATUS_SUCCESS; - } } } } - return status; + return (count != 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE); } /* create a new conferene with a specific profile */ @@ -4423,12 +4422,8 @@ conference->rate = rate; conference->interval = interval; - /* copy the xml config sections to the new conference */ - memcpy(&conference->xml_cfg,xml_cfg,sizeof(conf_xml_cfg_t)); - /* build the chat interface permissions map */ - chat_permissions_get(conference); - + chat_permissions_get(conference, xml_cfg); /* Activate the conference mutex for exclusivity */ switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool); @@ -4512,7 +4507,7 @@ } done: - /* Release the config registry handle */ + /* Release the config registry thread lock */ if (cxml) { switch_xml_free(cxml); cxml = NULL;
participants (1)
-
Freeswitch SVN