http://jira.freeswitch.org/browse/MODAPP-112 Patch uploaded to jira and attached to this email as well. Please let me know if there is something incorrect in this work, or what not. Everything worked fine in my tests. I added a new type of variable to the channel named "conference-name". Now one can do something as follows: <param name="auto-record" value="/var/nfs_shar/usr/${conference-name}_${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/> or you can do <param name="auto-record" value="shout://user:pass@server.com <mailto:pass@server.com>/live.mp3" /> I followed Brian's lead on using the switch_channel_expand_variables call. Kind Regards, Chris *Chris Danielson* Software Consultant and Co-Founder Web: MaxPowerSoft, LLC <http://www.maxpowersoft.com/> Brian West wrote:
Dan and I had a chat about this issue. I had to think on it but I think Dan and I have agreed on a solution.
<param name="auto-record" value="/nfs/conference/$ {some_conference_variable}-${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
or
<param name="auto-record" value="shout://user:pass@shoutcasthost.org/$ {some_conference_variable}.mp3"/>
Does that sound sane to you?
/b
On Jul 7, 2008, at 4:42 PM, e schmidbauer wrote:
can the auto-record send the conference to an icecast stream using mod_shout?
Brian West sip:brian@freeswitch.org
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Index: mod_conference.c =================================================================== --- mod_conference.c (revision 8910) +++ mod_conference.c (working copy) @@ -27,8 +27,8 @@ * Neal Horman <neal at wanlink dot com> * Bret McDanel <trixter at 0xdecafbad dot com> * Dale Thatcher <freeswitch at dalethatcher dot com> + * Chris Danielson <chris at maxpowersoft dot com> * - * * mod_conference.c -- Software Conference Bridge * */ @@ -230,6 +230,7 @@ char *caller_id_number; char *sound_prefix; char *special_announce; + char *auto_record; uint32_t max_members; char *maxmember_sound; uint32_t anounce_count; @@ -866,6 +867,7 @@ switch_event_t *event; uint8_t *file_frame; uint8_t *async_file_frame; + switch_channel_t *channel; file_frame = switch_core_alloc(conference->pool, SWITCH_RECOMMENDED_BUFFER_SIZE); async_file_frame = switch_core_alloc(conference->pool, SWITCH_RECOMMENDED_BUFFER_SIZE); @@ -880,6 +882,19 @@ switch_mutex_lock(globals.hash_mutex); globals.threads++; switch_mutex_unlock(globals.hash_mutex); + + if (conference->auto_record) { + imember = conference->members; + if (imember) { + channel = switch_core_session_get_channel(imember->session); + char *rfile = switch_channel_expand_variables(channel, conference->auto_record); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Auto recording file: %s\n", rfile); + launch_conference_record_thread(conference, rfile); + switch_safe_free(rfile); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Auto Record Failed. No members in conference.\n"); + } + } while (globals.running && !switch_test_flag(conference, CFLAG_DESTRUCT)) { switch_size_t file_sample_len = samples; @@ -4252,12 +4267,14 @@ /* Create the conference object. */ conference = conference_new(conf_name, xml_cfg, NULL); - + if (!conference) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); goto done; } + switch_channel_set_variable(channel, "conference-name", conference->name); + /* Set the minimum number of members (once you go above it you cannot go below it) */ conference->min = 2; @@ -4287,6 +4304,8 @@ if (dpin) { conference->pin = switch_core_strdup(conference->pool, dpin); } + + switch_channel_set_variable(channel, "conference-name", conference->name); /* Set the minimum number of members (once you go above it you cannot go below it) */ conference->min = 1; @@ -4296,8 +4315,10 @@ /* Start the conference thread for this conference */ launch_conference_thread(conference); + } else { /* setup user variable */ + switch_channel_set_variable(channel, "conference-name", conference->name); } - + /* acquire a read lock on the thread so it can't leave without us */ if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n"); @@ -4380,7 +4401,7 @@ } } - + /* Release the config registry handle */ if (cxml) { switch_xml_free(cxml); @@ -4806,6 +4827,7 @@ switch_status_t status; int comfort_noise_level = 0; char *suppress_events = NULL; + char *auto_record = NULL; /* Validate the conference name */ if (switch_strlen_zero(name)) { @@ -4923,6 +4945,8 @@ } } else if (!strcasecmp(var, "suppress-events") && !switch_strlen_zero(val)) { suppress_events = val; + } else if (!strcasecmp(var, "auto-record") && !switch_strlen_zero(val)) { + auto_record = val; } } @@ -5078,6 +5102,10 @@ clear_eflags(suppress_events, &conference->eflags); } + if (!switch_strlen_zero(auto_record)) { + conference->auto_record = switch_core_strdup(conference->pool, auto_record); + } + /* caller control configuration chores */ if (switch_ivr_digit_stream_parser_new(conference->pool, &conference->dtmf_parser) == SWITCH_STATUS_SUCCESS) {