add bridged method to scripting langs

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16854 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2010-03-01 20:04:12 +00:00
parent 717308a3cf
commit 334abcdae7
11 changed files with 185 additions and 10 deletions

View File

@ -331,6 +331,7 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg);
SWITCH_DECLARE(void) setHangupHook(void *hangup_func);
SWITCH_DECLARE(bool) ready();
SWITCH_DECLARE(bool) bridged();
SWITCH_DECLARE(bool) answered();
SWITCH_DECLARE(bool) mediaReady();

View File

@ -301,6 +301,10 @@ public class CoreSession {
return freeswitchJNI.CoreSession_ready(swigCPtr, this);
}
public boolean bridged() {
return freeswitchJNI.CoreSession_bridged(swigCPtr, this);
}
public boolean answered() {
return freeswitchJNI.CoreSession_answered(swigCPtr, this);
}

View File

@ -152,6 +152,7 @@ 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_bridged(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_);

View File

@ -2993,6 +2993,21 @@ SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1
}
SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1bridged(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)->bridged();
jresult = (jboolean)result;
return jresult;
}
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 ;

View File

@ -377,6 +377,28 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BLANK_STRING_get() {
}
SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_TON_UNDEF_get() {
int jresult ;
int result;
result = (int) 255;
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_NUMPLAN_UNDEF_get() {
int jresult ;
int result;
result = (int) 255;
jresult = result;
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_ESC_get() {
char * jresult ;
char *result = 0 ;
@ -21877,11 +21899,17 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_timestamps(void * jarg1) {
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_audio_sync(void * jarg1) {
SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_perform_audio_sync(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
int arg4 ;
arg1 = (switch_channel_t *)jarg1;
switch_channel_audio_sync(arg1);
arg2 = (char *)jarg2;
arg3 = (char *)jarg3;
arg4 = (int)jarg4;
switch_channel_perform_audio_sync(arg1,(char const *)arg2,(char const *)arg3,arg4);
}
@ -22163,6 +22191,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_read(void * jarg1, void * jar
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_peek(void * jarg1, void * jarg2, void * jarg3) {
void * jresult ;
switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
void *arg2 = (void *) 0 ;
switch_size_t arg3 ;
switch_size_t result;
switch_size_t *argp3 ;
arg1 = (switch_buffer_t *)jarg1;
arg2 = (void *)jarg2;
argp3 = (switch_size_t *)jarg3;
if (!argp3) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
return 0;
}
arg3 = *argp3;
result = switch_buffer_peek(arg1,arg2,arg3);
jresult = new switch_size_t((switch_size_t &)result);
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_read_loop(void * jarg1, void * jarg2, void * jarg3) {
void * jresult ;
switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
@ -31317,6 +31367,18 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_Ready(void * jarg1) {
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_bridged(void * jarg1) {
unsigned int jresult ;
CoreSession *arg1 = (CoreSession *) 0 ;
bool result;
arg1 = (CoreSession *)jarg1;
result = (bool)(arg1)->bridged();
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_answered(void * jarg1) {
unsigned int jresult ;
CoreSession *arg1 = (CoreSession *) 0 ;

View File

@ -362,6 +362,11 @@ public class CoreSession : IDisposable {
return ret;
}
public bool bridged() {
bool ret = freeswitchPINVOKE.CoreSession_bridged(swigCPtr);
return ret;
}
public bool answered() {
bool ret = freeswitchPINVOKE.CoreSession_answered(swigCPtr);
return ret;
@ -3113,8 +3118,8 @@ public class freeswitch {
return ret;
}
public static void switch_channel_audio_sync(SWIGTYPE_p_switch_channel channel) {
freeswitchPINVOKE.switch_channel_audio_sync(SWIGTYPE_p_switch_channel.getCPtr(channel));
public static void switch_channel_perform_audio_sync(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
freeswitchPINVOKE.switch_channel_perform_audio_sync(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
}
public static void switch_channel_set_private_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
@ -3218,6 +3223,12 @@ public class freeswitch {
return ret;
}
public static SWIGTYPE_p_switch_size_t switch_buffer_peek(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_peek(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
public static SWIGTYPE_p_switch_size_t switch_buffer_read_loop(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_read_loop(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
@ -4673,6 +4684,8 @@ public class freeswitch {
public static readonly int __BSD_VISIBLE = freeswitchPINVOKE.__BSD_VISIBLE_get();
public static readonly string SWITCH_ENT_ORIGINATE_DELIM = freeswitchPINVOKE.SWITCH_ENT_ORIGINATE_DELIM_get();
public static readonly string SWITCH_BLANK_STRING = freeswitchPINVOKE.SWITCH_BLANK_STRING_get();
public static readonly int SWITCH_TON_UNDEF = freeswitchPINVOKE.SWITCH_TON_UNDEF_get();
public static readonly int SWITCH_NUMPLAN_UNDEF = freeswitchPINVOKE.SWITCH_NUMPLAN_UNDEF_get();
public static readonly string SWITCH_SEQ_ESC = freeswitchPINVOKE.SWITCH_SEQ_ESC_get();
public static readonly char SWITCH_SEQ_HOME_CHAR = freeswitchPINVOKE.SWITCH_SEQ_HOME_CHAR_get();
public static readonly string SWITCH_SEQ_HOME_CHAR_STR = freeswitchPINVOKE.SWITCH_SEQ_HOME_CHAR_STR_get();
@ -5062,6 +5075,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BLANK_STRING_get")]
public static extern string SWITCH_BLANK_STRING_get();
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_TON_UNDEF_get")]
public static extern int SWITCH_TON_UNDEF_get();
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_NUMPLAN_UNDEF_get")]
public static extern int SWITCH_NUMPLAN_UNDEF_get();
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_ESC_get")]
public static extern string SWITCH_SEQ_ESC_get();
@ -10255,8 +10274,8 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_timestamps")]
public static extern int switch_channel_set_timestamps(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_audio_sync")]
public static extern void switch_channel_audio_sync(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_audio_sync")]
public static extern void switch_channel_perform_audio_sync(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_private_flag")]
public static extern void switch_channel_set_private_flag(HandleRef jarg1, uint jarg2);
@ -10321,6 +10340,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_read")]
public static extern IntPtr switch_buffer_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_peek")]
public static extern IntPtr switch_buffer_peek(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_read_loop")]
public static extern IntPtr switch_buffer_read_loop(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
@ -12370,6 +12392,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Ready")]
public static extern bool CoreSession_Ready(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_CoreSession_bridged")]
public static extern bool CoreSession_bridged(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_CoreSession_answered")]
public static extern bool CoreSession_answered(HandleRef jarg1);
@ -21004,7 +21029,7 @@ namespace FreeSWITCH.Native {
SCF_USE_AUTO_NAT = (1 << 6),
SCF_EARLY_HANGUP = (1 << 7),
SCF_CALIBRATE_CLOCK = (1 << 8),
SCF_USE_COND_TIMING = (1 << 9),
SCF_USE_HEAVY_TIMING = (1 << 9),
SCF_USE_CLOCK_RT = (1 << 10)
}

View File

@ -432,6 +432,7 @@ sub DESTROY {
*setAutoHangup = *freeswitchc::CoreSession_setAutoHangup;
*setHangupHook = *freeswitchc::CoreSession_setHangupHook;
*ready = *freeswitchc::CoreSession_ready;
*bridged = *freeswitchc::CoreSession_bridged;
*answered = *freeswitchc::CoreSession_answered;
*mediaReady = *freeswitchc::CoreSession_mediaReady;
*waitForAnswer = *freeswitchc::CoreSession_waitForAnswer;

View File

@ -9367,6 +9367,34 @@ XS(_wrap_CoreSession_ready) {
}
XS(_wrap_CoreSession_bridged) {
{
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_bridged(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_bridged" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
result = (bool)(arg1)->bridged();
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_CoreSession_answered) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
@ -11734,6 +11762,7 @@ 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_bridged", _wrap_CoreSession_bridged},
{"freeswitchc::CoreSession_answered", _wrap_CoreSession_answered},
{"freeswitchc::CoreSession_mediaReady", _wrap_CoreSession_mediaReady},
{"freeswitchc::CoreSession_waitForAnswer", _wrap_CoreSession_waitForAnswer},
@ -12073,17 +12102,17 @@ XS(SWIG_init) {
SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
SvREADONLY_on(sv);

View File

@ -290,6 +290,7 @@ 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 bridged(*args): return _freeswitch.CoreSession_bridged(*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)

View File

@ -8914,6 +8914,28 @@ fail:
}
SWIGINTERN PyObject *_wrap_CoreSession_bridged(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_bridged",&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_bridged" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
result = (bool)(arg1)->bridged();
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_CoreSession_answered(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
@ -10472,6 +10494,7 @@ 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_bridged", _wrap_CoreSession_bridged, 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},

View File

@ -896,6 +896,19 @@ SWITCH_DECLARE(bool) CoreSession::ready() {
return switch_channel_ready(channel) != 0;
}
SWITCH_DECLARE(bool) CoreSession::bridged() {
this_check(false);
if (!session) {
return false;
}
sanity_check(false);
return (switch_channel_up(channel) && switch_channel_test_flag(channel, CF_BRIDGED));
}
SWITCH_DECLARE(bool) CoreSession::mediaReady() {
this_check(false);