[Freeswitch-branches] [commit] r3883 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference

Freeswitch SVN knhor at freeswitch.org
Mon Jan 1 11:14:47 EST 2007


Author: knhor
Date: Mon Jan  1 11:14:46 2007
New Revision: 3883

Modified:
   freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c

Log:
require a profile name when transfering members to another conference.
fix conference presence for transfered members


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	Mon Jan  1 11:14:46 2007
@@ -3094,11 +3094,13 @@
 static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char**argv)
 {
     switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
+    char *profile_name = strchr(argv[0],'@');
 
     assert(conference != NULL);
     assert(stream != NULL);
 
-    if (argc >= 2 && !switch_strlen_zero(argv[0])) {
+    /* if we have a conference name with a profile name, and at least one member to transfer */
+    if (argc >= 2 && !switch_strlen_zero(argv[0]) && !switch_strlen_zero(profile_name)) {
         int x;
 
         for (x = 1; x<argc; x++) {
@@ -3120,7 +3122,6 @@
                 switch_memory_pool_t *pool = NULL;
 		conf_xml_cfg_t xml_cfg = {0};
                 char *conf_name;
-		char *profile_name;
 
                 /* Setup a memory pool to use. */
                 if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
@@ -3242,7 +3243,7 @@
     {"say",          (api_cmd_fn_t)&conf_api_sub_say,           CONF_API_SUB_ARGS_AS_ONE,      "<confname> say <text>"},
     {"saymember",    (api_cmd_fn_t)&conf_api_sub_saymember,     CONF_API_SUB_ARGS_AS_ONE,      "<confname> saymember <member_id> <text>"},
     {"stop",         (api_cmd_fn_t)&conf_api_sub_stop,          CONF_API_SUB_MEMBER_TARGET,    "<confname> stop <[current|all|last]> [<member_id>]"},
-    {"transfer",     (api_cmd_fn_t)&conf_api_sub_transfer,      CONF_API_SUB_ARGS_SPLIT,       "<confname> transfer <conference_name> <member id> [...<member id>]"},
+    {"transfer",     (api_cmd_fn_t)&conf_api_sub_transfer,      CONF_API_SUB_ARGS_SPLIT,       "<confname> transfer <conference_name at conference_profile_name> <member id> [...<member id>]"},
     {"undeaf",       (api_cmd_fn_t)&conf_api_sub_undeaf,        CONF_API_SUB_MEMBER_TARGET,    "<confname> undeaf <[member_id|all]|last>"},
     {"unlock",       (api_cmd_fn_t)&conf_api_sub_unlock,        CONF_API_SUB_ARGS_SPLIT,       "<confname> unlock"},
     {"unmute",       (api_cmd_fn_t)&conf_api_sub_unmute,        CONF_API_SUB_MEMBER_TARGET,    "<confname> unmute <[member_id|all]|last>"},
@@ -4123,7 +4124,23 @@
 			conf_api_dispatch(conference, &stream, argc, argv, (const char *)body);
 		    }
 #endif
-            }
+            } else if (perm != NULL) {
+		char *p = strdup(perm);
+
+		if (p != NULL) {
+			char *str = p;
+
+			while(*p) {
+				if(*p == '|') {
+					*p = '\n';
+				}
+				p++;
+			}
+			stream.write_function(&stream, "valid commands are;%s", str);
+
+			free(str);
+		}
+	    }
         } else {
             stream.write_function(&stream, "No parameters specified.\nTry 'help'\n");
         }
@@ -4180,6 +4197,8 @@
 					char *commands = (char *) switch_xml_attr(xml_kvp, "commands");
 
 					if (!switch_strlen_zero(name) && !switch_strlen_zero(commands)) {
+						// "commands" MUST be validated against the  conf_api_sub_commands[] table
+						// and any invalid commands MUST be removed before being inserted in the hash
 						switch_core_hash_insert(conference->chat_permissions_map, name, commands);
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "chat-permissions %s=%s\n",name,commands);
 						count ++;
@@ -4460,7 +4479,8 @@
         if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { 
             switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO); 
             switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", conference->name); 
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain); 
+//            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", conference->name, conference->domain); // i think this is wrong
+            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to);
             switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d caller%s)", conference->count, conference->count == 1 ? "" : "s"); 
             switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); 
             switch_event_fire(&event); 



More information about the Freeswitch-branches mailing list