mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-02 06:38:04 +00:00
add session destroy psuedo method to sort of destroy a session at least for the sake of FS
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9571 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
49cf6c1039
commit
ddd1ae14b7
@ -254,6 +254,8 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg);
|
|||||||
SWITCH_DECLARE(int) originate(CoreSession * a_leg_session, char *dest, int timeout = 60);
|
SWITCH_DECLARE(int) originate(CoreSession * a_leg_session, char *dest, int timeout = 60);
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_DECLARE(void) destroy(void);
|
||||||
|
|
||||||
/** \brief set a DTMF callback function
|
/** \brief set a DTMF callback function
|
||||||
*
|
*
|
||||||
* The DTMF callback function will be set and persist
|
* The DTMF callback function will be set and persist
|
||||||
|
@ -189,6 +189,10 @@ public class CoreSession {
|
|||||||
return freeswitchJNI.CoreSession_originate__SWIG_1(swigCPtr, this, CoreSession.getCPtr(a_leg_session), a_leg_session, dest);
|
return freeswitchJNI.CoreSession_originate__SWIG_1(swigCPtr, this, CoreSession.getCPtr(a_leg_session), a_leg_session, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void destroy() {
|
||||||
|
freeswitchJNI.CoreSession_destroy(swigCPtr, this);
|
||||||
|
}
|
||||||
|
|
||||||
public void setDTMFCallback(SWIGTYPE_p_void cbfunc, String funcargs) {
|
public void setDTMFCallback(SWIGTYPE_p_void cbfunc, String funcargs) {
|
||||||
freeswitchJNI.CoreSession_setDTMFCallback(swigCPtr, this, SWIGTYPE_p_void.getCPtr(cbfunc), funcargs);
|
freeswitchJNI.CoreSession_setDTMFCallback(swigCPtr, this, SWIGTYPE_p_void.getCPtr(cbfunc), funcargs);
|
||||||
}
|
}
|
||||||
|
@ -122,6 +122,7 @@ class freeswitchJNI {
|
|||||||
public final static native void CoreSession_setCallerData(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
|
public final static native void CoreSession_setCallerData(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
|
||||||
public final static native int CoreSession_originate__SWIG_0(long jarg1, CoreSession jarg1_, long jarg2, CoreSession jarg2_, String jarg3, int jarg4);
|
public final static native int CoreSession_originate__SWIG_0(long jarg1, CoreSession jarg1_, long jarg2, CoreSession jarg2_, String jarg3, int jarg4);
|
||||||
public final static native int CoreSession_originate__SWIG_1(long jarg1, CoreSession jarg1_, long jarg2, CoreSession jarg2_, String jarg3);
|
public final static native int CoreSession_originate__SWIG_1(long jarg1, CoreSession jarg1_, long jarg2, CoreSession jarg2_, String jarg3);
|
||||||
|
public final static native void CoreSession_destroy(long jarg1, CoreSession jarg1_);
|
||||||
public final static native void CoreSession_setDTMFCallback(long jarg1, CoreSession jarg1_, long jarg2, String jarg3);
|
public final static native void CoreSession_setDTMFCallback(long jarg1, CoreSession jarg1_, long jarg2, String jarg3);
|
||||||
public final static native int CoreSession_speak(long jarg1, CoreSession jarg1_, String jarg2);
|
public final static native int CoreSession_speak(long jarg1, CoreSession jarg1_, String jarg2);
|
||||||
public final static native void CoreSession_set_tts_parms(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
|
public final static native void CoreSession_set_tts_parms(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
|
||||||
|
@ -2304,6 +2304,17 @@ SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1orig
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1destroy(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
|
||||||
|
CoreSession *arg1 = (CoreSession *) 0 ;
|
||||||
|
|
||||||
|
(void)jenv;
|
||||||
|
(void)jcls;
|
||||||
|
(void)jarg1_;
|
||||||
|
arg1 = *(CoreSession **)&jarg1;
|
||||||
|
(arg1)->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1setDTMFCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jstring jarg3) {
|
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1setDTMFCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jstring jarg3) {
|
||||||
CoreSession *arg1 = (CoreSession *) 0 ;
|
CoreSession *arg1 = (CoreSession *) 0 ;
|
||||||
void *arg2 = (void *) 0 ;
|
void *arg2 = (void *) 0 ;
|
||||||
|
@ -5405,6 +5405,30 @@ static int _wrap_CoreSession_originate(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int _wrap_CoreSession_destroy(lua_State* L) {
|
||||||
|
int SWIG_arg = -1;
|
||||||
|
CoreSession *arg1 = (CoreSession *) 0 ;
|
||||||
|
|
||||||
|
SWIG_check_num_args("destroy",1,1)
|
||||||
|
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("destroy",1,"CoreSession *");
|
||||||
|
|
||||||
|
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
|
||||||
|
SWIG_fail_ptr("CoreSession_destroy",1,SWIGTYPE_p_CoreSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
(arg1)->destroy();
|
||||||
|
SWIG_arg=0;
|
||||||
|
|
||||||
|
return SWIG_arg;
|
||||||
|
|
||||||
|
if(0) SWIG_fail;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
lua_error(L);
|
||||||
|
return SWIG_arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int _wrap_CoreSession_setDTMFCallback(lua_State* L) {
|
static int _wrap_CoreSession_setDTMFCallback(lua_State* L) {
|
||||||
int SWIG_arg = -1;
|
int SWIG_arg = -1;
|
||||||
CoreSession *arg1 = (CoreSession *) 0 ;
|
CoreSession *arg1 = (CoreSession *) 0 ;
|
||||||
@ -6674,6 +6698,7 @@ static swig_lua_method swig_CoreSession_methods[] = {
|
|||||||
{"recordFile", _wrap_CoreSession_recordFile},
|
{"recordFile", _wrap_CoreSession_recordFile},
|
||||||
{"setCallerData", _wrap_CoreSession_setCallerData},
|
{"setCallerData", _wrap_CoreSession_setCallerData},
|
||||||
{"originate", _wrap_CoreSession_originate},
|
{"originate", _wrap_CoreSession_originate},
|
||||||
|
{"destroy", _wrap_CoreSession_destroy},
|
||||||
{"setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
|
{"setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
|
||||||
{"speak", _wrap_CoreSession_speak},
|
{"speak", _wrap_CoreSession_speak},
|
||||||
{"set_tts_parms", _wrap_CoreSession_set_tts_parms},
|
{"set_tts_parms", _wrap_CoreSession_set_tts_parms},
|
||||||
|
@ -410,6 +410,7 @@ sub DESTROY {
|
|||||||
*recordFile = *freeswitchc::CoreSession_recordFile;
|
*recordFile = *freeswitchc::CoreSession_recordFile;
|
||||||
*setCallerData = *freeswitchc::CoreSession_setCallerData;
|
*setCallerData = *freeswitchc::CoreSession_setCallerData;
|
||||||
*originate = *freeswitchc::CoreSession_originate;
|
*originate = *freeswitchc::CoreSession_originate;
|
||||||
|
*destroy = *freeswitchc::CoreSession_destroy;
|
||||||
*setDTMFCallback = *freeswitchc::CoreSession_setDTMFCallback;
|
*setDTMFCallback = *freeswitchc::CoreSession_setDTMFCallback;
|
||||||
*speak = *freeswitchc::CoreSession_speak;
|
*speak = *freeswitchc::CoreSession_speak;
|
||||||
*set_tts_parms = *freeswitchc::CoreSession_set_tts_parms;
|
*set_tts_parms = *freeswitchc::CoreSession_set_tts_parms;
|
||||||
|
@ -7030,6 +7030,33 @@ XS(_wrap_CoreSession_originate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
XS(_wrap_CoreSession_destroy) {
|
||||||
|
{
|
||||||
|
CoreSession *arg1 = (CoreSession *) 0 ;
|
||||||
|
void *argp1 = 0 ;
|
||||||
|
int res1 = 0 ;
|
||||||
|
int argvi = 0;
|
||||||
|
dXSARGS;
|
||||||
|
|
||||||
|
if ((items < 1) || (items > 1)) {
|
||||||
|
SWIG_croak("Usage: CoreSession_destroy(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_destroy" "', argument " "1"" of type '" "CoreSession *""'");
|
||||||
|
}
|
||||||
|
arg1 = reinterpret_cast< CoreSession * >(argp1);
|
||||||
|
(arg1)->destroy();
|
||||||
|
|
||||||
|
|
||||||
|
XSRETURN(argvi);
|
||||||
|
fail:
|
||||||
|
|
||||||
|
SWIG_croak_null();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
XS(_wrap_CoreSession_setDTMFCallback) {
|
XS(_wrap_CoreSession_setDTMFCallback) {
|
||||||
{
|
{
|
||||||
CoreSession *arg1 = (CoreSession *) 0 ;
|
CoreSession *arg1 = (CoreSession *) 0 ;
|
||||||
@ -10588,6 +10615,7 @@ static swig_command_info swig_commands[] = {
|
|||||||
{"freeswitchc::CoreSession_recordFile", _wrap_CoreSession_recordFile},
|
{"freeswitchc::CoreSession_recordFile", _wrap_CoreSession_recordFile},
|
||||||
{"freeswitchc::CoreSession_setCallerData", _wrap_CoreSession_setCallerData},
|
{"freeswitchc::CoreSession_setCallerData", _wrap_CoreSession_setCallerData},
|
||||||
{"freeswitchc::CoreSession_originate", _wrap_CoreSession_originate},
|
{"freeswitchc::CoreSession_originate", _wrap_CoreSession_originate},
|
||||||
|
{"freeswitchc::CoreSession_destroy", _wrap_CoreSession_destroy},
|
||||||
{"freeswitchc::CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
|
{"freeswitchc::CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
|
||||||
{"freeswitchc::CoreSession_speak", _wrap_CoreSession_speak},
|
{"freeswitchc::CoreSession_speak", _wrap_CoreSession_speak},
|
||||||
{"freeswitchc::CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms},
|
{"freeswitchc::CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms},
|
||||||
|
@ -268,6 +268,7 @@ class CoreSession(_object):
|
|||||||
def recordFile(*args): return _freeswitch.CoreSession_recordFile(*args)
|
def recordFile(*args): return _freeswitch.CoreSession_recordFile(*args)
|
||||||
def setCallerData(*args): return _freeswitch.CoreSession_setCallerData(*args)
|
def setCallerData(*args): return _freeswitch.CoreSession_setCallerData(*args)
|
||||||
def originate(*args): return _freeswitch.CoreSession_originate(*args)
|
def originate(*args): return _freeswitch.CoreSession_originate(*args)
|
||||||
|
def destroy(*args): return _freeswitch.CoreSession_destroy(*args)
|
||||||
def setDTMFCallback(*args): return _freeswitch.CoreSession_setDTMFCallback(*args)
|
def setDTMFCallback(*args): return _freeswitch.CoreSession_setDTMFCallback(*args)
|
||||||
def speak(*args): return _freeswitch.CoreSession_speak(*args)
|
def speak(*args): return _freeswitch.CoreSession_speak(*args)
|
||||||
def set_tts_parms(*args): return _freeswitch.CoreSession_set_tts_parms(*args)
|
def set_tts_parms(*args): return _freeswitch.CoreSession_set_tts_parms(*args)
|
||||||
|
@ -7131,6 +7131,27 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWIGINTERN PyObject *_wrap_CoreSession_destroy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||||
|
PyObject *resultobj = 0;
|
||||||
|
CoreSession *arg1 = (CoreSession *) 0 ;
|
||||||
|
void *argp1 = 0 ;
|
||||||
|
int res1 = 0 ;
|
||||||
|
PyObject * obj0 = 0 ;
|
||||||
|
|
||||||
|
if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_destroy",&obj0)) SWIG_fail;
|
||||||
|
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
|
||||||
|
if (!SWIG_IsOK(res1)) {
|
||||||
|
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_destroy" "', argument " "1"" of type '" "CoreSession *""'");
|
||||||
|
}
|
||||||
|
arg1 = reinterpret_cast< CoreSession * >(argp1);
|
||||||
|
(arg1)->destroy();
|
||||||
|
resultobj = SWIG_Py_Void();
|
||||||
|
return resultobj;
|
||||||
|
fail:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWIGINTERN PyObject *_wrap_CoreSession_setDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
SWIGINTERN PyObject *_wrap_CoreSession_setDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||||
PyObject *resultobj = 0;
|
PyObject *resultobj = 0;
|
||||||
CoreSession *arg1 = (CoreSession *) 0 ;
|
CoreSession *arg1 = (CoreSession *) 0 ;
|
||||||
@ -9639,6 +9660,7 @@ static PyMethodDef SwigMethods[] = {
|
|||||||
{ (char *)"CoreSession_recordFile", _wrap_CoreSession_recordFile, METH_VARARGS, NULL},
|
{ (char *)"CoreSession_recordFile", _wrap_CoreSession_recordFile, METH_VARARGS, NULL},
|
||||||
{ (char *)"CoreSession_setCallerData", _wrap_CoreSession_setCallerData, METH_VARARGS, NULL},
|
{ (char *)"CoreSession_setCallerData", _wrap_CoreSession_setCallerData, METH_VARARGS, NULL},
|
||||||
{ (char *)"CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL},
|
{ (char *)"CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL},
|
||||||
|
{ (char *)"CoreSession_destroy", _wrap_CoreSession_destroy, METH_VARARGS, NULL},
|
||||||
{ (char *)"CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback, METH_VARARGS, NULL},
|
{ (char *)"CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback, METH_VARARGS, NULL},
|
||||||
{ (char *)"CoreSession_speak", _wrap_CoreSession_speak, METH_VARARGS, NULL},
|
{ (char *)"CoreSession_speak", _wrap_CoreSession_speak, METH_VARARGS, NULL},
|
||||||
{ (char *)"CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms, METH_VARARGS, NULL},
|
{ (char *)"CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms, METH_VARARGS, NULL},
|
||||||
|
@ -459,22 +459,8 @@ SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(switch_core_session_t *new_s
|
|||||||
|
|
||||||
SWITCH_DECLARE_CONSTRUCTOR CoreSession::~CoreSession()
|
SWITCH_DECLARE_CONSTRUCTOR CoreSession::~CoreSession()
|
||||||
{
|
{
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::~CoreSession desctructor\n");
|
|
||||||
switch_channel_t *channel = NULL;
|
|
||||||
|
|
||||||
this_check_void();
|
this_check_void();
|
||||||
switch_safe_free(xml_cdr_text);
|
destroy();
|
||||||
switch_safe_free(uuid);
|
|
||||||
switch_safe_free(tts_name);
|
|
||||||
switch_safe_free(voice_name);
|
|
||||||
|
|
||||||
if (session) {
|
|
||||||
channel = switch_core_session_get_channel(session);
|
|
||||||
if (switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
|
|
||||||
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
|
||||||
}
|
|
||||||
switch_core_session_rwunlock(session);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(char *) CoreSession::getXMLCDR()
|
SWITCH_DECLARE(char *) CoreSession::getXMLCDR()
|
||||||
@ -850,6 +836,28 @@ SWITCH_DECLARE(bool) CoreSession::answered() {
|
|||||||
return switch_channel_test_flag(channel, CF_ANSWERED) != 0;
|
return switch_channel_test_flag(channel, CF_ANSWERED) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(void) CoreSession::destroy(void)
|
||||||
|
{
|
||||||
|
this_check_void();
|
||||||
|
|
||||||
|
switch_safe_free(xml_cdr_text);
|
||||||
|
switch_safe_free(uuid);
|
||||||
|
switch_safe_free(tts_name);
|
||||||
|
switch_safe_free(voice_name);
|
||||||
|
|
||||||
|
if (session) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "destroy/unlink session from object\n");
|
||||||
|
if (switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
|
||||||
|
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||||
|
}
|
||||||
|
switch_core_session_rwunlock(session);
|
||||||
|
session = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
allocated = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(int) CoreSession::originate(CoreSession *a_leg_session, char *dest, int timeout)
|
SWITCH_DECLARE(int) CoreSession::originate(CoreSession *a_leg_session, char *dest, int timeout)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user