From 34690e47ff48f5c52b13cfb7b2c0226f3c0dc92e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 20 Dec 2010 11:16:14 -0600 Subject: [PATCH 01/11] FS-2879 --- src/mod/applications/mod_fifo/mod_fifo.c | 44 +++++++++++++++--------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 9d9896956e..e9d7cfb0e6 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -1761,27 +1761,28 @@ static void *SWITCH_THREAD_FUNC node_thread_run(switch_thread_t *thread, void *o for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &var, NULL, &val); if ((node = (fifo_node_t *) val)) { + int x = 0; + switch_event_t *pop; if (node->ready == FIFO_DELAY_DESTROY) { - int doit = 0; - - switch_mutex_lock(node->update_mutex); - doit = node->consumer_count == 0 && node_caller_count(node) == 0; - switch_mutex_unlock(node->update_mutex); - - if (doit) { + if (switch_thread_rwlock_trywrlock(node->rwlock) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s removed.\n", node->name); switch_core_hash_delete(globals.fifo_hash, node->name); + + for (x = 0; x < MAX_PRI; x++) { + while (fifo_queue_pop(node->fifo_list[x], &pop, 2) == SWITCH_STATUS_SUCCESS) { + switch_event_destroy(&pop); + } + } node->ready = 0; - switch_mutex_lock(node->mutex); switch_core_hash_destroy(&node->consumer_hash); switch_mutex_unlock(node->mutex); switch_mutex_unlock(node->update_mutex); + switch_thread_rwlock_unlock(node->rwlock); switch_core_destroy_memory_pool(&node->pool); goto restart; } - } @@ -2172,7 +2173,7 @@ SWITCH_STANDARD_APP(fifo_function) char *mydata = NULL, *argv[5] = { 0 }; fifo_node_t *node = NULL, *node_list[MAX_NODES_PER_CONSUMER + 1] = { 0 }; switch_channel_t *channel = switch_core_session_get_channel(session); - int do_wait = 1, node_count = 0, i = 0; + int do_destroy = 0, do_wait = 1, node_count = 0, i = 0; const char *moh = NULL; const char *announce = NULL; switch_event_t *event = NULL; @@ -2247,13 +2248,10 @@ SWITCH_STANDARD_APP(fifo_function) if (!(node = switch_core_hash_find(globals.fifo_hash, nlist[i]))) { node = create_node(nlist[i], importance, globals.sql_mutex); node->ready = 1; - switch_thread_rwlock_rdlock(node->rwlock); } - node_list[node_count++] = node; - } - if (switch_true(switch_channel_get_variable(channel, "fifo_destroy_after_use")) && node->ready == 1) { - node->ready = FIFO_DELAY_DESTROY; + switch_thread_rwlock_rdlock(node->rwlock); + node_list[node_count++] = node; } switch_mutex_unlock(globals.mutex); @@ -3103,10 +3101,22 @@ SWITCH_STANDARD_APP(fifo_function) done: - if (node) { - switch_thread_rwlock_unlock(node->rwlock); + if (switch_true(switch_channel_get_variable(channel, "fifo_destroy_after_use"))) { + do_destroy = 1; } + switch_mutex_lock(globals.mutex); + for (i = 0; i < node_count; i++) { + if (!(node = node_list[i])) { + continue; + } + switch_thread_rwlock_unlock(node->rwlock); + if (node->ready == 1 && do_destroy) { + node->ready = FIFO_DELAY_DESTROY; + } + } + switch_mutex_unlock(globals.mutex); + switch_channel_clear_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_BRIDGE_TAG); switch_core_media_bug_resume(session); From a1a710482b8533d181bbf29eb67d2646036614ee Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 20 Dec 2010 12:15:41 -0600 Subject: [PATCH 02/11] freetdm windows build tweaks --- .../mod_freetdm/mod_freetdm.2010.vcxproj | 4 ++-- .../ftmod_sangoma_isdn.2008.vcproj | 10 +++++++--- .../ftmod_sangoma_isdn.2010.vcxproj | 18 +++++++++++++----- w32/Library/FreeSwitchCore.2010.vcxproj | 3 +-- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj b/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj index 9f01a3b1a1..ec69333410 100644 --- a/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj +++ b/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj @@ -103,7 +103,7 @@ ProgramDatabase - FreeSwitch.lib;%(AdditionalDependencies) + FreeSwitchCore.lib;%(AdditionalDependencies) ../../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories) true $(OutDir)$(TargetName).pdb @@ -127,7 +127,7 @@ ProgramDatabase - FreeSwitch.lib;%(AdditionalDependencies) + FreeSwitchCore.lib;%(AdditionalDependencies) ../../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories) true $(OutDir)$(TargetName).pdb diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj index e3930d8188..2e7fb82041 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj @@ -40,11 +40,12 @@ Disabled - C:\Program Files\libsng_isdn\include;C:\Program Files\libsng_isdn\include\sng_isdn;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories) + C:\Program Files\sangoma\sng_isdn\include;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true @@ -95,10 +95,11 @@ Level3 EditAndContinue + MultiThreadedDebugDLL freetdm.lib;libsng_isdn.lib;%(AdditionalDependencies) - $(OutDir);C:\Program Files\libsng_isdn\lib;C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories) + $(OutDir);C:\Program Files\sangoma\sng_isdn\lib;C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories) true Console false @@ -110,7 +111,7 @@ Disabled - C:\Program Files\libsng_isdn\include;C:\Program Files\libsng_isdn\include\sng_isdn;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories) + C:\Program Files\sangoma\sng_isdn\include;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) @@ -119,6 +120,7 @@ Level3 ProgramDatabase + MultiThreadedDebugDLL freetdm.lib;libsng_isdn.lib;%(AdditionalDependencies) @@ -135,11 +137,13 @@ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks - MultiThreadedDebugDLL + MultiThreadedDLL Level3 ProgramDatabase + C:\Program Files\sangoma\sng_isdn\include;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories) + Disabled true @@ -147,23 +151,27 @@ true true MachineX86 + freetdm.lib;libsng_isdn.lib;%(AdditionalDependencies) + $(OutDir);C:\Program Files\sangoma\sng_isdn\lib;C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) EnableFastChecks - MultiThreadedDebugDLL + MultiThreadedDLL Level3 ProgramDatabase + C:\Program Files\sangoma\sng_isdn\include;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories) true Windows true true + freetdm.lib;libsng_isdn.lib;%(AdditionalDependencies) diff --git a/w32/Library/FreeSwitchCore.2010.vcxproj b/w32/Library/FreeSwitchCore.2010.vcxproj index e218445a02..c74ad944b1 100644 --- a/w32/Library/FreeSwitchCore.2010.vcxproj +++ b/w32/Library/FreeSwitchCore.2010.vcxproj @@ -120,8 +120,7 @@ false - - + $(OutDir)FreeSwitchCore.lib MachineX86 From cfd6876c2127bd64b7c2ced80407b5b9f962549b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 20 Dec 2010 14:36:03 -0600 Subject: [PATCH 03/11] more presence and not the kind with bows and ribbons --- src/mod/endpoints/mod_sofia/sofia_presence.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index f0cade3e61..059018986c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -840,10 +840,11 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "where sip_subscriptions.expires > -1 and " "(event='%q' or event='%q') and sub_to_user='%q' " "and (sub_to_host='%q' or presence_hosts like '%%%q%%') " - "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host)", + "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host) " + "and (presence_id is null or presence_id = '%q@%q')", switch_str_nil(status), switch_str_nil(rpid), host, dh.status,dh.rpid, - event_type, alt_event_type, euser, host, host, profile->name))) { + event_type, alt_event_type, euser, host, host, profile->name, euser, host))) { struct presence_helper helper = { 0 }; From 82ad5278b3fac8adeebbb32bf155d024d423c43c Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 20 Dec 2010 14:55:18 -0600 Subject: [PATCH 04/11] tweak vs2010 freetdm wanpipe --- .../src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj index b165ac82d3..40d0a73a5b 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj @@ -100,7 +100,7 @@ EditAndContinue - freetdm.lib;libsangoma.lib;%(AdditionalDependencies) + libsangoma.lib;%(AdditionalDependencies) $(OutDir);C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories) true Console @@ -127,7 +127,7 @@ ProgramDatabase - freetdm.lib;libsangoma.lib;%(AdditionalDependencies) + libsangoma.lib;%(AdditionalDependencies) $(OutDir);C:\Program Files\Sangoma\api\lib\x64;%(AdditionalLibraryDirectories) true Console @@ -148,7 +148,7 @@ ProgramDatabase - freetdm.lib;libsangoma.lib;%(AdditionalDependencies) + libsangoma.lib;%(AdditionalDependencies) $(OutDir);C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories) true Console @@ -174,7 +174,7 @@ ProgramDatabase - freetdm.lib;libsangoma.lib;%(AdditionalDependencies) + libsangoma.lib;%(AdditionalDependencies) $(OutDir);C:\Program Files\Sangoma\api\lib\x64;%(AdditionalLibraryDirectories) true Console From a78922a21221b1c88ebfe0093c7a55bb4bfd6be7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 20 Dec 2010 15:05:07 -0600 Subject: [PATCH 05/11] nope --- src/mod/endpoints/mod_sofia/sofia_presence.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 059018986c..f0cade3e61 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -840,11 +840,10 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "where sip_subscriptions.expires > -1 and " "(event='%q' or event='%q') and sub_to_user='%q' " "and (sub_to_host='%q' or presence_hosts like '%%%q%%') " - "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host) " - "and (presence_id is null or presence_id = '%q@%q')", + "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host)", switch_str_nil(status), switch_str_nil(rpid), host, dh.status,dh.rpid, - event_type, alt_event_type, euser, host, host, profile->name, euser, host))) { + event_type, alt_event_type, euser, host, host, profile->name))) { struct presence_helper helper = { 0 }; From f804c75d99598cfce0d4e09c0fcef40bd8827f9d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 20 Dec 2010 15:43:54 -0600 Subject: [PATCH 06/11] presence was drafted by satan --- src/mod/endpoints/mod_sofia/sofia_presence.c | 31 +++++++++----------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index f0cade3e61..4b93492eae 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -55,6 +55,7 @@ static void sync_sla(sofia_profile_t *profile, const char *to_user, const char * struct dialog_helper { char status[512]; char rpid[512]; + char presence_id[1024]; }; struct resub_helper { @@ -479,9 +480,10 @@ static int sofia_presence_dialog_callback(void *pArg, int argc, char **argv, cha { struct dialog_helper *helper = (struct dialog_helper *) pArg; - if (argc == 2) { + if (argc == 3) { switch_set_string(helper->status, argv[0]); switch_set_string(helper->rpid, argv[1]); + switch_set_string(helper->presence_id, argv[2]); } return -1; @@ -638,7 +640,8 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) } if (probe_euser && probe_host && (profile = sofia_glue_find_profile(probe_host))) { - sql = switch_mprintf("select status,rpid from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", + sql = switch_mprintf("select status,rpid,presence_id from sip_dialogs " + "where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", probe_euser, probe_host, probe_euser, probe_host); sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_dialog_callback, &dh); @@ -656,16 +659,16 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "sip_dialogs.direction, " "sip_dialogs.sip_to_user, " "sip_dialogs.sip_to_host, " + "sip_presence.status," "sip_presence.rpid," "sip_dialogs.presence_id, " "sip_presence.open_closed," "'%q','%q' " + "from sip_registrations " - "from sip_registrations left join sip_dialogs on " + "left join sip_dialogs on " "sip_dialogs.presence_id = sip_registrations.sip_user || '@' || sip_registrations.sip_host " - - "or (sip_dialogs.sip_from_user = sip_registrations.sip_user " "and sip_dialogs.sip_from_host = sip_registrations.sip_host) " @@ -813,7 +816,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } - sql = switch_mprintf("select status,rpid from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", + sql = switch_mprintf("select status,rpid,presence_id from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", euser, host, euser, host); sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_dialog_callback, &dh); switch_safe_free(sql); @@ -824,25 +827,19 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent," "sip_subscriptions.accept,sip_subscriptions.profile_name" ",'%q','%q','%q',sip_presence.status,sip_presence.rpid,sip_presence.open_closed,'%q','%q'," - "sip_subscriptions.version, sip_dialogs.presence_id " + "sip_subscriptions.version, '%q' " "from sip_subscriptions " "left join sip_presence on " "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " "sip_subscriptions.profile_name=sip_presence.profile_name) " - "left join sip_dialogs on " - - "sip_dialogs.presence_id = sip_subscriptions.sub_to_user || '@' || sip_subscriptions.sub_to_host or " - - - "(sip_dialogs.sip_from_user = sip_subscriptions.sub_to_user " - "and sip_dialogs.sip_from_host = sip_subscriptions.sub_to_host) " "where sip_subscriptions.expires > -1 and " "(event='%q' or event='%q') and sub_to_user='%q' " "and (sub_to_host='%q' or presence_hosts like '%%%q%%') " - "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host)", - switch_str_nil(status), switch_str_nil(rpid), host, - dh.status,dh.rpid, + "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host) ", + + switch_str_nil(status), switch_str_nil(rpid), host, + dh.status,dh.rpid,dh.presence_id, event_type, alt_event_type, euser, host, host, profile->name))) { struct presence_helper helper = { 0 }; From d29d83d74323fda1d8c6c50627dab5504c8441b8 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 20 Dec 2010 19:23:13 -0600 Subject: [PATCH 07/11] ESL-53 Noevent/Noevents disparity --- libs/esl/fs_cli.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index 569e2cd169..1e3bf04ca1 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -656,7 +656,7 @@ static int process_command(esl_handle_t *handle, const char *cmd) "-----------------------------------------------\n" "/help \tHelp\n" "/exit, /quit, /bye, ... \tExit the program.\n" - "/event, /noevent, /nixevent\tEvent commands.\n" + "/event, /noevents, /nixevent\tEvent commands.\n" "/log, /nolog \tLog commands.\n" "/uuid \tFilter logs for a single call uuid\n" "/filter \tFilter commands.\n" @@ -692,7 +692,7 @@ static int process_command(esl_handle_t *handle, const char *cmd) } else if ( !strncasecmp(cmd, "event", 5) || - !strncasecmp(cmd, "noevent", 7) || + !strncasecmp(cmd, "noevents", 8) || !strncasecmp(cmd, "nixevent", 8) || !strncasecmp(cmd, "log", 3) || !strncasecmp(cmd, "nolog", 5) || From 1b1dea020675d588053f0051b5236dd60d115b08 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 20 Dec 2010 20:19:36 -0600 Subject: [PATCH 08/11] FS-2879 --- src/switch_ivr_bridge.c | 4 ---- src/switch_ivr_originate.c | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 2f2dcdbc95..aa5ddb9232 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1052,8 +1052,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t * switch_channel_set_variable(caller_channel, "signal_bridge", "true"); switch_channel_set_variable(peer_channel, "signal_bridge", "true"); - switch_channel_sort_cid(peer_channel, SWITCH_FALSE); - /* fire events that will change the data table from "show channels" */ if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(caller_channel, event); @@ -1119,8 +1117,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses switch_channel_set_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR); switch_channel_clear_flag(peer_channel, CF_BRIDGE_ORIGINATOR); - switch_channel_sort_cid(peer_channel, SWITCH_FALSE); - b_leg->session = peer_session; switch_copy_string(b_leg->b_uuid, switch_core_session_get_uuid(session), sizeof(b_leg->b_uuid)); b_leg->stream_id = stream_id; diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 87a47e65aa..51032dec60 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2410,6 +2410,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } + new_profile->callee_id_name = switch_core_strdup(new_profile->pool, "Outbound Call"); + new_profile->callee_id_number = switch_core_strdup(new_profile->pool, new_profile->destination_number); + originate_status[i].caller_profile = NULL; originate_status[i].peer_channel = NULL; originate_status[i].peer_session = NULL; From 4f9dd5e164b355d8b116a5f3cb0f0271c3366d10 Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Mon, 20 Dec 2010 23:57:45 -0500 Subject: [PATCH 09/11] mod_conference: Add XML output for conference run time, recording status and member mute-detect. Also add events for recording start and stop. This work was funded by Xpander Communications. --- .../mod_conference/mod_conference.c | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 53ce82b4cb..cf8ae96da0 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -191,7 +191,8 @@ typedef enum { EFLAG_TRANSFER = (1 << 23), EFLAG_BGDIAL_RESULT = (1 << 24), EFLAG_FLOOR_CHANGE = (1 << 25), - EFLAG_MUTE_DETECT = (1 << 26) + EFLAG_MUTE_DETECT = (1 << 26), + EFLAG_RECORD = (1 << 27) } event_type_t; typedef struct conference_file_node { @@ -270,6 +271,7 @@ typedef struct conference_obj { uint32_t not_talking_buf_len; int comfort_noise_level; int is_recording; + int record_count; int video_running; uint32_t eflags; uint32_t verbose_events; @@ -283,6 +285,7 @@ typedef struct conference_obj { uint32_t avg_score; uint32_t avg_itt; uint32_t avg_tally; + switch_time_t run_time; } conference_obj_t; /* Relationship with another member */ @@ -468,6 +471,7 @@ static switch_status_t conference_add_event_member_data(conference_member_t *mem switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Hear", "%s", switch_test_flag(member, MFLAG_CAN_HEAR) ? "true" : "false" ); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Speak", "%s", switch_test_flag(member, MFLAG_CAN_SPEAK) ? "true" : "false" ); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Talking", "%s", switch_test_flag(member, MFLAG_TALKING) ? "true" : "false" ); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Mute-Detect", "%s", switch_test_flag(member, MFLAG_MUTE_DETECT) ? "true" : "false" ); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-Type", "%s", switch_test_flag(member, MFLAG_MOD) ? "moderator" : "member"); @@ -563,6 +567,7 @@ static switch_status_t conference_record_stop(conference_obj_t *conference, char return count; } + /* Add a custom relationship to a member */ static conference_relationship_t *member_add_relationship(conference_member_t *member, uint32_t id) { @@ -1035,6 +1040,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v switch_mutex_unlock(globals.hash_mutex); conference->is_recording = 0; + conference->record_count = 0; while (globals.running && !switch_test_flag(conference, CFLAG_DESTRUCT)) { switch_size_t file_sample_len = samples; @@ -1099,6 +1105,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v /* Start recording if there's more than one participant. */ if (conference->auto_record && !conference->is_recording && conference->count > 1) { conference->is_recording = 1; + conference->record_count++; imember = conference->members; if (imember) { switch_channel_t *channel = switch_core_session_get_channel(imember->session); @@ -2623,6 +2630,7 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th switch_timer_t timer = { 0 }; uint32_t rlen; switch_size_t data_buf_len; + switch_event_t *event; data_buf_len = samples * sizeof(int16_t); @@ -2701,6 +2709,15 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th switch_core_file_set_string(&fh, SWITCH_AUDIO_COL_STR_ARTIST, "FreeSWITCH mod_conference Software Conference Module"); + if (test_eflag(conference, EFLAG_RECORD) && + switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "start-recording"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", rec->path); + switch_event_fire(&event); + } + + while (switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(conference, CFLAG_RUNNING) && conference->count) { switch_size_t len = 0; mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer); @@ -3759,6 +3776,13 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer switch_xml_set_attr_d(x_conference, "dynamic", "true"); } + if (conference->record_count > 0) { + switch_xml_set_attr_d(x_conference, "recording", "true"); + } + + switch_snprintf(i, sizeof(i), "%d", switch_epoch_time_now(NULL) - conference->run_time); + switch_xml_set_attr_d(x_conference, "run_time", ival); + if (conference->agc_level) { char tmp[30] = ""; switch_snprintf(tmp, sizeof(tmp), "%d", conference->agc_level); @@ -3825,6 +3849,9 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer x_tag = switch_xml_add_child_d(x_flags, "can_speak", count++); switch_xml_set_txt_d(x_tag, switch_test_flag(member, MFLAG_CAN_SPEAK) ? "true" : "false"); + x_tag = switch_xml_add_child_d(x_flags, "mute_detect", count++); + switch_xml_set_txt_d(x_tag, switch_test_flag(member, MFLAG_MUTE_DETECT) ? "true" : "false"); + x_tag = switch_xml_add_child_d(x_flags, "talking", count++); switch_xml_set_txt_d(x_tag, switch_test_flag(member, MFLAG_TALKING) ? "true" : "false"); @@ -4414,6 +4441,7 @@ static switch_status_t conf_api_sub_record(conference_obj_t *conference, switch_ return SWITCH_STATUS_GENERR; stream->write_function(stream, "Record file %s\n", argv[2]); + conference->record_count++; launch_conference_record_thread(conference, argv[2]); return SWITCH_STATUS_SUCCESS; } @@ -4421,6 +4449,7 @@ static switch_status_t conf_api_sub_record(conference_obj_t *conference, switch_ static switch_status_t conf_api_sub_norecord(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { int all; + switch_event_t *event; switch_assert(conference != NULL); switch_assert(stream != NULL); @@ -4432,6 +4461,20 @@ static switch_status_t conf_api_sub_norecord(conference_obj_t *conference, switc stream->write_function(stream, "Stop recording file %s\n", argv[2]); if (!conference_record_stop(conference, all ? NULL : argv[2]) && !all) { stream->write_function(stream, "non-existant recording '%s'\n", argv[2]); + } else { + if (all) { + conference->record_count = 0; + } else { + conference->record_count--; + } + if (test_eflag(conference, EFLAG_RECORD) && + switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "stop-recording"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", all ? "all" : argv[2]); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Other-Recordings", conference->record_count ? "true" : "false"); + switch_event_fire(&event); + } } return SWITCH_STATUS_SUCCESS; @@ -5138,6 +5181,8 @@ static void clear_eflags(char *events, uint32_t *f) *f &= ~EFLAG_BGDIAL_RESULT; } else if (!strcmp(event, "floor-change")) { *f &= ~EFLAG_FLOOR_CHANGE; + } else if (!strcmp(event, "record")) { + *f &= ~EFLAG_RECORD; } event = next; @@ -6121,6 +6166,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name); conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number); conference->caller_controls = switch_core_strdup(conference->pool, caller_controls); + conference->run_time = switch_epoch_time_now(NULL); if (!zstr(perpetual_sound)) { From 94bd1a7f26df0f59652364e33f9e9b46729b036a Mon Sep 17 00:00:00 2001 From: Michal Bielicki Date: Tue, 21 Dec 2010 15:52:22 +0000 Subject: [PATCH 10/11] added german ringtone --- conf/vars.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/vars.xml b/conf/vars.xml index fced2ef139..05561d778c 100644 --- a/conf/vars.xml +++ b/conf/vars.xml @@ -204,6 +204,7 @@ +