add waitForAnswer to cpp

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8745 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-06-02 23:42:59 +00:00
parent 6798cd2b5f
commit 7f4c8a6d46
10 changed files with 333 additions and 0 deletions

View File

@ -282,6 +282,8 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg);
SWITCH_DECLARE(bool) answered();
SWITCH_DECLARE(bool) mediaReady();
SWITCH_DECLARE(void) waitForAnswer(CoreSession *calling_session);
SWITCH_DECLARE(void) execute(char *app, char *data = NULL);
SWITCH_DECLARE(void) sendEvent(Event * sendME);

View File

@ -225,6 +225,18 @@ public class CoreSession {
return freeswitchJNI.CoreSession_ready(swigCPtr, this);
}
public boolean answered() {
return freeswitchJNI.CoreSession_answered(swigCPtr, this);
}
public boolean mediaReady() {
return freeswitchJNI.CoreSession_mediaReady(swigCPtr, this);
}
public void waitForAnswer(CoreSession calling_session) {
freeswitchJNI.CoreSession_waitForAnswer(swigCPtr, this, CoreSession.getCPtr(calling_session), calling_session);
}
public void execute(String app, String data) {
freeswitchJNI.CoreSession_execute__SWIG_0(swigCPtr, this, app, data);
}

View File

@ -107,6 +107,9 @@ class freeswitchJNI {
public final static native int CoreSession_setAutoHangup(long jarg1, CoreSession jarg1_, boolean jarg2);
public final static native void CoreSession_setHangupHook(long jarg1, CoreSession jarg1_, long jarg2);
public final static native boolean CoreSession_ready(long jarg1, CoreSession jarg1_);
public final static native boolean CoreSession_answered(long jarg1, CoreSession jarg1_);
public final static native boolean CoreSession_mediaReady(long jarg1, CoreSession jarg1_);
public final static native void CoreSession_waitForAnswer(long jarg1, CoreSession jarg1_, long jarg2, CoreSession jarg2_);
public final static native void CoreSession_execute__SWIG_0(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
public final static native void CoreSession_execute__SWIG_1(long jarg1, CoreSession jarg1_, String jarg2);
public final static native void CoreSession_sendEvent(long jarg1, CoreSession jarg1_, long jarg2, Event jarg2_);

View File

@ -2119,6 +2119,50 @@ SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1
}
SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1answered(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jboolean jresult = 0 ;
CoreSession *arg1 = (CoreSession *) 0 ;
bool result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(CoreSession **)&jarg1;
result = (bool)(arg1)->answered();
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1mediaReady(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jboolean jresult = 0 ;
CoreSession *arg1 = (CoreSession *) 0 ;
bool result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(CoreSession **)&jarg1;
result = (bool)(arg1)->mediaReady();
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1waitForAnswer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
CoreSession *arg1 = (CoreSession *) 0 ;
CoreSession *arg2 = (CoreSession *) 0 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
(void)jarg2_;
arg1 = *(CoreSession **)&jarg1;
arg2 = *(CoreSession **)&jarg2;
(arg1)->waitForAnswer(arg2);
}
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1execute_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
CoreSession *arg1 = (CoreSession *) 0 ;
char *arg2 = (char *) 0 ;

View File

@ -4907,6 +4907,87 @@ fail:
}
static int _wrap_CoreSession_answered(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
bool result;
SWIG_check_num_args("answered",1,1)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("answered",1,"CoreSession *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
SWIG_fail_ptr("CoreSession_answered",1,SWIGTYPE_p_CoreSession);
}
result = (bool)(arg1)->answered();
SWIG_arg=0;
lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_CoreSession_mediaReady(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
bool result;
SWIG_check_num_args("mediaReady",1,1)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mediaReady",1,"CoreSession *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
SWIG_fail_ptr("CoreSession_mediaReady",1,SWIGTYPE_p_CoreSession);
}
result = (bool)(arg1)->mediaReady();
SWIG_arg=0;
lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_CoreSession_waitForAnswer(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
CoreSession *arg2 = (CoreSession *) 0 ;
SWIG_check_num_args("waitForAnswer",2,2)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("waitForAnswer",1,"CoreSession *");
if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("waitForAnswer",2,"CoreSession *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
SWIG_fail_ptr("CoreSession_waitForAnswer",1,SWIGTYPE_p_CoreSession);
}
if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
SWIG_fail_ptr("CoreSession_waitForAnswer",2,SWIGTYPE_p_CoreSession);
}
(arg1)->waitForAnswer(arg2);
SWIG_arg=0;
return SWIG_arg;
if(0) SWIG_fail;
fail:
lua_error(L);
return SWIG_arg;
}
static int _wrap_CoreSession_execute__SWIG_0(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
@ -5306,6 +5387,9 @@ static swig_lua_method swig_CoreSession_methods[] = {
{"setAutoHangup", _wrap_CoreSession_setAutoHangup},
{"setHangupHook", _wrap_CoreSession_setHangupHook},
{"ready", _wrap_CoreSession_ready},
{"answered", _wrap_CoreSession_answered},
{"mediaReady", _wrap_CoreSession_mediaReady},
{"waitForAnswer", _wrap_CoreSession_waitForAnswer},
{"execute", _wrap_CoreSession_execute},
{"sendEvent", _wrap_CoreSession_sendEvent},
{"setEventData", _wrap_CoreSession_setEventData},

View File

@ -327,6 +327,9 @@ sub DESTROY {
*setAutoHangup = *freeswitchc::CoreSession_setAutoHangup;
*setHangupHook = *freeswitchc::CoreSession_setHangupHook;
*ready = *freeswitchc::CoreSession_ready;
*answered = *freeswitchc::CoreSession_answered;
*mediaReady = *freeswitchc::CoreSession_mediaReady;
*waitForAnswer = *freeswitchc::CoreSession_waitForAnswer;
*execute = *freeswitchc::CoreSession_execute;
*sendEvent = *freeswitchc::CoreSession_sendEvent;
*setEventData = *freeswitchc::CoreSession_setEventData;

View File

@ -6547,6 +6547,99 @@ XS(_wrap_CoreSession_ready) {
}
XS(_wrap_CoreSession_answered) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
bool result;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: CoreSession_answered(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_answered" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
result = (bool)(arg1)->answered();
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_CoreSession_mediaReady) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
bool result;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: CoreSession_mediaReady(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_mediaReady" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
result = (bool)(arg1)->mediaReady();
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_CoreSession_waitForAnswer) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
CoreSession *arg2 = (CoreSession *) 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_waitForAnswer(self,calling_session);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_waitForAnswer" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_waitForAnswer" "', argument " "2"" of type '" "CoreSession *""'");
}
arg2 = reinterpret_cast< CoreSession * >(argp2);
(arg1)->waitForAnswer(arg2);
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_CoreSession_execute__SWIG_0) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
@ -8290,6 +8383,9 @@ static swig_command_info swig_commands[] = {
{"freeswitchc::CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup},
{"freeswitchc::CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook},
{"freeswitchc::CoreSession_ready", _wrap_CoreSession_ready},
{"freeswitchc::CoreSession_answered", _wrap_CoreSession_answered},
{"freeswitchc::CoreSession_mediaReady", _wrap_CoreSession_mediaReady},
{"freeswitchc::CoreSession_waitForAnswer", _wrap_CoreSession_waitForAnswer},
{"freeswitchc::CoreSession_execute", _wrap_CoreSession_execute},
{"freeswitchc::CoreSession_sendEvent", _wrap_CoreSession_sendEvent},
{"freeswitchc::CoreSession_setEventData", _wrap_CoreSession_setEventData},

View File

@ -218,6 +218,9 @@ class CoreSession(_object):
def setAutoHangup(*args): return _freeswitch.CoreSession_setAutoHangup(*args)
def setHangupHook(*args): return _freeswitch.CoreSession_setHangupHook(*args)
def ready(*args): return _freeswitch.CoreSession_ready(*args)
def answered(*args): return _freeswitch.CoreSession_answered(*args)
def mediaReady(*args): return _freeswitch.CoreSession_mediaReady(*args)
def waitForAnswer(*args): return _freeswitch.CoreSession_waitForAnswer(*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)

View File

@ -6760,6 +6760,80 @@ fail:
}
SWIGINTERN PyObject *_wrap_CoreSession_answered(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
bool result;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_answered",&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_answered" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
result = (bool)(arg1)->answered();
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_CoreSession_mediaReady(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
bool result;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_mediaReady",&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_mediaReady" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
result = (bool)(arg1)->mediaReady();
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_CoreSession_waitForAnswer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
CoreSession *arg2 = (CoreSession *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_waitForAnswer",&obj0,&obj1)) 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_waitForAnswer" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_waitForAnswer" "', argument " "2"" of type '" "CoreSession *""'");
}
arg2 = reinterpret_cast< CoreSession * >(argp2);
(arg1)->waitForAnswer(arg2);
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
@ -7736,6 +7810,9 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup, METH_VARARGS, NULL},
{ (char *)"CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook, METH_VARARGS, NULL},
{ (char *)"CoreSession_ready", _wrap_CoreSession_ready, METH_VARARGS, NULL},
{ (char *)"CoreSession_answered", _wrap_CoreSession_answered, METH_VARARGS, NULL},
{ (char *)"CoreSession_mediaReady", _wrap_CoreSession_mediaReady, METH_VARARGS, NULL},
{ (char *)"CoreSession_waitForAnswer", _wrap_CoreSession_waitForAnswer, METH_VARARGS, NULL},
{ (char *)"CoreSession_execute", _wrap_CoreSession_execute, METH_VARARGS, NULL},
{ (char *)"CoreSession_sendEvent", _wrap_CoreSession_sendEvent, METH_VARARGS, NULL},
{ (char *)"CoreSession_setEventData", _wrap_CoreSession_setEventData, METH_VARARGS, NULL},

View File

@ -890,6 +890,15 @@ SWITCH_DECLARE(int) CoreSession::setAutoHangup(bool val)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(void) CoreSession::waitForAnswer(CoreSession *calling_session)
{
this_check_void();
sanity_check_noreturn;
switch_ivr_wait_for_answer(calling_session ? calling_session->session : NULL, session);
}
SWITCH_DECLARE(void) CoreSession::setCallerData(char *var, char *val) {
this_check_void();