Merge remote-tracking branch 'fsorig/master'

This commit is contained in:
Moises Silva
2011-05-27 16:37:24 -04:00
50 changed files with 3458 additions and 2039 deletions
+8
View File
@@ -274,7 +274,15 @@
<extension name="Local_Extension_Skinny">
<condition field="destination_number" expression="^(11[01][0-9])$">
<action application="set" data="dialed_extension=$1"/>
<action application="export" data="dialed_extension=$1"/>
<action application="set" data="call_timeout=30"/>
<action application="set" data="hangup_after_bridge=true"/>
<action application="set" data="continue_on_fail=true"/>
<action application="bridge" data="skinny/internal/${destination_number}"/>
<action application="answer"/>
<action application="sleep" data="1000"/>
<action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_extension}"/>
</condition>
</extension>
+1 -1
View File
@@ -5,7 +5,7 @@
This context is used for skinny to match dialed number
The special applications:
- skinny-route tells skinny to route the call
- skinny-process tells skinny to process the call (route, set call forwarding, ...)
- skinny-drop tells skinny to drop the call
- skinny-wait tells skinny to wait 'data' seconds for more numbers before drop
-->
+1 -1
View File
@@ -1,7 +1,7 @@
<include>
<extension name="Demo">
<condition field="destination_number" expression="^(9[0-9]{3})$">
<action application="skinny-route"/>
<action application="skinny-process"/>
</condition>
</extension>
</include>
@@ -1,12 +1,12 @@
<include>
<extension name="Local_Extension">
<condition field="destination_number" expression="^(10[01][0-9])$">
<action application="skinny-route"/>
<action application="skinny-process"/>
</condition>
</extension>
<extension name="Local_Extension_Skinny">
<condition field="destination_number" expression="^(11[01][0-9])$">
<action application="skinny-route"/>
<action application="skinny-process"/>
</condition>
</extension>
</include>
@@ -1,7 +1,7 @@
<include>
<extension name="External">
<condition field="destination_number" expression="^(0[0-9]{10,})$">
<action application="skinny-route"/>
<action application="skinny-process"/>
</condition>
</extension>
</include>
+1
View File
@@ -6,6 +6,7 @@
<!--voicemail_en_tts is purely implemented with tts, we have the files based one that is the default. -->
<X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/> <!-- vm/tts.xml if you want to use tts and have cepstral -->
<X-PRE-PROCESS cmd="include" data="dir/sounds.xml"/> <!-- dir/tts.xml if you want to use tts and have cepstral -->
<X-PRE-PROCESS cmd="include" data="ivr/*.xml"/> <!-- IVR and custom phrases go here -->
</macros>
</phrases>
</language>
+62 -2
View File
@@ -419,10 +419,11 @@ SWIGEXPORT jboolean JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1setPriority
}
SWIGEXPORT jstring JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1getHeader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
SWIGEXPORT jstring JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1getHeader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3) {
jstring jresult = 0 ;
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 = (int) -1 ;
char *result = 0 ;
(void)jenv;
@@ -434,7 +435,8 @@ SWIGEXPORT jstring JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1getHeader(JN
arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
if (!arg2) return 0;
}
result = (char *)(arg1)->getHeader((char const *)arg2);
arg3 = (int)jarg3;
result = (char *)(arg1)->getHeader((char const *)arg2,arg3);
if(result) jresult = jenv->NewStringUTF((const char *)result);
if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
return jresult;
@@ -522,6 +524,64 @@ SWIGEXPORT jboolean JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1addHeader(J
}
SWIGEXPORT jboolean JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1pushHeader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
jboolean jresult = 0 ;
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(ESLevent **)&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;
}
result = (bool)(arg1)->pushHeader((char const *)arg2,(char const *)arg3);
jresult = (jboolean)result;
if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1unshiftHeader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
jboolean jresult = 0 ;
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(ESLevent **)&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;
}
result = (bool)(arg1)->unshiftHeader((char const *)arg2,(char const *)arg3);
jresult = (jboolean)result;
if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_freeswitch_esl_eslJNI_ESLevent_1delHeader(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
jboolean jresult = 0 ;
ESLevent *arg1 = (ESLevent *) 0 ;
+10 -2
View File
@@ -78,8 +78,8 @@ public class ESLevent {
return eslJNI.ESLevent_setPriority(swigCPtr, this, SWIGTYPE_p_esl_priority_t.getCPtr(priority));
}
public String getHeader(String header_name) {
return eslJNI.ESLevent_getHeader(swigCPtr, this, header_name);
public String getHeader(String header_name, int idx) {
return eslJNI.ESLevent_getHeader(swigCPtr, this, header_name, idx);
}
public String getBody() {
@@ -98,6 +98,14 @@ public class ESLevent {
return eslJNI.ESLevent_addHeader(swigCPtr, this, header_name, value);
}
public boolean pushHeader(String header_name, String value) {
return eslJNI.ESLevent_pushHeader(swigCPtr, this, header_name, value);
}
public boolean unshiftHeader(String header_name, String value) {
return eslJNI.ESLevent_unshiftHeader(swigCPtr, this, header_name, value);
}
public boolean delHeader(String header_name) {
return eslJNI.ESLevent_delHeader(swigCPtr, this, header_name);
}
+3 -1
View File
@@ -21,11 +21,13 @@ class eslJNI {
public final static native void delete_ESLevent(long jarg1);
public final static native String ESLevent_serialize(long jarg1, ESLevent jarg1_, String jarg2);
public final static native boolean ESLevent_setPriority(long jarg1, ESLevent jarg1_, long jarg2);
public final static native String ESLevent_getHeader(long jarg1, ESLevent jarg1_, String jarg2);
public final static native String ESLevent_getHeader(long jarg1, ESLevent jarg1_, String jarg2, int jarg3);
public final static native String ESLevent_getBody(long jarg1, ESLevent jarg1_);
public final static native String ESLevent_getType(long jarg1, ESLevent jarg1_);
public final static native boolean ESLevent_addBody(long jarg1, ESLevent jarg1_, String jarg2);
public final static native boolean ESLevent_addHeader(long jarg1, ESLevent jarg1_, String jarg2, String jarg3);
public final static native boolean ESLevent_pushHeader(long jarg1, ESLevent jarg1_, String jarg2, String jarg3);
public final static native boolean ESLevent_unshiftHeader(long jarg1, ESLevent jarg1_, String jarg2, String jarg3);
public final static native boolean ESLevent_delHeader(long jarg1, ESLevent jarg1_, String jarg2);
public final static native String ESLevent_firstHeader(long jarg1, ESLevent jarg1_);
public final static native String ESLevent_nextHeader(long jarg1, ESLevent jarg1_);
+71 -2
View File
@@ -1923,18 +1923,23 @@ static int _wrap_ESLevent_getHeader(lua_State* L) {
int SWIG_arg = -1;
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 = (int) -1 ;
char *result = 0 ;
SWIG_check_num_args("getHeader",2,2)
SWIG_check_num_args("getHeader",2,3)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getHeader",1,"ESLevent *");
if(!lua_isstring(L,2)) SWIG_fail_arg("getHeader",2,"char const *");
if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg("getHeader",3,"int");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
SWIG_fail_ptr("ESLevent_getHeader",1,SWIGTYPE_p_ESLevent);
}
arg2 = (char *)lua_tostring(L, 2);
result = (char *)(arg1)->getHeader((char const *)arg2);
if(lua_gettop(L)>=3){
arg3 = (int)lua_tonumber(L, 3);
}
result = (char *)(arg1)->getHeader((char const *)arg2,arg3);
SWIG_arg=0;
lua_pushstring(L,(const char*)result); SWIG_arg++;
return SWIG_arg;
@@ -2056,6 +2061,68 @@ fail:
}
static int _wrap_ESLevent_pushHeader(lua_State* L) {
int SWIG_arg = -1;
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
SWIG_check_num_args("pushHeader",3,3)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("pushHeader",1,"ESLevent *");
if(!lua_isstring(L,2)) SWIG_fail_arg("pushHeader",2,"char const *");
if(!lua_isstring(L,3)) SWIG_fail_arg("pushHeader",3,"char const *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
SWIG_fail_ptr("ESLevent_pushHeader",1,SWIGTYPE_p_ESLevent);
}
arg2 = (char *)lua_tostring(L, 2);
arg3 = (char *)lua_tostring(L, 3);
result = (bool)(arg1)->pushHeader((char const *)arg2,(char const *)arg3);
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_ESLevent_unshiftHeader(lua_State* L) {
int SWIG_arg = -1;
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
SWIG_check_num_args("unshiftHeader",3,3)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("unshiftHeader",1,"ESLevent *");
if(!lua_isstring(L,2)) SWIG_fail_arg("unshiftHeader",2,"char const *");
if(!lua_isstring(L,3)) SWIG_fail_arg("unshiftHeader",3,"char const *");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_ESLevent,0))){
SWIG_fail_ptr("ESLevent_unshiftHeader",1,SWIGTYPE_p_ESLevent);
}
arg2 = (char *)lua_tostring(L, 2);
arg3 = (char *)lua_tostring(L, 3);
result = (bool)(arg1)->unshiftHeader((char const *)arg2,(char const *)arg3);
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_ESLevent_delHeader(lua_State* L) {
int SWIG_arg = -1;
ESLevent *arg1 = (ESLevent *) 0 ;
@@ -2146,6 +2213,8 @@ static swig_lua_method swig_ESLevent_methods[] = {
{"getType", _wrap_ESLevent_getType},
{"addBody", _wrap_ESLevent_addBody},
{"addHeader", _wrap_ESLevent_addHeader},
{"pushHeader", _wrap_ESLevent_pushHeader},
{"unshiftHeader", _wrap_ESLevent_unshiftHeader},
{"delHeader", _wrap_ESLevent_delHeader},
{"firstHeader", _wrap_ESLevent_firstHeader},
{"nextHeader", _wrap_ESLevent_nextHeader},
+7 -1
View File
@@ -221,7 +221,7 @@ class ESLPINVOKE {
public static extern bool ESLevent_SetPriority(HandleRef jarg1, HandleRef jarg2);
[DllImport("ESL", EntryPoint="CSharp_ESLevent_GetHeader")]
public static extern string ESLevent_GetHeader(HandleRef jarg1, string jarg2);
public static extern string ESLevent_GetHeader(HandleRef jarg1, string jarg2, int jarg3);
[DllImport("ESL", EntryPoint="CSharp_ESLevent_GetBody")]
public static extern string ESLevent_GetBody(HandleRef jarg1);
@@ -235,6 +235,12 @@ class ESLPINVOKE {
[DllImport("ESL", EntryPoint="CSharp_ESLevent_AddHeader")]
public static extern bool ESLevent_AddHeader(HandleRef jarg1, string jarg2, string jarg3);
[DllImport("ESL", EntryPoint="CSharp_ESLevent_pushHeader")]
public static extern bool ESLevent_pushHeader(HandleRef jarg1, string jarg2, string jarg3);
[DllImport("ESL", EntryPoint="CSharp_ESLevent_unshiftHeader")]
public static extern bool ESLevent_unshiftHeader(HandleRef jarg1, string jarg2, string jarg3);
[DllImport("ESL", EntryPoint="CSharp_ESLevent_DelHeader")]
public static extern bool ESLevent_DelHeader(HandleRef jarg1, string jarg2);
+12 -2
View File
@@ -89,8 +89,8 @@ public class ESLevent : IDisposable {
return ret;
}
public string GetHeader(string header_name) {
string ret = ESLPINVOKE.ESLevent_GetHeader(swigCPtr, header_name);
public string GetHeader(string header_name, int idx) {
string ret = ESLPINVOKE.ESLevent_GetHeader(swigCPtr, header_name, idx);
return ret;
}
@@ -114,6 +114,16 @@ public class ESLevent : IDisposable {
return ret;
}
public bool pushHeader(string header_name, string value) {
bool ret = ESLPINVOKE.ESLevent_pushHeader(swigCPtr, header_name, value);
return ret;
}
public bool unshiftHeader(string header_name, string value) {
bool ret = ESLPINVOKE.ESLevent_unshiftHeader(swigCPtr, header_name, value);
return ret;
}
public bool DelHeader(string header_name) {
bool ret = ESLPINVOKE.ESLevent_DelHeader(swigCPtr, header_name);
return ret;
+36 -2
View File
@@ -436,15 +436,17 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_SetPriority(void * jarg1, vo
}
SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_GetHeader(void * jarg1, char * jarg2) {
SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_GetHeader(void * jarg1, char * jarg2, int jarg3) {
char * jresult ;
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 = (int) -1 ;
char *result = 0 ;
arg1 = (ESLevent *)jarg1;
arg2 = (char *)jarg2;
result = (char *)(arg1)->getHeader((char const *)arg2);
arg3 = (int)jarg3;
result = (char *)(arg1)->getHeader((char const *)arg2,arg3);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
@@ -504,6 +506,38 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_AddHeader(void * jarg1, char
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_pushHeader(void * jarg1, char * jarg2, char * jarg3) {
unsigned int jresult ;
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
arg1 = (ESLevent *)jarg1;
arg2 = (char *)jarg2;
arg3 = (char *)jarg3;
result = (bool)(arg1)->pushHeader((char const *)arg2,(char const *)arg3);
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_unshiftHeader(void * jarg1, char * jarg2, char * jarg3) {
unsigned int jresult ;
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
arg1 = (ESLevent *)jarg1;
arg2 = (char *)jarg2;
arg3 = (char *)jarg3;
result = (bool)(arg1)->unshiftHeader((char const *)arg2,(char const *)arg3);
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_DelHeader(void * jarg1, char * jarg2) {
unsigned int jresult ;
ESLevent *arg1 = (ESLevent *) 0 ;
+2
View File
@@ -88,6 +88,8 @@ sub DESTROY {
*getType = *ESLc::ESLevent_getType;
*addBody = *ESLc::ESLevent_addBody;
*addHeader = *ESLc::ESLevent_addHeader;
*pushHeader = *ESLc::ESLevent_pushHeader;
*unshiftHeader = *ESLc::ESLevent_unshiftHeader;
*delHeader = *ESLc::ESLevent_delHeader;
*firstHeader = *ESLc::ESLevent_firstHeader;
*nextHeader = *ESLc::ESLevent_nextHeader;
+117 -3
View File
@@ -2285,17 +2285,20 @@ XS(_wrap_ESLevent_getHeader) {
{
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 = (int) -1 ;
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int val3 ;
int ecode3 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 2) || (items > 2)) {
SWIG_croak("Usage: ESLevent_getHeader(self,header_name);");
if ((items < 2) || (items > 3)) {
SWIG_croak("Usage: ESLevent_getHeader(self,header_name,idx);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 );
if (!SWIG_IsOK(res1)) {
@@ -2307,14 +2310,23 @@ XS(_wrap_ESLevent_getHeader) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_getHeader" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (char *)(arg1)->getHeader((char const *)arg2);
if (items > 2) {
ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ESLevent_getHeader" "', argument " "3"" of type '" "int""'");
}
arg3 = static_cast< int >(val3);
}
result = (char *)(arg1)->getHeader((char const *)arg2,arg3);
ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
XSRETURN(argvi);
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
SWIG_croak_null();
}
}
@@ -2465,6 +2477,106 @@ XS(_wrap_ESLevent_addHeader) {
}
XS(_wrap_ESLevent_pushHeader) {
{
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 3) || (items > 3)) {
SWIG_croak("Usage: ESLevent_pushHeader(self,header_name,value);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_pushHeader" "', argument " "1"" of type '" "ESLevent *""'");
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_pushHeader" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_pushHeader" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (bool)(arg1)->pushHeader((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
XSRETURN(argvi);
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_croak_null();
}
}
XS(_wrap_ESLevent_unshiftHeader) {
{
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 3) || (items > 3)) {
SWIG_croak("Usage: ESLevent_unshiftHeader(self,header_name,value);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLevent, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_unshiftHeader" "', argument " "1"" of type '" "ESLevent *""'");
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_unshiftHeader" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_unshiftHeader" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (bool)(arg1)->unshiftHeader((char const *)arg2,(char const *)arg3);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
XSRETURN(argvi);
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_croak_null();
}
}
XS(_wrap_ESLevent_delHeader) {
{
ESLevent *arg1 = (ESLevent *) 0 ;
@@ -3658,6 +3770,8 @@ static swig_command_info swig_commands[] = {
{"ESLc::ESLevent_getType", _wrap_ESLevent_getType},
{"ESLc::ESLevent_addBody", _wrap_ESLevent_addBody},
{"ESLc::ESLevent_addHeader", _wrap_ESLevent_addHeader},
{"ESLc::ESLevent_pushHeader", _wrap_ESLevent_pushHeader},
{"ESLc::ESLevent_unshiftHeader", _wrap_ESLevent_unshiftHeader},
{"ESLc::ESLevent_delHeader", _wrap_ESLevent_delHeader},
{"ESLc::ESLevent_firstHeader", _wrap_ESLevent_firstHeader},
{"ESLc::ESLevent_nextHeader", _wrap_ESLevent_nextHeader},
+10 -2
View File
@@ -76,8 +76,8 @@ class ESLevent {
return $r;
}
function getHeader($header_name) {
return ESLevent_getHeader($this->_cPtr,$header_name);
function getHeader($header_name,$idx=-1) {
return ESLevent_getHeader($this->_cPtr,$header_name,$idx);
}
function getBody() {
@@ -96,6 +96,14 @@ class ESLevent {
return ESLevent_addHeader($this->_cPtr,$header_name,$value);
}
function pushHeader($header_name,$value) {
return ESLevent_pushHeader($this->_cPtr,$header_name,$value);
}
function unshiftHeader($header_name,$value) {
return ESLevent_unshiftHeader($this->_cPtr,$header_name,$value);
}
function delHeader($header_name) {
return ESLevent_delHeader($this->_cPtr,$header_name);
}
+97 -5
View File
@@ -1445,13 +1445,16 @@ fail:
ZEND_NAMED_FUNCTION(_wrap_ESLevent_getHeader) {
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 = (int) -1 ;
char *result = 0 ;
zval **args[2];
zval **args[3];
int arg_count;
SWIG_ResetError();
if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {
WRONG_PARAM_COUNT;
}
arg_count = ZEND_NUM_ARGS();
if(arg_count<2 || arg_count>3 ||
zend_get_parameters_array_ex(arg_count,args)!=SUCCESS)
WRONG_PARAM_COUNT;
{
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
@@ -1465,7 +1468,14 @@ ZEND_NAMED_FUNCTION(_wrap_ESLevent_getHeader) {
arg2 = (char *) Z_STRVAL_PP(args[1]);
/*@SWIG@*/;
result = (char *)(arg1)->getHeader((char const *)arg2);
if(arg_count > 2) {
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
convert_to_long_ex(args[2]);
arg3 = (int) Z_LVAL_PP(args[2]);
/*@SWIG@*/;
}
result = (char *)(arg1)->getHeader((char const *)arg2,arg3);
{
if(!result) {
ZVAL_NULL(return_value);
@@ -1612,6 +1622,86 @@ fail:
}
ZEND_NAMED_FUNCTION(_wrap_ESLevent_pushHeader) {
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
zval **args[3];
SWIG_ResetError();
if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) {
WRONG_PARAM_COUNT;
}
{
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_pushHeader. Expected SWIGTYPE_p_ESLevent");
}
}
if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[1]);
arg2 = (char *) Z_STRVAL_PP(args[1]);
/*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[2]);
arg3 = (char *) Z_STRVAL_PP(args[2]);
/*@SWIG@*/;
result = (bool)(arg1)->pushHeader((char const *)arg2,(char const *)arg3);
{
ZVAL_BOOL(return_value,(result)?1:0);
}
return;
fail:
zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
}
ZEND_NAMED_FUNCTION(_wrap_ESLevent_unshiftHeader) {
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
zval **args[3];
SWIG_ResetError();
if(ZEND_NUM_ARGS() != 3 || zend_get_parameters_array_ex(3, args) != SUCCESS) {
WRONG_PARAM_COUNT;
}
{
if(SWIG_ConvertPtr(*args[0], (void **) &arg1, SWIGTYPE_p_ESLevent, 0) < 0) {
SWIG_PHP_Error(E_ERROR, "Type error in argument 1 of ESLevent_unshiftHeader. Expected SWIGTYPE_p_ESLevent");
}
}
if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[1]);
arg2 = (char *) Z_STRVAL_PP(args[1]);
/*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
convert_to_string_ex(args[2]);
arg3 = (char *) Z_STRVAL_PP(args[2]);
/*@SWIG@*/;
result = (bool)(arg1)->unshiftHeader((char const *)arg2,(char const *)arg3);
{
ZVAL_BOOL(return_value,(result)?1:0);
}
return;
fail:
zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
}
ZEND_NAMED_FUNCTION(_wrap_ESLevent_delHeader) {
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
@@ -2547,6 +2637,8 @@ static zend_function_entry ESL_functions[] = {
SWIG_ZEND_NAMED_FE(eslevent_gettype,_wrap_ESLevent_getType,NULL)
SWIG_ZEND_NAMED_FE(eslevent_addbody,_wrap_ESLevent_addBody,NULL)
SWIG_ZEND_NAMED_FE(eslevent_addheader,_wrap_ESLevent_addHeader,NULL)
SWIG_ZEND_NAMED_FE(eslevent_pushheader,_wrap_ESLevent_pushHeader,NULL)
SWIG_ZEND_NAMED_FE(eslevent_unshiftheader,_wrap_ESLevent_unshiftHeader,NULL)
SWIG_ZEND_NAMED_FE(eslevent_delheader,_wrap_ESLevent_delHeader,NULL)
SWIG_ZEND_NAMED_FE(eslevent_firstheader,_wrap_ESLevent_firstHeader,NULL)
SWIG_ZEND_NAMED_FE(eslevent_nextheader,_wrap_ESLevent_nextHeader,NULL)
+2
View File
@@ -46,6 +46,8 @@ ZEND_NAMED_FUNCTION(_wrap_ESLevent_getBody);
ZEND_NAMED_FUNCTION(_wrap_ESLevent_getType);
ZEND_NAMED_FUNCTION(_wrap_ESLevent_addBody);
ZEND_NAMED_FUNCTION(_wrap_ESLevent_addHeader);
ZEND_NAMED_FUNCTION(_wrap_ESLevent_pushHeader);
ZEND_NAMED_FUNCTION(_wrap_ESLevent_unshiftHeader);
ZEND_NAMED_FUNCTION(_wrap_ESLevent_delHeader);
ZEND_NAMED_FUNCTION(_wrap_ESLevent_firstHeader);
ZEND_NAMED_FUNCTION(_wrap_ESLevent_nextHeader);
+2
View File
@@ -59,6 +59,8 @@ class ESLevent:
def getType(*args): return apply(_ESL.ESLevent_getType, args)
def addBody(*args): return apply(_ESL.ESLevent_addBody, args)
def addHeader(*args): return apply(_ESL.ESLevent_addHeader, args)
def pushHeader(*args): return apply(_ESL.ESLevent_pushHeader, args)
def unshiftHeader(*args): return apply(_ESL.ESLevent_unshiftHeader, args)
def delHeader(*args): return apply(_ESL.ESLevent_delHeader, args)
def firstHeader(*args): return apply(_ESL.ESLevent_firstHeader, args)
def nextHeader(*args): return apply(_ESL.ESLevent_nextHeader, args)
+121 -2
View File
@@ -3373,17 +3373,21 @@ SWIGINTERN PyObject *_wrap_ESLevent_getHeader(PyObject *SWIGUNUSEDPARM(self), Py
PyObject *resultobj = 0;
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 = (int) -1 ;
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
if (!PyArg_ParseTuple(args,(char *)"OO:ESLevent_getHeader",&obj0,&obj1)) SWIG_fail;
if (!PyArg_ParseTuple(args,(char *)"OO|O:ESLevent_getHeader",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getHeader" "', argument " "1"" of type '" "ESLevent *""'");
@@ -3394,9 +3398,16 @@ SWIGINTERN PyObject *_wrap_ESLevent_getHeader(PyObject *SWIGUNUSEDPARM(self), Py
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_getHeader" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
if (obj2) {
ecode3 = SWIG_AsVal_int(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ESLevent_getHeader" "', argument " "3"" of type '" "int""'");
}
arg3 = static_cast< int >(val3);
}
{
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
result = (char *)(arg1)->getHeader((char const *)arg2);
result = (char *)(arg1)->getHeader((char const *)arg2,arg3);
SWIG_PYTHON_THREAD_END_ALLOW;
}
resultobj = SWIG_FromCharPtr((const char *)result);
@@ -3562,6 +3573,112 @@ fail:
}
SWIGINTERN PyObject *_wrap_ESLevent_pushHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
if (!PyArg_ParseTuple(args,(char *)"OOO:ESLevent_pushHeader",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_pushHeader" "', argument " "1"" of type '" "ESLevent *""'");
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_pushHeader" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_pushHeader" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
{
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
result = (bool)(arg1)->pushHeader((char const *)arg2,(char const *)arg3);
SWIG_PYTHON_THREAD_END_ALLOW;
}
resultobj = SWIG_From_bool(static_cast< bool >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_PYTHON_THREAD_END_BLOCK;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_PYTHON_THREAD_END_BLOCK;
return NULL;
}
SWIGINTERN PyObject *_wrap_ESLevent_unshiftHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
if (!PyArg_ParseTuple(args,(char *)"OOO:ESLevent_unshiftHeader",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_unshiftHeader" "', argument " "1"" of type '" "ESLevent *""'");
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_unshiftHeader" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_unshiftHeader" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
{
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
result = (bool)(arg1)->unshiftHeader((char const *)arg2,(char const *)arg3);
SWIG_PYTHON_THREAD_END_ALLOW;
}
resultobj = SWIG_From_bool(static_cast< bool >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_PYTHON_THREAD_END_BLOCK;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_PYTHON_THREAD_END_BLOCK;
return NULL;
}
SWIGINTERN PyObject *_wrap_ESLevent_delHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ESLevent *arg1 = (ESLevent *) 0 ;
@@ -4726,6 +4843,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"ESLevent_getType", _wrap_ESLevent_getType, METH_VARARGS, NULL},
{ (char *)"ESLevent_addBody", _wrap_ESLevent_addBody, METH_VARARGS, NULL},
{ (char *)"ESLevent_addHeader", _wrap_ESLevent_addHeader, METH_VARARGS, NULL},
{ (char *)"ESLevent_pushHeader", _wrap_ESLevent_pushHeader, METH_VARARGS, NULL},
{ (char *)"ESLevent_unshiftHeader", _wrap_ESLevent_unshiftHeader, METH_VARARGS, NULL},
{ (char *)"ESLevent_delHeader", _wrap_ESLevent_delHeader, METH_VARARGS, NULL},
{ (char *)"ESLevent_firstHeader", _wrap_ESLevent_firstHeader, METH_VARARGS, NULL},
{ (char *)"ESLevent_nextHeader", _wrap_ESLevent_nextHeader, METH_VARARGS, NULL},
+106 -2
View File
@@ -2396,15 +2396,18 @@ SWIGINTERN VALUE
_wrap_ESLevent_getHeader(int argc, VALUE *argv, VALUE self) {
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 = (int) -1 ;
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int val3 ;
int ecode3 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
if ((argc < 1) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 );
@@ -2417,7 +2420,14 @@ _wrap_ESLevent_getHeader(int argc, VALUE *argv, VALUE self) {
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","getHeader", 2, argv[0] ));
}
arg2 = reinterpret_cast< char * >(buf2);
result = (char *)(arg1)->getHeader((char const *)arg2);
if (argc > 1) {
ecode3 = SWIG_AsVal_int(argv[1], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","getHeader", 3, argv[1] ));
}
arg3 = static_cast< int >(val3);
}
result = (char *)(arg1)->getHeader((char const *)arg2,arg3);
vresult = SWIG_FromCharPtr((const char *)result);
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return vresult;
@@ -2556,6 +2566,98 @@ fail:
}
SWIGINTERN VALUE
_wrap_ESLevent_pushHeader(int argc, VALUE *argv, VALUE self) {
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","pushHeader", 1, self ));
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","pushHeader", 2, argv[0] ));
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","pushHeader", 3, argv[1] ));
}
arg3 = reinterpret_cast< char * >(buf3);
result = (bool)(arg1)->pushHeader((char const *)arg2,(char const *)arg3);
vresult = SWIG_From_bool(static_cast< bool >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return vresult;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return Qnil;
}
SWIGINTERN VALUE
_wrap_ESLevent_unshiftHeader(int argc, VALUE *argv, VALUE self) {
ESLevent *arg1 = (ESLevent *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
bool result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ESLevent, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ESLevent *","unshiftHeader", 1, self ));
}
arg1 = reinterpret_cast< ESLevent * >(argp1);
res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","unshiftHeader", 2, argv[0] ));
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","unshiftHeader", 3, argv[1] ));
}
arg3 = reinterpret_cast< char * >(buf3);
result = (bool)(arg1)->unshiftHeader((char const *)arg2,(char const *)arg3);
vresult = SWIG_From_bool(static_cast< bool >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return vresult;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return Qnil;
}
SWIGINTERN VALUE
_wrap_ESLevent_delHeader(int argc, VALUE *argv, VALUE self) {
ESLevent *arg1 = (ESLevent *) 0 ;
@@ -3835,6 +3937,8 @@ SWIGEXPORT void Init_ESL(void) {
rb_define_method(cESLevent.klass, "getType", VALUEFUNC(_wrap_ESLevent_getType), -1);
rb_define_method(cESLevent.klass, "addBody", VALUEFUNC(_wrap_ESLevent_addBody), -1);
rb_define_method(cESLevent.klass, "addHeader", VALUEFUNC(_wrap_ESLevent_addHeader), -1);
rb_define_method(cESLevent.klass, "pushHeader", VALUEFUNC(_wrap_ESLevent_pushHeader), -1);
rb_define_method(cESLevent.klass, "unshiftHeader", VALUEFUNC(_wrap_ESLevent_unshiftHeader), -1);
rb_define_method(cESLevent.klass, "delHeader", VALUEFUNC(_wrap_ESLevent_delHeader), -1);
rb_define_method(cESLevent.klass, "firstHeader", VALUEFUNC(_wrap_ESLevent_firstHeader), -1);
rb_define_method(cESLevent.klass, "nextHeader", VALUEFUNC(_wrap_ESLevent_nextHeader), -1);
+2 -47
View File
@@ -1025,51 +1025,6 @@ static esl_ssize_t handle_recv(esl_handle_t *handle, void *data, esl_size_t data
return recv(handle->sock, data, datalen, 0);
}
static int add_array(esl_event_t *event, const char *var, const char *val)
{
char *data;
char **array;
int idx;
int max = 0;
int len;
const char *p;
int i;
if (strlen(val) < 8) {
return -1;
}
p = val + 7;
while((p = strstr(p, "::"))) {
max++;
p += 2;
}
if (!max) {
return -2;
}
data = strdup(val + 7);
len = (sizeof(char *) * max) + 1;
array = malloc(len);
memset(array, 0, len);
idx = esl_separate_string_string(data, "::", array, max);
for(i = 0; i < max; i++) {
esl_event_add_header_string(event, ESL_STACK_PUSH, var, array[i]);
}
free(array);
free(data);
return 0;
}
ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_event_t **save_event)
{
char *c;
@@ -1134,7 +1089,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_
esl_url_decode(hval);
esl_log(ESL_LOG_DEBUG, "RECV HEADER [%s] = [%s]\n", hname, hval);
if (!strncmp(hval, "ARRAY::", 7)) {
add_array(revent, hname, hval);
esl_event_add_array(revent, hname, hval);
} else {
esl_event_add_header_string(revent, ESL_STACK_BOTTOM, hname, hval);
}
@@ -1268,7 +1223,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_
}
if (!strncmp(hval, "ARRAY::", 7)) {
add_array(handle->last_ievent, hname, hval);
esl_event_add_array(handle->last_ievent, hname, hval);
} else {
esl_event_add_header_string(handle->last_ievent, ESL_STACK_BOTTOM, hname, hval);
}
+148 -32
View File
@@ -298,7 +298,7 @@ ESL_DECLARE(esl_status_t) esl_event_del_header_val(esl_event_t *event, const cha
esl_assert(x < 1000000);
hash = esl_ci_hashfunc_default(header_name, &hlen);
if ((!hp->hash || hash == hp->hash) && !strcasecmp(header_name, hp->name) && (esl_strlen_zero(val) || !strcmp(hp->value, val))) {
if ((!hp->hash || hash == hp->hash) && (hp->name && !strcasecmp(header_name, hp->name)) && (esl_strlen_zero(val) || !strcmp(hp->value, val))) {
if (lp) {
lp->next = hp->next;
} else {
@@ -338,30 +338,9 @@ ESL_DECLARE(esl_status_t) esl_event_del_header_val(esl_event_t *event, const cha
return status;
}
static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t stack, const char *header_name, char *data)
static esl_event_header_t *new_header(const char *header_name)
{
esl_event_header_t *header = NULL;
esl_ssize_t hlen = -1;
int exists = 0;
if ((stack & ESL_STACK_PUSH) || (stack & ESL_STACK_UNSHIFT) || esl_test_flag(event, ESL_EF_CONTAINS_ARRAYS)) {
if ((header = esl_event_get_header_ptr(event, header_name))) {
if (!(stack & ESL_STACK_PUSH) && !(stack & ESL_STACK_UNSHIFT) && header->idx) {
stack |= ESL_STACK_PUSH;
}
if ((stack & ESL_STACK_PUSH) || (stack & ESL_STACK_UNSHIFT)) {
exists++;
stack &= ~(ESL_STACK_TOP | ESL_STACK_BOTTOM);
} else {
header = NULL;
}
}
}
if (!header) {
esl_event_header_t *header;
#ifdef ESL_EVENT_RECYCLE
void *pop;
@@ -373,16 +352,144 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
esl_assert(header);
#ifdef ESL_EVENT_RECYCLE
}
#endif
#endif
memset(header, 0, sizeof(*header));
header->name = DUP(header_name);
return header;
}
ESL_DECLARE(int) esl_event_add_array(esl_event_t *event, const char *var, const char *val)
{
char *data;
char **array;
int max = 0;
int len;
const char *p;
int i;
if (strlen(val) < 8) {
return -1;
}
p = val + 7;
max = 1;
while((p = strstr(p, "|:"))) {
max++;
p += 2;
}
if (!max) {
return -2;
}
data = strdup(val + 7);
len = (sizeof(char *) * max) + 1;
array = malloc(len);
esl_assert(array);
memset(array, 0, len);
esl_separate_string_string(data, "|:", array, max);
for(i = 0; i < max; i++) {
esl_event_add_header_string(event, ESL_STACK_PUSH, var, array[i]);
}
free(array);
free(data);
return 0;
}
static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t stack, const char *header_name, char *data)
{
esl_event_header_t *header = NULL;
esl_ssize_t hlen = -1;
int exists = 0, fly = 0;
char *index_ptr;
int index = 0;
char *real_header_name = NULL;
if ((index_ptr = strchr(header_name, '['))) {
index_ptr++;
index = atoi(index_ptr);
real_header_name = DUP(header_name);
if ((index_ptr = strchr(real_header_name, '['))) {
*index_ptr++ = '\0';
}
header_name = real_header_name;
}
if (index_ptr || (stack & ESL_STACK_PUSH) || (stack & ESL_STACK_UNSHIFT)) {
if (!(header = esl_event_get_header_ptr(event, header_name)) && index_ptr) {
header = new_header(header_name);
if (esl_test_flag(event, ESL_EF_UNIQ_HEADERS)) {
esl_event_del_header(event, header_name);
}
fly++;
}
if ((header = esl_event_get_header_ptr(event, header_name))) {
if (index_ptr) {
if (index > -1 && index <= 4000) {
if (index < header->idx) {
FREE(header->array[index]);
header->array[index] = DUP(data);
} else {
int i;
char **m;
m = realloc(header->array, sizeof(char *) * (index + 1));
esl_assert(m);
header->array = m;
for (i = header->idx; i < index; i++) {
m[i] = DUP("");
}
m[index] = DUP(data);
header->idx = index + 1;
if (!fly) {
exists = 1;
}
goto redraw;
}
}
goto end;
} else {
if ((stack & ESL_STACK_PUSH) || (stack & ESL_STACK_UNSHIFT)) {
exists++;
stack &= ~(ESL_STACK_TOP | ESL_STACK_BOTTOM);
} else {
header = NULL;
}
}
}
}
if (!header) {
if (esl_test_flag(event, ESL_EF_UNIQ_HEADERS)) {
esl_event_del_header(event, header_name);
}
memset(header, 0, sizeof(*header));
if (strstr(data, "ARRAY::")) {
esl_event_add_array(event, header_name, data);
FREE(data);
goto end;
}
header->name = DUP(header_name);
header = new_header(header_name);
}
if ((stack & ESL_STACK_PUSH) || (stack & ESL_STACK_UNSHIFT)) {
@@ -391,8 +498,6 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
char *hv;
int i = 0, j = 0;
esl_set_flag(event, ESL_EF_CONTAINS_ARRAYS);
if (header->value && !header->idx) {
m = malloc(sizeof(char *));
esl_assert(m);
@@ -419,6 +524,8 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
header->idx++;
header->array = m;
redraw:
len = 0;
for(j = 0; j < header->idx; j++) {
len += strlen(header->array[j]) + 2;
}
@@ -428,9 +535,10 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
hv = realloc(header->value, len);
esl_assert(hv);
header->value = hv;
esl_snprintf(header->value, len, "ARRAY::");
for(j = 0; j < header->idx; j++) {
esl_snprintf(header->value + strlen(header->value), len - strlen(header->value), "%s%s", j == 0 ? "" : "::", header->array[j]);
esl_snprintf(header->value + strlen(header->value), len - strlen(header->value), "%s%s", j == 0 ? "" : "|:", header->array[j]);
}
}
@@ -458,6 +566,10 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
}
}
end:
esl_safe_free(real_header_name);
return ESL_SUCCESS;
}
@@ -681,10 +793,12 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
if ((len + llen) > dlen) {
char *m;
char *old = buf;
dlen += (blocksize + (len + llen));
if ((m = realloc(buf, dlen))) {
buf = m;
} else {
buf = old;
abort();
}
}
@@ -708,10 +822,12 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
if ((len + llen) > dlen) {
char *m;
char *old = buf;
dlen += (blocksize + (len + llen));
if ((m = realloc(buf, dlen))) {
buf = m;
} else {
buf = old;
abort();
}
}
@@ -768,7 +884,7 @@ ESL_DECLARE(esl_status_t) esl_event_create_json(esl_event_t **event, const char
for (i = 0; i < x; i++) {
cJSON *item = cJSON_GetArrayItem(cjp, i);
if (item && item->type == cJSON_String && item->valuestring) {
if (item != NULL && item->type == cJSON_String && item->valuestring) {
esl_event_add_header_string(new_event, ESL_STACK_PUSH, name, item->valuestring);
}
}
+28 -2
View File
@@ -390,12 +390,12 @@ bool ESLevent::setPriority(esl_priority_t priority)
return false;
}
const char *ESLevent::getHeader(const char *header_name)
const char *ESLevent::getHeader(const char *header_name, int idx)
{
this_check("");
if (event) {
return esl_event_get_header(event, header_name);
return esl_event_get_header_idx(event, header_name, idx);
} else {
esl_log(ESL_LOG_ERROR, "Trying to getHeader an event that does not exist!\n");
}
@@ -415,6 +415,32 @@ bool ESLevent::addHeader(const char *header_name, const char *value)
return false;
}
bool ESLevent::pushHeader(const char *header_name, const char *value)
{
this_check(false);
if (event) {
return esl_event_add_header_string(event, ESL_STACK_PUSH, header_name, value) == ESL_SUCCESS ? true : false;
} else {
esl_log(ESL_LOG_ERROR, "Trying to addHeader an event that does not exist!\n");
}
return false;
}
bool ESLevent::unshiftHeader(const char *header_name, const char *value)
{
this_check(false);
if (event) {
return esl_event_add_header_string(event, ESL_STACK_UNSHIFT, header_name, value) == ESL_SUCCESS ? true : false;
} else {
esl_log(ESL_LOG_ERROR, "Trying to addHeader an event that does not exist!\n");
}
return false;
}
bool ESLevent::delHeader(const char *header_name)
{
this_check(false);
+3 -2
View File
@@ -180,8 +180,7 @@ struct esl_event {
};
typedef enum {
ESL_EF_UNIQ_HEADERS = (1 << 0),
ESL_EF_CONTAINS_ARRAYS = (1 << 1)
ESL_EF_UNIQ_HEADERS = (1 << 0)
} esl_event_flag_t;
@@ -234,6 +233,8 @@ ESL_DECLARE(char *)esl_event_get_body(esl_event_t *event);
ESL_DECLARE(esl_status_t) esl_event_add_header(esl_event_t *event, esl_stack_t stack,
const char *header_name, const char *fmt, ...); //PRINTF_FUNCTION(4, 5);
ESL_DECLARE(int) esl_event_add_array(esl_event_t *event, const char *var, const char *val);
/*!
\brief Add a string header to an event
\param event the event to add the header to
+3 -1
View File
@@ -56,11 +56,13 @@ class ESLevent {
virtual ~ESLevent();
const char *serialize(const char *format = NULL);
bool setPriority(esl_priority_t priority = ESL_PRIORITY_NORMAL);
const char *getHeader(const char *header_name);
const char *getHeader(const char *header_name, int idx = -1);
char *getBody(void);
const char *getType(void);
bool addBody(const char *value);
bool addHeader(const char *header_name, const char *value);
bool pushHeader(const char *header_name, const char *value);
bool unshiftHeader(const char *header_name, const char *value);
bool delHeader(const char *header_name);
const char *firstHeader(void);
const char *nextHeader(void);
@@ -881,6 +881,12 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event)
uint8_t call_state = 0;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
if (!suInstId && !spInstId) {
/* We already cleared this call */
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dropping STATUS CONFIRM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId);
return;
}
if (staEvnt->callSte.eh.pres && staEvnt->callSte.callGlblSte.pres) {
call_state = staEvnt->callSte.callGlblSte.val;
@@ -502,12 +502,16 @@ void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, St
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
/* We sometimes receive a STA CFM after receiving a RELEASE/RELEASE COMPLETE, so we need to lock
here in case we are calling clear_call_data at the same time this function is called */
ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex);
if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
!(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId);
ftdm_assert(0, "Inconsistent call states\n");
ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex);
return;
}
@@ -526,6 +530,7 @@ void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, St
memcpy(&sngisdn_event->event.staEvnt, staEvnt, sizeof(*staEvnt));
ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event);
ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex);
ISDN_FUNC_TRACE_EXIT(__FUNCTION__);
}
@@ -100,12 +100,12 @@ void clear_call_data(sngisdn_chan_data_t *sngisdn_info)
ftdm_mutex_lock(g_sngisdn_data.ccs[cc_id].mutex);
g_sngisdn_data.ccs[cc_id].active_spInstIds[sngisdn_info->spInstId]=NULL;
g_sngisdn_data.ccs[cc_id].active_suInstIds[sngisdn_info->suInstId]=NULL;
ftdm_mutex_unlock(g_sngisdn_data.ccs[cc_id].mutex);
sngisdn_info->suInstId = 0;
sngisdn_info->spInstId = 0;
sngisdn_info->globalFlg = 0;
sngisdn_info->flags = 0;
ftdm_mutex_unlock(g_sngisdn_data.ccs[cc_id].mutex);
return;
}
+10 -6
View File
@@ -1066,16 +1066,20 @@ static __inline__ ftdm_status_t zt_channel_process_event(ftdm_channel_t *fchan,
break;
case ZT_EVENT_BADFCS:
{
ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Bad frame checksum (ZT_EVENT_BADFCS)!\n");
/* What else could we do? */
*event_id = FTDM_OOB_NOOP;
ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Bad frame checksum (ZT_EVENT_BADFCS)\n");
*event_id = FTDM_OOB_NOOP; /* What else could we do? */
}
break;
case ZT_EVENT_OVERRUN:
{
ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Driver overrun! (ZT_EVENT_OVERRUN)\n");
/* What else could we do? */
*event_id = FTDM_OOB_NOOP;
ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "HDLC frame overrun (ZT_EVENT_OVERRUN)\n");
*event_id = FTDM_OOB_NOOP; /* What else could we do? */
}
break;
case ZT_EVENT_ABORT:
{
ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "HDLC abort frame received (ZT_EVENT_ABORT)\n");
*event_id = FTDM_OOB_NOOP; /* What else could we do? */
}
break;
case ZT_EVENT_NONE:
+3 -4
View File
@@ -103,8 +103,7 @@ struct switch_event {
};
typedef enum {
EF_UNIQ_HEADERS = (1 << 0),
EF_CONTAINS_ARRAYS = (1 << 1),
EF_UNIQ_HEADERS = (1 << 0)
} switch_event_flag_t;
@@ -152,7 +151,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_set_priority(switch_event_t *event,
\return the value of the requested header
*/
_Ret_opt_z_ SWITCH_DECLARE(switch_event_header_t *) switch_event_get_header_ptr(switch_event_t *event, const char *header_name);
SWITCH_DECLARE(switch_event_header_t *) switch_event_get_header_ptr(switch_event_t *event, const char *header_name);
_Ret_opt_z_ SWITCH_DECLARE(char *) switch_event_get_header_idx(switch_event_t *event, const char *header_name, int idx);
#define switch_event_get_header(_e, _h) switch_event_get_header_idx(_e, _h, -1)
@@ -192,7 +191,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_add_header_string(switch_event_t *e
SWITCH_DECLARE(switch_status_t) switch_event_del_header_val(switch_event_t *event, const char *header_name, const char *val);
#define switch_event_del_header(_e, _h) switch_event_del_header_val(_e, _h, NULL)
SWITCH_DECLARE(int) switch_event_add_array(switch_event_t *event, const char *var, const char *val);
/*!
\brief Destroy an event
\param event pointer to the pointer to event to destroy
+5
View File
@@ -137,14 +137,17 @@ typedef int gid_t;
#ifdef WIN32
#if defined(SWITCH_CORE_DECLARE_STATIC)
#define SWITCH_DECLARE(type) type __stdcall
#define SWITCH_DECLARE_TYPEDEF(type, name) type (__stdcall name)
#define SWITCH_DECLARE_NONSTD(type) type __cdecl
#define SWITCH_DECLARE_DATA
#elif defined(FREESWITCHCORE_EXPORTS)
#define SWITCH_DECLARE(type) __declspec(dllexport) type __stdcall
#define SWITCH_DECLARE_TYPEDEF(type, name) __declspec(dllexport) type (__stdcall name)
#define SWITCH_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
#define SWITCH_DECLARE_DATA __declspec(dllexport)
#else
#define SWITCH_DECLARE(type) __declspec(dllimport) type __stdcall
#define SWITCH_DECLARE_TYPEDEF(type, name) __declspec(dllimport) type (__stdcall name)
#define SWITCH_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
#define SWITCH_DECLARE_DATA __declspec(dllimport)
#endif
@@ -174,6 +177,7 @@ typedef int gid_t;
#define O_BINARY 0
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(SWITCH_API_VISIBILITY)
#define SWITCH_DECLARE(type) __attribute__((visibility("default"))) type
#define SWITCH_DECLARE_TYPEDEF(type, name) type (name)
#define SWITCH_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type
#define SWITCH_DECLARE_DATA __attribute__((visibility("default")))
#define SWITCH_MOD_DECLARE(type) __attribute__((visibility("default"))) type
@@ -182,6 +186,7 @@ typedef int gid_t;
#define SWITCH_DECLARE_CLASS __attribute__((visibility("default")))
#else
#define SWITCH_DECLARE(type) type
#define SWITCH_DECLARE_TYPEDEF(type, name) type (name)
#define SWITCH_DECLARE_NONSTD(type) type
#define SWITCH_DECLARE_DATA
#define SWITCH_MOD_DECLARE(type) type
+1 -1
View File
@@ -1690,7 +1690,7 @@ struct switch_console_callback_match {
};
typedef struct switch_console_callback_match switch_console_callback_match_t;
typedef void (*switch_cap_callback_t) (const char *var, const char *val, void *user_data);
typedef SWITCH_DECLARE_TYPEDEF(void, *switch_cap_callback_t) (const char *var, const char *val, void *user_data);
typedef switch_status_t (*switch_console_complete_callback_t) (const char *, const char *, switch_console_callback_match_t **matches);
typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void *, switch_abc_type_t);
typedef switch_bool_t (*switch_tone_detect_callback_t) (switch_core_session_t *, const char *, const char *);
@@ -2320,7 +2320,7 @@ SWITCH_STANDARD_APP(capture_function)
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) == 3) {
if ((proceed = switch_regex_perform(argv[1], argv[2], &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
switch_capture_regex(re, proceed, argv[1], ovector, argv[0], (switch_cap_callback_t)switch_regex_set_var_callback, session);
switch_capture_regex(re, proceed, argv[1], ovector, argv[0], switch_regex_set_var_callback, session);
}
switch_regex_safe_free(re);
} else {
@@ -2529,8 +2529,7 @@ SWITCH_STANDARD_APP(audio_bridge_function)
char *tof_data = NULL;
char *tof_array[4] = { 0 };
//int tof_arrayc = 0;
const char *continue_on_fail = NULL, *failure_causes = NULL,
*v_campon = NULL, *v_campon_retries, *v_campon_sleep, *v_campon_timeout, *v_campon_fallback_exten = NULL;
const char *v_campon = NULL, *v_campon_retries, *v_campon_sleep, *v_campon_timeout, *v_campon_fallback_exten = NULL;
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
int campon_retries = 100, campon_timeout = 10, campon_sleep = 10, tmp, camping = 0, fail = 0, thread_started = 0;
struct camping_stake stake = { 0 };
@@ -2544,15 +2543,11 @@ SWITCH_STANDARD_APP(audio_bridge_function)
return;
}
continue_on_fail = switch_channel_get_variable(caller_channel, "continue_on_fail");
transfer_on_fail = switch_channel_get_variable(caller_channel, "transfer_on_fail");
tof_data = switch_core_session_strdup(session, transfer_on_fail);
switch_split(tof_data, ' ', tof_array);
transfer_on_fail = tof_array[0];
failure_causes = switch_channel_get_variable(caller_channel, "failure_causes");
if ((v_campon = switch_channel_get_variable(caller_channel, "campon")) && switch_true(v_campon)) {
const char *cid_name = NULL;
const char *cid_number = NULL;
@@ -2693,6 +2688,11 @@ SWITCH_STANDARD_APP(audio_bridge_function)
EXCEPTION... ATTENDED_TRANSFER never is a reason to continue.......
*/
if (cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
const char *continue_on_fail = NULL, *failure_causes = NULL;
continue_on_fail = switch_channel_get_variable(caller_channel, "continue_on_fail");
failure_causes = switch_channel_get_variable(caller_channel, "failure_causes");
if (continue_on_fail || failure_causes) {
const char *cause_str;
char cause_num[35] = "";
@@ -224,7 +224,7 @@ static int sangoma_create_rtp_port(void *usr_priv, uint32_t host_ip, uint32_t *p
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New allocated port %d for IP %s/%d.%d.%d.%d\n", rtp_port, local_ip,
SNGTC_NIPV4(host_ip));
*p_rtp_port = rtp_port;
*rtp_fd = (void *)(long)rtp_port;
*rtp_fd = NULL;
return 0;
}
@@ -259,6 +259,9 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r
switch_port_t rtp_port;
struct sangoma_transcoding_session *sess = usr_priv;
rtp_port = codec_req_leg->host_udp_port;
*rtp_fd = NULL;
/*
* We *MUST* use a new pool
* Do not use the session pool since the session may go away while the RTP socket should linger around
@@ -271,10 +274,6 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r
return -1;
}
rtp_port = (switch_port_t)(long)*rtp_fd;
codec_req_leg->host_udp_port = rtp_port;
local_ip_addr.s_addr = htonl(codec_req_leg->host_ip);
switch_inet_ntop(AF_INET, &local_ip_addr, local_ip, sizeof(local_ip));
sngtc_codec_ipv4_hex_to_str(codec_reply_leg->codec_ip, codec_ip);
@@ -307,6 +306,9 @@ static int sangoma_destroy_rtp(void *usr_priv, void *fd)
{
switch_memory_pool_t *sesspool;
switch_rtp_t *rtp = fd;
if (!rtp) {
return 0;
}
sesspool = switch_rtp_get_private(rtp);
switch_rtp_destroy(&rtp);
switch_core_destroy_memory_pool(&sesspool);
@@ -224,7 +224,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
} else {
if (field && strchr(expression, '(')) {
switch_channel_set_variable(channel, "DP_MATCH", NULL);
switch_capture_regex(re, proceed, field_data, ovector, "DP_MATCH", (switch_cap_callback_t)switch_regex_set_var_callback, session);
switch_capture_regex(re, proceed, field_data, ovector, "DP_MATCH", switch_regex_set_var_callback, session);
}
for (xaction = switch_xml_child(xcond, "action"); xaction; xaction = xaction->next) {
+264 -264
View File
@@ -50,58 +50,58 @@ skinny_globals_t globals;
/* SQL TABLES */
/*****************************************************************************/
static char devices_sql[] =
"CREATE TABLE skinny_devices (\n"
" name VARCHAR(16),\n"
" user_id INTEGER,\n"
" instance INTEGER,\n"
" ip VARCHAR(15),\n"
" type INTEGER,\n"
" max_streams INTEGER,\n"
" port INTEGER,\n"
" codec_string VARCHAR(255),\n"
" headset INTEGER,\n"
" handset INTEGER,\n"
" speaker INTEGER\n"
");\n";
"CREATE TABLE skinny_devices (\n"
" name VARCHAR(16),\n"
" user_id INTEGER,\n"
" instance INTEGER,\n"
" ip VARCHAR(15),\n"
" type INTEGER,\n"
" max_streams INTEGER,\n"
" port INTEGER,\n"
" codec_string VARCHAR(255),\n"
" headset INTEGER,\n"
" handset INTEGER,\n"
" speaker INTEGER\n"
");\n";
static char lines_sql[] =
"CREATE TABLE skinny_lines (\n"
" device_name VARCHAR(16),\n"
" device_instance INTEGER,\n"
" position INTEGER,\n"
" line_instance INTEGER,\n"
" label VARCHAR(40),\n"
" value VARCHAR(24),\n"
" caller_name VARCHAR(44),\n"
" ring_on_idle INTEGER,\n"
" ring_on_active INTEGER,\n"
" busy_trigger INTEGER,\n"
" forward_all VARCHAR(255),\n"
" forward_busy VARCHAR(255),\n"
" forward_noanswer VARCHAR(255),\n"
" noanswer_duration INTEGER\n"
");\n";
"CREATE TABLE skinny_lines (\n"
" device_name VARCHAR(16),\n"
" device_instance INTEGER,\n"
" position INTEGER,\n"
" line_instance INTEGER,\n"
" label VARCHAR(40),\n"
" value VARCHAR(24),\n"
" caller_name VARCHAR(44),\n"
" ring_on_idle INTEGER,\n"
" ring_on_active INTEGER,\n"
" busy_trigger INTEGER,\n"
" forward_all VARCHAR(255),\n"
" forward_busy VARCHAR(255),\n"
" forward_noanswer VARCHAR(255),\n"
" noanswer_duration INTEGER\n"
");\n";
static char buttons_sql[] =
"CREATE TABLE skinny_buttons (\n"
" device_name VARCHAR(16),\n"
" device_instance INTEGER,\n"
" position INTEGER,\n"
" type INTEGER,\n"
" label VARCHAR(40),\n"
" value VARCHAR(255),\n"
" settings VARCHAR(44)\n"
");\n";
"CREATE TABLE skinny_buttons (\n"
" device_name VARCHAR(16),\n"
" device_instance INTEGER,\n"
" position INTEGER,\n"
" type INTEGER,\n"
" label VARCHAR(40),\n"
" value VARCHAR(255),\n"
" settings VARCHAR(44)\n"
");\n";
static char active_lines_sql[] =
"CREATE TABLE skinny_active_lines (\n"
" device_name VARCHAR(16),\n"
" device_instance INTEGER,\n"
" line_instance INTEGER,\n"
" channel_uuid VARCHAR(256),\n"
" call_id INTEGER,\n"
" call_state INTEGER\n"
");\n";
"CREATE TABLE skinny_active_lines (\n"
" device_name VARCHAR(16),\n"
" device_instance INTEGER,\n"
" line_instance INTEGER,\n"
" channel_uuid VARCHAR(256),\n"
" call_id INTEGER,\n"
" call_state INTEGER\n"
");\n";
/*****************************************************************************/
/* PROFILES FUNCTIONS */
@@ -238,7 +238,7 @@ char * skinny_profile_find_session_uuid(skinny_profile_t *profile, listener_t *l
if(listener) {
device_condition = switch_mprintf("device_name='%s' AND device_instance=%d",
listener->device_name, listener->device_instance);
listener->device_name, listener->device_instance);
} else {
device_condition = switch_mprintf("1=1");
}
@@ -256,14 +256,14 @@ char * skinny_profile_find_session_uuid(skinny_profile_t *profile, listener_t *l
}
switch_assert(call_id_condition);
if((sql = switch_mprintf(
"SELECT channel_uuid, line_instance "
"FROM skinny_active_lines "
"WHERE %s AND %s AND %s "
"ORDER BY call_state, channel_uuid", /* off hook first */
device_condition, line_instance_condition, call_id_condition
))) {
"SELECT channel_uuid, line_instance "
"FROM skinny_active_lines "
"WHERE %s AND %s AND %s "
"ORDER BY call_state, channel_uuid", /* off hook first */
device_condition, line_instance_condition, call_id_condition
))) {
skinny_execute_sql_callback(profile, profile->sql_mutex, sql,
skinny_profile_find_session_uuid_callback, &helper);
skinny_profile_find_session_uuid_callback, &helper);
switch_safe_free(sql);
}
switch_safe_free(device_condition);
@@ -291,8 +291,8 @@ switch_core_session_t * skinny_profile_find_session(skinny_profile_t *profile, l
#endif
if(!result) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Unable to find session %s on %s:%d, line %d\n",
uuid, listener->device_name, listener->device_instance, *line_instance_p);
"Unable to find session %s on %s:%d, line %d\n",
uuid, listener->device_name, listener->device_instance, *line_instance_p);
}
switch_safe_free(uuid);
}
@@ -340,7 +340,7 @@ switch_status_t skinny_execute_sql(skinny_profile_t *profile, char *sql, switch_
status = switch_cache_db_execute_sql(dbh, sql, NULL);
end:
end:
switch_cache_db_release_db_handle(&dbh);
@@ -352,7 +352,7 @@ switch_status_t skinny_execute_sql(skinny_profile_t *profile, char *sql, switch_
}
switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback,
void *pdata)
void *pdata)
{
switch_bool_t ret = SWITCH_FALSE;
char *errmsg = NULL;
@@ -374,7 +374,7 @@ switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile, switch_mute
free(errmsg);
}
end:
end:
switch_cache_db_release_db_handle(&dbh);
@@ -400,9 +400,9 @@ void skinny_line_perform_set_state(const char *file, const char *func, int line,
switch_event_fire(&event);
send_call_state(listener, call_state, line_instance, call_id);
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG,
"Device %s:%d, Line %d, Call %d Change State to %s (%d)\n",
listener->device_name, listener->device_instance, line_instance, call_id,
skinny_call_state2str(call_state), call_state);
"Device %s:%d, Line %d, Call %d Change State to %s (%d)\n",
listener->device_name, listener->device_instance, line_instance, call_id,
skinny_call_state2str(call_state), call_state);
}
@@ -443,13 +443,13 @@ uint32_t skinny_line_get_state(listener_t *listener, uint32_t line_instance, uin
helper.call_state = -1;
if ((sql = switch_mprintf(
"SELECT call_state FROM skinny_active_lines "
"WHERE device_name='%s' AND device_instance=%d "
"AND %s AND %s "
"ORDER BY call_state, channel_uuid", /* off hook first */
listener->device_name, listener->device_instance,
line_instance_condition, call_id_condition
))) {
"SELECT call_state FROM skinny_active_lines "
"WHERE device_name='%s' AND device_instance=%d "
"AND %s AND %s "
"ORDER BY call_state, channel_uuid", /* off hook first */
listener->device_name, listener->device_instance,
line_instance_condition, call_id_condition
))) {
skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_line_get_state_callback, &helper);
switch_safe_free(sql);
}
@@ -475,13 +475,13 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
switch_goto_status(SWITCH_STATUS_SUCCESS, end);
}
if (strcasecmp(tech_pvt->read_impl.iananame, tech_pvt->iananame) ||
tech_pvt->read_impl.samples_per_second != tech_pvt->rm_rate ||
tech_pvt->codec_ms != (uint32_t)tech_pvt->read_impl.microseconds_per_packet / 1000) {
tech_pvt->read_impl.samples_per_second != tech_pvt->rm_rate ||
tech_pvt->codec_ms != (uint32_t)tech_pvt->read_impl.microseconds_per_packet / 1000) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Changing Codec from %s@%dms to %s@%dms\n",
tech_pvt->read_impl.iananame, tech_pvt->read_impl.microseconds_per_packet / 1000,
tech_pvt->rm_encoding, tech_pvt->codec_ms);
tech_pvt->read_impl.iananame, tech_pvt->read_impl.microseconds_per_packet / 1000,
tech_pvt->rm_encoding, tech_pvt->codec_ms);
switch_core_session_lock_codec_write(tech_pvt->session);
switch_core_session_lock_codec_read(tech_pvt->session);
resetting = 1;
@@ -494,25 +494,25 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
}
if (switch_core_codec_init(&tech_pvt->read_codec,
tech_pvt->iananame,
tech_pvt->rm_fmtp,
tech_pvt->rm_rate,
tech_pvt->codec_ms,
1,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | 0 /* TODO tech_pvt->profile->codec_flags */,
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
tech_pvt->iananame,
tech_pvt->rm_fmtp,
tech_pvt->rm_rate,
tech_pvt->codec_ms,
1,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | 0 /* TODO tech_pvt->profile->codec_flags */,
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n");
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
if (switch_core_codec_init(&tech_pvt->write_codec,
tech_pvt->iananame,
tech_pvt->rm_fmtp,
tech_pvt->rm_rate,
tech_pvt->codec_ms,
1,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | 0 /* TODO tech_pvt->profile->codec_flags */,
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
tech_pvt->iananame,
tech_pvt->rm_fmtp,
tech_pvt->rm_rate,
tech_pvt->codec_ms,
1,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | 0 /* TODO tech_pvt->profile->codec_flags */,
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n");
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
@@ -530,9 +530,9 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
switch_assert(tech_pvt->read_codec.implementation);
if (switch_rtp_change_interval(tech_pvt->rtp_session,
tech_pvt->read_impl.microseconds_per_packet,
tech_pvt->read_impl.samples_per_packet
) != SWITCH_STATUS_SUCCESS) {
tech_pvt->read_impl.microseconds_per_packet,
tech_pvt->read_impl.samples_per_packet
) != SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -549,8 +549,8 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Codec %s %s/%ld %d ms %d samples\n",
"" /* TODO switch_channel_get_name(tech_pvt->channel)*/, tech_pvt->iananame, tech_pvt->rm_rate, tech_pvt->codec_ms,
tech_pvt->read_impl.samples_per_packet);
"" /* TODO switch_channel_get_name(tech_pvt->channel)*/, tech_pvt->iananame, tech_pvt->rm_rate, tech_pvt->codec_ms,
tech_pvt->read_impl.samples_per_packet);
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
tech_pvt->write_codec.agreed_pt = tech_pvt->agreed_pt;
@@ -562,16 +562,16 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
}
/* TODO
tech_pvt->fmtp_out = switch_core_session_strdup(tech_pvt->session, tech_pvt->write_codec.fmtp_out);
*/
tech_pvt->fmtp_out = switch_core_session_strdup(tech_pvt->session, tech_pvt->write_codec.fmtp_out);
*/
/* TODO
if (switch_rtp_ready(tech_pvt->rtp_session)) {
switch_rtp_set_default_payload(tech_pvt->rtp_session, tech_pvt->pt);
}
*/
if (switch_rtp_ready(tech_pvt->rtp_session)) {
switch_rtp_set_default_payload(tech_pvt->rtp_session, tech_pvt->pt);
}
*/
end:
end:
if (resetting) {
switch_core_session_unlock_codec_write(tech_pvt->session);
switch_core_session_unlock_codec_read(tech_pvt->session);
@@ -600,7 +600,7 @@ void tech_init(private_t *tech_pvt, skinny_profile_t *profile, switch_core_sessi
State methods they get called when the state changes to the specific state
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
*/
*/
switch_status_t channel_on_init(switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -641,23 +641,23 @@ int channel_on_routing_callback(void *pArg, int argc, char **argv, char **column
skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener);
if(listener) {
if(!strcmp(device_name, helper->listener->device_name)
&& (device_instance == helper->listener->device_instance)
&& (line_instance == helper->line_instance)) {/* the calling line */
if(!strcmp(device_name, helper->listener->device_name)
&& (device_instance == helper->listener->device_instance)
&& (line_instance == helper->line_instance)) {/* the calling line */
helper->tech_pvt->caller_profile->dialplan = switch_core_strdup(helper->tech_pvt->caller_profile->pool, listener->profile->dialplan);
helper->tech_pvt->caller_profile->context = switch_core_strdup(helper->tech_pvt->caller_profile->pool, listener->profile->context);
send_dialed_number(listener, helper->tech_pvt->caller_profile->destination_number, line_instance, helper->tech_pvt->call_id);
skinny_line_set_state(listener, line_instance, helper->tech_pvt->call_id, SKINNY_PROCEED);
skinny_session_send_call_info(helper->tech_pvt->session, listener, line_instance);
skinny_session_ring_out(helper->tech_pvt->session, listener, line_instance);
} else {
} else {
send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_ON);
skinny_line_set_state(listener, line_instance, helper->tech_pvt->call_id, SKINNY_IN_USE_REMOTELY);
send_select_soft_keys(listener, line_instance, helper->tech_pvt->call_id, SKINNY_KEY_SET_IN_USE_HINT, 0xffff);
send_display_prompt_status(listener, 0, SKINNY_DISP_IN_USE_REMOTE,
line_instance, helper->tech_pvt->call_id);
line_instance, helper->tech_pvt->call_id);
skinny_session_send_call_info(helper->tech_pvt->session, listener, line_instance);
}
}
}
return 0;
}
@@ -673,15 +673,15 @@ switch_status_t channel_on_routing(switch_core_session_t *session)
struct channel_on_routing_helper helper = {0};
if(switch_test_flag(tech_pvt, TFLAG_FORCE_ROUTE)) {
action = SKINNY_ACTION_ROUTE;
action = SKINNY_ACTION_PROCESS;
} else {
action = skinny_session_dest_match_pattern(session, &data);
}
switch(action) {
case SKINNY_ACTION_ROUTE:
case SKINNY_ACTION_PROCESS:
skinny_profile_find_listener_by_device_name_and_instance(tech_pvt->profile,
switch_channel_get_variable(channel, "skinny_device_name"),
atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
switch_channel_get_variable(channel, "skinny_device_name"),
atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
if (listener) {
helper.tech_pvt = tech_pvt;
helper.listener = listener;
@@ -689,8 +689,8 @@ switch_status_t channel_on_routing(switch_core_session_t *session)
skinny_session_walk_lines(tech_pvt->profile, switch_core_session_get_uuid(session), channel_on_routing_callback, &helper);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Could not find listener %s:%s for Channel %s\n",
switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"),
switch_channel_get_name(channel));
switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"),
switch_channel_get_name(channel));
}
/* Future bridge should go straight */
switch_set_flag_locked(tech_pvt, TFLAG_FORCE_ROUTE);
@@ -777,16 +777,16 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN
send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF);
switch (helper->cause) {
case SWITCH_CAUSE_UNALLOCATED_NUMBER:
send_start_tone(listener, SKINNY_TONE_REORDER, 0, line_instance, call_id);
send_start_tone(listener, SKINNY_TONE_REORDER, 0, line_instance, call_id);
skinny_session_send_call_info(helper->tech_pvt->session, listener, line_instance);
send_display_prompt_status(listener, 0, SKINNY_DISP_UNKNOWN_NUMBER, line_instance, call_id);
break;
case SWITCH_CAUSE_USER_BUSY:
send_start_tone(listener, SKINNY_TONE_BUSYTONE, 0, line_instance, call_id);
send_start_tone(listener, SKINNY_TONE_BUSYTONE, 0, line_instance, call_id);
send_display_prompt_status(listener, 0, SKINNY_DISP_BUSY, line_instance, call_id);
break;
break;
case SWITCH_CAUSE_NORMAL_CLEARING:
send_clear_prompt_status(listener, line_instance, call_id);
send_clear_prompt_status(listener, line_instance, call_id);
break;
default:
send_display_prompt_status(listener, 0, switch_channel_cause2str(helper->cause), line_instance, call_id);
@@ -821,9 +821,9 @@ switch_status_t channel_on_hangup(switch_core_session_t *session)
skinny_session_walk_lines(tech_pvt->profile, switch_core_session_get_uuid(session), channel_on_hangup_callback, &helper);
if ((sql = switch_mprintf(
"DELETE FROM skinny_active_lines WHERE channel_uuid='%s'",
switch_core_session_get_uuid(session)
))) {
"DELETE FROM skinny_active_lines WHERE channel_uuid='%s'",
switch_core_session_get_uuid(session)
))) {
skinny_execute_sql(tech_pvt->profile, sql, tech_pvt->profile->sql_mutex);
switch_safe_free(sql);
}
@@ -836,16 +836,16 @@ switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
private_t *tech_pvt = switch_core_session_get_private(session);
switch (sig) {
case SWITCH_SIG_KILL:
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
break;
case SWITCH_SIG_BREAK:
if (switch_rtp_ready(tech_pvt->rtp_session)) {
switch_rtp_break(tech_pvt->rtp_session);
}
break;
default:
break;
case SWITCH_SIG_KILL:
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
break;
case SWITCH_SIG_BREAK:
if (switch_rtp_ready(tech_pvt->rtp_session)) {
switch_rtp_break(tech_pvt->rtp_session);
}
break;
default:
break;
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL KILL %d\n", switch_channel_get_name(channel), sig);
@@ -968,8 +968,8 @@ switch_status_t channel_answer_channel(switch_core_session_t *session)
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name_and_instance(tech_pvt->profile,
switch_channel_get_variable(channel, "skinny_device_name"),
atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
switch_channel_get_variable(channel, "skinny_device_name"),
atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
if (listener) {
int x = 0;
skinny_session_start_media(session, listener, atoi(switch_channel_get_variable(channel, "skinny_line_instance")));
@@ -978,13 +978,13 @@ switch_status_t channel_answer_channel(switch_core_session_t *session)
switch_cond_next();
if (++x > 1000) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Wait tooo long to answer %s:%s\n",
switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"));
switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"));
return SWITCH_STATUS_FALSE;
}
}
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unable to find listener to answer %s:%s\n",
switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"));
switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"));
}
return SWITCH_STATUS_SUCCESS;
}
@@ -995,24 +995,24 @@ switch_status_t channel_receive_message(switch_core_session_t *session, switch_c
private_t *tech_pvt = switch_core_session_get_private(session);
switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_ANSWER:
switch_clear_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
return channel_answer_channel(session);
case SWITCH_MESSAGE_INDICATE_DISPLAY:
skinny_session_send_call_info_all(session);
return SWITCH_STATUS_SUCCESS;
case SWITCH_MESSAGE_INDICATE_PROGRESS:
if (!switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
/* early media */
switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
case SWITCH_MESSAGE_INDICATE_ANSWER:
switch_clear_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
return channel_answer_channel(session);
}
return SWITCH_STATUS_SUCCESS;
default:
return SWITCH_STATUS_SUCCESS;
case SWITCH_MESSAGE_INDICATE_DISPLAY:
skinny_session_send_call_info_all(session);
return SWITCH_STATUS_SUCCESS;
case SWITCH_MESSAGE_INDICATE_PROGRESS:
if (!switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
/* early media */
switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
return channel_answer_channel(session);
}
return SWITCH_STATUS_SUCCESS;
default:
return SWITCH_STATUS_SUCCESS;
}
@@ -1020,10 +1020,10 @@ switch_status_t channel_receive_message(switch_core_session_t *session, switch_c
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
*/
switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
{
switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
switch_core_session_t *nsession = NULL;
@@ -1082,13 +1082,13 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
tech_pvt->caller_profile = caller_profile;
if ((sql = switch_mprintf(
"INSERT INTO skinny_active_lines "
"(device_name, device_instance, line_instance, channel_uuid, call_id, call_state) "
"SELECT device_name, device_instance, line_instance, '%s', %d, %d "
"FROM skinny_lines "
"WHERE value='%s'",
switch_core_session_get_uuid(nsession), tech_pvt->call_id, SKINNY_ON_HOOK, dest
))) {
"INSERT INTO skinny_active_lines "
"(device_name, device_instance, line_instance, channel_uuid, call_id, call_state) "
"SELECT device_name, device_instance, line_instance, '%s', %d, %d "
"FROM skinny_lines "
"WHERE value='%s'",
switch_core_session_get_uuid(nsession), tech_pvt->call_id, SKINNY_ON_HOOK, dest
))) {
skinny_execute_sql(profile, sql, profile->sql_mutex);
switch_safe_free(sql);
}
@@ -1098,7 +1098,7 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
switch_channel_set_variable(switch_core_session_get_channel(session), SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(nsession));
switch_channel_set_variable(nchannel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(session));
}
cause = skinny_ring_lines(tech_pvt, session);
if(cause != SWITCH_CAUSE_SUCCESS) {
@@ -1116,7 +1116,7 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
cause = SWITCH_CAUSE_SUCCESS;
goto done;
error:
error:
if (nsession) {
switch_core_session_destroy(&nsession);
}
@@ -1126,7 +1126,7 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
}
done:
done:
if (profile) {
if (cause == SWITCH_CAUSE_SUCCESS) {
@@ -1267,37 +1267,37 @@ static void flush_listener(listener_t *listener)
char *sql;
if ((sql = switch_mprintf(
"SELECT '%q', value, '%q', '%q', '%d' "
"FROM skinny_lines "
"WHERE device_name='%s' AND device_instance=%d "
"ORDER BY position",
profile->name, profile->domain, listener->device_name, listener->device_instance,
listener->device_name, listener->device_instance
))) {
"SELECT '%q', value, '%q', '%q', '%d' "
"FROM skinny_lines "
"WHERE device_name='%s' AND device_instance=%d "
"ORDER BY position",
profile->name, profile->domain, listener->device_name, listener->device_instance,
listener->device_name, listener->device_instance
))) {
skinny_execute_sql_callback(profile, profile->sql_mutex, sql, flush_listener_callback, NULL);
switch_safe_free(sql);
}
if ((sql = switch_mprintf(
"DELETE FROM skinny_devices "
"WHERE name='%s' and instance=%d",
listener->device_name, listener->device_instance))) {
"DELETE FROM skinny_devices "
"WHERE name='%s' and instance=%d",
listener->device_name, listener->device_instance))) {
skinny_execute_sql(profile, sql, profile->sql_mutex);
switch_safe_free(sql);
}
if ((sql = switch_mprintf(
"DELETE FROM skinny_lines "
"WHERE device_name='%s' and device_instance=%d",
listener->device_name, listener->device_instance))) {
"DELETE FROM skinny_lines "
"WHERE device_name='%s' and device_instance=%d",
listener->device_name, listener->device_instance))) {
skinny_execute_sql(profile, sql, profile->sql_mutex);
switch_safe_free(sql);
}
if ((sql = switch_mprintf(
"DELETE FROM skinny_buttons "
"WHERE device_name='%s' and device_instance=%d",
listener->device_name, listener->device_instance))) {
"DELETE FROM skinny_buttons "
"WHERE device_name='%s' and device_instance=%d",
listener->device_name, listener->device_instance))) {
skinny_execute_sql(profile, sql, profile->sql_mutex);
switch_safe_free(sql);
}
@@ -1348,8 +1348,8 @@ switch_status_t dump_device(skinny_profile_t *profile, const char *device_name,
{
char *sql;
if ((sql = switch_mprintf("SELECT name, user_id, instance, ip, type, max_streams, port, codec_string, headset, handset, speaker "
"FROM skinny_devices WHERE name='%s'",
device_name))) {
"FROM skinny_devices WHERE name='%s'",
device_name))) {
skinny_execute_sql_callback(profile, profile->sql_mutex, sql, dump_device_callback, stream);
switch_safe_free(sql);
}
@@ -1372,7 +1372,7 @@ static void close_socket(switch_socket_t **sock, skinny_profile_t *profile)
static switch_status_t kill_listener(listener_t *listener, void *pvt)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Killing listener %s:%d.\n",
listener->device_name, listener->device_instance);
listener->device_name, listener->device_instance);
switch_clear_flag(listener, LFLAG_RUNNING);
close_socket(&listener->sock, listener->profile);
return SWITCH_STATUS_SUCCESS;
@@ -1435,7 +1435,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
switch(status) {
case SWITCH_STATUS_TIMEOUT:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Communication Time Out with %s:%d.\n",
listener->remote_ip, listener->remote_port);
listener->remote_ip, listener->remote_port);
if(listener->expire_time < switch_epoch_time_now(NULL)) {
switch_event_t *event = NULL;
@@ -1446,7 +1446,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
break;
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Communication Error with %s:%d.\n",
listener->remote_ip, listener->remote_port);
listener->remote_ip, listener->remote_port);
}
switch_clear_flag_locked(listener, LFLAG_RUNNING);
break;
@@ -1470,7 +1470,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
if (listener->profile->debug > 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Communication Complete with %s:%d.\n",
listener->remote_ip, listener->remote_port);
listener->remote_ip, listener->remote_port);
}
switch_thread_rwlock_wrlock(listener->rwlock);
@@ -1484,7 +1484,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
if (listener->profile->debug > 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Communication Closed with %s:%d.\n",
listener->remote_ip, listener->remote_port);
listener->remote_ip, listener->remote_port);
}
if(destroy_pool == 0) {
@@ -1559,7 +1559,7 @@ new_socket:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Socket up listening on %s:%u\n", profile->ip, profile->port);
break;
sock_fail:
sock_fail:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", profile->ip, profile->port);
switch_yield(100000);
}
@@ -1622,7 +1622,7 @@ new_socket:
}
end:
end:
close_socket(&profile->sock, profile);
@@ -1635,7 +1635,7 @@ new_socket:
}
fail:
fail:
return NULL;
}
@@ -1677,7 +1677,7 @@ switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, c
if (profile->sock && !strcasecmp(var, "odbc-dsn")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Skinny profile setting 'odbc-dsn' can't be changed while running\n");
"Skinny profile setting 'odbc-dsn' can't be changed while running\n");
return SWITCH_STATUS_FALSE;
}
@@ -1758,7 +1758,7 @@ static switch_status_t load_skinny_config(void)
switch_xml_t xsettings, xdevice_types, xsoft_key_set_sets;
if (zstr(profile_name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"<profile> is missing name attribute\n");
"<profile> is missing name attribute\n");
continue;
}
if ((xsettings = switch_xml_child(xprofile, "settings"))) {
@@ -1767,11 +1767,11 @@ static switch_status_t load_skinny_config(void)
switch_core_db_t *db;
skinny_profile_t *profile = NULL;
switch_xml_t param;
if (switch_core_new_memory_pool(&profile_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
return SWITCH_STATUS_TERM;
}
if (switch_core_new_memory_pool(&profile_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
return SWITCH_STATUS_TERM;
}
profile = switch_core_alloc(profile_pool, sizeof(skinny_profile_t));
profile->pool = profile_pool;
profile->name = switch_core_strdup(profile->pool, profile_name);
@@ -1780,17 +1780,17 @@ static switch_status_t load_skinny_config(void)
switch_mutex_init(&profile->listener_mutex, SWITCH_MUTEX_NESTED, profile->pool);
switch_mutex_init(&profile->sock_mutex, SWITCH_MUTEX_NESTED, profile->pool);
switch_mutex_init(&profile->flag_mutex, SWITCH_MUTEX_NESTED, profile->pool);
for (param = switch_xml_child(xsettings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
if (skinny_profile_set(profile, var, val) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Unable to set skinny setting '%s'. Does it exists?\n", var);
"Unable to set skinny setting '%s'. Does it exists?\n", var);
}
} /* param */
if (!profile->dialplan) {
skinny_profile_set(profile, "dialplan","XML");
}
@@ -1838,8 +1838,8 @@ static switch_status_t load_skinny_config(void)
}
if (soft_key_set_id > 15) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"soft-key-set name '%s' is greater than 15 in soft-key-set-set '%s' in profile %s.\n",
switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name);
"soft-key-set name '%s' is greater than 15 in soft-key-set-set '%s' in profile %s.\n",
switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name);
continue;
}
for (string_pos = 0; string_pos <= string_len; string_pos++) {
@@ -1847,8 +1847,8 @@ static switch_status_t load_skinny_config(void)
val[string_pos] = '\0';
if (field_no > 15) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"soft-key-set name '%s' is limited to 16 buttons in soft-key-set-set '%s' in profile %s.\n",
switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name);
"soft-key-set name '%s' is limited to 16 buttons in soft-key-set-set '%s' in profile %s.\n",
switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name);
break;
}
message->data.soft_key_set.soft_key_set[soft_key_set_id].soft_key_template_index[field_no++] = skinny_str2soft_key_event(&val[start]);
@@ -1857,28 +1857,28 @@ static switch_status_t load_skinny_config(void)
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Unknown soft-key-set name '%s' in soft-key-set-set '%s' in profile %s.\n",
switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name);
"Unknown soft-key-set name '%s' in soft-key-set-set '%s' in profile %s.\n",
switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name);
}
} /* soft-key-set */
switch_core_hash_insert(profile->soft_key_set_sets_hash, soft_key_set_set_name, message);
switch_core_hash_insert(profile->soft_key_set_sets_hash, soft_key_set_set_name, message);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"<soft-key-set-set> is missing a name attribute in profile %s.\n", profile->name);
"<soft-key-set-set> is missing a name attribute in profile %s.\n", profile->name);
}
} /* soft-key-set-set */
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"<soft-key-set-sets> is missing in profile %s.\n", profile->name);
"<soft-key-set-sets> is missing in profile %s.\n", profile->name);
} /* soft-key-set-sets */
if (!switch_core_hash_find(profile->soft_key_set_sets_hash, "default")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Profile %s doesn't have a default <soft-key-set-set>. Profile ignored.\n", profile->name);
"Profile %s doesn't have a default <soft-key-set-set>. Profile ignored.\n", profile->name);
switch_core_destroy_memory_pool(&profile_pool);
continue;
}
/* Device types */
switch_core_hash_init(&profile->device_type_params_hash, profile->pool);
if ((xdevice_types = switch_xml_child(xprofile, "device-types"))) {
@@ -1893,13 +1893,13 @@ static switch_status_t load_skinny_config(void)
char *val = (char *) switch_xml_attr_soft(param, "value");
if (!strcasecmp(var, "firmware-version")) {
strncpy(params->firmware_version, val, 16);
strncpy(params->firmware_version, val, 16);
}
} /* param */
switch_core_hash_insert(profile->device_type_params_hash, id_str, params);
switch_core_hash_insert(profile->device_type_params_hash, id_str, params);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Unknow device type %s in profile %s.\n", switch_xml_attr_soft(xdevice_type, "id"), profile->name);
"Unknow device type %s in profile %s.\n", switch_xml_attr_soft(xdevice_type, "id"), profile->name);
}
}
}
@@ -1936,7 +1936,7 @@ static switch_status_t load_skinny_config(void)
}
switch_core_db_close(db);
}
skinny_execute_sql_callback(profile, profile->sql_mutex, "DELETE FROM skinny_devices", NULL, NULL);
skinny_execute_sql_callback(profile, profile->sql_mutex, "DELETE FROM skinny_lines", NULL, NULL);
skinny_execute_sql_callback(profile, profile->sql_mutex, "DELETE FROM skinny_buttons", NULL, NULL);
@@ -1945,13 +1945,13 @@ static switch_status_t load_skinny_config(void)
skinny_profile_respawn(profile, 0);
/* Register profile */
switch_mutex_lock(globals.mutex);
switch_core_hash_insert(globals.profile_hash, profile->name, profile);
switch_mutex_unlock(globals.mutex);
switch_mutex_lock(globals.mutex);
switch_core_hash_insert(globals.profile_hash, profile->name, profile);
switch_mutex_unlock(globals.mutex);
profile = NULL;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Settings are missing from profile %s.\n", profile_name);
"Settings are missing from profile %s.\n", profile_name);
} /* settings */
} /* profile */
}
@@ -1991,26 +1991,26 @@ static void skinny_user_to_device_event_handler(switch_event_t *event)
case USER_TO_DEVICE_DATA_MESSAGE:
data_length = strlen(data); /* we ignore data_length sent */
send_data(listener, message_type,
application_id, line_instance, call_id, transaction_id, data_length,
data);
application_id, line_instance, call_id, transaction_id, data_length,
data);
case USER_TO_DEVICE_DATA_VERSION1_MESSAGE:
data_length = strlen(data); /* we ignore data_length sent */
send_extended_data(listener, message_type,
application_id, line_instance, call_id, transaction_id, data_length,
sequence_flag, display_priority, conference_id, app_instance_id, routing_id,
data);
application_id, line_instance, call_id, transaction_id, data_length,
sequence_flag, display_priority, conference_id, app_instance_id, routing_id,
data);
break;
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Incorrect message type %s (%d).\n", skinny_message_type2str(message_type), message_type);
"Incorrect message type %s (%d).\n", skinny_message_type2str(message_type), message_type);
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Device %s:%d in profile '%s' not found.\n", device_name, device_instance, profile_name);
"Device %s:%d in profile '%s' not found.\n", device_name, device_instance, profile_name);
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Profile '%s' not found.\n", profile_name);
"Profile '%s' not found.\n", profile_name);
}
}
@@ -2032,41 +2032,41 @@ static void skinny_call_state_event_handler(switch_event_t *event)
if ((profile = skinny_find_profile(profile_name))) {
skinny_profile_find_listener_by_device_name_and_instance(profile, device_name, device_instance, &listener);
if(listener) {
if(line_instance > 0) {
line_instance_condition = switch_mprintf("line_instance=%d", line_instance);
} else {
line_instance_condition = switch_mprintf("1=1");
}
switch_assert(line_instance_condition);
if(call_id > 0) {
call_id_condition = switch_mprintf("call_id=%d", call_id);
} else {
call_id_condition = switch_mprintf("1=1");
}
switch_assert(call_id_condition);
if(listener) {
if(line_instance > 0) {
line_instance_condition = switch_mprintf("line_instance=%d", line_instance);
} else {
line_instance_condition = switch_mprintf("1=1");
}
switch_assert(line_instance_condition);
if(call_id > 0) {
call_id_condition = switch_mprintf("call_id=%d", call_id);
} else {
call_id_condition = switch_mprintf("1=1");
}
switch_assert(call_id_condition);
if ((sql = switch_mprintf(
"UPDATE skinny_active_lines "
"SET call_state=%d "
"WHERE device_name='%s' AND device_instance=%d "
"AND %s AND %s",
call_state,
listener->device_name, listener->device_instance,
line_instance_condition, call_id_condition
))) {
skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
switch_safe_free(sql);
}
switch_safe_free(line_instance_condition);
switch_safe_free(call_id_condition);
if ((sql = switch_mprintf(
"UPDATE skinny_active_lines "
"SET call_state=%d "
"WHERE device_name='%s' AND device_instance=%d "
"AND %s AND %s",
call_state,
listener->device_name, listener->device_instance,
line_instance_condition, call_id_condition
))) {
skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex);
switch_safe_free(sql);
}
switch_safe_free(line_instance_condition);
switch_safe_free(call_id_condition);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Device %s:%d in profile '%s' not found.\n", device_name, device_instance, profile_name);
"Device %s:%d in profile '%s' not found.\n", device_name, device_instance, profile_name);
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Profile '%s' not found.\n", profile_name);
"Profile '%s' not found.\n", profile_name);
}
}
}
@@ -2089,7 +2089,7 @@ int skinny_message_waiting_event_handler_callback(void *pArg, int argc, char **a
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name_and_instance(helper->profile,
device_name, device_instance, &listener);
device_name, device_instance, &listener);
if (listener) {
if (helper->yn == SWITCH_TRUE) {
@@ -2143,15 +2143,15 @@ static void skinny_message_waiting_event_handler(switch_event_t *event)
count_str = switch_event_get_header(event, "mwi-voice-message");
if ((sql = switch_mprintf(
"SELECT device_name, device_instance FROM skinny_lines "
"WHERE value='%s' AND line_instance=1", user))) {
"SELECT device_name, device_instance FROM skinny_lines "
"WHERE value='%s' AND line_instance=1", user))) {
struct skinny_message_waiting_event_handler_helper helper = {0};
helper.profile = profile;
helper.yn = switch_true(yn);
if (count_str) {
sscanf(count_str,"%d/%d (%d/%d)",
&helper.total_new_messages, &helper.total_saved_messages,
&helper.total_new_urgent_messages, &helper.total_saved_urgent_messages);
&helper.total_new_messages, &helper.total_saved_messages,
&helper.total_new_urgent_messages, &helper.total_saved_urgent_messages);
}
skinny_execute_sql_callback(profile, profile->sql_mutex, sql, skinny_message_waiting_event_handler_callback, &helper);
switch_safe_free(sql);
@@ -2285,7 +2285,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load)
switch_hash_this(hi, NULL, NULL, &val);
profile = (skinny_profile_t *) val;
launch_skinny_profile_thread(profile);
}
switch_mutex_unlock(globals.mutex);
@@ -2303,7 +2303,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skinny_shutdown)
int sanity = 0;
skinny_api_unregister();
/* release events */
switch_event_unbind(&globals.user_to_device_node);
switch_event_unbind(&globals.call_state_node);
+62 -62
View File
@@ -48,66 +48,66 @@
#define SKINNY_EVENT_DEVICE_TO_USER "skinny::device_to_user"
struct skinny_globals {
int running;
switch_memory_pool_t *pool;
switch_mutex_t *mutex;
switch_hash_t *profile_hash;
switch_event_node_t *user_to_device_node;
switch_event_node_t *call_state_node;
switch_event_node_t *message_waiting_node;
switch_event_node_t *trap_node;
int auto_restart;
int running;
switch_memory_pool_t *pool;
switch_mutex_t *mutex;
switch_hash_t *profile_hash;
switch_event_node_t *user_to_device_node;
switch_event_node_t *call_state_node;
switch_event_node_t *message_waiting_node;
switch_event_node_t *trap_node;
int auto_restart;
};
typedef struct skinny_globals skinny_globals_t;
extern skinny_globals_t globals;
typedef enum {
PFLAG_LISTENER_READY = (1 << 0),
PFLAG_SHOULD_RESPAWN = (1 << 1),
PFLAG_RESPAWN = (1 << 2),
PFLAG_LISTENER_READY = (1 << 0),
PFLAG_SHOULD_RESPAWN = (1 << 1),
PFLAG_RESPAWN = (1 << 2),
} profile_flag_t;
struct skinny_profile {
/* prefs */
char *name;
char *domain;
char *ip;
unsigned int port;
char *dialplan;
char *context;
char *patterns_dialplan;
char *patterns_context;
uint32_t keep_alive;
char date_format[6];
int debug;
/* prefs */
char *name;
char *domain;
char *ip;
unsigned int port;
char *dialplan;
char *context;
char *patterns_dialplan;
char *patterns_context;
uint32_t keep_alive;
char date_format[6];
int debug;
int auto_restart;
switch_hash_t *soft_key_set_sets_hash;
switch_hash_t *device_type_params_hash;
/* db */
char *dbname;
char *odbc_dsn;
char *odbc_user;
char *odbc_pass;
switch_odbc_handle_t *master_odbc;
switch_mutex_t *sql_mutex;
/* stats */
uint32_t ib_calls;
uint32_t ob_calls;
uint32_t ib_failed_calls;
uint32_t ob_failed_calls;
/* listener */
int listener_threads;
switch_mutex_t *listener_mutex;
switch_socket_t *sock;
switch_mutex_t *sock_mutex;
struct listener *listeners;
int flags;
switch_mutex_t *flag_mutex;
/* call id */
uint32_t next_call_id;
/* others */
switch_memory_pool_t *pool;
switch_hash_t *soft_key_set_sets_hash;
switch_hash_t *device_type_params_hash;
/* db */
char *dbname;
char *odbc_dsn;
char *odbc_user;
char *odbc_pass;
switch_odbc_handle_t *master_odbc;
switch_mutex_t *sql_mutex;
/* stats */
uint32_t ib_calls;
uint32_t ob_calls;
uint32_t ib_failed_calls;
uint32_t ob_failed_calls;
/* listener */
int listener_threads;
switch_mutex_t *listener_mutex;
switch_socket_t *sock;
switch_mutex_t *sock_mutex;
struct listener *listeners;
int flags;
switch_mutex_t *flag_mutex;
/* call id */
uint32_t next_call_id;
/* others */
switch_memory_pool_t *pool;
};
typedef struct skinny_profile skinny_profile_t;
@@ -117,7 +117,7 @@ struct skinny_device_type_params {
typedef struct skinny_device_type_params skinny_device_type_params_t;
typedef enum {
SKINNY_ACTION_ROUTE,
SKINNY_ACTION_PROCESS,
SKINNY_ACTION_DROP,
SKINNY_ACTION_WAIT
} skinny_action_t;
@@ -127,7 +127,7 @@ typedef enum {
/*****************************************************************************/
typedef enum {
LFLAG_RUNNING = (1 << 0),
LFLAG_RUNNING = (1 << 0),
} listener_flag_t;
#define SKINNY_MAX_LINES 42
@@ -161,25 +161,25 @@ typedef switch_status_t (*skinny_listener_callback_func_t) (listener_t *listener
/* CHANNEL TYPES */
/*****************************************************************************/
typedef enum {
TFLAG_FORCE_ROUTE = (1 << 0),
TFLAG_EARLY_MEDIA = (1 << 1),
TFLAG_IO = (1 << 2),
TFLAG_READING = (1 << 3),
TFLAG_WRITING = (1 << 4)
TFLAG_FORCE_ROUTE = (1 << 0),
TFLAG_EARLY_MEDIA = (1 << 1),
TFLAG_IO = (1 << 2),
TFLAG_READING = (1 << 3),
TFLAG_WRITING = (1 << 4)
} TFLAGS;
typedef enum {
GFLAG_MY_CODEC_PREFS = (1 << 0)
GFLAG_MY_CODEC_PREFS = (1 << 0)
} GFLAGS;
struct private_object {
unsigned int flags;
switch_mutex_t *flag_mutex;
switch_frame_t read_frame;
unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
switch_core_session_t *session;
switch_caller_profile_t *caller_profile;
switch_mutex_t *mutex;
switch_mutex_t *flag_mutex;
/* identification */
skinny_profile_t *profile;
@@ -236,7 +236,7 @@ void profile_walk_listeners(skinny_profile_t *profile, skinny_listener_callback_
switch_cache_db_handle_t *skinny_get_db_handle(skinny_profile_t *profile);
switch_status_t skinny_execute_sql(skinny_profile_t *profile, char *sql, switch_mutex_t *mutex);
switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile,
switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata);
switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata);
/*****************************************************************************/
/* LISTENER FUNCTIONS */
@@ -261,8 +261,8 @@ switch_status_t channel_on_routing(switch_core_session_t *session);
switch_status_t channel_on_exchange_media(switch_core_session_t *session);
switch_status_t channel_on_soft_execute(switch_core_session_t *session);
switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
+349 -349
View File
@@ -41,202 +41,202 @@
static switch_status_t skinny_api_list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_console_callback_match_t *my_matches = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
switch_hash_index_t *hi;
void *val;
skinny_profile_t *profile;
switch_console_callback_match_t *my_matches = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
switch_hash_index_t *hi;
void *val;
skinny_profile_t *profile;
/* walk profiles */
switch_mutex_lock(globals.mutex);
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (skinny_profile_t *) val;
/* walk profiles */
switch_mutex_lock(globals.mutex);
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (skinny_profile_t *) val;
switch_console_push_match(&my_matches, profile->name);
}
switch_mutex_unlock(globals.mutex);
switch_console_push_match(&my_matches, profile->name);
}
switch_mutex_unlock(globals.mutex);
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
return status;
}
struct match_helper {
switch_console_callback_match_t *my_matches;
switch_console_callback_match_t *my_matches;
};
static int skinny_api_list_devices_callback(void *pArg, int argc, char **argv, char **columnNames)
{
struct match_helper *h = (struct match_helper *) pArg;
char *device_name = argv[0];
struct match_helper *h = (struct match_helper *) pArg;
char *device_name = argv[0];
switch_console_push_match(&h->my_matches, device_name);
return 0;
switch_console_push_match(&h->my_matches, device_name);
return 0;
}
static switch_status_t skinny_api_list_devices(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
struct match_helper h = { 0 };
switch_status_t status = SWITCH_STATUS_FALSE;
skinny_profile_t *profile = NULL;
char *sql;
struct match_helper h = { 0 };
switch_status_t status = SWITCH_STATUS_FALSE;
skinny_profile_t *profile = NULL;
char *sql;
char *myline;
char *argv[1024] = { 0 };
int argc = 0;
char *myline;
char *argv[1024] = { 0 };
int argc = 0;
if (!(myline = strdup(line))) {
status = SWITCH_STATUS_MEMERR;
return status;
}
if (!(argc = switch_separate_string(myline, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || argc < 4) {
return status;
}
if (!(myline = strdup(line))) {
status = SWITCH_STATUS_MEMERR;
return status;
}
if (!(argc = switch_separate_string(myline, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || argc < 4) {
return status;
}
if(!strcasecmp(argv[1], "profile")) {/* skinny profile <profile_name> ... */
profile = skinny_find_profile(argv[2]);
} else if(!strcasecmp(argv[2], "profile")) {/* skinny status profile <profile_name> ... */
profile = skinny_find_profile(argv[3]);
}
if(!strcasecmp(argv[1], "profile")) {/* skinny profile <profile_name> ... */
profile = skinny_find_profile(argv[2]);
} else if(!strcasecmp(argv[2], "profile")) {/* skinny status profile <profile_name> ... */
profile = skinny_find_profile(argv[3]);
}
if(profile) {
if ((sql = switch_mprintf("SELECT name FROM skinny_devices"))) {
skinny_execute_sql_callback(profile, profile->sql_mutex, sql, skinny_api_list_devices_callback, &h);
switch_safe_free(sql);
}
}
if(profile) {
if ((sql = switch_mprintf("SELECT name FROM skinny_devices"))) {
skinny_execute_sql_callback(profile, profile->sql_mutex, sql, skinny_api_list_devices_callback, &h);
switch_safe_free(sql);
}
}
if (h.my_matches) {
*matches = h.my_matches;
status = SWITCH_STATUS_SUCCESS;
}
if (h.my_matches) {
*matches = h.my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
return status;
}
static switch_status_t skinny_api_list_reset_types(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_DEVICE_RESET_TYPES
return status;
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_DEVICE_RESET_TYPES
return status;
}
static switch_status_t skinny_api_list_stimuli(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_STIMULI
return status;
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_STIMULI
return status;
}
static switch_status_t skinny_api_list_ring_types(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_RING_TYPES
return status;
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_RING_TYPES
return status;
}
static switch_status_t skinny_api_list_ring_modes(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_RING_MODES
return status;
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_RING_MODES
return status;
}
static switch_status_t skinny_api_list_stimulus_instances(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_console_callback_match_t *my_matches = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
switch_console_callback_match_t *my_matches = NULL;
switch_console_push_match(&my_matches, "<stimulus_instance>");
switch_console_push_match(&my_matches, "0");
switch_console_push_match(&my_matches, "<stimulus_instance>");
switch_console_push_match(&my_matches, "0");
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
}
static switch_status_t skinny_api_list_stimulus_modes(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_LAMP_MODES
return status;
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_LAMP_MODES
return status;
}
static switch_status_t skinny_api_list_speaker_modes(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_SPEAKER_MODES
return status;
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_SPEAKER_MODES
return status;
}
static switch_status_t skinny_api_list_call_states(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_CALL_STATES
return status;
switch_status_t status = SWITCH_STATUS_FALSE;
SKINNY_PUSH_CALL_STATES
return status;
}
static switch_status_t skinny_api_list_line_instances(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_console_callback_match_t *my_matches = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
switch_console_callback_match_t *my_matches = NULL;
/* TODO */
switch_console_push_match(&my_matches, "1");
switch_console_push_match(&my_matches, "<line_instance>");
/* TODO */
switch_console_push_match(&my_matches, "1");
switch_console_push_match(&my_matches, "<line_instance>");
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
}
static switch_status_t skinny_api_list_call_ids(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_console_callback_match_t *my_matches = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
switch_console_callback_match_t *my_matches = NULL;
/* TODO */
switch_console_push_match(&my_matches, "1345");
switch_console_push_match(&my_matches, "<call_id>");
/* TODO */
switch_console_push_match(&my_matches, "1345");
switch_console_push_match(&my_matches, "<call_id>");
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
}
static switch_status_t skinny_api_list_settings(const char *line, const char *cursor, switch_console_callback_match_t **matches)
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_console_callback_match_t *my_matches = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
switch_console_callback_match_t *my_matches = NULL;
switch_console_push_match(&my_matches, "domain");
switch_console_push_match(&my_matches, "ip");
switch_console_push_match(&my_matches, "port");
switch_console_push_match(&my_matches, "patterns-dialplan");
switch_console_push_match(&my_matches, "patterns-context");
switch_console_push_match(&my_matches, "dialplan");
switch_console_push_match(&my_matches, "context");
switch_console_push_match(&my_matches, "keep-alive");
switch_console_push_match(&my_matches, "date-format");
switch_console_push_match(&my_matches, "odbc-dsn");
switch_console_push_match(&my_matches, "debug");
switch_console_push_match(&my_matches, "auto-restart");
switch_console_push_match(&my_matches, "domain");
switch_console_push_match(&my_matches, "ip");
switch_console_push_match(&my_matches, "port");
switch_console_push_match(&my_matches, "patterns-dialplan");
switch_console_push_match(&my_matches, "patterns-context");
switch_console_push_match(&my_matches, "dialplan");
switch_console_push_match(&my_matches, "context");
switch_console_push_match(&my_matches, "keep-alive");
switch_console_push_match(&my_matches, "date-format");
switch_console_push_match(&my_matches, "odbc-dsn");
switch_console_push_match(&my_matches, "debug");
switch_console_push_match(&my_matches, "auto-restart");
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
}
return status;
}
/*****************************************************************************/
@@ -244,136 +244,136 @@ static switch_status_t skinny_api_list_settings(const char *line, const char *cu
/*****************************************************************************/
static switch_status_t skinny_api_cmd_status_profile(const char *profile_name, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
skinny_profile_dump(profile, stream);
} else {
stream->write_function(stream, "Profile not found!\n");
}
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
skinny_profile_dump(profile, stream);
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_status_profile_device(const char *profile_name, const char *device_name, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
dump_device(profile, device_name, stream);
} else {
stream->write_function(stream, "Profile not found!\n");
}
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
dump_device(profile, device_name, stream);
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_ringer_message(const char *profile_name, const char *device_name, const char *ring_type, const char *ring_mode, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_set_ringer(listener, skinny_str2ring_type(ring_type), skinny_str2ring_mode(ring_mode), 0, 0);
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_set_ringer(listener, skinny_str2ring_type(ring_type), skinny_str2ring_mode(ring_mode), 0, 0);
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_lamp_message(const char *profile_name, const char *device_name, const char *stimulus, const char *instance, const char *lamp_mode, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_set_lamp(listener, skinny_str2button(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode));
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_set_lamp(listener, skinny_str2button(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode));
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_speaker_mode_message(const char *profile_name, const char *device_name, const char *speaker_mode, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_set_speaker_mode(listener, skinny_str2speaker_mode(speaker_mode));
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_set_speaker_mode(listener, skinny_str2speaker_mode(speaker_mode));
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_call_state_message(const char *profile_name, const char *device_name, const char *call_state, const char *line_instance, const char *call_id, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_call_state(listener, skinny_str2call_state(call_state), atoi(line_instance), atoi(call_id));
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_call_state(listener, skinny_str2call_state(call_state), atoi(line_instance), atoi(call_id));
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_reset_message(const char *profile_name, const char *device_name, const char *reset_type, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_reset(listener, skinny_str2device_reset_type(reset_type));
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
send_reset(listener, skinny_str2device_reset_type(reset_type));
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_data(const char *profile_name, const char *device_name, const char *message_type, char *params, const char *body, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
if ((profile = skinny_find_profile(profile_name))) {
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
switch_event_t *event = NULL;
char *argv[64] = { 0 };
int argc = 0;
@@ -395,49 +395,49 @@ static switch_status_t skinny_api_cmd_profile_device_send_data(const char *profi
switch_event_add_header(event, SWITCH_STACK_BOTTOM, tmp, "%s", var_value);
switch_safe_free(tmp);
/*
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Application-Id", "%d", request->data.extended_data.application_id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Line-Instance", "%d", request->data.extended_data.line_instance);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Call-Id", "%d", request->data.extended_data.call_id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Transaction-Id", "%d", request->data.extended_data.transaction_id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Data-Length", "%d", request->data.extended_data.data_length);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Sequence-Flag", "%d", request->data.extended_data.sequence_flag);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Display-Priority", "%d", request->data.extended_data.display_priority);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Conference-Id", "%d", request->data.extended_data.conference_id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-App-Instance-Id", "%d", request->data.extended_data.app_instance_id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Routing-Id", "%d", request->data.extended_data.routing_id);
*/
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Application-Id", "%d", request->data.extended_data.application_id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Line-Instance", "%d", request->data.extended_data.line_instance);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Call-Id", "%d", request->data.extended_data.call_id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Transaction-Id", "%d", request->data.extended_data.transaction_id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Data-Length", "%d", request->data.extended_data.data_length);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Sequence-Flag", "%d", request->data.extended_data.sequence_flag);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Display-Priority", "%d", request->data.extended_data.display_priority);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Conference-Id", "%d", request->data.extended_data.conference_id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-App-Instance-Id", "%d", request->data.extended_data.app_instance_id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Routing-Id", "%d", request->data.extended_data.routing_id);
*/
}
}
switch_event_add_body(event, "%s", body);
switch_event_fire(&event);
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
} else {
stream->write_function(stream, "Listener not found!\n");
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_set(const char *profile_name, const char *name, const char *value, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
if (skinny_profile_set(profile, name, value) == SWITCH_STATUS_SUCCESS) {
if ((profile = skinny_find_profile(profile_name))) {
if (skinny_profile_set(profile, name, value) == SWITCH_STATUS_SUCCESS) {
skinny_profile_respawn(profile, 0);
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "Unable to set skinny setting '%s'. Does it exists?\n", name);
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
} else {
stream->write_function(stream, "Unable to set skinny setting '%s'. Does it exists?\n", name);
}
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
return SWITCH_STATUS_SUCCESS;
}
/*****************************************************************************/
@@ -445,148 +445,148 @@ static switch_status_t skinny_api_cmd_profile_set(const char *profile_name, cons
/*****************************************************************************/
SWITCH_STANDARD_API(skinny_function)
{
char *argv[1024] = { 0 };
int argc = 0;
char *mycmd = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
const char *usage_string = "USAGE:\n"
"--------------------------------------------------------------------------------\n"
"skinny help\n"
"skinny status profile <profile_name>\n"
"skinny status profile <profile_name> device <device_name>\n"
"skinny profile <profile_name> device <device_name> send ResetMessage [DeviceReset|DeviceRestart]\n"
"skinny profile <profile_name> device <device_name> send SetRingerMessage <ring_type> <ring_mode>\n"
"skinny profile <profile_name> device <device_name> send SetLampMessage <stimulus> <instance> <lamp_mode>\n"
"skinny profile <profile_name> device <device_name> send SetSpeakerModeMessage <speaker_mode>\n"
"skinny profile <profile_name> device <device_name> send CallStateMessage <call_state> <line_instance> <call_id>\n"
"skinny profile <profile_name> device <device_name> send <UserToDeviceDataMessage|UserToDeviceDataVersion1Message> [ <param>=<value>;... ] <data>\n"
"skinny profile <profile_name> set <name> <value>\n"
"--------------------------------------------------------------------------------\n";
if (session) {
return SWITCH_STATUS_FALSE;
}
char *argv[1024] = { 0 };
int argc = 0;
char *mycmd = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
const char *usage_string = "USAGE:\n"
"--------------------------------------------------------------------------------\n"
"skinny help\n"
"skinny status profile <profile_name>\n"
"skinny status profile <profile_name> device <device_name>\n"
"skinny profile <profile_name> device <device_name> send ResetMessage [DeviceReset|DeviceRestart]\n"
"skinny profile <profile_name> device <device_name> send SetRingerMessage <ring_type> <ring_mode>\n"
"skinny profile <profile_name> device <device_name> send SetLampMessage <stimulus> <instance> <lamp_mode>\n"
"skinny profile <profile_name> device <device_name> send SetSpeakerModeMessage <speaker_mode>\n"
"skinny profile <profile_name> device <device_name> send CallStateMessage <call_state> <line_instance> <call_id>\n"
"skinny profile <profile_name> device <device_name> send <UserToDeviceDataMessage|UserToDeviceDataVersion1Message> [ <param>=<value>;... ] <data>\n"
"skinny profile <profile_name> set <name> <value>\n"
"--------------------------------------------------------------------------------\n";
if (session) {
return SWITCH_STATUS_FALSE;
}
if (zstr(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
if (zstr(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
if (!(mycmd = strdup(cmd))) {
status = SWITCH_STATUS_MEMERR;
goto done;
}
if (!(mycmd = strdup(cmd))) {
status = SWITCH_STATUS_MEMERR;
goto done;
}
if (!(argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || !argv[0]) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
if (!(argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || !argv[0]) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
if (!strcasecmp(argv[0], "help")) {/* skinny help */
stream->write_function(stream, "%s", usage_string);
} else if (argc == 3 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile")) {
/* skinny status profile <profile_name> */
status = skinny_api_cmd_status_profile(argv[2], stream);
} else if (argc == 5 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile") && !strcasecmp(argv[3], "device")) {
/* skinny status profile <profile_name> device <device_name> */
status = skinny_api_cmd_status_profile_device(argv[2], argv[4], stream);
} else if (argc >= 6 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "device") && !strcasecmp(argv[4], "send")) {
/* skinny profile <profile_name> device <device_name> send ... */
switch(skinny_str2message_type(argv[5])) {
case SET_RINGER_MESSAGE:
if(argc == 8) {
/* SetRingerMessage <ring_type> <ring_mode> */
status = skinny_api_cmd_profile_device_send_ringer_message(argv[1], argv[3], argv[6], argv[7], stream);
}
break;
case SET_LAMP_MESSAGE:
if (argc == 9) {
/* SetLampMessage <stimulus> <instance> <lamp_mode> */
status = skinny_api_cmd_profile_device_send_lamp_message(argv[1], argv[3], argv[6], argv[7], argv[8], stream);
}
break;
case SET_SPEAKER_MODE_MESSAGE:
if (argc == 7) {
/* SetSpeakerModeMessage <speaker_mode> */
status = skinny_api_cmd_profile_device_send_speaker_mode_message(argv[1], argv[3], argv[6], stream);
}
break;
case CALL_STATE_MESSAGE:
if (argc == 9) {
/* CallStateMessage <call_state> <line_instance> <call_id> */
status = skinny_api_cmd_profile_device_send_call_state_message(argv[1], argv[3], argv[6], argv[7], argv[8], stream);
}
break;
case RESET_MESSAGE:
if (argc == 7) {
/* ResetMessage <reset_type> */
status = skinny_api_cmd_profile_device_send_reset_message(argv[1], argv[3], argv[6], stream);
}
break;
if (!strcasecmp(argv[0], "help")) {/* skinny help */
stream->write_function(stream, "%s", usage_string);
} else if (argc == 3 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile")) {
/* skinny status profile <profile_name> */
status = skinny_api_cmd_status_profile(argv[2], stream);
} else if (argc == 5 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile") && !strcasecmp(argv[3], "device")) {
/* skinny status profile <profile_name> device <device_name> */
status = skinny_api_cmd_status_profile_device(argv[2], argv[4], stream);
} else if (argc >= 6 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "device") && !strcasecmp(argv[4], "send")) {
/* skinny profile <profile_name> device <device_name> send ... */
switch(skinny_str2message_type(argv[5])) {
case SET_RINGER_MESSAGE:
if(argc == 8) {
/* SetRingerMessage <ring_type> <ring_mode> */
status = skinny_api_cmd_profile_device_send_ringer_message(argv[1], argv[3], argv[6], argv[7], stream);
}
break;
case SET_LAMP_MESSAGE:
if (argc == 9) {
/* SetLampMessage <stimulus> <instance> <lamp_mode> */
status = skinny_api_cmd_profile_device_send_lamp_message(argv[1], argv[3], argv[6], argv[7], argv[8], stream);
}
break;
case SET_SPEAKER_MODE_MESSAGE:
if (argc == 7) {
/* SetSpeakerModeMessage <speaker_mode> */
status = skinny_api_cmd_profile_device_send_speaker_mode_message(argv[1], argv[3], argv[6], stream);
}
break;
case CALL_STATE_MESSAGE:
if (argc == 9) {
/* CallStateMessage <call_state> <line_instance> <call_id> */
status = skinny_api_cmd_profile_device_send_call_state_message(argv[1], argv[3], argv[6], argv[7], argv[8], stream);
}
break;
case RESET_MESSAGE:
if (argc == 7) {
/* ResetMessage <reset_type> */
status = skinny_api_cmd_profile_device_send_reset_message(argv[1], argv[3], argv[6], stream);
}
break;
case USER_TO_DEVICE_DATA_MESSAGE:
case USER_TO_DEVICE_DATA_VERSION1_MESSAGE:
if(argc == 8) {
if(argc == 8) {
/* <UserToDeviceDataMessage|UserToDeviceDataVersion1Message> [ <param>=<value>;... ] <data> */
status = skinny_api_cmd_profile_device_send_data(argv[1], argv[3], argv[5], argv[6], argv[7], stream);
} else if(argc == 7) {
} else if(argc == 7) {
/* <UserToDeviceDataMessage|UserToDeviceDataVersion1Message> <data> */
status = skinny_api_cmd_profile_device_send_data(argv[1], argv[3], argv[5], "", argv[6], stream);
}
break;
default:
stream->write_function(stream, "Unhandled message %s\n", argv[5]);
}
} else if (argc == 5 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "set")) {
/* skinny profile <profile_name> set <name> <value> */
status = skinny_api_cmd_profile_set(argv[1], argv[3], argv[4], stream);
} else {
stream->write_function(stream, "%s", usage_string);
}
break;
default:
stream->write_function(stream, "Unhandled message %s\n", argv[5]);
}
} else if (argc == 5 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "set")) {
/* skinny profile <profile_name> set <name> <value> */
status = skinny_api_cmd_profile_set(argv[1], argv[3], argv[4], stream);
} else {
stream->write_function(stream, "%s", usage_string);
}
done:
switch_safe_free(mycmd);
return status;
switch_safe_free(mycmd);
return status;
}
switch_status_t skinny_api_register(switch_loadable_module_interface_t **module_interface)
{
switch_api_interface_t *api_interface;
switch_api_interface_t *api_interface;
SWITCH_ADD_API(api_interface, "skinny", "Skinny Controls", skinny_function, "<cmd> <args>");
switch_console_set_complete("add skinny help");
SWITCH_ADD_API(api_interface, "skinny", "Skinny Controls", skinny_function, "<cmd> <args>");
switch_console_set_complete("add skinny help");
switch_console_set_complete("add skinny status profile ::skinny::list_profiles");
switch_console_set_complete("add skinny status profile ::skinny::list_profiles device ::skinny::list_devices");
switch_console_set_complete("add skinny status profile ::skinny::list_profiles");
switch_console_set_complete("add skinny status profile ::skinny::list_profiles device ::skinny::list_devices");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send ResetMessage ::skinny::list_reset_types");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetRingerMessage ::skinny::list_ring_types ::skinny::list_ring_modes");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetLampMessage ::skinny::list_stimuli ::skinny::list_stimulus_instances ::skinny::list_stimulus_modes");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetSpeakerModeMessage ::skinny::list_speaker_modes");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send CallStateMessage ::skinny::list_call_states ::skinny::list_line_instances ::skinny::list_call_ids");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send UserToDeviceDataMessage");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send UserToDeviceDataVersion1Message");
switch_console_set_complete("add skinny profile ::skinny::list_profiles set ::skinny::list_settings");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send ResetMessage ::skinny::list_reset_types");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetRingerMessage ::skinny::list_ring_types ::skinny::list_ring_modes");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetLampMessage ::skinny::list_stimuli ::skinny::list_stimulus_instances ::skinny::list_stimulus_modes");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetSpeakerModeMessage ::skinny::list_speaker_modes");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send CallStateMessage ::skinny::list_call_states ::skinny::list_line_instances ::skinny::list_call_ids");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send UserToDeviceDataMessage");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send UserToDeviceDataVersion1Message");
switch_console_set_complete("add skinny profile ::skinny::list_profiles set ::skinny::list_settings");
switch_console_add_complete_func("::skinny::list_profiles", skinny_api_list_profiles);
switch_console_add_complete_func("::skinny::list_devices", skinny_api_list_devices);
switch_console_add_complete_func("::skinny::list_reset_types", skinny_api_list_reset_types);
switch_console_add_complete_func("::skinny::list_ring_types", skinny_api_list_ring_types);
switch_console_add_complete_func("::skinny::list_ring_modes", skinny_api_list_ring_modes);
switch_console_add_complete_func("::skinny::list_stimuli", skinny_api_list_stimuli);
switch_console_add_complete_func("::skinny::list_stimulus_instances", skinny_api_list_stimulus_instances);
switch_console_add_complete_func("::skinny::list_stimulus_modes", skinny_api_list_stimulus_modes);
switch_console_add_complete_func("::skinny::list_speaker_modes", skinny_api_list_speaker_modes);
switch_console_add_complete_func("::skinny::list_call_states", skinny_api_list_call_states);
switch_console_add_complete_func("::skinny::list_line_instances", skinny_api_list_line_instances);
switch_console_add_complete_func("::skinny::list_call_ids", skinny_api_list_call_ids);
switch_console_add_complete_func("::skinny::list_settings", skinny_api_list_settings);
return SWITCH_STATUS_SUCCESS;
switch_console_add_complete_func("::skinny::list_profiles", skinny_api_list_profiles);
switch_console_add_complete_func("::skinny::list_devices", skinny_api_list_devices);
switch_console_add_complete_func("::skinny::list_reset_types", skinny_api_list_reset_types);
switch_console_add_complete_func("::skinny::list_ring_types", skinny_api_list_ring_types);
switch_console_add_complete_func("::skinny::list_ring_modes", skinny_api_list_ring_modes);
switch_console_add_complete_func("::skinny::list_stimuli", skinny_api_list_stimuli);
switch_console_add_complete_func("::skinny::list_stimulus_instances", skinny_api_list_stimulus_instances);
switch_console_add_complete_func("::skinny::list_stimulus_modes", skinny_api_list_stimulus_modes);
switch_console_add_complete_func("::skinny::list_speaker_modes", skinny_api_list_speaker_modes);
switch_console_add_complete_func("::skinny::list_call_states", skinny_api_list_call_states);
switch_console_add_complete_func("::skinny::list_line_instances", skinny_api_list_line_instances);
switch_console_add_complete_func("::skinny::list_call_ids", skinny_api_list_call_ids);
switch_console_add_complete_func("::skinny::list_settings", skinny_api_list_settings);
return SWITCH_STATUS_SUCCESS;
}
switch_status_t skinny_api_unregister()
{
switch_console_set_complete("del skinny");
return SWITCH_STATUS_SUCCESS;
return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
+199 -199
View File
@@ -149,26 +149,26 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req)
if(mlen) {
bytes += mlen;
if(bytes >= SKINNY_MESSAGE_FIELD_SIZE) {
do_sleep = 0;
ptr += mlen;
memcpy(request, mbuf, bytes);
#ifdef SKINNY_MEGA_DEBUG
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Got request: length=%d,reserved=%x,type=%x\n",
request->length,request->reserved,request->type);
"Got request: length=%d,reserved=%x,type=%x\n",
request->length,request->reserved,request->type);
#endif
if(request->length < SKINNY_MESSAGE_FIELD_SIZE) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Skinny client sent invalid data. Length should be greater than 4 but got %d.\n",
request->length);
"Skinny client sent invalid data. Length should be greater than 4 but got %d.\n",
request->length);
return SWITCH_STATUS_FALSE;
}
if(request->length + 2*SKINNY_MESSAGE_FIELD_SIZE > SKINNY_MESSAGE_MAXSIZE) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Skinny client sent too huge data. Got %d which is above threshold %d.\n",
request->length, SKINNY_MESSAGE_MAXSIZE - 2*SKINNY_MESSAGE_FIELD_SIZE);
"Skinny client sent too huge data. Got %d which is above threshold %d.\n",
request->length, SKINNY_MESSAGE_MAXSIZE - 2*SKINNY_MESSAGE_FIELD_SIZE);
return SWITCH_STATUS_FALSE;
}
if(bytes >= request->length + 2*SKINNY_MESSAGE_FIELD_SIZE) {
@@ -224,10 +224,10 @@ switch_status_t skinny_device_event(listener_t *listener, switch_event_t **ev, s
switch_event_create_subclass(&event, event_id, subclass_name);
switch_assert(event);
if ((sql = switch_mprintf("SELECT '%s', name, user_id, instance, ip, type, max_streams, port, codec_string "
"FROM skinny_devices "
"WHERE name='%s' AND instance=%d",
listener->profile->name,
listener->device_name, listener->device_instance))) {
"FROM skinny_devices "
"WHERE name='%s' AND instance=%d",
listener->profile->name,
listener->device_name, listener->device_instance))) {
skinny_execute_sql_callback(profile, profile->sql_mutex, sql, skinny_device_event_callback, event);
switch_safe_free(sql);
}
@@ -243,14 +243,14 @@ switch_status_t skinny_session_walk_lines(skinny_profile_t *profile, char *chann
{
char *sql;
if ((sql = switch_mprintf(
"SELECT skinny_lines.*, channel_uuid, call_id, call_state "
"FROM skinny_active_lines "
"INNER JOIN skinny_lines "
"ON skinny_active_lines.device_name = skinny_lines.device_name "
"AND skinny_active_lines.device_instance = skinny_lines.device_instance "
"AND skinny_active_lines.line_instance = skinny_lines.line_instance "
"WHERE channel_uuid='%s'",
channel_uuid))) {
"SELECT skinny_lines.*, channel_uuid, call_id, call_state "
"FROM skinny_active_lines "
"INNER JOIN skinny_lines "
"ON skinny_active_lines.device_name = skinny_lines.device_name "
"AND skinny_active_lines.device_instance = skinny_lines.device_instance "
"AND skinny_active_lines.line_instance = skinny_lines.line_instance "
"WHERE channel_uuid='%s'",
channel_uuid))) {
skinny_execute_sql_callback(profile, profile->sql_mutex, sql, callback, data);
switch_safe_free(sql);
}
@@ -261,14 +261,14 @@ switch_status_t skinny_session_walk_lines_by_call_id(skinny_profile_t *profile,
{
char *sql;
if ((sql = switch_mprintf(
"SELECT skinny_lines.*, channel_uuid, call_id, call_state "
"FROM skinny_active_lines "
"INNER JOIN skinny_lines "
"ON skinny_active_lines.device_name = skinny_lines.device_name "
"AND skinny_active_lines.device_instance = skinny_lines.device_instance "
"AND skinny_active_lines.line_instance = skinny_lines.line_instance "
"WHERE call_id='%d'",
call_id))) {
"SELECT skinny_lines.*, channel_uuid, call_id, call_state "
"FROM skinny_active_lines "
"INNER JOIN skinny_lines "
"ON skinny_active_lines.device_name = skinny_lines.device_name "
"AND skinny_active_lines.device_instance = skinny_lines.device_instance "
"AND skinny_active_lines.line_instance = skinny_lines.line_instance "
"WHERE call_id='%d'",
call_id))) {
skinny_execute_sql_callback(profile, profile->sql_mutex, sql, callback, data);
switch_safe_free(sql);
}
@@ -309,13 +309,13 @@ void skinny_line_get(listener_t *listener, uint32_t instance, struct line_stat_r
helper.button = switch_core_alloc(listener->pool, sizeof(struct line_stat_res_message));
if ((sql = switch_mprintf(
"SELECT '%d' AS wanted_position, position, label, value, caller_name "
"FROM skinny_lines "
"WHERE device_name='%s' AND device_instance=%d "
"ORDER BY position",
instance,
listener->device_name, listener->device_instance
))) {
"SELECT '%d' AS wanted_position, position, label, value, caller_name "
"FROM skinny_lines "
"WHERE device_name='%s' AND device_instance=%d "
"ORDER BY position",
instance,
listener->device_name, listener->device_instance
))) {
skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_line_get_callback, &helper);
switch_safe_free(sql);
}
@@ -352,14 +352,14 @@ void skinny_speed_dial_get(listener_t *listener, uint32_t instance, struct speed
helper.button = switch_core_alloc(listener->pool, sizeof(struct speed_dial_stat_res_message));
if ((sql = switch_mprintf(
"SELECT '%d' AS wanted_position, position, label, value, settings "
"FROM skinny_buttons "
"WHERE device_name='%s' AND device_instance=%d AND type=%d "
"ORDER BY position",
instance,
listener->device_name, listener->device_instance,
SKINNY_BUTTON_SPEED_DIAL
))) {
"SELECT '%d' AS wanted_position, position, label, value, settings "
"FROM skinny_buttons "
"WHERE device_name='%s' AND device_instance=%d AND type=%d "
"ORDER BY position",
instance,
listener->device_name, listener->device_instance,
SKINNY_BUTTON_SPEED_DIAL
))) {
skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_speed_dial_get_callback, &helper);
switch_safe_free(sql);
}
@@ -396,15 +396,15 @@ void skinny_service_url_get(listener_t *listener, uint32_t instance, struct serv
helper.button = switch_core_alloc(listener->pool, sizeof(struct service_url_stat_res_message));
if ((sql = switch_mprintf(
"SELECT '%d' AS wanted_position, position, label, value, settings "
"FROM skinny_buttons "
"WHERE device_name='%s' AND device_instance=%d AND type=%d "
"ORDER BY position",
instance,
listener->device_name,
listener->device_instance,
SKINNY_BUTTON_SERVICE_URL
))) {
"SELECT '%d' AS wanted_position, position, label, value, settings "
"FROM skinny_buttons "
"WHERE device_name='%s' AND device_instance=%d AND type=%d "
"ORDER BY position",
instance,
listener->device_name,
listener->device_instance,
SKINNY_BUTTON_SERVICE_URL
))) {
skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_service_url_get_callback, &helper);
switch_safe_free(sql);
}
@@ -442,15 +442,15 @@ void skinny_feature_get(listener_t *listener, uint32_t instance, struct feature_
helper.button = switch_core_alloc(listener->pool, sizeof(struct feature_stat_res_message));
if ((sql = switch_mprintf(
"SELECT '%d' AS wanted_position, position, label, value, settings "
"FROM skinny_buttons "
"WHERE device_name='%s' AND device_instance=%d AND NOT (type=%d OR type=%d) "
"ORDER BY position",
instance,
listener->device_name,
listener->device_instance,
SKINNY_BUTTON_SPEED_DIAL, SKINNY_BUTTON_SERVICE_URL
))) {
"SELECT '%d' AS wanted_position, position, label, value, settings "
"FROM skinny_buttons "
"WHERE device_name='%s' AND device_instance=%d AND NOT (type=%d OR type=%d) "
"ORDER BY position",
instance,
listener->device_name,
listener->device_instance,
SKINNY_BUTTON_SPEED_DIAL, SKINNY_BUTTON_SERVICE_URL
))) {
skinny_execute_sql_callback(listener->profile, listener->profile->sql_mutex, sql, skinny_feature_get_callback, &helper);
switch_safe_free(sql);
}
@@ -461,11 +461,11 @@ void skinny_feature_get(listener_t *listener, uint32_t instance, struct feature_
/* SKINNY MESSAGE SENDER */
/*****************************************************************************/
switch_status_t send_register_ack(listener_t *listener,
uint32_t keep_alive,
char *date_format,
char *reserved,
uint32_t secondary_keep_alive,
char *reserved2)
uint32_t keep_alive,
char *date_format,
char *reserved,
uint32_t secondary_keep_alive,
char *reserved2)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reg_ack));
@@ -480,10 +480,10 @@ switch_status_t send_register_ack(listener_t *listener,
}
switch_status_t send_start_tone(listener_t *listener,
uint32_t tone,
uint32_t reserved,
uint32_t line_instance,
uint32_t call_id)
uint32_t tone,
uint32_t reserved,
uint32_t line_instance,
uint32_t call_id)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.start_tone));
@@ -497,8 +497,8 @@ switch_status_t send_start_tone(listener_t *listener,
}
switch_status_t send_stop_tone(listener_t *listener,
uint32_t line_instance,
uint32_t call_id)
uint32_t line_instance,
uint32_t call_id)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.stop_tone));
@@ -510,10 +510,10 @@ switch_status_t send_stop_tone(listener_t *listener,
}
switch_status_t send_set_ringer(listener_t *listener,
uint32_t ring_type,
uint32_t ring_mode,
uint32_t line_instance,
uint32_t call_id)
uint32_t ring_type,
uint32_t ring_mode,
uint32_t line_instance,
uint32_t call_id)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.ringer));
@@ -527,9 +527,9 @@ switch_status_t send_set_ringer(listener_t *listener,
}
switch_status_t send_set_lamp(listener_t *listener,
uint32_t stimulus,
uint32_t stimulus_instance,
uint32_t mode)
uint32_t stimulus,
uint32_t stimulus_instance,
uint32_t mode)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.lamp));
@@ -542,7 +542,7 @@ switch_status_t send_set_lamp(listener_t *listener,
}
switch_status_t send_set_speaker_mode(listener_t *listener,
uint32_t mode)
uint32_t mode)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.speaker_mode));
@@ -553,16 +553,16 @@ switch_status_t send_set_speaker_mode(listener_t *listener,
}
switch_status_t send_start_media_transmission(listener_t *listener,
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t remote_ip,
uint32_t remote_port,
uint32_t ms_per_packet,
uint32_t payload_capacity,
uint32_t precedence,
uint32_t silence_suppression,
uint16_t max_frames_per_packet,
uint32_t g723_bitrate)
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t remote_ip,
uint32_t remote_port,
uint32_t ms_per_packet,
uint32_t payload_capacity,
uint32_t precedence,
uint32_t silence_suppression,
uint16_t max_frames_per_packet,
uint32_t g723_bitrate)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.start_media));
@@ -583,9 +583,9 @@ switch_status_t send_start_media_transmission(listener_t *listener,
}
switch_status_t send_stop_media_transmission(listener_t *listener,
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t conference_id2)
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t conference_id2)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.stop_media));
@@ -599,26 +599,26 @@ switch_status_t send_stop_media_transmission(listener_t *listener,
}
switch_status_t skinny_send_call_info(listener_t *listener,
const char *calling_party_name,
const char *calling_party,
const char *called_party_name,
const char *called_party,
uint32_t line_instance,
uint32_t call_id,
uint32_t call_type,
const char *original_called_party_name,
const char *original_called_party,
const char *last_redirecting_party_name,
const char *last_redirecting_party,
uint32_t original_called_party_redirect_reason,
uint32_t last_redirecting_reason,
const char *calling_party_voice_mailbox,
const char *called_party_voice_mailbox,
const char *original_called_party_voice_mailbox,
const char *last_redirecting_voice_mailbox,
uint32_t call_instance,
uint32_t call_security_status,
uint32_t party_pi_restriction_bits)
const char *calling_party_name,
const char *calling_party,
const char *called_party_name,
const char *called_party,
uint32_t line_instance,
uint32_t call_id,
uint32_t call_type,
const char *original_called_party_name,
const char *original_called_party,
const char *last_redirecting_party_name,
const char *last_redirecting_party,
uint32_t original_called_party_redirect_reason,
uint32_t last_redirecting_reason,
const char *calling_party_voice_mailbox,
const char *called_party_voice_mailbox,
const char *original_called_party_voice_mailbox,
const char *last_redirecting_voice_mailbox,
uint32_t call_instance,
uint32_t call_security_status,
uint32_t party_pi_restriction_bits)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.call_info));
@@ -648,15 +648,15 @@ switch_status_t skinny_send_call_info(listener_t *listener,
}
switch_status_t send_define_time_date(listener_t *listener,
uint32_t year,
uint32_t month,
uint32_t day_of_week, /* monday = 1 */
uint32_t day,
uint32_t hour,
uint32_t minute,
uint32_t seconds,
uint32_t milliseconds,
uint32_t timestamp)
uint32_t year,
uint32_t month,
uint32_t day_of_week, /* monday = 1 */
uint32_t day,
uint32_t hour,
uint32_t minute,
uint32_t seconds,
uint32_t milliseconds,
uint32_t timestamp)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.define_time_date));
@@ -681,15 +681,15 @@ switch_status_t send_define_current_time_date(listener_t *listener)
ts = switch_micro_time_now();
switch_time_exp_lt(&tm, ts);
return send_define_time_date(listener,
tm.tm_year + 1900,
tm.tm_mon + 1,
tm.tm_wday,
tm.tm_mday,
tm.tm_hour,
tm.tm_min,
tm.tm_sec,
tm.tm_usec / 1000,
ts / 1000000);
tm.tm_year + 1900,
tm.tm_mon + 1,
tm.tm_wday,
tm.tm_mday,
tm.tm_hour,
tm.tm_min,
tm.tm_sec,
tm.tm_usec / 1000,
ts / 1000000);
}
switch_status_t send_capabilities_req(listener_t *listener)
@@ -702,7 +702,7 @@ switch_status_t send_capabilities_req(listener_t *listener)
}
switch_status_t send_version(listener_t *listener,
char *version)
char *version)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.version));
@@ -713,7 +713,7 @@ switch_status_t send_version(listener_t *listener,
}
switch_status_t send_register_reject(listener_t *listener,
char *error)
char *error)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reg_rej));
@@ -724,14 +724,14 @@ switch_status_t send_register_reject(listener_t *listener,
}
switch_status_t send_open_receive_channel(listener_t *listener,
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t packets,
uint32_t payload_capacity,
uint32_t echo_cancel_type,
uint32_t g723_bitrate,
uint32_t conference_id2,
uint32_t reserved[10])
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t packets,
uint32_t payload_capacity,
uint32_t echo_cancel_type,
uint32_t g723_bitrate,
uint32_t conference_id2,
uint32_t reserved[10])
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.open_receive_channel));
@@ -745,24 +745,24 @@ switch_status_t send_open_receive_channel(listener_t *listener,
message->data.open_receive_channel.g723_bitrate = g723_bitrate;
message->data.open_receive_channel.conference_id2 = conference_id2;
/*
message->data.open_receive_channel.reserved[0] = reserved[0];
message->data.open_receive_channel.reserved[1] = reserved[1];
message->data.open_receive_channel.reserved[2] = reserved[2];
message->data.open_receive_channel.reserved[3] = reserved[3];
message->data.open_receive_channel.reserved[4] = reserved[4];
message->data.open_receive_channel.reserved[5] = reserved[5];
message->data.open_receive_channel.reserved[6] = reserved[6];
message->data.open_receive_channel.reserved[7] = reserved[7];
message->data.open_receive_channel.reserved[8] = reserved[8];
message->data.open_receive_channel.reserved[9] = reserved[9];
*/
message->data.open_receive_channel.reserved[0] = reserved[0];
message->data.open_receive_channel.reserved[1] = reserved[1];
message->data.open_receive_channel.reserved[2] = reserved[2];
message->data.open_receive_channel.reserved[3] = reserved[3];
message->data.open_receive_channel.reserved[4] = reserved[4];
message->data.open_receive_channel.reserved[5] = reserved[5];
message->data.open_receive_channel.reserved[6] = reserved[6];
message->data.open_receive_channel.reserved[7] = reserved[7];
message->data.open_receive_channel.reserved[8] = reserved[8];
message->data.open_receive_channel.reserved[9] = reserved[9];
*/
return skinny_send_reply(listener, message);
}
switch_status_t send_close_receive_channel(listener_t *listener,
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t conference_id2)
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t conference_id2)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.close_receive_channel));
@@ -775,10 +775,10 @@ switch_status_t send_close_receive_channel(listener_t *listener,
}
switch_status_t send_select_soft_keys(listener_t *listener,
uint32_t line_instance,
uint32_t call_id,
uint32_t soft_key_set,
uint32_t valid_key_mask)
uint32_t line_instance,
uint32_t call_id,
uint32_t soft_key_set,
uint32_t valid_key_mask)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.select_soft_keys));
@@ -792,9 +792,9 @@ switch_status_t send_select_soft_keys(listener_t *listener,
}
switch_status_t send_call_state(listener_t *listener,
uint32_t call_state,
uint32_t line_instance,
uint32_t call_id)
uint32_t call_state,
uint32_t line_instance,
uint32_t call_id)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.call_state));
@@ -807,10 +807,10 @@ switch_status_t send_call_state(listener_t *listener,
}
switch_status_t send_display_prompt_status(listener_t *listener,
uint32_t timeout,
const char *display,
uint32_t line_instance,
uint32_t call_id)
uint32_t timeout,
const char *display,
uint32_t line_instance,
uint32_t call_id)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.display_prompt_status));
@@ -824,8 +824,8 @@ switch_status_t send_display_prompt_status(listener_t *listener,
}
switch_status_t send_clear_prompt_status(listener_t *listener,
uint32_t line_instance,
uint32_t call_id)
uint32_t line_instance,
uint32_t call_id)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.clear_prompt_status));
@@ -837,7 +837,7 @@ switch_status_t send_clear_prompt_status(listener_t *listener,
}
switch_status_t send_activate_call_plane(listener_t *listener,
uint32_t line_instance)
uint32_t line_instance)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.activate_call_plane));
@@ -848,8 +848,8 @@ switch_status_t send_activate_call_plane(listener_t *listener,
}
switch_status_t send_back_space_request(listener_t *listener,
uint32_t line_instance,
uint32_t call_id)
uint32_t line_instance,
uint32_t call_id)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.back_space_req));
@@ -862,9 +862,9 @@ switch_status_t send_back_space_request(listener_t *listener,
}
switch_status_t send_dialed_number(listener_t *listener,
char called_party[24],
uint32_t line_instance,
uint32_t call_id)
char called_party[24],
uint32_t line_instance,
uint32_t call_id)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.dialed_number));
@@ -877,9 +877,9 @@ switch_status_t send_dialed_number(listener_t *listener,
}
switch_status_t send_display_pri_notify(listener_t *listener,
uint32_t message_timeout,
uint32_t priority,
char *notify)
uint32_t message_timeout,
uint32_t priority,
char *notify)
{
skinny_message_t *message;
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.display_pri_notify));
@@ -903,12 +903,12 @@ switch_status_t send_reset(listener_t *listener, uint32_t reset_type)
}
switch_status_t send_data(listener_t *listener, uint32_t message_type,
uint32_t application_id,
uint32_t line_instance,
uint32_t call_id,
uint32_t transaction_id,
uint32_t data_length,
const char *data)
uint32_t application_id,
uint32_t line_instance,
uint32_t call_id,
uint32_t transaction_id,
uint32_t data_length,
const char *data)
{
skinny_message_t *message;
switch_assert(data_length == strlen(data));
@@ -929,17 +929,17 @@ switch_status_t send_data(listener_t *listener, uint32_t message_type,
}
switch_status_t send_extended_data(listener_t *listener, uint32_t message_type,
uint32_t application_id,
uint32_t line_instance,
uint32_t call_id,
uint32_t transaction_id,
uint32_t data_length,
uint32_t sequence_flag,
uint32_t display_priority,
uint32_t conference_id,
uint32_t app_instance_id,
uint32_t routing_id,
const char *data)
uint32_t application_id,
uint32_t line_instance,
uint32_t call_id,
uint32_t transaction_id,
uint32_t data_length,
uint32_t sequence_flag,
uint32_t display_priority,
uint32_t conference_id,
uint32_t app_instance_id,
uint32_t routing_id,
const char *data)
{
skinny_message_t *message;
switch_assert(data_length == strlen(data));
@@ -975,16 +975,16 @@ switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file
if (listener_is_ready(listener)) {
if (listener->profile->debug >= 10 || reply->type != KEEP_ALIVE_ACK_MESSAGE) {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG,
"Sending %s (type=%x,length=%d) to %s:%d.\n",
skinny_message_type2str(reply->type), reply->type, reply->length,
listener->device_name, listener->device_instance);
"Sending %s (type=%x,length=%d) to %s:%d.\n",
skinny_message_type2str(reply->type), reply->type, reply->length,
listener->device_name, listener->device_instance);
}
return switch_socket_send(listener->sock, ptr, &len);
} else {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_WARNING,
"Not sending %s (type=%x,length=%d) to %s:%d while not ready.\n",
skinny_message_type2str(reply->type), reply->type, reply->length,
listener->device_name, listener->device_instance);
"Not sending %s (type=%x,length=%d) to %s:%d while not ready.\n",
skinny_message_type2str(reply->type), reply->type, reply->length,
listener->device_name, listener->device_instance);
return SWITCH_STATUS_FALSE;
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+151 -151
View File
@@ -108,181 +108,181 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = {
{XML_ALARM_MESSAGE, "XMLAlarmMessage"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, "UnknownMessage")
SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, "UnknownMessage")
SKINNY_DECLARE_STR2ID(skinny_str2message_type, SKINNY_MESSAGE_TYPES, -1)
struct skinny_table SKINNY_DEVICE_TYPES[] = {
{1, "Cisco 30 SP+"},
{2, "Cisco 12 SP+"},
{3, "Cisco 12 SP"},
{4, "Cisco 12"},
{5, "Cisco 30 VIP"},
{6, "Cisco IP Phone 7910"},
{7, "Cisco IP Phone 7960"},
{8, "Cisco IP Phone 7940"},
{9, "Cisco IP Phone 7935"},
{12, "Cisco ATA 186"},
{365, "Cisco IP Phone CP-7921G"},
{404, "Cisco IP Phone CP-7962G"},
{436, "Cisco IP Phone CP-7965G"},
{30018, "Cisco IP Phone CP-7961G"},
{30019, "Cisco IP Phone 7936"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_device_type2str, SKINNY_DEVICE_TYPES, "UnknownDeviceType")
struct skinny_table SKINNY_DEVICE_TYPES[] = {
{1, "Cisco 30 SP+"},
{2, "Cisco 12 SP+"},
{3, "Cisco 12 SP"},
{4, "Cisco 12"},
{5, "Cisco 30 VIP"},
{6, "Cisco IP Phone 7910"},
{7, "Cisco IP Phone 7960"},
{8, "Cisco IP Phone 7940"},
{9, "Cisco IP Phone 7935"},
{12, "Cisco ATA 186"},
{365, "Cisco IP Phone CP-7921G"},
{404, "Cisco IP Phone CP-7962G"},
{436, "Cisco IP Phone CP-7965G"},
{30018, "Cisco IP Phone CP-7961G"},
{30019, "Cisco IP Phone 7936"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_device_type2str, SKINNY_DEVICE_TYPES, "UnknownDeviceType")
SKINNY_DECLARE_STR2ID(skinny_str2device_type, SKINNY_DEVICE_TYPES, -1)
struct skinny_table SKINNY_RING_TYPES[] = {
{SKINNY_RING_OFF, "RingOff"},
{SKINNY_RING_INSIDE, "RingInside"},
{SKINNY_RING_OUTSIDE, "RingOutside"},
{SKINNY_RING_FEATURE, "RingFeature"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_ring_type2str, SKINNY_RING_TYPES, "RingTypeUnknown")
struct skinny_table SKINNY_RING_TYPES[] = {
{SKINNY_RING_OFF, "RingOff"},
{SKINNY_RING_INSIDE, "RingInside"},
{SKINNY_RING_OUTSIDE, "RingOutside"},
{SKINNY_RING_FEATURE, "RingFeature"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_ring_type2str, SKINNY_RING_TYPES, "RingTypeUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2ring_type, SKINNY_RING_TYPES, -1)
struct skinny_table SKINNY_RING_MODES[] = {
{SKINNY_RING_FOREVER, "RingForever"},
{SKINNY_RING_ONCE, "RingOnce"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_ring_mode2str, SKINNY_RING_MODES, "RingModeUnknown")
struct skinny_table SKINNY_RING_MODES[] = {
{SKINNY_RING_FOREVER, "RingForever"},
{SKINNY_RING_ONCE, "RingOnce"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_ring_mode2str, SKINNY_RING_MODES, "RingModeUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2ring_mode, SKINNY_RING_MODES, -1)
struct skinny_table SKINNY_BUTTONS[] = {
{SKINNY_BUTTON_UNKNOWN, "Unknown"},
{SKINNY_BUTTON_LAST_NUMBER_REDIAL, "LastNumberRedial"},
{SKINNY_BUTTON_SPEED_DIAL, "SpeedDial"},
{SKINNY_BUTTON_HOLD, "Hold"},
{SKINNY_BUTTON_TRANSFER, "Transfer"},
{SKINNY_BUTTON_LINE, "Line"},
{SKINNY_BUTTON_VOICEMAIL, "Voicemail"},
{SKINNY_BUTTON_PRIVACY, "Privacy"},
{SKINNY_BUTTON_SERVICE_URL, "ServiceUrl"},
{SKINNY_BUTTON_UNDEFINED, "Undefined"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_button2str, SKINNY_BUTTONS, "Unknown")
struct skinny_table SKINNY_BUTTONS[] = {
{SKINNY_BUTTON_UNKNOWN, "Unknown"},
{SKINNY_BUTTON_LAST_NUMBER_REDIAL, "LastNumberRedial"},
{SKINNY_BUTTON_SPEED_DIAL, "SpeedDial"},
{SKINNY_BUTTON_HOLD, "Hold"},
{SKINNY_BUTTON_TRANSFER, "Transfer"},
{SKINNY_BUTTON_LINE, "Line"},
{SKINNY_BUTTON_VOICEMAIL, "Voicemail"},
{SKINNY_BUTTON_PRIVACY, "Privacy"},
{SKINNY_BUTTON_SERVICE_URL, "ServiceUrl"},
{SKINNY_BUTTON_UNDEFINED, "Undefined"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_button2str, SKINNY_BUTTONS, "Unknown")
SKINNY_DECLARE_STR2ID(skinny_str2button, SKINNY_BUTTONS, -1)
struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = {
{SOFTKEY_REDIAL, "SoftkeyRedial"},
{SOFTKEY_NEWCALL, "SoftkeyNewcall"},
{SOFTKEY_HOLD, "SoftkeyHold"},
{SOFTKEY_TRANSFER, "SoftkeyTransfer"},
{SOFTKEY_CFWDALL, "SoftkeyCfwdall"},
{SOFTKEY_CFWDBUSY, "SoftkeyCfwdbusy"},
{SOFTKEY_CFWDNOANSWER, "SoftkeyCfwdnoanswer"},
{SOFTKEY_BACKSPACE, "SoftkeyBackspace"},
{SOFTKEY_ENDCALL, "SoftkeyEndcall"},
{SOFTKEY_RESUME, "SoftkeyResume"},
{SOFTKEY_ANSWER , "SoftkeyAnswer"},
{SOFTKEY_INFO, "SoftkeyInfo"},
{SOFTKEY_CONFRM, "SoftkeyConfrm"},
{SOFTKEY_PARK, "SoftkeyPark"},
{SOFTKEY_JOIN, "SoftkeyJoin"},
{SOFTKEY_MEETMECONFRM, "SoftkeyMeetmeconfrm"},
{SOFTKEY_CALLPICKUP, "SoftkeyCallpickup"},
{SOFTKEY_GRPCALLPICKUP, "SoftkeyGrpcallpickup"},
{SOFTKEY_DND, "SoftkeyDnd"},
{SOFTKEY_IDIVERT, "SoftkeyIdivert"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_soft_key_event2str, SKINNY_SOFT_KEY_EVENTS, "SoftkeyUnknown")
struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = {
{SOFTKEY_REDIAL, "SoftkeyRedial"},
{SOFTKEY_NEWCALL, "SoftkeyNewcall"},
{SOFTKEY_HOLD, "SoftkeyHold"},
{SOFTKEY_TRANSFER, "SoftkeyTransfer"},
{SOFTKEY_CFWDALL, "SoftkeyCfwdall"},
{SOFTKEY_CFWDBUSY, "SoftkeyCfwdbusy"},
{SOFTKEY_CFWDNOANSWER, "SoftkeyCfwdnoanswer"},
{SOFTKEY_BACKSPACE, "SoftkeyBackspace"},
{SOFTKEY_ENDCALL, "SoftkeyEndcall"},
{SOFTKEY_RESUME, "SoftkeyResume"},
{SOFTKEY_ANSWER , "SoftkeyAnswer"},
{SOFTKEY_INFO, "SoftkeyInfo"},
{SOFTKEY_CONFRM, "SoftkeyConfrm"},
{SOFTKEY_PARK, "SoftkeyPark"},
{SOFTKEY_JOIN, "SoftkeyJoin"},
{SOFTKEY_MEETMECONFRM, "SoftkeyMeetmeconfrm"},
{SOFTKEY_CALLPICKUP, "SoftkeyCallpickup"},
{SOFTKEY_GRPCALLPICKUP, "SoftkeyGrpcallpickup"},
{SOFTKEY_DND, "SoftkeyDnd"},
{SOFTKEY_IDIVERT, "SoftkeyIdivert"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_soft_key_event2str, SKINNY_SOFT_KEY_EVENTS, "SoftkeyUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2soft_key_event, SKINNY_SOFT_KEY_EVENTS, 0)
struct skinny_table SKINNY_LAMP_MODES[] = {
{SKINNY_LAMP_OFF, "Off"},
{SKINNY_LAMP_ON, "On"},
{SKINNY_LAMP_WINK, "Wink"},
{SKINNY_LAMP_FLASH, "Flash"},
{SKINNY_LAMP_BLINK, "Blink"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_lamp_mode2str, SKINNY_LAMP_MODES, "Unknown")
struct skinny_table SKINNY_LAMP_MODES[] = {
{SKINNY_LAMP_OFF, "Off"},
{SKINNY_LAMP_ON, "On"},
{SKINNY_LAMP_WINK, "Wink"},
{SKINNY_LAMP_FLASH, "Flash"},
{SKINNY_LAMP_BLINK, "Blink"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_lamp_mode2str, SKINNY_LAMP_MODES, "Unknown")
SKINNY_DECLARE_STR2ID(skinny_str2lamp_mode, SKINNY_LAMP_MODES, -1)
struct skinny_table SKINNY_SPEAKER_MODES[] = {
{SKINNY_SPEAKER_ON, "SpeakerOn"},
{SKINNY_SPEAKER_OFF, "SpeakerOff"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_speaker_mode2str, SKINNY_SPEAKER_MODES, "Unknown")
struct skinny_table SKINNY_SPEAKER_MODES[] = {
{SKINNY_SPEAKER_ON, "SpeakerOn"},
{SKINNY_SPEAKER_OFF, "SpeakerOff"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_speaker_mode2str, SKINNY_SPEAKER_MODES, "Unknown")
SKINNY_DECLARE_STR2ID(skinny_str2speaker_mode, SKINNY_SPEAKER_MODES, -1)
struct skinny_table SKINNY_KEY_SETS[] = {
{SKINNY_KEY_SET_ON_HOOK, "KeySetOnHook"},
{SKINNY_KEY_SET_CONNECTED, "KeySetConnected"},
{SKINNY_KEY_SET_ON_HOLD, "KeySetOnHold"},
{SKINNY_KEY_SET_RING_IN, "KeySetRingIn"},
{SKINNY_KEY_SET_OFF_HOOK, "KeySetOffHook"},
{SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER, "KeySetConnectedWithTransfer"},
{SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT, "KeySetDigitsAfterDialingFirstDigit"},
{SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE, "KeySetConnectedWithConference"},
{SKINNY_KEY_SET_RING_OUT, "KeySetRingOut"},
{SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES, "KeySetOffHookWithFeatures"},
{SKINNY_KEY_SET_IN_USE_HINT, "KeySetInUseHint"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_soft_key_set2str, SKINNY_KEY_SETS, "UNKNOWN_SOFT_KEY_SET")
struct skinny_table SKINNY_KEY_SETS[] = {
{SKINNY_KEY_SET_ON_HOOK, "KeySetOnHook"},
{SKINNY_KEY_SET_CONNECTED, "KeySetConnected"},
{SKINNY_KEY_SET_ON_HOLD, "KeySetOnHold"},
{SKINNY_KEY_SET_RING_IN, "KeySetRingIn"},
{SKINNY_KEY_SET_OFF_HOOK, "KeySetOffHook"},
{SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER, "KeySetConnectedWithTransfer"},
{SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT, "KeySetDigitsAfterDialingFirstDigit"},
{SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE, "KeySetConnectedWithConference"},
{SKINNY_KEY_SET_RING_OUT, "KeySetRingOut"},
{SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES, "KeySetOffHookWithFeatures"},
{SKINNY_KEY_SET_IN_USE_HINT, "KeySetInUseHint"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_soft_key_set2str, SKINNY_KEY_SETS, "UNKNOWN_SOFT_KEY_SET")
SKINNY_DECLARE_STR2ID(skinny_str2soft_key_set, SKINNY_KEY_SETS, -1)
struct skinny_table SKINNY_CALL_STATES[] = {
{SKINNY_OFF_HOOK, "OffHook"},
{SKINNY_ON_HOOK, "OnHook"},
{SKINNY_RING_OUT, "RingOut"},
{SKINNY_RING_IN, "RingIn"},
{SKINNY_CONNECTED, "Connected"},
{SKINNY_BUSY, "Busy"},
{SKINNY_LINE_IN_USE, "LineInUse"},
{SKINNY_HOLD, "Hold"},
{SKINNY_CALL_WAITING, "CallWaiting"},
{SKINNY_CALL_TRANSFER, "CallTransfer"},
{SKINNY_CALL_PARK, "CallPark"},
{SKINNY_PROCEED, "Proceed"},
{SKINNY_IN_USE_REMOTELY, "InUseRemotely"},
{SKINNY_INVALID_NUMBER, "InvalidNumber"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_call_state2str, SKINNY_CALL_STATES, "CallStateUnknown")
struct skinny_table SKINNY_CALL_STATES[] = {
{SKINNY_OFF_HOOK, "OffHook"},
{SKINNY_ON_HOOK, "OnHook"},
{SKINNY_RING_OUT, "RingOut"},
{SKINNY_RING_IN, "RingIn"},
{SKINNY_CONNECTED, "Connected"},
{SKINNY_BUSY, "Busy"},
{SKINNY_LINE_IN_USE, "LineInUse"},
{SKINNY_HOLD, "Hold"},
{SKINNY_CALL_WAITING, "CallWaiting"},
{SKINNY_CALL_TRANSFER, "CallTransfer"},
{SKINNY_CALL_PARK, "CallPark"},
{SKINNY_PROCEED, "Proceed"},
{SKINNY_IN_USE_REMOTELY, "InUseRemotely"},
{SKINNY_INVALID_NUMBER, "InvalidNumber"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_call_state2str, SKINNY_CALL_STATES, "CallStateUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2call_state, SKINNY_CALL_STATES, -1)
struct skinny_table SKINNY_DEVICE_RESET_TYPES[] = {
{SKINNY_DEVICE_RESET, "DeviceReset"},
{SKINNY_DEVICE_RESTART, "DeviceRestart"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_device_reset_type2str, SKINNY_DEVICE_RESET_TYPES, "DeviceResetTypeUnknown")
struct skinny_table SKINNY_DEVICE_RESET_TYPES[] = {
{SKINNY_DEVICE_RESET, "DeviceReset"},
{SKINNY_DEVICE_RESTART, "DeviceRestart"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_device_reset_type2str, SKINNY_DEVICE_RESET_TYPES, "DeviceResetTypeUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2device_reset_type, SKINNY_DEVICE_RESET_TYPES, -1)
struct skinny_table SKINNY_ACCESSORY_TYPES[] = {
{SKINNY_ACCESSORY_NONE, "AccessoryNone"},
{SKINNY_ACCESSORY_HEADSET, "Headset"},
{SKINNY_ACCESSORY_HANDSET, "Handset"},
{SKINNY_ACCESSORY_SPEAKER, "Speaker"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_accessory_type2str, SKINNY_ACCESSORY_TYPES, "AccessoryUnknown")
struct skinny_table SKINNY_ACCESSORY_TYPES[] = {
{SKINNY_ACCESSORY_NONE, "AccessoryNone"},
{SKINNY_ACCESSORY_HEADSET, "Headset"},
{SKINNY_ACCESSORY_HANDSET, "Handset"},
{SKINNY_ACCESSORY_SPEAKER, "Speaker"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_accessory_type2str, SKINNY_ACCESSORY_TYPES, "AccessoryUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2accessory_type, SKINNY_ACCESSORY_TYPES, -1)
struct skinny_table SKINNY_ACCESSORY_STATES[] = {
{SKINNY_ACCESSORY_STATE_NONE, "AccessoryNoState"},
{SKINNY_ACCESSORY_STATE_OFFHOOK, "OffHook"},
{SKINNY_ACCESSORY_STATE_ONHOOK, "OnHook"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_accessory_state2str, SKINNY_ACCESSORY_STATES, "AccessoryStateUnknown")
struct skinny_table SKINNY_ACCESSORY_STATES[] = {
{SKINNY_ACCESSORY_STATE_NONE, "AccessoryNoState"},
{SKINNY_ACCESSORY_STATE_OFFHOOK, "OffHook"},
{SKINNY_ACCESSORY_STATE_ONHOOK, "OnHook"},
{0, NULL}
};
SKINNY_DECLARE_ID2STR(skinny_accessory_state2str, SKINNY_ACCESSORY_STATES, "AccessoryStateUnknown")
SKINNY_DECLARE_STR2ID(skinny_str2accessory_state, SKINNY_ACCESSORY_STATES, -1)
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/
+118 -118
View File
@@ -36,55 +36,55 @@
/* SKINNY TABLES */
/*****************************************************************************/
struct skinny_table {
uint32_t id;
const char *name;
uint32_t id;
const char *name;
};
#define SKINNY_DECLARE_ID2STR(func, TABLE, DEFAULT_STR) \
const char *func(uint32_t id) \
const char *func(uint32_t id) \
{ \
const char *str = DEFAULT_STR; \
uint8_t x; \
\
for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
if (TABLE[x].id == id) {\
str = TABLE[x].name;\
break;\
}\
}\
\
return str;\
const char *str = DEFAULT_STR; \
uint8_t x; \
\
for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
if (TABLE[x].id == id) {\
str = TABLE[x].name;\
break;\
}\
}\
\
return str;\
}
#define SKINNY_DECLARE_STR2ID(func, TABLE, DEFAULT_ID) \
uint32_t func(const char *str)\
uint32_t func(const char *str)\
{\
uint32_t id = (uint32_t) DEFAULT_ID;\
\
if (*str > 47 && *str < 58) {\
id = atoi(str);\
} else {\
uint8_t x;\
for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1 && TABLE[x].name; x++) {\
if (!strcasecmp(TABLE[x].name, str)) {\
id = TABLE[x].id;\
break;\
}\
}\
}\
return id;\
uint32_t id = (uint32_t) DEFAULT_ID;\
\
if (*str > 47 && *str < 58) {\
id = atoi(str);\
} else {\
uint8_t x;\
for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1 && TABLE[x].name; x++) {\
if (!strcasecmp(TABLE[x].name, str)) {\
id = TABLE[x].id;\
break;\
}\
}\
}\
return id;\
}
#define SKINNY_DECLARE_PUSH_MATCH(TABLE) \
switch_console_callback_match_t *my_matches = NULL;\
uint8_t x;\
for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
switch_console_push_match(&my_matches, TABLE[x].name);\
}\
if (my_matches) {\
*matches = my_matches;\
status = SWITCH_STATUS_SUCCESS;\
}
switch_console_callback_match_t *my_matches = NULL;\
uint8_t x;\
for (x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
switch_console_push_match(&my_matches, TABLE[x].name);\
}\
if (my_matches) {\
*matches = my_matches;\
status = SWITCH_STATUS_SUCCESS;\
}
extern struct skinny_table SKINNY_MESSAGE_TYPES[72];
@@ -98,20 +98,20 @@ uint32_t skinny_str2device_type(const char *str);
#define SKINNY_PUSH_DEVICE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_DEVICE_TYPES)
enum skinny_tone {
SKINNY_TONE_SILENCE = 0x00,
SKINNY_TONE_DIALTONE = 0x21,
SKINNY_TONE_BUSYTONE = 0x23,
SKINNY_TONE_ALERT = 0x24,
SKINNY_TONE_REORDER = 0x25,
SKINNY_TONE_CALLWAITTONE = 0x2D,
SKINNY_TONE_NOTONE = 0x7F,
SKINNY_TONE_SILENCE = 0x00,
SKINNY_TONE_DIALTONE = 0x21,
SKINNY_TONE_BUSYTONE = 0x23,
SKINNY_TONE_ALERT = 0x24,
SKINNY_TONE_REORDER = 0x25,
SKINNY_TONE_CALLWAITTONE = 0x2D,
SKINNY_TONE_NOTONE = 0x7F,
};
enum skinny_ring_type {
SKINNY_RING_OFF = 1,
SKINNY_RING_INSIDE = 2,
SKINNY_RING_OUTSIDE = 3,
SKINNY_RING_FEATURE = 4
SKINNY_RING_OFF = 1,
SKINNY_RING_INSIDE = 2,
SKINNY_RING_OUTSIDE = 3,
SKINNY_RING_FEATURE = 4
};
extern struct skinny_table SKINNY_RING_TYPES[5];
const char *skinny_ring_type2str(uint32_t id);
@@ -119,8 +119,8 @@ uint32_t skinny_str2ring_type(const char *str);
#define SKINNY_PUSH_RING_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_RING_TYPES)
enum skinny_ring_mode {
SKINNY_RING_FOREVER = 1,
SKINNY_RING_ONCE = 2,
SKINNY_RING_FOREVER = 1,
SKINNY_RING_ONCE = 2,
};
extern struct skinny_table SKINNY_RING_MODES[3];
const char *skinny_ring_mode2str(uint32_t id);
@@ -129,11 +129,11 @@ uint32_t skinny_str2ring_mode(const char *str);
enum skinny_lamp_mode {
SKINNY_LAMP_OFF = 1,
SKINNY_LAMP_ON = 2,
SKINNY_LAMP_WINK = 3,
SKINNY_LAMP_FLASH = 4,
SKINNY_LAMP_BLINK = 5,
SKINNY_LAMP_OFF = 1,
SKINNY_LAMP_ON = 2,
SKINNY_LAMP_WINK = 3,
SKINNY_LAMP_FLASH = 4,
SKINNY_LAMP_BLINK = 5,
};
extern struct skinny_table SKINNY_LAMP_MODES[6];
const char *skinny_lamp_mode2str(uint32_t id);
@@ -141,8 +141,8 @@ uint32_t skinny_str2lamp_mode(const char *str);
#define SKINNY_PUSH_LAMP_MODES SKINNY_DECLARE_PUSH_MATCH(SKINNY_LAMP_MODES)
enum skinny_speaker_mode {
SKINNY_SPEAKER_ON = 1,
SKINNY_SPEAKER_OFF = 2,
SKINNY_SPEAKER_ON = 1,
SKINNY_SPEAKER_OFF = 2,
};
extern struct skinny_table SKINNY_SPEAKER_MODES[3];
const char *skinny_speaker_mode2str(uint32_t id);
@@ -150,22 +150,22 @@ uint32_t skinny_str2speaker_mode(const char *str);
#define SKINNY_PUSH_SPEAKER_MODES SKINNY_DECLARE_PUSH_MATCH(SKINNY_SPEAKER_MODES)
enum skinny_call_type {
SKINNY_INBOUND_CALL = 1,
SKINNY_OUTBOUND_CALL = 2,
SKINNY_FORWARD_CALL = 3,
SKINNY_INBOUND_CALL = 1,
SKINNY_OUTBOUND_CALL = 2,
SKINNY_FORWARD_CALL = 3,
};
enum skinny_button_definition {
SKINNY_BUTTON_UNKNOWN = 0x00,
SKINNY_BUTTON_LAST_NUMBER_REDIAL = 0x01,
SKINNY_BUTTON_SPEED_DIAL = 0x02,
SKINNY_BUTTON_HOLD = 0x03,
SKINNY_BUTTON_TRANSFER = 0x04,
SKINNY_BUTTON_LINE = 0x09,
SKINNY_BUTTON_VOICEMAIL = 0x0F,
SKINNY_BUTTON_PRIVACY = 0x13,
SKINNY_BUTTON_SERVICE_URL = 0x14,
SKINNY_BUTTON_UNDEFINED = 0xFF,
SKINNY_BUTTON_UNKNOWN = 0x00,
SKINNY_BUTTON_LAST_NUMBER_REDIAL = 0x01,
SKINNY_BUTTON_SPEED_DIAL = 0x02,
SKINNY_BUTTON_HOLD = 0x03,
SKINNY_BUTTON_TRANSFER = 0x04,
SKINNY_BUTTON_LINE = 0x09,
SKINNY_BUTTON_VOICEMAIL = 0x0F,
SKINNY_BUTTON_PRIVACY = 0x13,
SKINNY_BUTTON_SERVICE_URL = 0x14,
SKINNY_BUTTON_UNDEFINED = 0xFF,
};
extern struct skinny_table SKINNY_BUTTONS[11];
const char *skinny_button2str(uint32_t id);
@@ -173,26 +173,26 @@ uint32_t skinny_str2button(const char *str);
#define SKINNY_PUSH_STIMULI SKINNY_DECLARE_PUSH_MATCH(SKINNY_BUTTONS)
enum skinny_soft_key_event {
SOFTKEY_REDIAL = 0x01,
SOFTKEY_NEWCALL = 0x02,
SOFTKEY_HOLD = 0x03,
SOFTKEY_TRANSFER = 0x04,
SOFTKEY_CFWDALL = 0x05,
SOFTKEY_CFWDBUSY = 0x06,
SOFTKEY_CFWDNOANSWER = 0x07,
SOFTKEY_BACKSPACE = 0x08,
SOFTKEY_ENDCALL = 0x09,
SOFTKEY_RESUME = 0x0A,
SOFTKEY_ANSWER = 0x0B,
SOFTKEY_INFO = 0x0C,
SOFTKEY_CONFRM = 0x0D,
SOFTKEY_PARK = 0x0E,
SOFTKEY_JOIN = 0x0F,
SOFTKEY_MEETMECONFRM = 0x10,
SOFTKEY_CALLPICKUP = 0x11,
SOFTKEY_GRPCALLPICKUP = 0x12,
SOFTKEY_DND = 0x13,
SOFTKEY_IDIVERT = 0x14,
SOFTKEY_REDIAL = 0x01,
SOFTKEY_NEWCALL = 0x02,
SOFTKEY_HOLD = 0x03,
SOFTKEY_TRANSFER = 0x04,
SOFTKEY_CFWDALL = 0x05,
SOFTKEY_CFWDBUSY = 0x06,
SOFTKEY_CFWDNOANSWER = 0x07,
SOFTKEY_BACKSPACE = 0x08,
SOFTKEY_ENDCALL = 0x09,
SOFTKEY_RESUME = 0x0A,
SOFTKEY_ANSWER = 0x0B,
SOFTKEY_INFO = 0x0C,
SOFTKEY_CONFRM = 0x0D,
SOFTKEY_PARK = 0x0E,
SOFTKEY_JOIN = 0x0F,
SOFTKEY_MEETMECONFRM = 0x10,
SOFTKEY_CALLPICKUP = 0x11,
SOFTKEY_GRPCALLPICKUP = 0x12,
SOFTKEY_DND = 0x13,
SOFTKEY_IDIVERT = 0x14,
};
extern struct skinny_table SKINNY_SOFT_KEY_EVENTS[21];
const char *skinny_soft_key_event2str(uint32_t id);
@@ -200,17 +200,17 @@ uint32_t skinny_str2soft_key_event(const char *str);
#define SKINNY_PUSH_SOFT_KEY_EVENTS SKINNY_DECLARE_PUSH_MATCH(SOFT_KEY_EVENTS)
enum skinny_key_set {
SKINNY_KEY_SET_ON_HOOK = 0,
SKINNY_KEY_SET_CONNECTED = 1,
SKINNY_KEY_SET_ON_HOLD = 2,
SKINNY_KEY_SET_RING_IN = 3,
SKINNY_KEY_SET_OFF_HOOK = 4,
SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER = 5,
SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT = 6,
SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE = 7,
SKINNY_KEY_SET_RING_OUT = 8,
SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES = 9,
SKINNY_KEY_SET_IN_USE_HINT = 10,
SKINNY_KEY_SET_ON_HOOK = 0,
SKINNY_KEY_SET_CONNECTED = 1,
SKINNY_KEY_SET_ON_HOLD = 2,
SKINNY_KEY_SET_RING_IN = 3,
SKINNY_KEY_SET_OFF_HOOK = 4,
SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER = 5,
SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT = 6,
SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE = 7,
SKINNY_KEY_SET_RING_OUT = 8,
SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES = 9,
SKINNY_KEY_SET_IN_USE_HINT = 10,
};
extern struct skinny_table SKINNY_KEY_SETS[12];
const char *skinny_soft_key_set2str(uint32_t id);
@@ -219,20 +219,20 @@ uint32_t skinny_str2soft_key_set(const char *str);
enum skinny_call_state {
SKINNY_OFF_HOOK = 1,
SKINNY_ON_HOOK = 2,
SKINNY_RING_OUT = 3,
SKINNY_RING_IN = 4,
SKINNY_CONNECTED = 5,
SKINNY_BUSY = 6,
SKINNY_LINE_IN_USE = 7,
SKINNY_HOLD = 8,
SKINNY_CALL_WAITING = 9,
SKINNY_CALL_TRANSFER = 10,
SKINNY_CALL_PARK = 11,
SKINNY_PROCEED = 12,
SKINNY_IN_USE_REMOTELY = 13,
SKINNY_INVALID_NUMBER = 14
SKINNY_OFF_HOOK = 1,
SKINNY_ON_HOOK = 2,
SKINNY_RING_OUT = 3,
SKINNY_RING_IN = 4,
SKINNY_CONNECTED = 5,
SKINNY_BUSY = 6,
SKINNY_LINE_IN_USE = 7,
SKINNY_HOLD = 8,
SKINNY_CALL_WAITING = 9,
SKINNY_CALL_TRANSFER = 10,
SKINNY_CALL_PARK = 11,
SKINNY_PROCEED = 12,
SKINNY_IN_USE_REMOTELY = 13,
SKINNY_INVALID_NUMBER = 14
};
extern struct skinny_table SKINNY_CALL_STATES[15];
const char *skinny_call_state2str(uint32_t id);
@@ -240,8 +240,8 @@ uint32_t skinny_str2call_state(const char *str);
#define SKINNY_PUSH_CALL_STATES SKINNY_DECLARE_PUSH_MATCH(SKINNY_CALL_STATES)
enum skinny_device_reset_types {
SKINNY_DEVICE_RESET = 1,
SKINNY_DEVICE_RESTART = 2
SKINNY_DEVICE_RESET = 1,
SKINNY_DEVICE_RESTART = 2
};
extern struct skinny_table SKINNY_DEVICE_RESET_TYPES[3];
const char *skinny_device_reset_type2str(uint32_t id);
+3 -4
View File
@@ -4634,7 +4634,7 @@ static void general_event_handler(switch_event_t *event)
id = switch_mprintf("sip:%s@%s", user, host);
switch_assert(id);
for (m = list->head; m; m = m->next) {
contact = sofia_glue_get_url_from_contact(m->val, 0);
@@ -4647,10 +4647,9 @@ static void general_event_handler(switch_event_t *event)
nua_message(nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR(ct),
TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_IF(!zstr(subject), SIPTAG_SUBJECT_STR(subject)), TAG_END());
free(id);
}
free(id);
switch_console_free_matches(&list);
sofia_glue_release_profile(profile);
+4
View File
@@ -1326,6 +1326,10 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
(statements == 0 || (statements <= 1024 && (switch_micro_time_now() - last_commit)/1000 < profile->trans_timeout)))) {
switch_interval_time_t sleepy_time = !statements ? 1000000 : switch_micro_time_now() - last_commit - profile->trans_timeout*1000;
if (sleepy_time < 1000 || sleepy_time > 1000000) {
sleepy_time = 1000;
}
if (sql || (switch_queue_pop_timeout(profile->sql_queue, &pop, sleepy_time) == SWITCH_STATUS_SUCCESS && pop)) {
switch_size_t newlen;
@@ -29,6 +29,7 @@
*
*/
#include <switch.h>
#include <sys/wait.h>
#define MY_BUF_LEN 1024 * 32
#define MY_BLOCK_SIZE MY_BUF_LEN
@@ -135,6 +136,8 @@ static switch_status_t shell_stream_file_open(switch_file_handle_t *handle, cons
switch_cond_next();
}
wait(&(context->pid));
goto end;
} else { /* child */
close(context->fds[0]);
@@ -2857,6 +2857,34 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_flush_packet_count_get
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_largest_jb_size_set(void * jarg1, void * jarg2) {
switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
switch_size_t arg2 ;
switch_size_t *argp2 ;
arg1 = (switch_rtp_numbers_t *)jarg1;
argp2 = (switch_size_t *)jarg2;
if (!argp2) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
return ;
}
arg2 = *argp2;
if (arg1) (arg1)->largest_jb_size = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_largest_jb_size_get(void * jarg1) {
void * jresult ;
switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
switch_size_t result;
arg1 = (switch_rtp_numbers_t *)jarg1;
result = ((arg1)->largest_jb_size);
jresult = new switch_size_t((const switch_size_t &)result);
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_numbers_t() {
void * jresult ;
switch_rtp_numbers_t *result = 0 ;
@@ -5158,6 +5186,38 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_regex_match_partial(char * jarg1, char
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_capture_regex(void * jarg1, int jarg2, char * jarg3, void * jarg4, char * jarg5, void * jarg6, void * jarg7) {
switch_regex_t *arg1 = (switch_regex_t *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
int *arg4 = (int *) 0 ;
char *arg5 = (char *) 0 ;
switch_cap_callback_t arg6 = (switch_cap_callback_t) 0 ;
void *arg7 = (void *) 0 ;
arg1 = (switch_regex_t *)jarg1;
arg2 = (int)jarg2;
arg3 = (char *)jarg3;
arg4 = (int *)jarg4;
arg5 = (char *)jarg5;
arg6 = (switch_cap_callback_t)jarg6;
arg7 = (void *)jarg7;
switch_capture_regex(arg1,arg2,(char const *)arg3,arg4,(char const *)arg5,arg6,arg7);
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_regex_set_var_callback(char * jarg1, char * jarg2, void * jarg3) {
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
void *arg3 = (void *) 0 ;
arg1 = (char *)jarg1;
arg2 = (char *)jarg2;
arg3 = (void *)jarg3;
switch_regex_set_var_callback((char const *)arg1,(char const *)arg2,arg3);
}
SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_CORE_THREAD_SESSION_OBJS_get() {
int jresult ;
int result;
@@ -5410,6 +5470,34 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_app_log_arg_get(void * jarg1) {
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_app_log_stamp_set(void * jarg1, void * jarg2) {
switch_app_log *arg1 = (switch_app_log *) 0 ;
switch_time_t arg2 ;
switch_time_t *argp2 ;
arg1 = (switch_app_log *)jarg1;
argp2 = (switch_time_t *)jarg2;
if (!argp2) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
return ;
}
arg2 = *argp2;
if (arg1) (arg1)->stamp = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_app_log_stamp_get(void * jarg1) {
void * jresult ;
switch_app_log *arg1 = (switch_app_log *) 0 ;
switch_time_t result;
arg1 = (switch_app_log *)jarg1;
result = ((arg1)->stamp);
jresult = new switch_time_t((const switch_time_t &)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_app_log_next_set(void * jarg1, void * jarg2) {
switch_app_log *arg1 = (switch_app_log *) 0 ;
switch_app_log *arg2 = (switch_app_log *) 0 ;
@@ -6605,6 +6693,30 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_add_state_handler(void * jarg1) {
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_curl_count(void * jarg1) {
int jresult ;
int *arg1 = (int *) 0 ;
int result;
arg1 = (int *)jarg1;
result = (int)switch_core_curl_count(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_ssl_count(void * jarg1) {
int jresult ;
int *arg1 = (int *) 0 ;
int result;
arg1 = (int *)jarg1;
result = (int)switch_core_ssl_count(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_remove_state_handler(void * jarg1) {
switch_state_handler_table_t *arg1 = (switch_state_handler_table_t *) 0 ;
@@ -13101,6 +13213,106 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_split_user_domain(char * jarg1, void *
}
SWIGEXPORT void SWIGSTDCALL CSharp_profile_node_t_var_set(void * jarg1, char * jarg2) {
profile_node_t *arg1 = (profile_node_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (profile_node_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg1->var) delete [] arg1->var;
if (arg2) {
arg1->var = (char *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->var, (const char *)arg2);
} else {
arg1->var = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_profile_node_t_var_get(void * jarg1) {
char * jresult ;
profile_node_t *arg1 = (profile_node_t *) 0 ;
char *result = 0 ;
arg1 = (profile_node_t *)jarg1;
result = (char *) ((arg1)->var);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_profile_node_t_val_set(void * jarg1, char * jarg2) {
profile_node_t *arg1 = (profile_node_t *) 0 ;
char *arg2 = (char *) 0 ;
arg1 = (profile_node_t *)jarg1;
arg2 = (char *)jarg2;
{
if (arg1->val) delete [] arg1->val;
if (arg2) {
arg1->val = (char *) (new char[strlen((const char *)arg2)+1]);
strcpy((char *)arg1->val, (const char *)arg2);
} else {
arg1->val = 0;
}
}
}
SWIGEXPORT char * SWIGSTDCALL CSharp_profile_node_t_val_get(void * jarg1) {
char * jresult ;
profile_node_t *arg1 = (profile_node_t *) 0 ;
char *result = 0 ;
arg1 = (profile_node_t *)jarg1;
result = (char *) ((arg1)->val);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_profile_node_t_next_set(void * jarg1, void * jarg2) {
profile_node_t *arg1 = (profile_node_t *) 0 ;
profile_node_s *arg2 = (profile_node_s *) 0 ;
arg1 = (profile_node_t *)jarg1;
arg2 = (profile_node_s *)jarg2;
if (arg1) (arg1)->next = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_profile_node_t_next_get(void * jarg1) {
void * jresult ;
profile_node_t *arg1 = (profile_node_t *) 0 ;
profile_node_s *result = 0 ;
arg1 = (profile_node_t *)jarg1;
result = (profile_node_s *) ((arg1)->next);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_profile_node_t() {
void * jresult ;
profile_node_t *result = 0 ;
result = (profile_node_t *)new profile_node_t();
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_delete_profile_node_t(void * jarg1) {
profile_node_t *arg1 = (profile_node_t *) 0 ;
arg1 = (profile_node_t *)jarg1;
delete arg1;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_username_set(void * jarg1, char * jarg2) {
switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
char *arg2 = (char *) 0 ;
@@ -13964,6 +14176,28 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_caller_profile_direction_get(void * jar
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_soft_set(void * jarg1, void * jarg2) {
switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
profile_node_t *arg2 = (profile_node_t *) 0 ;
arg1 = (switch_caller_profile *)jarg1;
arg2 = (profile_node_t *)jarg2;
if (arg1) (arg1)->soft = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_soft_get(void * jarg1) {
void * jresult ;
switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
profile_node_t *result = 0 ;
arg1 = (switch_caller_profile *)jarg1;
result = (profile_node_t *) ((arg1)->soft);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_caller_profile() {
void * jresult ;
switch_caller_profile *result = 0 ;
@@ -23118,6 +23352,26 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_variable_var_check(void * j
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_add_variable_var_check(void * jarg1, char * jarg2, char * jarg3, int jarg4, int jarg5) {
int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
switch_bool_t arg4 ;
switch_stack_t arg5 ;
switch_status_t result;
arg1 = (switch_channel_t *)jarg1;
arg2 = (char *)jarg2;
arg3 = (char *)jarg3;
arg4 = (switch_bool_t)jarg4;
arg5 = (switch_stack_t)jarg5;
result = (switch_status_t)switch_channel_add_variable_var_check(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_variable_printf(void * jarg1, char * jarg2, char * jarg3) {
int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
@@ -23261,17 +23515,19 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_printf(void * j
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable_dup(void * jarg1, char * jarg2, int jarg3) {
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable_dup(void * jarg1, char * jarg2, int jarg3, int jarg4) {
char * jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
char *arg2 = (char *) 0 ;
switch_bool_t arg3 ;
int arg4 ;
char *result = 0 ;
arg1 = (switch_channel_t *)jarg1;
arg2 = (char *)jarg2;
arg3 = (switch_bool_t)jarg3;
result = (char *)switch_channel_get_variable_dup(arg1,(char const *)arg2,arg3);
arg4 = (int)jarg4;
result = (char *)switch_channel_get_variable_dup(arg1,(char const *)arg2,arg3,arg4);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
@@ -24577,6 +24833,50 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_header_value_get(void * jarg1)
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_header_array_set(void * jarg1, void * jarg2) {
switch_event_header *arg1 = (switch_event_header *) 0 ;
char **arg2 = (char **) 0 ;
arg1 = (switch_event_header *)jarg1;
arg2 = (char **)jarg2;
if (arg1) (arg1)->array = arg2;
}
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_header_array_get(void * jarg1) {
void * jresult ;
switch_event_header *arg1 = (switch_event_header *) 0 ;
char **result = 0 ;
arg1 = (switch_event_header *)jarg1;
result = (char **) ((arg1)->array);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_header_idx_set(void * jarg1, int jarg2) {
switch_event_header *arg1 = (switch_event_header *) 0 ;
int arg2 ;
arg1 = (switch_event_header *)jarg1;
arg2 = (int)jarg2;
if (arg1) (arg1)->idx = arg2;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_header_idx_get(void * jarg1) {
int jresult ;
switch_event_header *arg1 = (switch_event_header *) 0 ;
int result;
arg1 = (switch_event_header *)jarg1;
result = (int) ((arg1)->idx);
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_header_hash_set(void * jarg1, unsigned long jarg2) {
switch_event_header *arg1 = (switch_event_header *) 0 ;
unsigned long arg2 ;
@@ -25003,15 +25303,31 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_set_priority(void * jarg1, int ja
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_get_header(void * jarg1, char * jarg2) {
SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_get_header_ptr(void * jarg1, char * jarg2) {
void * jresult ;
switch_event_t *arg1 = (switch_event_t *) 0 ;
char *arg2 = (char *) 0 ;
switch_event_header_t *result = 0 ;
arg1 = (switch_event_t *)jarg1;
arg2 = (char *)jarg2;
result = (switch_event_header_t *)switch_event_get_header_ptr(arg1,(char const *)arg2);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_get_header_idx(void * jarg1, char * jarg2, int jarg3) {
char * jresult ;
switch_event_t *arg1 = (switch_event_t *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 ;
char *result = 0 ;
arg1 = (switch_event_t *)jarg1;
arg2 = (char *)jarg2;
result = (char *)switch_event_get_header(arg1,(char const *)arg2);
arg3 = (int)jarg3;
result = (char *)switch_event_get_header_idx(arg1,(char const *)arg2,arg3);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
@@ -30580,6 +30896,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate_user_merged(char * jarg1, ch
}
SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_xml_clear_user_cache(char * jarg1, char * jarg2, char * jarg3) {
unsigned long jresult ;
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
uint32_t result;
arg1 = (char *)jarg1;
arg2 = (char *)jarg2;
arg3 = (char *)jarg3;
result = (uint32_t)switch_xml_clear_user_cache((char const *)arg1,(char const *)arg2,(char const *)arg3);
jresult = (unsigned long)result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_merge_user(void * jarg1, void * jarg2, void * jarg3) {
switch_xml_t arg1 = (switch_xml_t) 0 ;
switch_xml_t arg2 = (switch_xml_t) 0 ;
@@ -954,6 +954,14 @@ public class freeswitch {
return ret;
}
public static void switch_capture_regex(SWIGTYPE_p_real_pcre re, int match_count, string field_data, SWIGTYPE_p_int ovector, string var, SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void callback, SWIGTYPE_p_void user_data) {
freeswitchPINVOKE.switch_capture_regex(SWIGTYPE_p_real_pcre.getCPtr(re), match_count, field_data, SWIGTYPE_p_int.getCPtr(ovector), var, SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data));
}
public static void switch_regex_set_var_callback(string var, string val, SWIGTYPE_p_void user_data) {
freeswitchPINVOKE.switch_regex_set_var_callback(var, val, SWIGTYPE_p_void.getCPtr(user_data));
}
public static void switch_core_session_sched_heartbeat(SWIGTYPE_p_switch_core_session session, uint seconds) {
freeswitchPINVOKE.switch_core_session_sched_heartbeat(SWIGTYPE_p_switch_core_session.getCPtr(session), seconds);
}
@@ -1161,6 +1169,16 @@ public class freeswitch {
return ret;
}
public static int switch_core_curl_count(SWIGTYPE_p_int val) {
int ret = freeswitchPINVOKE.switch_core_curl_count(SWIGTYPE_p_int.getCPtr(val));
return ret;
}
public static int switch_core_ssl_count(SWIGTYPE_p_int val) {
int ret = freeswitchPINVOKE.switch_core_ssl_count(SWIGTYPE_p_int.getCPtr(val));
return ret;
}
public static void switch_core_remove_state_handler(switch_state_handler_table state_handler) {
freeswitchPINVOKE.switch_core_remove_state_handler(switch_state_handler_table.getCPtr(state_handler));
}
@@ -3394,6 +3412,11 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_channel_add_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string value, switch_bool_t var_check, switch_stack_t stack) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_add_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, value, (int)var_check, (int)stack);
return ret;
}
public static switch_status_t switch_channel_set_variable_printf(SWIGTYPE_p_switch_channel channel, string varname, string fmt) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_variable_printf(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, fmt);
return ret;
@@ -3438,8 +3461,8 @@ public class freeswitch {
return ret;
}
public static string switch_channel_get_variable_dup(SWIGTYPE_p_switch_channel channel, string varname, switch_bool_t dup) {
string ret = freeswitchPINVOKE.switch_channel_get_variable_dup(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, (int)dup);
public static string switch_channel_get_variable_dup(SWIGTYPE_p_switch_channel channel, string varname, switch_bool_t dup, int idx) {
string ret = freeswitchPINVOKE.switch_channel_get_variable_dup(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, (int)dup, idx);
return ret;
}
@@ -3902,8 +3925,14 @@ public class freeswitch {
return ret;
}
public static string switch_event_get_header(switch_event arg0, string header_name) {
string ret = freeswitchPINVOKE.switch_event_get_header(switch_event.getCPtr(arg0), header_name);
public static switch_event_header switch_event_get_header_ptr(switch_event arg0, string header_name) {
IntPtr cPtr = freeswitchPINVOKE.switch_event_get_header_ptr(switch_event.getCPtr(arg0), header_name);
switch_event_header ret = (cPtr == IntPtr.Zero) ? null : new switch_event_header(cPtr, false);
return ret;
}
public static string switch_event_get_header_idx(switch_event arg0, string header_name, int idx) {
string ret = freeswitchPINVOKE.switch_event_get_header_idx(switch_event.getCPtr(arg0), header_name, idx);
return ret;
}
@@ -5252,6 +5281,11 @@ public class freeswitch {
return ret;
}
public static uint switch_xml_clear_user_cache(string key, string user_name, string domain_name) {
uint ret = freeswitchPINVOKE.switch_xml_clear_user_cache(key, user_name, domain_name);
return ret;
}
public static void switch_xml_merge_user(switch_xml user, switch_xml domain, switch_xml group) {
freeswitchPINVOKE.switch_xml_merge_user(switch_xml.getCPtr(user), switch_xml.getCPtr(domain), switch_xml.getCPtr(group));
}
@@ -6611,6 +6645,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_flush_packet_count_get")]
public static extern IntPtr switch_rtp_numbers_t_flush_packet_count_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_largest_jb_size_set")]
public static extern void switch_rtp_numbers_t_largest_jb_size_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_largest_jb_size_get")]
public static extern IntPtr switch_rtp_numbers_t_largest_jb_size_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_numbers_t")]
public static extern IntPtr new_switch_rtp_numbers_t();
@@ -7214,6 +7254,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_regex_match_partial")]
public static extern int switch_regex_match_partial(string jarg1, string jarg2, HandleRef jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_capture_regex")]
public static extern void switch_capture_regex(HandleRef jarg1, int jarg2, string jarg3, HandleRef jarg4, string jarg5, HandleRef jarg6, HandleRef jarg7);
[DllImport("mod_managed", EntryPoint="CSharp_switch_regex_set_var_callback")]
public static extern void switch_regex_set_var_callback(string jarg1, string jarg2, HandleRef jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_CORE_THREAD_SESSION_OBJS_get")]
public static extern int SWITCH_MAX_CORE_THREAD_SESSION_OBJS_get();
@@ -7280,6 +7326,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_arg_get")]
public static extern string switch_app_log_arg_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_stamp_set")]
public static extern void switch_app_log_stamp_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_stamp_get")]
public static extern IntPtr switch_app_log_stamp_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_next_set")]
public static extern void switch_app_log_next_set(HandleRef jarg1, HandleRef jarg2);
@@ -7574,6 +7626,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_add_state_handler")]
public static extern int switch_core_add_state_handler(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_curl_count")]
public static extern int switch_core_curl_count(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_ssl_count")]
public static extern int switch_core_ssl_count(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_remove_state_handler")]
public static extern void switch_core_remove_state_handler(HandleRef jarg1);
@@ -9017,6 +9075,30 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_split_user_domain")]
public static extern int switch_split_user_domain(string jarg1, ref string jarg2, ref string jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_profile_node_t_var_set")]
public static extern void profile_node_t_var_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_profile_node_t_var_get")]
public static extern string profile_node_t_var_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_profile_node_t_val_set")]
public static extern void profile_node_t_val_set(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_profile_node_t_val_get")]
public static extern string profile_node_t_val_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_profile_node_t_next_set")]
public static extern void profile_node_t_next_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_profile_node_t_next_get")]
public static extern IntPtr profile_node_t_next_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_new_profile_node_t")]
public static extern IntPtr new_profile_node_t();
[DllImport("mod_managed", EntryPoint="CSharp_delete_profile_node_t")]
public static extern void delete_profile_node_t(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_username_set")]
public static extern void switch_caller_profile_username_set(HandleRef jarg1, string jarg2);
@@ -9221,6 +9303,12 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_direction_get")]
public static extern int switch_caller_profile_direction_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_soft_set")]
public static extern void switch_caller_profile_soft_set(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_soft_get")]
public static extern IntPtr switch_caller_profile_soft_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_new_switch_caller_profile")]
public static extern IntPtr new_switch_caller_profile();
@@ -11594,6 +11682,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_variable_var_check")]
public static extern int switch_channel_set_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_add_variable_var_check")]
public static extern int switch_channel_add_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_variable_printf")]
public static extern int switch_channel_set_variable_printf(HandleRef jarg1, string jarg2, string jarg3);
@@ -11622,7 +11713,7 @@ class freeswitchPINVOKE {
public static extern int switch_channel_export_variable_printf(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variable_dup")]
public static extern string switch_channel_get_variable_dup(HandleRef jarg1, string jarg2, int jarg3);
public static extern string switch_channel_get_variable_dup(HandleRef jarg1, string jarg2, int jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variables")]
public static extern int switch_channel_get_variables(HandleRef jarg1, HandleRef jarg2);
@@ -11909,6 +12000,18 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_value_get")]
public static extern string switch_event_header_value_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_array_set")]
public static extern void switch_event_header_array_set(HandleRef jarg1, ref string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_array_get")]
public static extern string switch_event_header_array_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_idx_set")]
public static extern void switch_event_header_idx_set(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_idx_get")]
public static extern int switch_event_header_idx_get(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_hash_set")]
public static extern void switch_event_header_hash_set(HandleRef jarg1, uint jarg2);
@@ -12017,8 +12120,11 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_set_priority")]
public static extern int switch_event_set_priority(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_get_header")]
public static extern string switch_event_get_header(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_get_header_ptr")]
public static extern IntPtr switch_event_get_header_ptr(HandleRef jarg1, string jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_get_header_idx")]
public static extern string switch_event_get_header_idx(HandleRef jarg1, string jarg2, int jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_event_get_body")]
public static extern string switch_event_get_body(HandleRef jarg1);
@@ -13190,6 +13296,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_user_merged")]
public static extern int switch_xml_locate_user_merged(string jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5, HandleRef jarg6);
[DllImport("mod_managed", EntryPoint="CSharp_switch_xml_clear_user_cache")]
public static extern uint switch_xml_clear_user_cache(string jarg1, string jarg2, string jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_xml_merge_user")]
public static extern void switch_xml_merge_user(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
@@ -14472,6 +14581,86 @@ public partial class ManagedSession : CoreSession {
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class profile_node_t : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal profile_node_t(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(profile_node_t obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~profile_node_t() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
freeswitchPINVOKE.delete_profile_node_t(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public string var {
set {
freeswitchPINVOKE.profile_node_t_var_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.profile_node_t_var_get(swigCPtr);
return ret;
}
}
public string val {
set {
freeswitchPINVOKE.profile_node_t_val_set(swigCPtr, value);
}
get {
string ret = freeswitchPINVOKE.profile_node_t_val_get(swigCPtr);
return ret;
}
}
public profile_node_t next {
set {
freeswitchPINVOKE.profile_node_t_next_set(swigCPtr, profile_node_t.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.profile_node_t_next_get(swigCPtr);
profile_node_t ret = (cPtr == IntPtr.Zero) ? null : new profile_node_t(cPtr, false);
return ret;
}
}
public profile_node_t() : this(freeswitchPINVOKE.new_profile_node_t(), true) {
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.1
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
[System.Flags] public enum session_flag_t {
S_HUP = (1 << 0),
S_FREE = (1 << 1),
@@ -14853,6 +15042,36 @@ namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void {
private HandleRef swigCPtr;
internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void(IntPtr cPtr, bool futureUse) {
swigCPtr = new HandleRef(this, cPtr);
}
protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void() {
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_void__void obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
}
}
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.1
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace FreeSWITCH.Native {
using System;
using System.Runtime.InteropServices;
public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char__switch_status_t {
private HandleRef swigCPtr;
@@ -19960,6 +20179,18 @@ public class switch_app_log : IDisposable {
}
}
public SWIGTYPE_p_switch_time_t stamp {
set {
freeswitchPINVOKE.switch_app_log_stamp_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
}
get {
SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_app_log_stamp_get(swigCPtr), true);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
public switch_app_log next {
set {
freeswitchPINVOKE.switch_app_log_next_set(swigCPtr, switch_app_log.getCPtr(value));
@@ -21727,6 +21958,17 @@ public class switch_caller_profile : IDisposable {
}
}
public profile_node_t soft {
set {
freeswitchPINVOKE.switch_caller_profile_soft_set(swigCPtr, profile_node_t.getCPtr(value));
}
get {
IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_soft_get(swigCPtr);
profile_node_t ret = (cPtr == IntPtr.Zero) ? null : new profile_node_t(cPtr, false);
return ret;
}
}
public switch_caller_profile() : this(freeswitchPINVOKE.new_switch_caller_profile(), true) {
}
@@ -24926,7 +25168,8 @@ public class switch_event : IDisposable {
namespace FreeSWITCH.Native {
public enum switch_event_flag_t {
EF_UNIQ_HEADERS = (1 << 0)
EF_UNIQ_HEADERS = (1 << 0),
EF_CONTAINS_ARRAYS = (1 << 1)
}
}
@@ -24993,6 +25236,25 @@ public class switch_event_header : IDisposable {
}
}
public string array {
set { freeswitchPINVOKE.switch_event_header_array_set(swigCPtr, ref value); }
get {
return freeswitchPINVOKE.switch_event_header_array_get(swigCPtr);
}
}
public int idx {
set {
freeswitchPINVOKE.switch_event_header_idx_set(swigCPtr, value);
}
get {
int ret = freeswitchPINVOKE.switch_event_header_idx_get(swigCPtr);
return ret;
}
}
public uint hash {
set {
freeswitchPINVOKE.switch_event_header_hash_set(swigCPtr, value);
@@ -29376,6 +29638,18 @@ public class switch_rtp_numbers_t : IDisposable {
}
}
public SWIGTYPE_p_switch_size_t largest_jb_size {
set {
freeswitchPINVOKE.switch_rtp_numbers_t_largest_jb_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
}
get {
SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_largest_jb_size_get(swigCPtr), true);
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
public switch_rtp_numbers_t() : this(freeswitchPINVOKE.new_switch_rtp_numbers_t(), true) {
}
@@ -30497,7 +30771,9 @@ namespace FreeSWITCH.Native {
public enum switch_stack_t {
SWITCH_STACK_BOTTOM = (1 << 0),
SWITCH_STACK_TOP = (1 << 1),
SWITCH_STACK_NODUP = (1 << 2)
SWITCH_STACK_NODUP = (1 << 2),
SWITCH_STACK_UNSHIFT = (1 << 3),
SWITCH_STACK_PUSH = (1 << 4)
}
}
+84 -30
View File
@@ -829,6 +829,75 @@ SWITCH_DECLARE(switch_status_t) switch_event_del_header_val(switch_event_t *even
return status;
}
static switch_event_header_t *new_header(const char *header_name)
{
switch_event_header_t *header;
#ifdef SWITCH_EVENT_RECYCLE
void *pop;
if (switch_queue_trypop(EVENT_HEADER_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
header = (switch_event_header_t *) pop;
} else {
#endif
header = ALLOC(sizeof(*header));
switch_assert(header);
#ifdef SWITCH_EVENT_RECYCLE
}
#endif
memset(header, 0, sizeof(*header));
header->name = DUP(header_name);
return header;
}
SWITCH_DECLARE(int) switch_event_add_array(switch_event_t *event, const char *var, const char *val)
{
char *data;
char **array;
int max = 0;
int len;
const char *p;
int i;
if (strlen(val) < 8) {
return -1;
}
p = val + 7;
max = 1;
while((p = strstr(p, "|:"))) {
max++;
p += 2;
}
if (!max) {
return -2;
}
data = strdup(val + 7);
len = (sizeof(char *) * max) + 1;
switch_assert(len);
array = malloc(len);
memset(array, 0, len);
switch_separate_string_string(data, "|:", array, max);
for(i = 0; i < max; i++) {
switch_event_add_header_string(event, SWITCH_STACK_PUSH, var, array[i]);
}
free(array);
free(data);
return 0;
}
static switch_status_t switch_event_base_add_header(switch_event_t *event, switch_stack_t stack, const char *header_name, char *data)
{
switch_event_header_t *header = NULL;
@@ -848,19 +917,19 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc
header_name = real_header_name;
}
if (index_ptr || (stack & SWITCH_STACK_PUSH) || (stack & SWITCH_STACK_UNSHIFT) || switch_test_flag(event, EF_CONTAINS_ARRAYS)) {
if (index_ptr || (stack & SWITCH_STACK_PUSH) || (stack & SWITCH_STACK_UNSHIFT)) {
if (!(header = switch_event_get_header_ptr(event, header_name)) && index_ptr) {
header = ALLOC(sizeof(*header));
switch_assert(header);
memset(header, 0, sizeof(*header));
header->name = DUP(header_name);
header = new_header(header_name);
if (switch_test_flag(event, EF_UNIQ_HEADERS)) {
switch_event_del_header(event, header_name);
}
fly++;
}
if ((header = switch_event_get_header_ptr(event, header_name))) {
if (index_ptr) {
@@ -889,11 +958,6 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc
}
goto end;
} else {
if (!(stack & SWITCH_STACK_PUSH) && !(stack & SWITCH_STACK_UNSHIFT) && header->idx) {
stack |= SWITCH_STACK_PUSH;
}
if ((stack & SWITCH_STACK_PUSH) || (stack & SWITCH_STACK_UNSHIFT)) {
exists++;
stack &= ~(SWITCH_STACK_TOP | SWITCH_STACK_BOTTOM);
@@ -904,28 +968,20 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc
}
}
if (!header) {
#ifdef SWITCH_EVENT_RECYCLE
void *pop;
if (switch_queue_trypop(EVENT_HEADER_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
header = (switch_event_header_t *) pop;
} else {
#endif
header = ALLOC(sizeof(*header));
switch_assert(header);
#ifdef SWITCH_EVENT_RECYCLE
}
#endif
if (switch_test_flag(event, EF_UNIQ_HEADERS)) {
switch_event_del_header(event, header_name);
}
memset(header, 0, sizeof(*header));
if (strstr(data, "ARRAY::")) {
switch_event_add_array(event, header_name, data);
FREE(data);
goto end;
}
header->name = DUP(header_name);
header = new_header(header_name);
}
if ((stack & SWITCH_STACK_PUSH) || (stack & SWITCH_STACK_UNSHIFT)) {
@@ -934,8 +990,6 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc
char *hv;
int i = 0, j = 0;
switch_set_flag(event, EF_CONTAINS_ARRAYS);
if (header->value && !header->idx) {
m = malloc(sizeof(char *));
switch_assert(m);
@@ -976,7 +1030,7 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc
switch_snprintf(header->value, len, "ARRAY::");
for(j = 0; j < header->idx; j++) {
switch_snprintf(header->value + strlen(header->value), len - strlen(header->value), "%s%s", j == 0 ? "" : "::", header->array[j]);
switch_snprintf(header->value + strlen(header->value), len - strlen(header->value), "%s%s", j == 0 ? "" : "|:", header->array[j]);
}
}