]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add timelimit to record
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 28 Nov 2006 21:46:29 +0000 (21:46 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 28 Nov 2006 21:46:29 +0000 (21:46 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3475 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_ivr.h
src/mod/applications/mod_playback/mod_playback.c
src/mod/languages/mod_perl/switch_swig_wrap.c
src/mod/languages/mod_php/php_freeswitch.h
src/mod/languages/mod_php/switch_swig_wrap.c
src/mod/languages/mod_python/switch_swig_wrap.c
src/mod/languages/mod_ruby/switch_swig_wrap.c
src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
src/switch_ivr.c
src/switch_swig.c

index 996cddb12b83bb79f4f20432b530de42ffd97a6b..f8c3978e6bffd9342062a6ab4e1a2ed4e7ddc104 100644 (file)
@@ -200,15 +200,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
   \param dtmf_callback code to execute if any dtmf is dialed during the recording
   \param buf an object to maintain across calls
   \param buflen the size of buf
+  \param limit max limit to record for (0 for infinite)
   \return SWITCH_STATUS_SUCCESS if all is well
   \note passing a NULL dtmf_callback nad a not NULL buf indicates to copy any dtmf to buf and stop recording.
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *session,
-                                                                                                        switch_file_handle_t *fh,
-                                                                                                        char *file,
-                                                                                                        switch_input_callback_function_t dtmf_callback,
-                                                                                                        void *buf,
-                                                                                                        uint32_t buflen);
+                                                       switch_file_handle_t *fh,
+                                                       char *file,
+                                                       switch_input_callback_function_t dtmf_callback,
+                                                       void *buf,
+                                                       uint32_t buflen,
+                                                       uint32_t limit);
 
 /*!
  \brief Function to evaluate an expression against a string
index 81f717286c3eae6dbc54ac0dc6b8c09309593887..2504091b6fd51fe63670ef41f07507c0440f6bf9 100644 (file)
@@ -132,10 +132,20 @@ static void record_function(switch_core_session_t *session, char *data)
 {
        switch_channel_t *channel;
        switch_status_t status;
+    uint32_t limit = 0;
+    char *path;
+    char *p;
+
        channel = switch_core_session_get_channel(session);
     assert(channel != NULL);
 
-       status = switch_ivr_record_file(session, NULL, data, on_dtmf, NULL, 0);
+    path = switch_core_session_strdup(session, data);
+    if ((p = strchr(path, '+'))) {
+        *p++ = '\0';
+        limit = atoi(p);
+    }
+
+       status = switch_ivr_record_file(session, NULL, path, on_dtmf, NULL, 0, limit);
 
        if (!switch_channel_ready(channel) || (status != SWITCH_STATUS_SUCCESS && !SWITCH_STATUS_IS_BREAK(status))) {
                switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
index feae7905219c180dc07891dbc09b66080f600e55..537ac9a03ff12145dbecf51454e7125c7cdc920d 100644 (file)
@@ -43,7 +43,6 @@
  ************************************************************************/
 
 #include <string.h>
-#include <switch.h>
 
 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
 #  if defined(_MSC_VER) || defined(__GNUC__)
@@ -808,7 +807,7 @@ extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
 extern void fs_channel_get_variable(switch_core_session_t *,char *);
 extern void fs_channel_set_state(switch_core_session_t *,char *);
 extern int fs_ivr_play_file(switch_core_session_t *,char *,char *,switch_input_callback_function_t,void *,unsigned int);
-extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int);
+extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
 extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
 extern int fs_ivr_play_file2(switch_core_session_t *,char *);
 extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
@@ -1263,12 +1262,13 @@ XS(_wrap_fs_switch_ivr_record_file) {
         switch_input_callback_function_t arg4 ;
         void *arg5 = (void *) 0 ;
         unsigned int arg6 ;
+        unsigned int arg7 ;
         int result;
         int argvi = 0;
         dXSARGS;
         
-        if ((items < 6) || (items > 6)) {
-            SWIG_croak("Usage: fs_switch_ivr_record_file(session,fh,file,dtmf_callback,buf,buflen);");
+        if ((items < 7) || (items > 7)) {
+            SWIG_croak("Usage: fs_switch_ivr_record_file(session,fh,file,dtmf_callback,buf,buflen,limit);");
         }
         {
             if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
@@ -1295,7 +1295,8 @@ XS(_wrap_fs_switch_ivr_record_file) {
             }
         }
         arg6 = (unsigned int) SvUV(ST(5));
-        result = (int)fs_switch_ivr_record_file(arg1,arg2,arg3,arg4,arg5,arg6);
+        arg7 = (unsigned int) SvUV(ST(6));
+        result = (int)fs_switch_ivr_record_file(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
         
         ST(argvi) = sv_newmortal();
         sv_setiv(ST(argvi++), (IV) result);
index ab5bc2bba2f4ffc6b414fe8c6c2781bf3bb400cb..be44bcc885b5af69c4f4143d0d247f49273d264e 100644 (file)
@@ -93,14 +93,3 @@ ZEND_END_MODULE_GLOBALS(freeswitch)
 #endif
 
 #endif /* PHP_FREESWITCH_H */
-
-/* For Emacs:
- * Local Variables:
- * mode:c
- * indent-tabs-mode:nil
- * tab-width:4
- * c-basic-offset:4
- * End:
- * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
- */
index 88341ded975754d231f29e579f29261c361020d3..4f058adb5609dbfe40257ba52215cc244e392038 100644 (file)
@@ -577,7 +577,7 @@ extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
 extern void fs_channel_get_variable(switch_core_session_t *,char *);
 extern void fs_channel_set_state(switch_core_session_t *,char *);
 extern int fs_ivr_play_file(switch_core_session_t *,char *,char *,switch_input_callback_function_t,void *,unsigned int);
-extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int);
+extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
 extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
 extern int fs_ivr_play_file2(switch_core_session_t *,char *);
 extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
@@ -1143,15 +1143,16 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_record_file) {
     switch_input_callback_function_t arg4 ;
     void *arg5 = (void *) 0 ;
     unsigned int arg6 ;
+    unsigned int arg7 ;
     int result;
-    zval **args[7];
+    zval **args[8];
     int argbase=0 ;
     
     if (this_ptr && this_ptr->type==IS_OBJECT) {
         /* fake this_ptr as first arg (till we can work out how to do it better */
         argbase++;
     }
-    if(((ZEND_NUM_ARGS() + argbase )!= 6) || (zend_get_parameters_array_ex(6-argbase, args)!= SUCCESS)) {
+    if(((ZEND_NUM_ARGS() + argbase )!= 7) || (zend_get_parameters_array_ex(7-argbase, args)!= SUCCESS)) {
         WRONG_PARAM_COUNT;
     }
     
@@ -1187,7 +1188,11 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_record_file) {
     convert_to_long_ex(args[5-argbase]);
     arg6 = (unsigned int) Z_LVAL_PP(args[5-argbase]);
     
-    result = (int)fs_switch_ivr_record_file(arg1,arg2,arg3,arg4,arg5,arg6);
+    
+    convert_to_long_ex(args[6-argbase]);
+    arg7 = (unsigned int) Z_LVAL_PP(args[6-argbase]);
+    
+    result = (int)fs_switch_ivr_record_file(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
     
     
     ZVAL_LONG(return_value,result);
index 0296d4abf12b1a6a5592253dd13637b88172e1de..3d07ca87fecbb225165cc2be92c04720769dd104 100644 (file)
@@ -716,7 +716,7 @@ extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
 extern void fs_channel_get_variable(switch_core_session_t *,char *);
 extern void fs_channel_set_state(switch_core_session_t *,char *);
 extern int fs_ivr_play_file(switch_core_session_t *,char *,char *,switch_input_callback_function_t,void *,unsigned int);
-extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int);
+extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
 extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
 extern int fs_ivr_play_file2(switch_core_session_t *,char *);
 extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
@@ -1000,6 +1000,7 @@ static PyObject *_wrap_fs_switch_ivr_record_file(PyObject *self, PyObject *args)
     switch_input_callback_function_t arg4 ;
     void *arg5 = (void *) 0 ;
     unsigned int arg6 ;
+    unsigned int arg7 ;
     int result;
     switch_input_callback_function_t *argp4 ;
     PyObject * obj0 = 0 ;
@@ -1007,8 +1008,9 @@ static PyObject *_wrap_fs_switch_ivr_record_file(PyObject *self, PyObject *args)
     PyObject * obj3 = 0 ;
     PyObject * obj4 = 0 ;
     PyObject * obj5 = 0 ;
+    PyObject * obj6 = 0 ;
     
-    if(!PyArg_ParseTuple(args,(char *)"OOsOOO:fs_switch_ivr_record_file",&obj0,&obj1,&arg3,&obj3,&obj4,&obj5)) goto fail;
+    if(!PyArg_ParseTuple(args,(char *)"OOsOOOO:fs_switch_ivr_record_file",&obj0,&obj1,&arg3,&obj3,&obj4,&obj5,&obj6)) goto fail;
     if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_switch_file_handle_t,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     if ((SWIG_ConvertPtr(obj3,(void **) &argp4, SWIGTYPE_p_switch_input_callback_function_t,SWIG_POINTER_EXCEPTION) == -1)) SWIG_fail;
@@ -1016,7 +1018,9 @@ static PyObject *_wrap_fs_switch_ivr_record_file(PyObject *self, PyObject *args)
     if ((SWIG_ConvertPtr(obj4,(void **) &arg5, 0, SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
     arg6 = (unsigned int) PyInt_AsLong(obj5);
     if (PyErr_Occurred()) SWIG_fail;
-    result = (int)fs_switch_ivr_record_file(arg1,arg2,arg3,arg4,arg5,arg6);
+    arg7 = (unsigned int) PyInt_AsLong(obj6);
+    if (PyErr_Occurred()) SWIG_fail;
+    result = (int)fs_switch_ivr_record_file(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
     
     resultobj = PyInt_FromLong((long)result);
     return resultobj;
index f20166182a441f1a672f092810d7e53732e09997..74f9c89ddddc251092465da62600fd84cf17c898 100644 (file)
@@ -628,7 +628,7 @@ extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
 extern void fs_channel_get_variable(switch_core_session_t *,char *);
 extern void fs_channel_set_state(switch_core_session_t *,char *);
 extern int fs_ivr_play_file(switch_core_session_t *,char *,char *,switch_input_callback_function_t,void *,unsigned int);
-extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int);
+extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
 extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
 extern int fs_ivr_play_file2(switch_core_session_t *,char *);
 extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
@@ -893,11 +893,12 @@ _wrap_fs_switch_ivr_record_file(int argc, VALUE *argv, VALUE self) {
     switch_input_callback_function_t arg4 ;
     void *arg5 = (void *) 0 ;
     unsigned int arg6 ;
+    unsigned int arg7 ;
     int result;
     VALUE vresult = Qnil;
     
-    if ((argc < 6) || (argc > 6))
-    rb_raise(rb_eArgError, "wrong # of arguments(%d for 6)",argc);
+    if ((argc < 7) || (argc > 7))
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 7)",argc);
     SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 1);
     SWIG_ConvertPtr(argv[1], (void **) &arg2, SWIGTYPE_p_switch_file_handle_t, 1);
     arg3 = StringValuePtr(argv[2]);
@@ -908,7 +909,8 @@ _wrap_fs_switch_ivr_record_file(int argc, VALUE *argv, VALUE self) {
     }
     SWIG_ConvertPtr(argv[4], (void **) &arg5, 0, 1);
     arg6 = NUM2UINT(argv[5]);
-    result = (int)fs_switch_ivr_record_file(arg1,arg2,arg3,arg4,arg5,arg6);
+    arg7 = NUM2UINT(argv[6]);
+    result = (int)fs_switch_ivr_record_file(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
     
     vresult = INT2NUM(result);
     return vresult;
index c0b61aef04777a252f7a11cfd857b5aec4949784..f30a91ab600fd5f4108dc9859cc2a16ade44047f 100644 (file)
@@ -831,6 +831,7 @@ static JSBool session_recordfile(JSContext *cx, JSObject *obj, uintN argc, jsval
        struct input_callback_state cb_state = {0};
        switch_file_handle_t fh;
        JSFunction *function;
+    int32 limit = 0;
 
        channel = switch_core_session_get_channel(jss->session);
        assert(channel != NULL);
@@ -857,12 +858,16 @@ static JSBool session_recordfile(JSContext *cx, JSObject *obj, uintN argc, jsval
                        bp = &cb_state;
                        len = sizeof(cb_state);
                }
+
+        if (argc > 3) {
+            JS_ValueToInt32(cx, argv[4], &limit);
+        }
        }
 
        memset(&fh, 0, sizeof(fh));
        cb_state.extra = &fh;
        cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE );
-       switch_ivr_record_file(jss->session, &fh, file_name, dtmf_func, bp, len);
+       switch_ivr_record_file(jss->session, &fh, file_name, dtmf_func, bp, len, limit);
        *rval = cb_state.ret;
 
        return (switch_channel_ready(channel)) ? JS_TRUE : JS_FALSE;
index 531ed2727aafe9b48bdca0f3e2fb5187152da4e4..08065956d9d7a73eec8605fe4182c82410f88fde 100644 (file)
@@ -325,11 +325,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
 
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *session, 
-                                                                                                        switch_file_handle_t *fh,
-                                                                                                        char *file,
-                                                                                                        switch_input_callback_function_t input_callback,
-                                                                                                        void *buf,
-                                                                                                        uint32_t buflen)
+                                                       switch_file_handle_t *fh,
+                                                       char *file,
+                                                       switch_input_callback_function_t input_callback,
+                                                       void *buf,
+                                                       uint32_t buflen,
+                                                       uint32_t limit)
 {
        switch_channel_t *channel;
     char dtmf[128];
@@ -340,6 +341,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        char *p;
        const char *vval;
+    time_t start = 0;
 
        if (!fh) {
                fh = &lfh;
@@ -422,17 +424,23 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                return SWITCH_STATUS_GENERR;
        }
        
+    if (limit) {
+        start = time(NULL);
+    }
 
        while(switch_channel_ready(channel)) {
                switch_size_t len;
                switch_event_t *event;
 
-
-               if (switch_core_session_dequeue_private_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+        if (switch_core_session_dequeue_private_event(session, &event) == SWITCH_STATUS_SUCCESS) {
                        switch_ivr_parse_event(session, event);
                        switch_event_destroy(&event);
                }
 
+        if (start && (time(NULL) - start) > limit) {
+            break;
+        }
+
                if (input_callback || buf || buflen) {
                        /*
                          dtmf handler function you can hook up to be executed when a digit is dialed during playback 
index 5a768eb83c78bc15a1aeb8b4d4b8561cb3e1bc50..e9c915abaee84d4c117eaf083fc231de7914542e 100644 (file)
@@ -88,17 +88,17 @@ int fs_console_loop(void)
 
 void fs_consol_log(char *level_str, char *msg)
 {
-        switch_log_level_t level = SWITCH_LOG_DEBUG;
-        if (level_str) {
-                level = switch_log_str2level(level_str);
+    switch_log_level_t level = SWITCH_LOG_DEBUG;
+    if (level_str) {
+        level = switch_log_str2level(level_str);
        }
       
-        switch_log_printf(SWITCH_CHANNEL_LOG, level, msg);
+    switch_log_printf(SWITCH_CHANNEL_LOG, level, msg);
 }
        
 void fs_consol_clean(char *msg)
 {
-        switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, msg);
+    switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, msg);
 }
 
 switch_core_session_t *fs_core_session_locate(char *uuid)
@@ -154,7 +154,7 @@ void fs_channel_set_state(switch_core_session_t *session, char *state)
 
 
 /*
-IVR Routines!  You can do IVR in PHP NOW!
+  IVR Routines!  You can do IVR in PHP NOW!
 */
 
 int fs_ivr_play_file(switch_core_session_t *session,
@@ -174,20 +174,22 @@ int fs_ivr_play_file(switch_core_session_t *session,
 }
 
 int fs_switch_ivr_record_file(switch_core_session_t *session,
-                                               switch_file_handle_t *fh,
-                                               char *file,
-                                               switch_input_callback_function_t dtmf_callback,
-                                               void *buf,
-                                               unsigned int buflen)
+                              switch_file_handle_t *fh,
+                              char *file,
+                              switch_input_callback_function_t dtmf_callback,
+                              void *buf,
+                              unsigned int buflen,
+                              unsigned int limit
+                              )
 {  
        switch_status_t status;
        
-        status = switch_ivr_record_file(session, fh, file, dtmf_callback, buf, buflen);
-        return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
+    status = switch_ivr_record_file(session, fh, file, dtmf_callback, buf, buflen, limit);
+    return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
 
 int fs_switch_ivr_sleep(switch_core_session_t *session,
-                                       uint32_t ms)
+                        uint32_t ms)
 {
        switch_status_t status;
        status = switch_ivr_sleep(session, ms);
@@ -211,98 +213,98 @@ int fs_switch_ivr_collect_digits_callback (switch_core_session_t *session,
                                                                                   unsigned int buflen,
                                                                                   unsigned int timeout)
 {
-        switch_status_t status;
+    switch_status_t status;
 
-        status = switch_ivr_collect_digits_callback(session, dtmf_callback, buf, buflen, timeout);
-        return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
+    status = switch_ivr_collect_digits_callback(session, dtmf_callback, buf, buflen, timeout);
+    return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
 
 int fs_switch_ivr_collect_digits_count         (switch_core_session_t *session,
-                                       char *buf,
-                                       unsigned int buflen,
-                                       unsigned int maxdigits,
-                                       const char *terminators,
-                                       char *terminator,
-                                       unsigned int timeout)  
+                                             char *buf,
+                                             unsigned int buflen,
+                                             unsigned int maxdigits,
+                                             const char *terminators,
+                                             char *terminator,
+                                             unsigned int timeout)  
 {
-        switch_status_t status;
+    switch_status_t status;
 
-        status = switch_ivr_collect_digits_count(session, buf, buflen, maxdigits, terminators, terminator, timeout);
-        return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
+    status = switch_ivr_collect_digits_count(session, buf, buflen, maxdigits, terminators, terminator, timeout);
+    return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
 
 /*int fs_switch_ivr_multi_threaded_bridge   (switch_core_session_t *session,
-                                       switch_core_session_t *peer_session,
-                                       switch_input_callback_function_t dtmf_callback,
-                                       void *session_data,
-                                       void *peer_session_data)  
-{
-        switch_status_t status;
-
-        status = switch_ivr_multi_threaded_bridge(session, peer_session, dtmf_callback, session_data, peer_session_data);
-        return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
-}
+  switch_core_session_t *peer_session,
+  switch_input_callback_function_t dtmf_callback,
+  void *session_data,
+  void *peer_session_data)  
+  {
+  switch_status_t status;
+
+  status = switch_ivr_multi_threaded_bridge(session, peer_session, dtmf_callback, session_data, peer_session_data);
+  return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
+  }
 */
 
 int fs_switch_ivr_originate       (switch_core_session_t *session,
-                               switch_core_session_t **bleg,
-                               char *          bridgeto,
-                               uint32_t        timelimit_sec)
-                               /*const switch_state_handler_table_t *table,
-                               char *          cid_name_override,
-                               char *          cid_num_override,
-                               switch_caller_profile_t *caller_profile_override)  */
+                                   switch_core_session_t **bleg,
+                                   char *      bridgeto,
+                                   uint32_t    timelimit_sec)
+/*const switch_state_handler_table_t *table,
+  char *       cid_name_override,
+  char *       cid_num_override,
+  switch_caller_profile_t *caller_profile_override)  */
 {
 
-        switch_channel_t *caller_channel;
-        switch_core_session_t *peer_session;
-        unsigned int timelimit = 60;
-        char *var;
-               switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
+    switch_channel_t *caller_channel;
+    switch_core_session_t *peer_session;
+    unsigned int timelimit = 60;
+    char *var;
+    switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
 
-        caller_channel = switch_core_session_get_channel(session);
-        assert(caller_channel != NULL);
+    caller_channel = switch_core_session_get_channel(session);
+    assert(caller_channel != NULL);
 
-        if ((var = switch_channel_get_variable(caller_channel, "call_timeout"))) {
-                timelimit = atoi(var);
-        }
+    if ((var = switch_channel_get_variable(caller_channel, "call_timeout"))) {
+        timelimit = atoi(var);
+    }
         
-        if (switch_ivr_originate(session, &peer_session, &cause, bridgeto, timelimit, NULL, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel!\n");
-                switch_channel_hangup(caller_channel, SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL);
-                return;
-        } else {
-                switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL);
-        }
+    if (switch_ivr_originate(session, &peer_session, &cause, bridgeto, timelimit, NULL, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel!\n");
+        switch_channel_hangup(caller_channel, SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL);
+        return;
+    } else {
+        switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL);
+    }
 
 
 }
 
 int fs_switch_ivr_session_transfer(switch_core_session_t *session,
-                               char *extension,
-                               char *dialplan,
-                               char *context)  
+                                   char *extension,
+                                   char *dialplan,
+                                   char *context)  
 {
-        switch_status_t status;
+    switch_status_t status;
 
-        status = switch_ivr_session_transfer(session,extension,dialplan,context);
-        return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
+    status = switch_ivr_session_transfer(session,extension,dialplan,context);
+    return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
 
 int fs_switch_ivr_speak_text      (switch_core_session_t *session,
-                               char *tts_name,
-                               char *voice_name,
-                               char *timer_name,
-                               uint32_t        rate,
-                               switch_input_callback_function_t dtmf_callback,
-                               char *text,
-                               void *buf,
-                               unsigned int buflen)  
+                                   char *tts_name,
+                                   char *voice_name,
+                                   char *timer_name,
+                                   uint32_t    rate,
+                                   switch_input_callback_function_t dtmf_callback,
+                                   char *text,
+                                   void *buf,
+                                   unsigned int buflen)  
 {
-        switch_status_t status;
+    switch_status_t status;
 
-        status = switch_ivr_speak_text(session,tts_name,voice_name,timer_name,rate,dtmf_callback,text,buf,buflen);
-        return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
+    status = switch_ivr_speak_text(session,tts_name,voice_name,timer_name,rate,dtmf_callback,text,buf,buflen);
+    return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }
 
 
@@ -320,10 +322,10 @@ char* fs_switch_channel_get_variable(switch_channel_t *channel, char *varname)
 
 int fs_switch_channel_set_variable(switch_channel_t *channel, char *varname, char *value)
 {
-        switch_status_t status;
+    switch_status_t status;
 
-        status = switch_channel_set_variable(channel, varname, value);
-        return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
+    status = switch_channel_set_variable(channel, varname, value);
+    return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 }  
 
 /* For Emacs: