]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
move channel_create event to init state to allow more info to be gathered
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 24 Jun 2011 15:52:18 +0000 (10:52 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 24 Jun 2011 15:52:18 +0000 (10:52 -0500)
src/switch_channel.c
src/switch_core_state_machine.c

index 81c903cb4afc6935c38af245172b6bfbafbd042f..38f177234ec105823433f28d67a865b3ed8f1470 100644 (file)
@@ -2262,15 +2262,6 @@ SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel
                caller_profile->context = switch_core_session_strdup(channel->session, "default");
        }
 
-       if (!channel->caller_profile) {
-               switch_event_t *event;
-
-               if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_CREATE) == SWITCH_STATUS_SUCCESS) {
-                       switch_channel_event_set_data(channel, event);
-                       switch_event_fire(&event);
-               }
-       }
-
        if (!caller_profile->times) {
                caller_profile->times = (switch_channel_timetable_t *) switch_core_session_alloc(channel->session, sizeof(*caller_profile->times));
                caller_profile->times->profile_created = switch_micro_time_now();
index 3c8bd28c559608b56097369248d61ede014006d3..2e45dde559c5f4dc3b7226db3e12c24a7c059c61 100644 (file)
@@ -358,7 +358,16 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
 
                                break;
                        case CS_INIT:           /* Basic setup tasks */
-                               STATE_MACRO(init, "INIT");
+                               {
+                                       switch_event_t *event;
+
+                                       STATE_MACRO(init, "INIT");
+                                       
+                                       if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_CREATE) == SWITCH_STATUS_SUCCESS) {
+                                               switch_channel_event_set_data(session->channel, event);
+                                               switch_event_fire(&event);
+                                       }
+                               }
                                break;
                        case CS_ROUTING:        /* Look for a dialplan and find something to do */
                                STATE_MACRO(routing, "ROUTING");