]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
take pin from x header (MODAPP-333)
authorMichael Jerris <mike@jerris.com>
Wed, 11 Nov 2009 01:33:05 +0000 (01:33 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 11 Nov 2009 01:33:05 +0000 (01:33 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15415 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_conference/mod_conference.c

index ad1b85ac2f5cc18f436e4dbfe55c83303c487998..d84984eb05449c845d97191159ae09db87ac42d9 100644 (file)
@@ -42,6 +42,7 @@ SWITCH_MODULE_DEFINITION(mod_conference, mod_conference_load, mod_conference_shu
 
 static const char global_app_name[] = "conference";
 static char *global_cf_name = "conference.conf";
+static char *cf_pin_url_param_name ="X-ConfPin=";
 static char *api_syntax;
 static int EC = 0;
 
@@ -5194,10 +5195,27 @@ SWITCH_STANDARD_APP(conference_function)
                        int pin_retries = 3;    /* XXX - this should be configurable - i'm too lazy to do it right now... */
                        int pin_valid = 0;
                        switch_status_t status = SWITCH_STATUS_SUCCESS;
+                       char *supplied_pin_value;
 
                        /* Answer the channel */
                        switch_channel_answer(channel);
                        
+                       /* look for PIN in channel variable first.  If not present or invalid revert to prompting user */ 
+                       supplied_pin_value = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "supplied_pin"));
+                       if (!zstr(supplied_pin_value)){
+                               char *supplied_pin_value_start;
+                               int i = 0;
+                               if ((supplied_pin_value_start = (char *)switch_stristr(cf_pin_url_param_name, supplied_pin_value))){
+                                       /* pin supplied as a URL parameter, move pointer to start of actual pin value */
+                                       supplied_pin_value = supplied_pin_value_start + strlen(cf_pin_url_param_name);
+                               }
+                               while (*supplied_pin_value != 0 && *supplied_pin_value != ';'){
+                                       pin_buf[i++] = *supplied_pin_value++;
+                               }
+                               pin_valid = (strcmp(pin_buf, dpin) == 0);
+                               memset(pin_buf, 0, sizeof(pin_buf));
+                       }
+                       
                        if (!conference->pin_sound) {
                                conference->pin_sound = switch_core_strdup(conference->pool, "conference/conf-pin.wav");
                        }