[Freeswitch-svn] [commit] r3475 - in freeswitch/trunk/src: . include mod/applications/mod_playback mod/languages/mod_perl mod/languages/mod_php mod/languages/mod_python mod/languages/mod_ruby mod/languages/mod_spidermonkey
Freeswitch SVN
anthm at freeswitch.org
Tue Nov 28 16:46:30 EST 2006
Author: anthm
Date: Tue Nov 28 16:46:29 2006
New Revision: 3475
Modified:
freeswitch/trunk/src/include/switch_ivr.h
freeswitch/trunk/src/mod/applications/mod_playback/mod_playback.c
freeswitch/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c
freeswitch/trunk/src/mod/languages/mod_php/php_freeswitch.h
freeswitch/trunk/src/mod/languages/mod_php/switch_swig_wrap.c
freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c
freeswitch/trunk/src/mod/languages/mod_ruby/switch_swig_wrap.c
freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/trunk/src/switch_ivr.c
freeswitch/trunk/src/switch_swig.c
Log:
add timelimit to record
Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/trunk/src/include/switch_ivr.h Tue Nov 28 16:46:29 2006
@@ -200,15 +200,17 @@
\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
Modified: freeswitch/trunk/src/mod/applications/mod_playback/mod_playback.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_playback/mod_playback.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_playback/mod_playback.c Tue Nov 28 16:46:29 2006
@@ -132,10 +132,20 @@
{
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);
Modified: freeswitch/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c Tue Nov 28 16:46:29 2006
@@ -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_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 @@
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 @@
}
}
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);
Modified: freeswitch/trunk/src/mod/languages/mod_php/php_freeswitch.h
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_php/php_freeswitch.h (original)
+++ freeswitch/trunk/src/mod/languages/mod_php/php_freeswitch.h Tue Nov 28 16:46:29 2006
@@ -93,14 +93,3 @@
#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:
- */
Modified: freeswitch/trunk/src/mod/languages/mod_php/switch_swig_wrap.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_php/switch_swig_wrap.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_php/switch_swig_wrap.c Tue Nov 28 16:46:29 2006
@@ -577,7 +577,7 @@
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 @@
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 @@
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);
Modified: freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c Tue Nov 28 16:46:29 2006
@@ -716,7 +716,7 @@
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 @@
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 @@
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 @@
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;
Modified: freeswitch/trunk/src/mod/languages/mod_ruby/switch_swig_wrap.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_ruby/switch_swig_wrap.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_ruby/switch_swig_wrap.c Tue Nov 28 16:46:29 2006
@@ -628,7 +628,7 @@
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 @@
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 @@
}
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;
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Tue Nov 28 16:46:29 2006
@@ -831,6 +831,7 @@
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 @@
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;
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Tue Nov 28 16:46:29 2006
@@ -325,11 +325,12 @@
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_status_t status = SWITCH_STATUS_SUCCESS;
char *p;
const char *vval;
+ time_t start = 0;
if (!fh) {
fh = &lfh;
@@ -422,16 +424,22 @@
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) {
/*
Modified: freeswitch/trunk/src/switch_swig.c
==============================================================================
--- freeswitch/trunk/src/switch_swig.c (original)
+++ freeswitch/trunk/src/switch_swig.c Tue Nov 28 16:46:29 2006
@@ -88,17 +88,17 @@
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 @@
/*
-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_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 @@
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;
+ 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;
-}
+ 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 @@
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:
More information about the Freeswitch-svn
mailing list