diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 8537ef87f9..ee2f7a4f0e 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2500,7 +2500,6 @@ SWITCH_STANDARD_API(originate_function) } caller_channel = switch_core_session_get_channel(caller_session); - switch_channel_clear_state_handler(caller_channel, NULL); if (*exten == '&' && *(exten + 1)) { switch_caller_extension_t *extension = NULL; diff --git a/src/switch_channel.c b/src/switch_channel.c index 5989edab97..ba5be9a0a2 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1747,7 +1747,7 @@ SWITCH_DECLARE(void) switch_channel_clear_state_handler(switch_channel_t *channe } } else { for (index = 0; index < i; index++) { - if (switch_test_flag(channel->state_handlers[index], SSH_FLAG_STICKY)) { + if (channel->state_handlers[index] && switch_test_flag(channel->state_handlers[index], SSH_FLAG_STICKY)) { new_handlers[channel->state_handler_index++] = channel->state_handlers[index]; } }