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

add some methods to CoreSession

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8352 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 0e6bb5f6
......@@ -160,6 +160,7 @@ class CoreSession {
switch_input_args_t *ap; // ptr to args .. (is this really needed?)
switch_caller_profile_t caller_profile; // avoid passing so many args to originate,
// instead set them here first
char *xml_cdr_text;
char *uuid;
char *tts_name;
char *voice_name;
......@@ -309,6 +310,9 @@ class CoreSession {
SWITCH_DECLARE(void) sendEvent(Event *sendME);
SWITCH_DECLARE(void) CoreSession::setEventData(Event *e);
SWITCH_DECLARE(char *) CoreSession::getXMLCDR();
virtual bool begin_allow_threads() = 0;
virtual bool end_allow_threads() = 0;
......
......@@ -213,6 +213,14 @@ public class CoreSession {
freeswitchJNI.CoreSession_sendEvent(swigCPtr, this, Event.getCPtr(sendME), sendME);
}
public void setEventData(Event e) {
freeswitchJNI.CoreSession_setEventData(swigCPtr, this, Event.getCPtr(e), e);
}
public String getXMLCDR() {
return freeswitchJNI.CoreSession_getXMLCDR(swigCPtr, this);
}
public boolean begin_allow_threads() {
return freeswitchJNI.CoreSession_begin_allow_threads(swigCPtr, this);
}
......
......@@ -104,6 +104,8 @@ class freeswitchJNI {
public final static native boolean CoreSession_ready(long jarg1, CoreSession jarg1_);
public final static native void CoreSession_execute(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
public final static native void CoreSession_sendEvent(long jarg1, CoreSession jarg1_, long jarg2, Event jarg2_);
public final static native void CoreSession_setEventData(long jarg1, CoreSession jarg1_, long jarg2, Event jarg2_);
public final static native String CoreSession_getXMLCDR(long jarg1, CoreSession jarg1_);
public final static native boolean CoreSession_begin_allow_threads(long jarg1, CoreSession jarg1_);
public final static native boolean CoreSession_end_allow_threads(long jarg1, CoreSession jarg1_);
public final static native String CoreSession_get_uuid(long jarg1, CoreSession jarg1_);
......
......@@ -2022,6 +2022,35 @@ SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1send
}
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1setEventData(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
CoreSession *arg1 = (CoreSession *) 0 ;
Event *arg2 = (Event *) 0 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
(void)jarg2_;
arg1 = *(CoreSession **)&jarg1;
arg2 = *(Event **)&jarg2;
(arg1)->setEventData(arg2);
}
SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1getXMLCDR(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jstring jresult = 0 ;
CoreSession *arg1 = (CoreSession *) 0 ;
char *result = 0 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(CoreSession **)&jarg1;
result = (char *)(arg1)->getXMLCDR();
if(result) jresult = jenv->NewStringUTF((const char *)result);
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1begin_1allow_1threads(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jboolean jresult = 0 ;
CoreSession *arg1 = (CoreSession *) 0 ;
......
......@@ -4726,6 +4726,62 @@ fail:
}
static int _wrap_CoreSession_setEventData(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
Event *arg2 = (Event *) 0 ;
SWIG_check_num_args("setEventData",2,2)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setEventData",1,"CoreSession *");
if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setEventData",2,"Event *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
SWIG_fail_ptr("CoreSession_setEventData",1,SWIGTYPE_p_CoreSession);
}
if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){
SWIG_fail_ptr("CoreSession_setEventData",2,SWIGTYPE_p_Event);
}
(arg1)->setEventData(arg2);
SWIG_arg=0;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_CoreSession_getXMLCDR(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
char *result = 0 ;
SWIG_check_num_args("getXMLCDR",1,1)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getXMLCDR",1,"CoreSession *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
SWIG_fail_ptr("CoreSession_getXMLCDR",1,SWIGTYPE_p_CoreSession);
}
result = (char *)(arg1)->getXMLCDR();
SWIG_arg=0;
lua_pushstring(L,(const char*)result); SWIG_arg++;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_CoreSession_begin_allow_threads(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
......@@ -4924,6 +4980,8 @@ static swig_lua_method swig_CoreSession_methods[] = {
{"ready", _wrap_CoreSession_ready},
{"execute", _wrap_CoreSession_execute},
{"sendEvent", _wrap_CoreSession_sendEvent},
{"setEventData", _wrap_CoreSession_setEventData},
{"getXMLCDR", _wrap_CoreSession_getXMLCDR},
{"begin_allow_threads", _wrap_CoreSession_begin_allow_threads},
{"end_allow_threads", _wrap_CoreSession_end_allow_threads},
{"get_uuid", _wrap_CoreSession_get_uuid},
......
......@@ -326,6 +326,8 @@ sub DESTROY {
*ready = *freeswitchc::CoreSession_ready;
*execute = *freeswitchc::CoreSession_execute;
*sendEvent = *freeswitchc::CoreSession_sendEvent;
*setEventData = *freeswitchc::CoreSession_setEventData;
*getXMLCDR = *freeswitchc::CoreSession_getXMLCDR;
*begin_allow_threads = *freeswitchc::CoreSession_begin_allow_threads;
*end_allow_threads = *freeswitchc::CoreSession_end_allow_threads;
*get_uuid = *freeswitchc::CoreSession_get_uuid;
......
......@@ -6243,6 +6243,71 @@ XS(_wrap_CoreSession_sendEvent) {
}
XS(_wrap_CoreSession_setEventData) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
Event *arg2 = (Event *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 2) || (items > 2)) {
SWIG_croak("Usage: CoreSession_setEventData(self,e);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_Event, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2"" of type '" "Event *""'");
}
arg2 = reinterpret_cast< Event * >(argp2);
(arg1)->setEventData(arg2);
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_CoreSession_getXMLCDR) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: CoreSession_getXMLCDR(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
result = (char *)(arg1)->getXMLCDR();
ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_CoreSession_begin_allow_threads) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
......@@ -7710,6 +7775,8 @@ static swig_command_info swig_commands[] = {
{"freeswitchc::CoreSession_ready", _wrap_CoreSession_ready},
{"freeswitchc::CoreSession_execute", _wrap_CoreSession_execute},
{"freeswitchc::CoreSession_sendEvent", _wrap_CoreSession_sendEvent},
{"freeswitchc::CoreSession_setEventData", _wrap_CoreSession_setEventData},
{"freeswitchc::CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR},
{"freeswitchc::CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads},
{"freeswitchc::CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads},
{"freeswitchc::CoreSession_get_uuid", _wrap_CoreSession_get_uuid},
......
# 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.
......@@ -169,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;
......@@ -217,6 +217,8 @@ class CoreSession(_object):
def ready(*args): return _freeswitch.CoreSession_ready(*args)
def execute(*args): return _freeswitch.CoreSession_execute(*args)
def sendEvent(*args): return _freeswitch.CoreSession_sendEvent(*args)
def setEventData(*args): return _freeswitch.CoreSession_setEventData(*args)
def getXMLCDR(*args): return _freeswitch.CoreSession_getXMLCDR(*args)
def begin_allow_threads(*args): return _freeswitch.CoreSession_begin_allow_threads(*args)
def end_allow_threads(*args): return _freeswitch.CoreSession_end_allow_threads(*args)
def get_uuid(*args): return _freeswitch.CoreSession_get_uuid(*args)
......
......@@ -382,11 +382,38 @@ SWITCH_DECLARE_CONSTRUCTOR CoreSession::~CoreSession()
switch_core_session_rwunlock(session);
}
switch_safe_free(xml_cdr_text);
switch_safe_free(uuid);
switch_safe_free(tts_name);
switch_safe_free(voice_name);
}
SWITCH_DECLARE(char *) CoreSession::getXMLCDR()
{
switch_xml_t cdr;
sanity_check("");
switch_safe_free(xml_cdr_text);
if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
xml_cdr_text = switch_xml_toxml(cdr, SWITCH_FALSE);
switch_xml_free(cdr);
}
return (char *) (xml_cdr_text ? xml_cdr_text : "");
}
SWITCH_DECLARE(void) CoreSession::setEventData(Event *e)
{
sanity_check_noreturn;
if (channel && e->event) {
switch_channel_event_set_data(channel, e->event);
}
}
SWITCH_DECLARE(int) CoreSession::answer()
{
switch_status_t status;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论