]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make error endpoint able to forked dial
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 12 Aug 2008 18:00:56 +0000 (18:00 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 12 Aug 2008 18:00:56 +0000 (18:00 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9282 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_dptools/mod_dptools.c
src/switch_ivr_originate.c

index 8204c58f8be68bf233d94d8240529fa5dc6798fa..bcff1bd04baab805cb1360c95fffe6eb317eb33d 100644 (file)
@@ -1882,6 +1882,31 @@ SWITCH_STANDARD_APP(audio_bridge_function)
        }
 }
 
+
+/* fake chan_error */
+switch_endpoint_interface_t *error_endpoint_interface;
+static switch_call_cause_t error_outgoing_channel(switch_core_session_t *session,
+                                                                                                switch_event_t *var_event,
+                                                                                                switch_caller_profile_t *outbound_profile,
+                                                                                                switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
+switch_io_routines_t error_io_routines = {
+       /*.outgoing_channel */ error_outgoing_channel
+};
+
+static switch_call_cause_t error_outgoing_channel(switch_core_session_t *session,
+                                                                                                switch_event_t *var_event,
+                                                                                                switch_caller_profile_t *outbound_profile,
+                                                                                                switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
+{
+       switch_call_cause_t cause = switch_channel_str2cause(outbound_profile->destination_number);
+       if (cause == SWITCH_CAUSE_NONE) {
+               cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+       }
+
+       return cause;
+}
+
+
 /* fake chan_user */
 switch_endpoint_interface_t *user_endpoint_interface;
 static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
@@ -2189,6 +2214,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
+       error_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
+       error_endpoint_interface->interface_name = "ERROR";
+       error_endpoint_interface->io_routines = &error_io_routines;
+
        user_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
        user_endpoint_interface->interface_name = "USER";
        user_endpoint_interface->io_routines = &user_io_routines;
index a78d46354ac5fc953903dd700cc2a49fb5150801..91a12b0308485f21c57a97e80563ae9689fedf48 100644 (file)
@@ -542,11 +542,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 
        *bleg = NULL;
 
-       if (!strncasecmp(bridgeto, "error/", 6)) {
-               *cause = switch_channel_str2cause(bridgeto + 6);
-               return SWITCH_STATUS_SUCCESS;
-       }
-
        switch_zmalloc(write_frame.data, SWITCH_RECOMMENDED_BUFFER_SIZE);
        write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;