提交 aa47e3e5 authored 作者: Anthony Minessale's avatar Anthony Minessale

update script langs

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8249 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 540a2fec
......@@ -64,6 +64,33 @@ Note that the first parameter to the new operator is implicitly handled by c++..
SWITCH_DECLARE(void) consoleLog(char *level_str, char *msg);
SWITCH_DECLARE(void) consoleCleanLog(char *msg);
class CoreSession;
class IVRMenu {
protected:
switch_ivr_menu_t *menu;
switch_memory_pool_t *pool;
public:
SWITCH_DECLARE_CONSTRUCTOR IVRMenu(IVRMenu *main,
const char *name,
const char *greeting_sound,
const char *short_greeting_sound,
const char *invalid_sound,
const char *exit_sound,
const char *confirm_macro,
const char *confirm_key,
int confirm_attempts,
int inter_timeout,
int digit_len,
int timeout,
int max_failures
);
virtual SWITCH_DECLARE_CONSTRUCTOR ~IVRMenu();
SWITCH_DECLARE(void) bindAction(char *action, const char *arg, const char *bind);
SWITCH_DECLARE(void) execute(CoreSession *session, const char *name);
};
class API {
protected:
char *last_data;
......
......@@ -717,6 +717,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t * s
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t * xml_menu_ctx,
switch_ivr_menu_t ** menu_stack, switch_xml_t xml_menus, switch_xml_t xml_menu);
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_name, switch_ivr_action_t *action);
/*!
*\param xml_menu_ctx The XML menu parser context previously created by switch_ivr_menu_stack_xml_init
*\param name The xml tag name to add to the parser engine
......
......@@ -11,6 +11,10 @@ package org.freeswitch.swig;
class freeswitchJNI {
public final static native void consoleLog(String jarg1, String jarg2);
public final static native void consoleCleanLog(String jarg1);
public final static native long new_IVRMenu(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4, String jarg5, String jarg6, String jarg7, String jarg8, int jarg9, int jarg10, int jarg11, int jarg12, int jarg13);
public final static native void delete_IVRMenu(long jarg1);
public final static native void IVRMenu_bindAction(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4);
public final static native void IVRMenu_execute(long jarg1, IVRMenu jarg1_, long jarg2, CoreSession jarg2_, String jarg3);
public final static native long new_API();
public final static native void delete_API(long jarg1);
public final static native String API_execute(long jarg1, API jarg1_, String jarg2, String jarg3);
......
......@@ -244,6 +244,144 @@ SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_consoleCleanLog(J
}
SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jstring jarg6, jstring jarg7, jstring jarg8, jint jarg9, jint jarg10, jint jarg11, jint jarg12, jint jarg13) {
jlong jresult = 0 ;
IVRMenu *arg1 = (IVRMenu *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
char *arg5 = (char *) 0 ;
char *arg6 = (char *) 0 ;
char *arg7 = (char *) 0 ;
char *arg8 = (char *) 0 ;
int arg9 ;
int arg10 ;
int arg11 ;
int arg12 ;
int arg13 ;
IVRMenu *result = 0 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(IVRMenu **)&jarg1;
arg2 = 0;
if (jarg2) {
arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
if (!arg2) return 0;
}
arg3 = 0;
if (jarg3) {
arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
if (!arg3) return 0;
}
arg4 = 0;
if (jarg4) {
arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
if (!arg4) return 0;
}
arg5 = 0;
if (jarg5) {
arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0);
if (!arg5) return 0;
}
arg6 = 0;
if (jarg6) {
arg6 = (char *)jenv->GetStringUTFChars(jarg6, 0);
if (!arg6) return 0;
}
arg7 = 0;
if (jarg7) {
arg7 = (char *)jenv->GetStringUTFChars(jarg7, 0);
if (!arg7) return 0;
}
arg8 = 0;
if (jarg8) {
arg8 = (char *)jenv->GetStringUTFChars(jarg8, 0);
if (!arg8) return 0;
}
arg9 = (int)jarg9;
arg10 = (int)jarg10;
arg11 = (int)jarg11;
arg12 = (int)jarg12;
arg13 = (int)jarg13;
result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
*(IVRMenu **)&jresult = result;
if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5);
if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6);
if (arg7) jenv->ReleaseStringUTFChars(jarg7, (const char *)arg7);
if (arg8) jenv->ReleaseStringUTFChars(jarg8, (const char *)arg8);
return jresult;
}
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1IVRMenu(JNIEnv *jenv, jclass jcls, jlong jarg1) {
IVRMenu *arg1 = (IVRMenu *) 0 ;
(void)jenv;
(void)jcls;
arg1 = *(IVRMenu **)&jarg1;
delete arg1;
}
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_IVRMenu_1bindAction(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
IVRMenu *arg1 = (IVRMenu *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(IVRMenu **)&jarg1;
arg2 = 0;
if (jarg2) {
arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
if (!arg2) return ;
}
arg3 = 0;
if (jarg3) {
arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
if (!arg3) return ;
}
arg4 = 0;
if (jarg4) {
arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
if (!arg4) return ;
}
(arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
}
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_IVRMenu_1execute(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3) {
IVRMenu *arg1 = (IVRMenu *) 0 ;
CoreSession *arg2 = (CoreSession *) 0 ;
char *arg3 = (char *) 0 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
(void)jarg2_;
arg1 = *(IVRMenu **)&jarg1;
arg2 = *(CoreSession **)&jarg2;
arg3 = 0;
if (jarg3) {
arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
if (!arg3) return ;
}
(arg1)->execute(arg2,(char const *)arg3);
if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
}
SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1API(JNIEnv *jenv, jclass jcls) {
jlong jresult = 0 ;
API *result = 0 ;
......
......@@ -1487,23 +1487,24 @@ SWIG_Lua_dostring(lua_State *L, const char* str) {
#define SWIGTYPE_p_API swig_types[0]
#define SWIGTYPE_p_CoreSession swig_types[1]
#define SWIGTYPE_p_Event swig_types[2]
#define SWIGTYPE_p_Session swig_types[3]
#define SWIGTYPE_p_Stream swig_types[4]
#define SWIGTYPE_p_input_callback_state swig_types[5]
#define SWIGTYPE_p_lua_State swig_types[6]
#define SWIGTYPE_p_session_flag_t swig_types[7]
#define SWIGTYPE_p_switch_channel_state_t swig_types[8]
#define SWIGTYPE_p_switch_channel_t swig_types[9]
#define SWIGTYPE_p_switch_core_session_t swig_types[10]
#define SWIGTYPE_p_switch_event_t swig_types[11]
#define SWIGTYPE_p_switch_input_args_t swig_types[12]
#define SWIGTYPE_p_switch_input_type_t swig_types[13]
#define SWIGTYPE_p_switch_priority_t swig_types[14]
#define SWIGTYPE_p_switch_status_t swig_types[15]
#define SWIGTYPE_p_switch_stream_handle_t swig_types[16]
#define SWIGTYPE_p_void swig_types[17]
static swig_type_info *swig_types[19];
static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0};
#define SWIGTYPE_p_IVRMenu swig_types[3]
#define SWIGTYPE_p_Session swig_types[4]
#define SWIGTYPE_p_Stream swig_types[5]
#define SWIGTYPE_p_input_callback_state swig_types[6]
#define SWIGTYPE_p_lua_State swig_types[7]
#define SWIGTYPE_p_session_flag_t swig_types[8]
#define SWIGTYPE_p_switch_channel_state_t swig_types[9]
#define SWIGTYPE_p_switch_channel_t swig_types[10]
#define SWIGTYPE_p_switch_core_session_t swig_types[11]
#define SWIGTYPE_p_switch_event_t swig_types[12]
#define SWIGTYPE_p_switch_input_args_t swig_types[13]
#define SWIGTYPE_p_switch_input_type_t swig_types[14]
#define SWIGTYPE_p_switch_priority_t swig_types[15]
#define SWIGTYPE_p_switch_status_t swig_types[16]
#define SWIGTYPE_p_switch_stream_handle_t swig_types[17]
#define SWIGTYPE_p_void swig_types[18]
static swig_type_info *swig_types[20];
static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
......@@ -1571,6 +1572,175 @@ fail:
}
static int _wrap_new_IVRMenu(lua_State* L) {
int SWIG_arg = -1;
IVRMenu *arg1 = (IVRMenu *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
char *arg5 = (char *) 0 ;
char *arg6 = (char *) 0 ;
char *arg7 = (char *) 0 ;
char *arg8 = (char *) 0 ;
int arg9 ;
int arg10 ;
int arg11 ;
int arg12 ;
int arg13 ;
IVRMenu *result = 0 ;
SWIG_check_num_args("IVRMenu",13,13)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *");
if(!lua_isstring(L,2)) SWIG_fail_arg("IVRMenu",2,"char const *");
if(!lua_isstring(L,3)) SWIG_fail_arg("IVRMenu",3,"char const *");
if(!lua_isstring(L,4)) SWIG_fail_arg("IVRMenu",4,"char const *");
if(!lua_isstring(L,5)) SWIG_fail_arg("IVRMenu",5,"char const *");
if(!lua_isstring(L,6)) SWIG_fail_arg("IVRMenu",6,"char const *");
if(!lua_isstring(L,7)) SWIG_fail_arg("IVRMenu",7,"char const *");
if(!lua_isstring(L,8)) SWIG_fail_arg("IVRMenu",8,"char const *");
if(!lua_isnumber(L,9)) SWIG_fail_arg("IVRMenu",9,"int");
if(!lua_isnumber(L,10)) SWIG_fail_arg("IVRMenu",10,"int");
if(!lua_isnumber(L,11)) SWIG_fail_arg("IVRMenu",11,"int");
if(!lua_isnumber(L,12)) SWIG_fail_arg("IVRMenu",12,"int");
if(!lua_isnumber(L,13)) SWIG_fail_arg("IVRMenu",13,"int");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
SWIG_fail_ptr("new_IVRMenu",1,SWIGTYPE_p_IVRMenu);
}
arg2 = (char *)lua_tostring(L, 2);
arg3 = (char *)lua_tostring(L, 3);
arg4 = (char *)lua_tostring(L, 4);
arg5 = (char *)lua_tostring(L, 5);
arg6 = (char *)lua_tostring(L, 6);
arg7 = (char *)lua_tostring(L, 7);
arg8 = (char *)lua_tostring(L, 8);
arg9 = (int)lua_tonumber(L, 9);
arg10 = (int)lua_tonumber(L, 10);
arg11 = (int)lua_tonumber(L, 11);
arg12 = (int)lua_tonumber(L, 12);
arg13 = (int)lua_tonumber(L, 13);
result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
SWIG_arg=0;
SWIG_NewPointerObj(L,result,SWIGTYPE_p_IVRMenu,1); SWIG_arg++;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_delete_IVRMenu(lua_State* L) {
int SWIG_arg = -1;
IVRMenu *arg1 = (IVRMenu *) 0 ;
SWIG_check_num_args("IVRMenu",1,1)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,SWIG_POINTER_DISOWN))){
SWIG_fail_ptr("delete_IVRMenu",1,SWIGTYPE_p_IVRMenu);
}
delete arg1;
SWIG_arg=0;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_IVRMenu_bindAction(lua_State* L) {
int SWIG_arg = -1;
IVRMenu *arg1 = (IVRMenu *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
SWIG_check_num_args("bindAction",4,4)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bindAction",1,"IVRMenu *");
if(!lua_isstring(L,2)) SWIG_fail_arg("bindAction",2,"char *");
if(!lua_isstring(L,3)) SWIG_fail_arg("bindAction",3,"char const *");
if(!lua_isstring(L,4)) SWIG_fail_arg("bindAction",4,"char const *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
SWIG_fail_ptr("IVRMenu_bindAction",1,SWIGTYPE_p_IVRMenu);
}
arg2 = (char *)lua_tostring(L, 2);
arg3 = (char *)lua_tostring(L, 3);
arg4 = (char *)lua_tostring(L, 4);
(arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
SWIG_arg=0;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_IVRMenu_execute(lua_State* L) {
int SWIG_arg = -1;
IVRMenu *arg1 = (IVRMenu *) 0 ;
CoreSession *arg2 = (CoreSession *) 0 ;
char *arg3 = (char *) 0 ;
SWIG_check_num_args("execute",3,3)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"IVRMenu *");
if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("execute",2,"CoreSession *");
if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
SWIG_fail_ptr("IVRMenu_execute",1,SWIGTYPE_p_IVRMenu);
}
if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
SWIG_fail_ptr("IVRMenu_execute",2,SWIGTYPE_p_CoreSession);
}
arg3 = (char *)lua_tostring(L, 3);
(arg1)->execute(arg2,(char const *)arg3);
SWIG_arg=0;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static void swig_delete_IVRMenu(void *obj) {
IVRMenu *arg1 = (IVRMenu *) obj;
delete arg1;
}
static swig_lua_method swig_IVRMenu_methods[] = {
{"bindAction", _wrap_IVRMenu_bindAction},
{"execute", _wrap_IVRMenu_execute},
{0,0}
};
static swig_lua_attribute swig_IVRMenu_attributes[] = {
{0,0,0}
};
static swig_lua_class *swig_IVRMenu_bases[] = {0};
static const char *swig_IVRMenu_base_names[] = {0};
static swig_lua_class _wrap_class_IVRMenu = { "IVRMenu", &SWIGTYPE_p_IVRMenu,_wrap_new_IVRMenu, swig_delete_IVRMenu, swig_IVRMenu_methods, swig_IVRMenu_attributes, swig_IVRMenu_bases, swig_IVRMenu_base_names };
static int _wrap_new_API(lua_State* L) {
int SWIG_arg = -1;
API *result = 0 ;
......@@ -5474,6 +5644,7 @@ static void *_p_SessionTo_p_CoreSession(void *x, int *newmemory) {
static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)&_wrap_class_API, 0};
static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)&_wrap_class_CoreSession, 0};
static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)&_wrap_class_Event, 0};
static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)&_wrap_class_IVRMenu, 0};
static swig_type_info _swigt__p_Session = {"_p_Session", "Session *", 0, 0, (void*)&_wrap_class_Session, 0};
static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)&_wrap_class_Stream, 0};
static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)&_wrap_class_input_callback_state_t, 0};
......@@ -5494,6 +5665,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_API,
&_swigt__p_CoreSession,
&_swigt__p_Event,
&_swigt__p_IVRMenu,
&_swigt__p_Session,
&_swigt__p_Stream,
&_swigt__p_input_callback_state,
......@@ -5514,6 +5686,7 @@ static swig_type_info *swig_type_initial[] = {
static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_Session, _p_SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Session[] = { {&_swigt__p_Session, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
......@@ -5534,6 +5707,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_API,
_swigc__p_CoreSession,
_swigc__p_Event,
_swigc__p_IVRMenu,
_swigc__p_Session,
_swigc__p_Stream,
_swigc__p_input_callback_state,
......
......@@ -11,7 +11,7 @@ include $(BASE)/build/modmake.rules
swigclean: clean
rm -f mod_perl_wrap.*
rm -f mod_perl_wrap.* freeswitch.so freeswitch.pm
mod_perl_wrap.cpp:
swig -static -shadow -perl5 -c++ -DMULTIPLICITY -I../../../../src/include -o mod_perl_wrap.cpp freeswitch.i
......
......@@ -56,6 +56,45 @@ package freeswitch;
*hanguphook = *freeswitchc::hanguphook;
*dtmf_callback = *freeswitchc::dtmf_callback;
############# Class : freeswitch::IVRMenu ##############
package freeswitch::IVRMenu;
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
@ISA = qw( freeswitch );
%OWNER = ();
%ITERATORS = ();
sub new {
my $pkg = shift;
my $self = freeswitchc::new_IVRMenu(@_);
bless $self, $pkg if defined($self);
}
sub DESTROY {
return unless $_[0]->isa('HASH');
my $self = tied(%{$_[0]});
return unless defined $self;
delete $ITERATORS{$self};
if (exists $OWNER{$self}) {
freeswitchc::delete_IVRMenu($self);
delete $OWNER{$self};
}
}
*bindAction = *freeswitchc::IVRMenu_bindAction;
*execute = *freeswitchc::IVRMenu_execute;
sub DISOWN {
my $self = shift;
my $ptr = tied(%$self);
delete $OWNER{$ptr};
}
sub ACQUIRE {
my $self = shift;
my $ptr = tied(%$self);
$OWNER{$ptr} = 1;
}
############# Class : freeswitch::API ##############
package freeswitch::API;
......
......@@ -121,14 +121,16 @@ static int perl_parse_and_execute(PerlInterpreter *my_perl, char *input_code, ch
}
if (!error) {
char *file = input_code;
char *err;
if (!switch_is_file_path(file)) {
file = switch_mprintf("do '%s/%s';\n", SWITCH_GLOBAL_dirs.script_dir, file);
file = switch_mprintf("require '%s/%s';", SWITCH_GLOBAL_dirs.script_dir, file);
switch_assert(file);
} else {
file = switch_mprintf("do '%s';\n", file);
file = switch_mprintf("require '%s';", file);
switch_assert(file);
}
error = Perl_safe_eval(my_perl, file);
switch_safe_free(file);
}
......
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.31
# Version 1.3.35
#
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.
......@@ -50,6 +50,23 @@ del types
consoleLog = _freeswitch.consoleLog
consoleCleanLog = _freeswitch.consoleCleanLog
class IVRMenu(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, IVRMenu, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, IVRMenu, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _freeswitch.new_IVRMenu(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _freeswitch.delete_IVRMenu
__del__ = lambda self : None;
def bindAction(*args): return _freeswitch.IVRMenu_bindAction(*args)
def execute(*args): return _freeswitch.IVRMenu_execute(*args)
IVRMenu_swigregister = _freeswitch.IVRMenu_swigregister
IVRMenu_swigregister(IVRMenu)
class API(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, API, name, value)
......@@ -152,7 +169,7 @@ class CoreSession(_object):
__setattr__ = lambda self, name, value: _swig_setattr(self, CoreSession, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, CoreSession, name)
def __init__(self): raise AttributeError, "No constructor defined"
def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
__repr__ = _swig_repr
__swig_destroy__ = _freeswitch.delete_CoreSession
__del__ = lambda self : None;
......
......@@ -37,6 +37,59 @@
#pragma warning(disable:4127 4003)
#endif
SWITCH_DECLARE_CONSTRUCTOR IVRMenu::IVRMenu(IVRMenu *main,
const char *name,
const char *greeting_sound,
const char *short_greeting_sound,
const char *invalid_sound,
const char *exit_sound,
const char *confirm_macro,
const char *confirm_key,
int confirm_attempts,
int inter_timeout,
int digit_len,
int timeout,
int max_failures)
{
menu = NULL;
switch_core_new_memory_pool(&pool);
switch_assert(pool);
if (switch_strlen_zero(name)) {
name = "no name";
}
switch_ivr_menu_init(&menu, main ? main->menu : NULL, name, greeting_sound, short_greeting_sound, invalid_sound,
exit_sound, confirm_macro, confirm_key, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, pool);
}
SWITCH_DECLARE_CONSTRUCTOR IVRMenu::~IVRMenu()
{
if (menu) {
switch_ivr_menu_stack_free(menu);
}
switch_core_destroy_memory_pool(&pool);
}
SWITCH_DECLARE(void) IVRMenu::bindAction(char *action, const char *arg, const char *bind)
{
switch_ivr_action_t ivr_action = SWITCH_IVR_ACTION_NOOP;
if (switch_ivr_menu_str2action(action, &ivr_action) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "bind %s to %s(%s)\n", bind, action, arg);
switch_ivr_menu_bind_action(menu, ivr_action, arg, bind);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid action %s\n", action);
}
}
SWITCH_DECLARE(void) IVRMenu::execute(CoreSession *session, const char *name)
{
switch_ivr_menu_execute(session->session, menu, (char *)name, NULL);
}
SWITCH_DECLARE_CONSTRUCTOR API::API()
{
last_data = NULL;
......
......@@ -601,6 +601,27 @@ static struct iam_s {
};
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_name, switch_ivr_action_t *action)
{
int i;
if (!switch_strlen_zero(action_name)) {
for(i = 0;;i++) {
if (!iam[i].name) {
break;
}
if (!strcasecmp(iam[i].name, action_name)) {
*action = iam[i].action;
return SWITCH_STATUS_SUCCESS;
}
}
}
return SWITCH_STATUS_FALSE;
}
static switch_bool_t is_valid_action(const char *action)
{
int i;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论