]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
set conference flags from a dial plan variable or via +flags{ }
authorHristo Trendev <htrendev@gmail.com>
Wed, 24 Sep 2014 12:55:50 +0000 (14:55 +0200)
committerHristo Trendev <htrendev@gmail.com>
Tue, 30 Sep 2014 09:31:03 +0000 (11:31 +0200)
This patch allows conference flags to be set dynamically from the
dial plan by either passing them to the conference application in
the +flags{ } string or by setting the "conference_flags" dial plan
variable.

The +flags{ } string is currently used to set *user* flags only.
This patch changes this by allowing the +flags{ } string to contain
conference related flags as well (for example wait_mod). It shouldn't
be a problem to pass both types of flags via +flags{ } as long as
the user and conference flag names are kept unique.

FS-5099 #resolve

src/mod/applications/mod_conference/mod_conference.c

index c431f11286ca55b21346ff991fbf6d609811752b..9ac4dd18aef3049e783d0e37c7fe1a31d1c92943 100644 (file)
@@ -9066,6 +9066,7 @@ SWITCH_STANDARD_APP(conference_function)
        char *profile_name = NULL;
        switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
        const char *flags_str, *v_flags_str;
+       const char *cflags_str, *v_cflags_str;
        member_flag_t mflags = 0;
        switch_core_session_message_t msg = { 0 };
        uint8_t rl = 0, isbr = 0;
@@ -9129,6 +9130,16 @@ SWITCH_STANDARD_APP(conference_function)
                }
        }
 
+    cflags_str = flags_str;
+
+       if ((v_cflags_str = switch_channel_get_variable(channel, "conference_flags"))) {
+               if (zstr(cflags_str)) {
+                       cflags_str = v_cflags_str;
+               } else {
+                       cflags_str = switch_core_session_sprintf(session, "%s|%s", cflags_str, v_cflags_str);
+               }
+       }
+
        /* is this a bridging conference ? */
        if (!strncasecmp(mydata, bridge_prefix, strlen(bridge_prefix))) {
                isbr = 1;
@@ -9219,6 +9230,8 @@ SWITCH_STANDARD_APP(conference_function)
                        goto done;
                }
 
+               set_cflags(cflags_str, &conference->flags);
+
                if (locked) {
                        switch_mutex_unlock(globals.setup_mutex);
                        locked = 0;
@@ -9294,6 +9307,8 @@ SWITCH_STANDARD_APP(conference_function)
                                goto done;
                        }
 
+                       set_cflags(cflags_str, &conference->flags);
+
                        if (locked) {
                                switch_mutex_unlock(globals.setup_mutex);
                                locked = 0;