Fix issues

Add support for Media update
Enable Echo suppression (Thanks to Philippe Verney)
This commit is contained in:
bossiel 2011-07-11 19:50:05 +00:00
parent 411ff1b9ed
commit 996ee2d27a
43 changed files with 587 additions and 199 deletions

View File

@ -109,6 +109,16 @@ SipMessage::~SipMessage()
}
}
bool SipMessage::isResponse()
{
return TSIP_MESSAGE_IS_RESPONSE(m_pSipMessage);
}
short SipMessage::getResponseCode()
{
return TSIP_RESPONSE_CODE(m_pSipMessage);
}
const tsip_header_t* SipMessage::getSipHeader(const char* name, unsigned index /* =0 */)
{
/* Do not worry about calling tsk_striequals() several times because the function

View File

@ -49,6 +49,8 @@ public:
#endif
virtual ~SipMessage();
bool isResponse();
short getResponseCode();
char* getSipHeaderValue(const char* name, unsigned index = 0);
char* getSipHeaderParamValue(const char* name, const char* param, unsigned index = 0);
unsigned getSipContentLength();

View File

@ -68,8 +68,9 @@ tsip_event_type_t;
// 8xx ==> success
#define tsip_event_code_dialog_request_incoming 800
#define tsip_event_code_dialog_request_cancelled 801
#define tsip_event_code_dialog_request_sent 802
#define tsip_event_code_dialog_request_outgoing 802
#define tsip_event_code_dialog_request_cancelled 803
#define tsip_event_code_dialog_request_sent 804
// 9xx ==> Informational
#define tsip_event_code_dialog_connecting 900
@ -158,7 +159,9 @@ typedef enum tsip_invite_event_type_e
//
tsip_m_early_media,
tsip_m_updating, // Trying to update from Audio -> Video for example
tsip_m_updated, // succeed to update
/* 3GPP TS 24.610: Communication Hold */
tsip_m_local_hold_ok,
tsip_m_local_hold_nok,

View File

@ -52,6 +52,16 @@ public class SipMessage : IDisposable {
public SipMessage() : this(tinyWRAPPINVOKE.new_SipMessage(), true) {
}
public bool isResponse() {
bool ret = tinyWRAPPINVOKE.SipMessage_isResponse(swigCPtr);
return ret;
}
public short getResponseCode() {
short ret = tinyWRAPPINVOKE.SipMessage_getResponseCode(swigCPtr);
return ret;
}
public string getSipHeaderValue(string name, uint index) {
string ret = tinyWRAPPINVOKE.SipMessage_getSipHeaderValue__SWIG_0(swigCPtr, name, index);
return ret;

View File

@ -16,6 +16,7 @@ public class tinyWRAP {
public static readonly int tsip_event_code_dialog_global_error = tinyWRAPPINVOKE.tsip_event_code_dialog_global_error_get();
public static readonly int tsip_event_code_dialog_message_error = tinyWRAPPINVOKE.tsip_event_code_dialog_message_error_get();
public static readonly int tsip_event_code_dialog_request_incoming = tinyWRAPPINVOKE.tsip_event_code_dialog_request_incoming_get();
public static readonly int tsip_event_code_dialog_request_outgoing = tinyWRAPPINVOKE.tsip_event_code_dialog_request_outgoing_get();
public static readonly int tsip_event_code_dialog_request_cancelled = tinyWRAPPINVOKE.tsip_event_code_dialog_request_cancelled_get();
public static readonly int tsip_event_code_dialog_request_sent = tinyWRAPPINVOKE.tsip_event_code_dialog_request_sent_get();
public static readonly int tsip_event_code_dialog_connecting = tinyWRAPPINVOKE.tsip_event_code_dialog_connecting_get();

View File

@ -428,6 +428,12 @@ class tinyWRAPPINVOKE {
[DllImport("tinyWRAP", EntryPoint="CSharp_delete_SipMessage")]
public static extern void delete_SipMessage(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_SipMessage_isResponse")]
public static extern bool SipMessage_isResponse(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_SipMessage_getResponseCode")]
public static extern short SipMessage_getResponseCode(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_SipMessage_getSipHeaderValue__SWIG_0")]
public static extern string SipMessage_getSipHeaderValue__SWIG_0(HandleRef jarg1, string jarg2, uint jarg3);
@ -1349,6 +1355,9 @@ class tinyWRAPPINVOKE {
[DllImport("tinyWRAP", EntryPoint="CSharp_tsip_event_code_dialog_request_incoming_get")]
public static extern int tsip_event_code_dialog_request_incoming_get();
[DllImport("tinyWRAP", EntryPoint="CSharp_tsip_event_code_dialog_request_outgoing_get")]
public static extern int tsip_event_code_dialog_request_outgoing_get();
[DllImport("tinyWRAP", EntryPoint="CSharp_tsip_event_code_dialog_request_cancelled_get")]
public static extern int tsip_event_code_dialog_request_cancelled_get();

View File

@ -2119,6 +2119,30 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_SipMessage(void * jarg1) {
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_SipMessage_isResponse(void * jarg1) {
unsigned int jresult ;
SipMessage *arg1 = (SipMessage *) 0 ;
bool result;
arg1 = (SipMessage *)jarg1;
result = (bool)(arg1)->isResponse();
jresult = result;
return jresult;
}
SWIGEXPORT short SWIGSTDCALL CSharp_SipMessage_getResponseCode(void * jarg1) {
short jresult ;
SipMessage *arg1 = (SipMessage *) 0 ;
short result;
arg1 = (SipMessage *)jarg1;
result = (short)(arg1)->getResponseCode();
jresult = result;
return jresult;
}
SWIGEXPORT char * SWIGSTDCALL CSharp_SipMessage_getSipHeaderValue__SWIG_0(void * jarg1, char * jarg2, unsigned int jarg3) {
char * jresult ;
SipMessage *arg1 = (SipMessage *) 0 ;
@ -6052,11 +6076,21 @@ SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_request_incoming_get()
}
SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_request_outgoing_get() {
int jresult ;
int result;
result = (int) 802;
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_request_cancelled_get() {
int jresult ;
int result;
result = (int) 801;
result = (int) 803;
jresult = result;
return jresult;
}
@ -6066,7 +6100,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_request_sent_get() {
int jresult ;
int result;
result = (int) 802;
result = (int) 804;
jresult = result;
return jresult;
}

View File

@ -16,6 +16,8 @@ public enum tsip_invite_event_type_t {
tsip_o_ect_nok,
tsip_i_ect,
tsip_m_early_media,
tsip_m_updating,
tsip_m_updated,
tsip_m_local_hold_ok,
tsip_m_local_hold_nok,
tsip_m_local_resume_ok,

View File

@ -49,6 +49,14 @@ public class SipMessage {
this(tinyWRAPJNI.new_SipMessage(), true);
}
public boolean isResponse() {
return tinyWRAPJNI.SipMessage_isResponse(swigCPtr, this);
}
public short getResponseCode() {
return tinyWRAPJNI.SipMessage_getResponseCode(swigCPtr, this);
}
public String getSipHeaderValue(String name, long index) {
return tinyWRAPJNI.SipMessage_getSipHeaderValue__SWIG_0(swigCPtr, this, name, index);
}

View File

@ -49,6 +49,14 @@ public class SipMessage {
this(tinyWRAPJNI.new_SipMessage(), true);
}
public boolean isResponse() {
return tinyWRAPJNI.SipMessage_isResponse(swigCPtr, this);
}
public short getResponseCode() {
return tinyWRAPJNI.SipMessage_getResponseCode(swigCPtr, this);
}
public String getSipHeaderValue(String name, long index) {
return tinyWRAPJNI.SipMessage_getSipHeaderValue__SWIG_0(swigCPtr, this, name, index);
}

View File

@ -13,8 +13,9 @@ public interface tinyWRAPConstants {
public final static int tsip_event_code_dialog_global_error = 703;
public final static int tsip_event_code_dialog_message_error = 704;
public final static int tsip_event_code_dialog_request_incoming = 800;
public final static int tsip_event_code_dialog_request_cancelled = 801;
public final static int tsip_event_code_dialog_request_sent = 802;
public final static int tsip_event_code_dialog_request_outgoing = 802;
public final static int tsip_event_code_dialog_request_cancelled = 803;
public final static int tsip_event_code_dialog_request_sent = 804;
public final static int tsip_event_code_dialog_connecting = 900;
public final static int tsip_event_code_dialog_connected = 901;
public final static int tsip_event_code_dialog_terminating = 902;

View File

@ -91,6 +91,8 @@ class tinyWRAPJNI {
public final static native String SdpMessage_getSdpHeaderAValue(long jarg1, SdpMessage jarg1_, String jarg2, String jarg3);
public final static native long new_SipMessage();
public final static native void delete_SipMessage(long jarg1);
public final static native boolean SipMessage_isResponse(long jarg1, SipMessage jarg1_);
public final static native short SipMessage_getResponseCode(long jarg1, SipMessage jarg1_);
public final static native String SipMessage_getSipHeaderValue__SWIG_0(long jarg1, SipMessage jarg1_, String jarg2, long jarg3);
public final static native String SipMessage_getSipHeaderValue__SWIG_1(long jarg1, SipMessage jarg1_, String jarg2);
public final static native String SipMessage_getSipHeaderParamValue__SWIG_0(long jarg1, SipMessage jarg1_, String jarg2, String jarg3, long jarg4);

View File

@ -3199,6 +3199,36 @@ SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_delete_1SipMessag
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipMessage_1isResponse(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jboolean jresult = 0 ;
SipMessage *arg1 = (SipMessage *) 0 ;
bool result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(SipMessage **)&jarg1;
result = (bool)(arg1)->isResponse();
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jshort JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipMessage_1getResponseCode(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jshort jresult = 0 ;
SipMessage *arg1 = (SipMessage *) 0 ;
short result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(SipMessage **)&jarg1;
result = (short)(arg1)->getResponseCode();
jresult = (jshort)result;
return jresult;
}
SWIGEXPORT jstring JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipMessage_1getSipHeaderValue_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3) {
jstring jresult = 0 ;
SipMessage *arg1 = (SipMessage *) 0 ;

View File

@ -16,6 +16,8 @@ public enum tsip_invite_event_type_t {
tsip_o_ect_nok,
tsip_i_ect,
tsip_m_early_media,
tsip_m_updating,
tsip_m_updated,
tsip_m_local_hold_ok,
tsip_m_local_hold_nok,
tsip_m_local_resume_ok,

View File

@ -13,8 +13,9 @@ public interface tinyWRAPConstants {
public final static int tsip_event_code_dialog_global_error = 703;
public final static int tsip_event_code_dialog_message_error = 704;
public final static int tsip_event_code_dialog_request_incoming = 800;
public final static int tsip_event_code_dialog_request_cancelled = 801;
public final static int tsip_event_code_dialog_request_sent = 802;
public final static int tsip_event_code_dialog_request_outgoing = 802;
public final static int tsip_event_code_dialog_request_cancelled = 803;
public final static int tsip_event_code_dialog_request_sent = 804;
public final static int tsip_event_code_dialog_connecting = 900;
public final static int tsip_event_code_dialog_connected = 901;
public final static int tsip_event_code_dialog_terminating = 902;

View File

@ -91,6 +91,8 @@ class tinyWRAPJNI {
public final static native String SdpMessage_getSdpHeaderAValue(long jarg1, SdpMessage jarg1_, String jarg2, String jarg3);
public final static native long new_SipMessage();
public final static native void delete_SipMessage(long jarg1);
public final static native boolean SipMessage_isResponse(long jarg1, SipMessage jarg1_);
public final static native short SipMessage_getResponseCode(long jarg1, SipMessage jarg1_);
public final static native String SipMessage_getSipHeaderValue__SWIG_0(long jarg1, SipMessage jarg1_, String jarg2, long jarg3);
public final static native String SipMessage_getSipHeaderValue__SWIG_1(long jarg1, SipMessage jarg1_, String jarg2);
public final static native String SipMessage_getSipHeaderParamValue__SWIG_0(long jarg1, SipMessage jarg1_, String jarg2, String jarg3, long jarg4);

View File

@ -3199,6 +3199,36 @@ SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_delete_1SipMessag
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipMessage_1isResponse(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jboolean jresult = 0 ;
SipMessage *arg1 = (SipMessage *) 0 ;
bool result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(SipMessage **)&jarg1;
result = (bool)(arg1)->isResponse();
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jshort JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipMessage_1getResponseCode(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jshort jresult = 0 ;
SipMessage *arg1 = (SipMessage *) 0 ;
short result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(SipMessage **)&jarg1;
result = (short)(arg1)->getResponseCode();
jresult = (jshort)result;
return jresult;
}
SWIGEXPORT jstring JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipMessage_1getSipHeaderValue_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jlong jarg3) {
jstring jresult = 0 ;
SipMessage *arg1 = (SipMessage *) 0 ;

View File

@ -16,6 +16,8 @@ public enum tsip_invite_event_type_t {
tsip_o_ect_nok,
tsip_i_ect,
tsip_m_early_media,
tsip_m_updating,
tsip_m_updated,
tsip_m_local_hold_ok,
tsip_m_local_hold_nok,
tsip_m_local_resume_ok,

View File

@ -409,6 +409,8 @@ sub DESTROY {
}
}
*isResponse = *tinyWRAPc::SipMessage_isResponse;
*getResponseCode = *tinyWRAPc::SipMessage_getResponseCode;
*getSipHeaderValue = *tinyWRAPc::SipMessage_getSipHeaderValue;
*getSipHeaderParamValue = *tinyWRAPc::SipMessage_getSipHeaderParamValue;
*getSipContentLength = *tinyWRAPc::SipMessage_getSipContentLength;
@ -2206,6 +2208,7 @@ package tinyWRAP;
*tsip_event_code_dialog_global_error = *tinyWRAPc::tsip_event_code_dialog_global_error;
*tsip_event_code_dialog_message_error = *tinyWRAPc::tsip_event_code_dialog_message_error;
*tsip_event_code_dialog_request_incoming = *tinyWRAPc::tsip_event_code_dialog_request_incoming;
*tsip_event_code_dialog_request_outgoing = *tinyWRAPc::tsip_event_code_dialog_request_outgoing;
*tsip_event_code_dialog_request_cancelled = *tinyWRAPc::tsip_event_code_dialog_request_cancelled;
*tsip_event_code_dialog_request_sent = *tinyWRAPc::tsip_event_code_dialog_request_sent;
*tsip_event_code_dialog_connecting = *tinyWRAPc::tsip_event_code_dialog_connecting;
@ -2242,6 +2245,8 @@ package tinyWRAP;
*tsip_o_ect_nok = *tinyWRAPc::tsip_o_ect_nok;
*tsip_i_ect = *tinyWRAPc::tsip_i_ect;
*tsip_m_early_media = *tinyWRAPc::tsip_m_early_media;
*tsip_m_updating = *tinyWRAPc::tsip_m_updating;
*tsip_m_updated = *tinyWRAPc::tsip_m_updated;
*tsip_m_local_hold_ok = *tinyWRAPc::tsip_m_local_hold_ok;
*tsip_m_local_hold_nok = *tinyWRAPc::tsip_m_local_hold_nok;
*tsip_m_local_resume_ok = *tinyWRAPc::tsip_m_local_resume_ok;

View File

@ -5179,6 +5179,62 @@ XS(_wrap_delete_SipMessage) {
}
XS(_wrap_SipMessage_isResponse) {
{
SipMessage *arg1 = (SipMessage *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
bool result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: SipMessage_isResponse(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SipMessage, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SipMessage_isResponse" "', argument " "1"" of type '" "SipMessage *""'");
}
arg1 = reinterpret_cast< SipMessage * >(argp1);
result = (bool)(arg1)->isResponse();
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_SipMessage_getResponseCode) {
{
SipMessage *arg1 = (SipMessage *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
short result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: SipMessage_getResponseCode(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SipMessage, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SipMessage_getResponseCode" "', argument " "1"" of type '" "SipMessage *""'");
}
arg1 = reinterpret_cast< SipMessage * >(argp1);
result = (short)(arg1)->getResponseCode();
ST(argvi) = SWIG_From_short SWIG_PERL_CALL_ARGS_1(static_cast< short >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_SipMessage_getSipHeaderValue__SWIG_0) {
{
SipMessage *arg1 = (SipMessage *) 0 ;
@ -21168,6 +21224,8 @@ static swig_command_info swig_commands[] = {
{"tinyWRAPc::SdpMessage_getSdpHeaderAValue", _wrap_SdpMessage_getSdpHeaderAValue},
{"tinyWRAPc::new_SipMessage", _wrap_new_SipMessage},
{"tinyWRAPc::delete_SipMessage", _wrap_delete_SipMessage},
{"tinyWRAPc::SipMessage_isResponse", _wrap_SipMessage_isResponse},
{"tinyWRAPc::SipMessage_getResponseCode", _wrap_SipMessage_getResponseCode},
{"tinyWRAPc::SipMessage_getSipHeaderValue", _wrap_SipMessage_getSipHeaderValue},
{"tinyWRAPc::SipMessage_getSipHeaderParamValue", _wrap_SipMessage_getSipHeaderParamValue},
{"tinyWRAPc::SipMessage_getSipContentLength", _wrap_SipMessage_getSipContentLength},
@ -21919,14 +21977,19 @@ XS(SWIG_init) {
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(800)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "tsip_event_code_dialog_request_outgoing", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(802)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "tsip_event_code_dialog_request_cancelled", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(801)));
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(803)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "tsip_event_code_dialog_request_sent", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(802)));
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(804)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
@ -22099,6 +22162,16 @@ XS(SWIG_init) {
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_m_early_media)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "tsip_m_updating", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_m_updating)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "tsip_m_updated", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_m_updated)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.39/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "tsip_m_local_hold_ok", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_m_local_hold_ok)));

View File

@ -357,6 +357,8 @@ class SipMessage(_object):
except: self.this = this
__swig_destroy__ = _tinyWRAP.delete_SipMessage
__del__ = lambda self : None;
def isResponse(self): return _tinyWRAP.SipMessage_isResponse(self)
def getResponseCode(self): return _tinyWRAP.SipMessage_getResponseCode(self)
def getSipHeaderValue(self, *args): return _tinyWRAP.SipMessage_getSipHeaderValue(self, *args)
def getSipHeaderParamValue(self, *args): return _tinyWRAP.SipMessage_getSipHeaderParamValue(self, *args)
def getSipContentLength(self): return _tinyWRAP.SipMessage_getSipContentLength(self)
@ -1153,6 +1155,7 @@ tsip_event_code_dialog_transport_error = _tinyWRAP.tsip_event_code_dialog_transp
tsip_event_code_dialog_global_error = _tinyWRAP.tsip_event_code_dialog_global_error
tsip_event_code_dialog_message_error = _tinyWRAP.tsip_event_code_dialog_message_error
tsip_event_code_dialog_request_incoming = _tinyWRAP.tsip_event_code_dialog_request_incoming
tsip_event_code_dialog_request_outgoing = _tinyWRAP.tsip_event_code_dialog_request_outgoing
tsip_event_code_dialog_request_cancelled = _tinyWRAP.tsip_event_code_dialog_request_cancelled
tsip_event_code_dialog_request_sent = _tinyWRAP.tsip_event_code_dialog_request_sent
tsip_event_code_dialog_connecting = _tinyWRAP.tsip_event_code_dialog_connecting
@ -1189,6 +1192,8 @@ tsip_o_ect_ok = _tinyWRAP.tsip_o_ect_ok
tsip_o_ect_nok = _tinyWRAP.tsip_o_ect_nok
tsip_i_ect = _tinyWRAP.tsip_i_ect
tsip_m_early_media = _tinyWRAP.tsip_m_early_media
tsip_m_updating = _tinyWRAP.tsip_m_updating
tsip_m_updated = _tinyWRAP.tsip_m_updated
tsip_m_local_hold_ok = _tinyWRAP.tsip_m_local_hold_ok
tsip_m_local_hold_nok = _tinyWRAP.tsip_m_local_hold_nok
tsip_m_local_resume_ok = _tinyWRAP.tsip_m_local_resume_ok

View File

@ -7523,6 +7523,50 @@ fail:
}
SWIGINTERN PyObject *_wrap_SipMessage_isResponse(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
SipMessage *arg1 = (SipMessage *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
bool result;
if (!PyArg_ParseTuple(args,(char *)"O:SipMessage_isResponse",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SipMessage, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SipMessage_isResponse" "', argument " "1"" of type '" "SipMessage *""'");
}
arg1 = reinterpret_cast< SipMessage * >(argp1);
result = (bool)(arg1)->isResponse();
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SipMessage_getResponseCode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
SipMessage *arg1 = (SipMessage *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
short result;
if (!PyArg_ParseTuple(args,(char *)"O:SipMessage_getResponseCode",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SipMessage, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SipMessage_getResponseCode" "', argument " "1"" of type '" "SipMessage *""'");
}
arg1 = reinterpret_cast< SipMessage * >(argp1);
result = (short)(arg1)->getResponseCode();
resultobj = SWIG_From_short(static_cast< short >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SipMessage_getSipHeaderValue__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
SipMessage *arg1 = (SipMessage *) 0 ;
@ -20694,6 +20738,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"SdpMessage_swigregister", SdpMessage_swigregister, METH_VARARGS, NULL},
{ (char *)"new_SipMessage", _wrap_new_SipMessage, METH_VARARGS, NULL},
{ (char *)"delete_SipMessage", _wrap_delete_SipMessage, METH_VARARGS, NULL},
{ (char *)"SipMessage_isResponse", _wrap_SipMessage_isResponse, METH_VARARGS, NULL},
{ (char *)"SipMessage_getResponseCode", _wrap_SipMessage_getResponseCode, METH_VARARGS, NULL},
{ (char *)"SipMessage_getSipHeaderValue", _wrap_SipMessage_getSipHeaderValue, METH_VARARGS, NULL},
{ (char *)"SipMessage_getSipHeaderParamValue", _wrap_SipMessage_getSipHeaderParamValue, METH_VARARGS, NULL},
{ (char *)"SipMessage_getSipContentLength", _wrap_SipMessage_getSipContentLength, METH_VARARGS, NULL},
@ -22083,8 +22129,9 @@ SWIG_init(void) {
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_global_error",SWIG_From_int(static_cast< int >(703)));
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_message_error",SWIG_From_int(static_cast< int >(704)));
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_request_incoming",SWIG_From_int(static_cast< int >(800)));
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_request_cancelled",SWIG_From_int(static_cast< int >(801)));
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_request_sent",SWIG_From_int(static_cast< int >(802)));
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_request_outgoing",SWIG_From_int(static_cast< int >(802)));
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_request_cancelled",SWIG_From_int(static_cast< int >(803)));
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_request_sent",SWIG_From_int(static_cast< int >(804)));
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_connecting",SWIG_From_int(static_cast< int >(900)));
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_connected",SWIG_From_int(static_cast< int >(901)));
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_terminating",SWIG_From_int(static_cast< int >(902)));
@ -22119,6 +22166,8 @@ SWIG_init(void) {
SWIG_Python_SetConstant(d, "tsip_o_ect_nok",SWIG_From_int(static_cast< int >(tsip_o_ect_nok)));
SWIG_Python_SetConstant(d, "tsip_i_ect",SWIG_From_int(static_cast< int >(tsip_i_ect)));
SWIG_Python_SetConstant(d, "tsip_m_early_media",SWIG_From_int(static_cast< int >(tsip_m_early_media)));
SWIG_Python_SetConstant(d, "tsip_m_updating",SWIG_From_int(static_cast< int >(tsip_m_updating)));
SWIG_Python_SetConstant(d, "tsip_m_updated",SWIG_From_int(static_cast< int >(tsip_m_updated)));
SWIG_Python_SetConstant(d, "tsip_m_local_hold_ok",SWIG_From_int(static_cast< int >(tsip_m_local_hold_ok)));
SWIG_Python_SetConstant(d, "tsip_m_local_hold_nok",SWIG_From_int(static_cast< int >(tsip_m_local_hold_nok)));
SWIG_Python_SetConstant(d, "tsip_m_local_resume_ok",SWIG_From_int(static_cast< int >(tsip_m_local_resume_ok)));

View File

@ -32,7 +32,7 @@
#if HAVE_SPEEX_DSP && HAVE_SPEEX_JB
#include "tinymedia/tmedia_JitterBuffer.h"
#include "tinymedia/tmedia_jitterbuffer.h"
#include <speex/speex_jitter.h>

View File

@ -21,10 +21,10 @@
*/
/**@file tdav_consumer_audio.c
* @brief Base class for all Audio consumers.
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*/
* @brief Base class for all Audio consumers.
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*/
#include "tinydav/audio/tdav_consumer_audio.h"
#include "tinymedia/tmedia_denoise.h"
@ -131,7 +131,7 @@ int tdav_consumer_audio_put(tdav_consumer_audio_t* self, const void* data, tsk_s
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
tsk_safeobj_lock(self);
if(!TMEDIA_JITTER_BUFFER(self->jitterbuffer)->opened){
@ -156,9 +156,9 @@ tsk_size_t tdav_consumer_audio_get(tdav_consumer_audio_t* self, void* out_data,
TSK_DEBUG_ERROR("Invalid parameter");
return 0;
}
tsk_safeobj_lock(self);
if(!TMEDIA_JITTER_BUFFER(self->jitterbuffer)->opened){
int ret;
uint32_t frame_duration = TMEDIA_CONSUMER(self)->audio.ptime;
@ -170,15 +170,24 @@ tsk_size_t tdav_consumer_audio_get(tdav_consumer_audio_t* self, void* out_data,
}
}
ret_size = tmedia_jitterbuffer_get(TMEDIA_JITTER_BUFFER(self->jitterbuffer), out_data, out_size);
tsk_safeobj_unlock(self);
// Echo process last frame
if(self->denoise && self->denoise->opened && TSK_BUFFER_SIZE(self->denoise->last_frame)){
tmedia_denoise_echo_playback(self->denoise, TSK_BUFFER_DATA(self->denoise->last_frame));
}
// denoiser
if(ret_size && self->denoise && self->denoise->opened){
// echo playback
tmedia_denoise_echo_playback(self->denoise, out_data);
if(self->denoise->echo_supp_enabled){
// echo playback
tsk_buffer_copy(self->denoise->last_frame, 0, out_data, ret_size);
}
#if 0 // Noise suppression only on producers
// suppress noise
tmedia_denoise_process_playback(self->denoise, out_data);
#endif
}
return ret_size;

View File

@ -21,11 +21,11 @@
*/
/**@file tdav_session_audio.c
* @brief Audio Session plugin.
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
* @contributors: See $(DOUBANGO_HOME)\contributors.txt
*/
* @brief Audio Session plugin.
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
* @contributors: See $(DOUBANGO_HOME)\contributors.txt
*/
#include "tinydav/audio/tdav_session_audio.h"
#include "tinydav/codecs/dtmf/tdav_codec_dtmf.h"
@ -53,7 +53,7 @@ static void _tdav_session_audio_apply_gain(void* buffer, int len, int bps, int g
typedef struct tdav_session_audio_dtmfe_s
{
TSK_DECLARE_OBJECT;
tsk_timer_id_t timer_id;
trtp_rtp_packet_t* packet;
@ -127,7 +127,7 @@ static int tdav_session_audio_producer_enc_cb(const void* callback_data, const v
if(audio->rtp_manager){
/* encode */
tsk_size_t out_size = 0;
ret = 0;
//
@ -168,11 +168,11 @@ static int tdav_session_audio_producer_enc_cb(const void* callback_data, const v
// Denoise (VAD, AGC, Noise suppression, ...)
if(audio->denoise){
tsk_bool_t silence_or_noise = tsk_false;
ret = tmedia_denoise_process_record(TMEDIA_DENOISE(audio->denoise), (void*)buffer, &silence_or_noise);
if(silence_or_noise && (ret == 0)){
//FIXME: Fixed-point implementation don't support VAD
TSK_DEBUG_INFO("Silence or Noise buffer");
return 0;
if(audio->denoise->echo_supp_enabled ){
ret = tmedia_denoise_process_record(TMEDIA_DENOISE(audio->denoise), (void*)buffer, &silence_or_noise);
}
else if(audio->denoise->vad_enabled || audio->denoise->noise_supp_enabled){
ret = tmedia_denoise_process_playback(TMEDIA_DENOISE(audio->denoise), (void*)buffer);
}
}
// adjust the gain
@ -252,7 +252,7 @@ int tdav_session_audio_prepare(tmedia_session_t* self)
/* set local port */
if(!audio->rtp_manager){
if((audio->rtp_manager = trtp_manager_create(audio->rtcp_enabled, audio->local_ip, audio->useIPv6))){
ret = trtp_manager_set_rtp_callback(audio->rtp_manager, tdav_session_audio_rtp_cb, audio);
ret = trtp_manager_prepare(audio->rtp_manager);
if(audio->natt_ctx){
@ -290,7 +290,7 @@ int tdav_session_audio_start(tmedia_session_t* self)
ret = trtp_manager_set_rtp_remote(audio->rtp_manager, audio->remote_ip, audio->remote_port);
//trtp_manager_set_payload_type(audio->rtp_manager, codec->neg_format ? atoi(codec->neg_format) : atoi(codec->format));
ret = trtp_manager_start(audio->rtp_manager);
// because of AudioUnit under iOS => prepare both consumer and producer then start() at the same time
/* prepare consumer and producer */
if(audio->consumer) tmedia_consumer_prepare(audio->consumer, codec);
@ -298,7 +298,7 @@ int tdav_session_audio_start(tmedia_session_t* self)
/* start consumer and producer */
if(audio->consumer) tmedia_consumer_start(audio->consumer);
if(audio->producer) tmedia_producer_start(audio->producer);
/* Denoise (AEC, Noise Suppression, AGC) */
if(audio->denoise && audio->encoder.codec){
tmedia_denoise_open(audio->denoise, TMEDIA_CODEC_PCM_FRAME_SIZE(audio->encoder.codec), TMEDIA_CODEC_RATE(audio->encoder.codec));
@ -312,7 +312,7 @@ int tdav_session_audio_start(tmedia_session_t* self)
TSK_DEBUG_ERROR("Invalid RTP/RTCP manager");
return -3;
}
return 0;
}
@ -400,47 +400,47 @@ int tdav_session_audio_send_dtmf(tmedia_session_t* self, uint8_t event)
/* RFC 4733 - 5. Examples
+-------+-----------+------+--------+------+--------+--------+------+
| Time | Event | M | Time- | Seq | Event | Dura- | E |
| (ms) | | bit | stamp | No | Code | tion | bit |
+-------+-----------+------+--------+------+--------+--------+------+
| 0 | "9" | | | | | | |
| | starts | | | | | | |
| 50 | RTP | "1" | 0 | 1 | 9 | 400 | "0" |
| | packet 1 | | | | | | |
| | sent | | | | | | |
| 100 | RTP | "0" | 0 | 2 | 9 | 800 | "0" |
| | packet 2 | | | | | | |
| | sent | | | | | | |
| 150 | RTP | "0" | 0 | 3 | 9 | 1200 | "0" |
| | packet 3 | | | | | | |
| | sent | | | | | | |
| 200 | RTP | "0" | 0 | 4 | 9 | 1600 | "0" |
| | packet 4 | | | | | | |
| | sent | | | | | | |
| 200 | "9" ends | | | | | | |
| 250 | RTP | "0" | 0 | 5 | 9 | 1600 | "1" |
| | packet 4 | | | | | | |
| | first | | | | | | |
| | retrans- | | | | | | |
| | mission | | | | | | |
| 300 | RTP | "0" | 0 | 6 | 9 | 1600 | "1" |
| | packet 4 | | | | | | |
| | second | | | | | | |
| | retrans- | | | | | | |
| | mission | | | | | | |
=====================================================================
| 880 | First "1" | | | | | | |
| | starts | | | | | | |
| 930 | RTP | "1" | 7040 | 7 | 1 | 400 | "0" |
| | packet 5 | | | | | | |
| | sent | | | | | | |
| Time | Event | M | Time- | Seq | Event | Dura- | E |
| (ms) | | bit | stamp | No | Code | tion | bit |
+-------+-----------+------+--------+------+--------+--------+------+
| 0 | "9" | | | | | | |
| | starts | | | | | | |
| 50 | RTP | "1" | 0 | 1 | 9 | 400 | "0" |
| | packet 1 | | | | | | |
| | sent | | | | | | |
| 100 | RTP | "0" | 0 | 2 | 9 | 800 | "0" |
| | packet 2 | | | | | | |
| | sent | | | | | | |
| 150 | RTP | "0" | 0 | 3 | 9 | 1200 | "0" |
| | packet 3 | | | | | | |
| | sent | | | | | | |
| 200 | RTP | "0" | 0 | 4 | 9 | 1600 | "0" |
| | packet 4 | | | | | | |
| | sent | | | | | | |
| 200 | "9" ends | | | | | | |
| 250 | RTP | "0" | 0 | 5 | 9 | 1600 | "1" |
| | packet 4 | | | | | | |
| | first | | | | | | |
| | retrans- | | | | | | |
| | mission | | | | | | |
| 300 | RTP | "0" | 0 | 6 | 9 | 1600 | "1" |
| | packet 4 | | | | | | |
| | second | | | | | | |
| | retrans- | | | | | | |
| | mission | | | | | | |
=====================================================================
| 880 | First "1" | | | | | | |
| | starts | | | | | | |
| 930 | RTP | "1" | 7040 | 7 | 1 | 400 | "0" |
| | packet 5 | | | | | | |
| | sent | | | | | | |
*/
// ref()(thread safeness)
audio = tsk_object_ref(audio);
duration = (rate * ptime)/1000;
/* Not mandatory but elegant */
timestamp += duration;
@ -516,7 +516,7 @@ const tsdp_header_M_t* tdav_session_audio_get_lo(tmedia_session_t* self)
tsdp_header_A_removeAll_by_field(self->M.lo->Attributes, "fmtp");
tsdp_header_A_removeAll_by_field(self->M.lo->Attributes, "rtpmap");
tsk_list_clear_items(self->M.lo->FMTs);
/* QoS */
tsdp_header_A_removeAll_by_field(self->M.lo->Attributes, "curr");
tsdp_header_A_removeAll_by_field(self->M.lo->Attributes, "des");
@ -534,17 +534,17 @@ const tsdp_header_M_t* tdav_session_audio_get_lo(tmedia_session_t* self)
tsk_null);
}
/* 3GPP TS 24.229 - 6.1.1 General
In order to support accurate bandwidth calculations, the UE may include the "a=ptime" attribute for all "audio" media
lines as described in RFC 4566 [39]. If a UE receives an "audio" media line with "a=ptime" specified, the UE should
transmit at the specified packetization rate. If a UE receives an "audio" media line which does not have "a=ptime"
specified or the UE does not support the "a=ptime" attribute, the UE should transmit at the default codec packetization
rate as defined in RFC 3551 [55A]. The UE will transmit consistent with the resources available from the network.
In order to support accurate bandwidth calculations, the UE may include the "a=ptime" attribute for all "audio" media
lines as described in RFC 4566 [39]. If a UE receives an "audio" media line with "a=ptime" specified, the UE should
transmit at the specified packetization rate. If a UE receives an "audio" media line which does not have "a=ptime"
specified or the UE does not support the "a=ptime" attribute, the UE should transmit at the default codec packetization
rate as defined in RFC 3551 [55A]. The UE will transmit consistent with the resources available from the network.
For "video" and "audio" media types that utilize the RTP/RTCP, the UE shall specify the proposed bandwidth for each
media stream utilizing the "b=" media descriptor and the "AS" bandwidth modifier in the SDP.
For "video" and "audio" media types that utilize the RTP/RTCP, the UE shall specify the proposed bandwidth for each
media stream utilizing the "b=" media descriptor and the "AS" bandwidth modifier in the SDP.
The UE shall include the MIME subtype "telephone-event" in the "m=" media descriptor in the SDP for audio media
flows that support both audio codec and DTMF payloads in RTP packets as described in RFC 4733 [23].
The UE shall include the MIME subtype "telephone-event" in the "m=" media descriptor in the SDP for audio media
flows that support both audio codec and DTMF payloads in RTP packets as described in RFC 4733 [23].
*/
tsdp_header_M_add_headers(self->M.lo,
TSDP_HEADER_A_VA_ARGS("ptime", "20"),
@ -560,7 +560,7 @@ const tsdp_header_M_t* tdav_session_audio_get_lo(tmedia_session_t* self)
/* from codecs to sdp */
if(changed){
tmedia_codecs_L_t* neg_codecs = tsk_null;
if(self->M.ro){
TSK_OBJECT_SAFE_FREE(self->neg_codecs);
/* update negociated codecs */
@ -664,7 +664,7 @@ int tdav_session_audio_set_ro(tmedia_session_t* self, const tsdp_header_M_t* m)
}
/* set remote port */
audio->remote_port = m->port;
return 0;
}
@ -686,7 +686,7 @@ void _tdav_session_audio_apply_gain(void* buffer, int len, int bps, int gain)
{
register int i;
int max_val;
max_val = (1 << (bps - 1 - gain)) - 1;
if (bps == 8) {
@ -712,15 +712,15 @@ tdav_session_audio_dtmfe_t* _tdav_session_audio_dtmfe_create(const tdav_session_
tdav_session_audio_dtmfe_t* dtmfe;
static uint8_t volume = 10;
static uint32_t ssrc = 0x5234A8;
uint8_t pay[4] = {0};
/* RFC 4733 - 2.3. Payload Format
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| event |E|R| volume | duration |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| event |E|R| volume | duration |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
if(!(dtmfe = tsk_object_new(tdav_session_audio_dtmfe_def_t))){
@ -734,7 +734,7 @@ tdav_session_audio_dtmfe_t* _tdav_session_audio_dtmfe_create(const tdav_session_
TSK_OBJECT_SAFE_FREE(dtmfe);
return tsk_null;
}
pay[0] = event;
pay[1] |= ((E << 7) | (volume & 0x3F));
pay[2] = (duration >> 8);
@ -807,7 +807,7 @@ static tsk_object_t* tdav_session_audio_dtor(tsk_object_t * self)
{
tdav_session_audio_t *session = self;
if(session){
// Do it in this order (deinit self first)
/* Timer manager */
@ -862,10 +862,10 @@ static const tsk_object_def_t tdav_session_audio_def_s =
static const tmedia_session_plugin_def_t tdav_session_audio_plugin_def_s =
{
&tdav_session_audio_def_s,
tmedia_audio,
"audio",
tdav_session_audio_set,
tdav_session_audio_prepare,
tdav_session_audio_start,

View File

@ -21,12 +21,12 @@
*/
/**@file tdav_speex_denoise.c
* @brief Speex Denoiser (Noise suppression, AGC, AEC) Plugin
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*
* @brief Speex Denoiser (Noise suppression, AGC, AEC) Plugin
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*
*/
*/
#include "tinydav/audio/tdav_speex_denoise.h"
#if HAVE_SPEEX_DSP && (!defined(HAVE_SPEEX_DENOISE) || HAVE_SPEEX_DENOISE)
@ -51,6 +51,8 @@ static int tdav_speex_denoise_open(tmedia_denoise_t* self, uint32_t frame_size,
int i;
if(!denoiser->echo_state && TMEDIA_DENOISE(denoiser)->echo_supp_enabled){
TSK_DEBUG_INFO("Init Aec frame_size[%d] filter_length[%d] SampleRate[%d]",
frame_size* sizeof(spx_int16_t),TMEDIA_DENOISE(denoiser)->echo_tail*frame_size,sampling_rate);
if((denoiser->echo_state = speex_echo_state_init(frame_size, TMEDIA_DENOISE(denoiser)->echo_tail*frame_size))){
speex_echo_ctl(denoiser->echo_state, SPEEX_ECHO_SET_SAMPLING_RATE, &sampling_rate);
}
@ -60,50 +62,64 @@ static int tdav_speex_denoise_open(tmedia_denoise_t* self, uint32_t frame_size,
denoiser->frame_size = frame_size;
if((denoiser->preprocess_state_record = speex_preprocess_state_init(frame_size, sampling_rate))
&& (denoiser->preprocess_state_playback = speex_preprocess_state_init(frame_size, sampling_rate))
){
&& (denoiser->preprocess_state_playback = speex_preprocess_state_init(frame_size, sampling_rate))
){
// Echo suppression
if(denoiser->echo_state){
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_ECHO_STATE, denoiser->echo_state);
// Echo suppression
if(denoiser->echo_state){
int echo_supp , echo_supp_active = 0;
TSK_FREE(denoiser->echo_output_frame);
denoiser->echo_output_frame = tsk_calloc(denoiser->frame_size, sizeof(spx_int16_t));
}
// Noise suppression
if(TMEDIA_DENOISE(denoiser)->noise_supp_enabled){
i = 1;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_DENOISE, &i);
speex_preprocess_ctl(denoiser->preprocess_state_playback, SPEEX_PREPROCESS_SET_DENOISE, &i);
i = TMEDIA_DENOISE(denoiser)->noise_supp_level;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &i);
speex_preprocess_ctl(denoiser->preprocess_state_playback, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &i);
}
else{
i = 0;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_DENOISE, &i);
speex_preprocess_ctl(denoiser->preprocess_state_playback, SPEEX_PREPROCESS_SET_DENOISE, &i);
}
// Automatic gain control
if(TMEDIA_DENOISE(denoiser)->agc_enabled){
float agc_level = TMEDIA_DENOISE(denoiser)->agc_level;
i = 1;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_AGC, &i);
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_AGC_LEVEL, &agc_level);
}
else{
i = 0, f = 8000.0f;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_AGC, &i);
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_AGC_LEVEL, &f);
}
// Voice Activity detection
i = TMEDIA_DENOISE(denoiser)->vad_enabled ? 1 : 0;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_VAD, &i);
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_ECHO_STATE, denoiser->echo_state);
return 0;
TSK_FREE(denoiser->echo_output_frame);
denoiser->echo_output_frame = tsk_calloc(denoiser->frame_size, sizeof(spx_int16_t));
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_GET_ECHO_SUPPRESS , &echo_supp );
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE , &echo_supp_active );
TSK_DEBUG_INFO("AEC echo_supp level [%d] echo_supp_active level[%d] ", echo_supp , echo_supp_active);
echo_supp = -60 ;
echo_supp_active = -60 ;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS , &echo_supp );
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE , &echo_supp_active );
// TRACES
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_GET_ECHO_SUPPRESS , &echo_supp );
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE , &echo_supp_active );
TSK_DEBUG_INFO("New aec echo_supp level [%d] echo_supp_active level[%d] ", echo_supp , echo_supp_active);
}
// Noise suppression
if(TMEDIA_DENOISE(denoiser)->noise_supp_enabled){
i = 1;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_DENOISE, &i);
speex_preprocess_ctl(denoiser->preprocess_state_playback, SPEEX_PREPROCESS_SET_DENOISE, &i);
i = TMEDIA_DENOISE(denoiser)->noise_supp_level;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &i);
speex_preprocess_ctl(denoiser->preprocess_state_playback, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &i);
}
else{
i = 0;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_DENOISE, &i);
speex_preprocess_ctl(denoiser->preprocess_state_playback, SPEEX_PREPROCESS_SET_DENOISE, &i);
}
// Automatic gain control
if(TMEDIA_DENOISE(denoiser)->agc_enabled){
float agc_level = TMEDIA_DENOISE(denoiser)->agc_level;
i = 1;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_AGC, &i);
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_AGC_LEVEL, &agc_level);
}
else{
i = 0, f = 8000.0f;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_AGC, &i);
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_AGC_LEVEL, &f);
}
// Voice Activity detection
i = TMEDIA_DENOISE(denoiser)->vad_enabled ? 1 : 0;
speex_preprocess_ctl(denoiser->preprocess_state_record, SPEEX_PREPROCESS_SET_VAD, &i);
return 0;
}
else{
TSK_DEBUG_ERROR("Failed to create Speex preprocessor state");
@ -147,7 +163,7 @@ static int tdav_speex_denoise_process_record(tmedia_denoise_t* self, void* audio
static int tdav_speex_denoise_process_playback(tmedia_denoise_t* self, void* audio_frame)
{
tdav_speex_denoise_t *denoiser = (tdav_speex_denoise_t *)self;
if(denoiser->preprocess_state_playback){
speex_preprocess_run(denoiser->preprocess_state_playback, audio_frame);
}
@ -157,7 +173,7 @@ static int tdav_speex_denoise_process_playback(tmedia_denoise_t* self, void* aud
static int tdav_speex_denoise_close(tmedia_denoise_t* self)
{
tdav_speex_denoise_t *denoiser = (tdav_speex_denoise_t *)self;
if(denoiser->preprocess_state_record){
speex_preprocess_state_destroy(denoiser->preprocess_state_record);
denoiser->preprocess_state_record = tsk_null;
@ -229,9 +245,9 @@ static const tsk_object_def_t tdav_speex_denoise_def_s =
static const tmedia_denoise_plugin_def_t tdav_speex_denoise_plugin_def_s =
{
&tdav_speex_denoise_def_s,
"Audio Denoiser based on Speex",
tdav_speex_denoise_set,
tdav_speex_denoise_open,
tdav_speex_denoise_echo_playback,

View File

@ -52,7 +52,7 @@ typedef struct tmedia_denoise_s
tsk_bool_t vad_enabled;
tsk_bool_t noise_supp_enabled;
int32_t noise_supp_level;
tsk_buffer_t *last_frame;
const struct tmedia_denoise_plugin_def_s* plugin;
}
tmedia_denoise_t;

View File

@ -21,12 +21,12 @@
*/
/**@file tmedia_denoise.c
* @brief Denoiser (Noise suppression, AGC, AEC, VAD) Plugin
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*
* @brief Denoiser (Noise suppression, AGC, AEC, VAD) Plugin
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*
*/
*/
#include "tinymedia/tmedia_denoise.h"
#include "tinymedia/tmedia_defaults.h"
@ -48,7 +48,7 @@ int tmedia_denoise_init(tmedia_denoise_t* self)
self->vad_enabled = tmedia_defaults_get_vad_enabled();
self->noise_supp_enabled = tmedia_defaults_get_noise_supp_enabled();
self->noise_supp_level = tmedia_defaults_get_noise_supp_level();
return 0;
}
@ -58,12 +58,12 @@ int tmedia_denoise_set(tmedia_denoise_t* self, const tmedia_param_t* param)
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
if(self->plugin->set){
// FIXME: to be implemnted
TSK_DEBUG_ERROR("Not implemented");
return self->plugin->set(self, param);
}
return 0;
@ -82,6 +82,18 @@ int tmedia_denoise_open(tmedia_denoise_t* self, uint32_t frame_size, uint32_t sa
if(self->plugin->open){
int ret;
// create the buffer. do not use tsk_buffer_create(data,size) which requires a valid buffer pointer
if(!self->last_frame && !(self->last_frame = tsk_buffer_create_null())){
TSK_DEBUG_ERROR("Failed to realloc the buffer");
return -2;
}
// resize the buffer
if((ret = tsk_buffer_realloc(self->last_frame, (frame_size * sizeof(int16_t))))){
TSK_DEBUG_ERROR("Failed to realloc the buffer");
return ret;
}
if((ret = self->plugin->open(self, frame_size, sampling_rate))){
TSK_DEBUG_ERROR("Failed to open [%s] denoiser", self->plugin->desc);
return ret;
@ -144,12 +156,12 @@ int tmedia_denoise_process_playback(tmedia_denoise_t* self, void* audio_frame)
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
if(!self->opened){
TSK_DEBUG_ERROR("Denoiser not opened");
return -2;
}
if(self->plugin->process_playback){
return self->plugin->process_playback(self, audio_frame);
}
@ -191,11 +203,13 @@ int tmedia_denoise_deinit(tmedia_denoise_t* self)
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
if(self->opened){
tmedia_denoise_close(self);
}
TSK_OBJECT_SAFE_FREE(self->last_frame);
return 0;
}

View File

@ -198,10 +198,10 @@ int tsk_buffer_realloc(tsk_buffer_t* self, tsk_size_t size)
return tsk_buffer_cleanup(self);
}
if(self->size == 0){
if(self->size == 0){ // first time?
self->data = tsk_calloc(size, sizeof(uint8_t));
}
else{
else if(self->size != size){ // only realloc if different sizes
self->data = tsk_realloc(self->data, size);
}
@ -274,6 +274,24 @@ int tsk_buffer_insert(tsk_buffer_t* self, tsk_size_t position, const void* data,
return -1;
}
int tsk_buffer_copy(tsk_buffer_t* self, tsk_size_t start, const void* data, tsk_size_t size)
{
int ret = 0;
if(!self || !data || !size){
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
// realloc the buffer to match the overral size
if((ret = tsk_buffer_realloc(self, (start + size)))){
TSK_DEBUG_ERROR("failed to realloc the buffer");
return ret;
}
memcpy(((uint8_t*)self->data) + start, data, size);
return ret;
}
/**@ingroup tsk_buffer_group
* Cleanups the internal data and reset the size.
* @param self The buffer holding the internal data to free.

View File

@ -91,6 +91,7 @@ TINYSAK_API int tsk_buffer_append(tsk_buffer_t* self, const void* data, tsk_size
TINYSAK_API int tsk_buffer_realloc(tsk_buffer_t* self, tsk_size_t size);
TINYSAK_API int tsk_buffer_remove(tsk_buffer_t* self, tsk_size_t position, tsk_size_t size);
TINYSAK_API int tsk_buffer_insert(tsk_buffer_t* self, tsk_size_t position, const void*data, tsk_size_t size);
TINYSAK_API int tsk_buffer_copy(tsk_buffer_t* self, tsk_size_t start, const void* data, tsk_size_t size);
TINYSAK_API int tsk_buffer_cleanup(tsk_buffer_t* self);
TINYSAK_API int tsk_buffer_takeownership(tsk_buffer_t* self, void** data, tsk_size_t size);

View File

@ -66,6 +66,9 @@ TSIP_BEGIN_DECLS
#define TSIP_DIALOG_SIGNAL(self, code, phrase) \
tsip_event_signal(tsip_event_dialog, TSIP_DIALOG(self)->ss, code, phrase)
#define TSIP_DIALOG_SIGNAL_2(self, code, phrase, message) \
tsip_event_signal_2(tsip_event_dialog, TSIP_DIALOG(self)->ss, code, phrase, message)
#define TSIP_DIALOG_SHUTDOWN_TIMEOUT 2000 /* miliseconds. */
typedef enum tsip_dialog_state_e
@ -123,7 +126,11 @@ typedef struct tsip_dialog_s
tsk_bool_t initialized;
tsk_bool_t running;
char* lasterror;
struct{
char* phrase;
short code;
tsip_message_t* message;
} last_error;
char* tag_local;
tsip_uri_t* uri_local;
@ -167,8 +174,9 @@ int tsip_dialog_getCKIK(tsip_dialog_t *self, AKA_CK_T *ck, AKA_IK_T *ik);
int tsip_dialog_init(tsip_dialog_t *self, tsip_dialog_type_t type, const char* call_id, tsip_ssession_t* ss, tsk_fsm_state_id curr, tsk_fsm_state_id term);
int tsip_dialog_fsm_act(tsip_dialog_t* self, tsk_fsm_action_id , const tsip_message_t* , const tsip_action_handle_t*);
int tsip_dialog_set_curr_action(tsip_dialog_t* self, const tsip_action_t* action);
int tsip_dialog_set_lasterror(tsip_dialog_t* self, const char* error);
const char* tsip_dialog_get_lasterror(const tsip_dialog_t* self);
int tsip_dialog_set_lasterror(tsip_dialog_t* self, const char* phrase, short code);
int tsip_dialog_set_lasterror_2(tsip_dialog_t* self, const char* phrase, short code, const tsip_message_t *message);
int tsip_dialog_get_lasterror(const tsip_dialog_t* self, short *code, const char** phrase, const tsip_message_t **message);
int tsip_dialog_hangup(tsip_dialog_t *self, const tsip_action_t* action);
int tsip_dialog_shutdown(tsip_dialog_t *self, const tsip_action_t* action);
int tsip_dialog_remove(const tsip_dialog_t* self);

View File

@ -99,6 +99,7 @@ TINYSIP_GEXTERN const tsk_object_def_t *tsip_event_def_t;
int tsip_event_init(tsip_event_t* self, tsip_ssession_t* ss, short code, const char *phrase, const struct tsip_message_s* sipmessage, tsip_event_type_t type);
int tsip_event_signal(tsip_event_type_t type, tsip_ssession_t* ss, short code, const char *phrase);
int tsip_event_signal_2(tsip_event_type_t type, tsip_ssession_t* ss, short code, const char *phrase, const struct tsip_message_s* sipmessage);
int tsip_event_deinit(tsip_event_t* self);
typedef int (*tsip_stack_callback_f)(const tsip_event_t *sipevent);

View File

@ -1077,25 +1077,46 @@ int tsip_dialog_set_curr_action(tsip_dialog_t* self, const tsip_action_t* action
return 0;
}
int tsip_dialog_set_lasterror(tsip_dialog_t* self, const char* error)
int tsip_dialog_set_lasterror_2(tsip_dialog_t* self, const char* phrase, short code, const tsip_message_t *message)
{
if(!self || tsk_strnullORempty(error)){
if(!self || tsk_strnullORempty(phrase)){
TSK_DEBUG_ERROR("Invalid parameter.");
return -1;
}
tsk_strupdate(&self->lasterror, error);
tsk_strupdate(&self->last_error.phrase, phrase);
self->last_error.code = code;
TSK_OBJECT_SAFE_FREE(self->last_error.message);
if(message){
self->last_error.message = (tsip_message_t*)tsk_object_ref((void*)message);
}
return 0;
}
const char* tsip_dialog_get_lasterror(const tsip_dialog_t* self)
int tsip_dialog_set_lasterror(tsip_dialog_t* self, const char* phrase, short code)
{
return tsip_dialog_set_lasterror_2(self, phrase, code, tsk_null);
}
int tsip_dialog_get_lasterror(const tsip_dialog_t* self, short *code, const char** phrase, const tsip_message_t **message)
{
if(!self){
TSK_DEBUG_ERROR("Invalid parameter.");
return tsk_null;
return -1;
}
return self->lasterror;
if(code){
*code = self->last_error.code;
}
if(phrase){
*phrase = self->last_error.phrase;
}
if(message){
*message = self->last_error.message;
}
return 0;
}
int tsip_dialog_hangup(tsip_dialog_t *self, const tsip_action_t* action)
@ -1163,7 +1184,8 @@ int tsip_dialog_deinit(tsip_dialog_t *self)
TSK_FREE(self->cseq_method);
TSK_FREE(self->callid);
TSK_FREE(self->lasterror);
TSK_FREE(self->last_error.phrase);
TSK_OBJECT_SAFE_FREE(self->last_error.message);
TSK_OBJECT_SAFE_FREE(self->record_routes);
TSK_OBJECT_SAFE_FREE(self->challenges);

View File

@ -713,7 +713,7 @@ int x0000_Any_2_Terminated_X_iBYE(va_list *app)
const tsip_request_t *rBYE = va_arg(*app, const tsip_request_t *);
/* set last error (or info) */
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Call Terminated");
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Call Terminated", tsip_event_code_dialog_terminated);
/* send 200 OK */
return send_RESPONSE(self, rBYE, 200, "OK", tsk_false);
@ -804,7 +804,7 @@ int x9998_Any_2_Any_X_transportError(va_list *app)
tsip_dialog_invite_t *self = va_arg(*app, tsip_dialog_invite_t *);
/* set last error (or info) */
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Transport error");
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Transport error", tsip_event_code_dialog_terminated);
return 0;
}
@ -1345,7 +1345,7 @@ int tsip_dialog_invite_OnTerminated(tsip_dialog_invite_t *self)
/* alert the user */
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminated,
TSIP_DIALOG(self)->lasterror ? TSIP_DIALOG(self)->lasterror : "Call Terminated");
TSIP_DIALOG(self)->last_error.phrase ? TSIP_DIALOG(self)->last_error.phrase : "Call Terminated");
/* Remove from the dialog layer. */
return tsip_dialog_remove(TSIP_DIALOG(self));

View File

@ -268,7 +268,7 @@ int c0000_Outgoing_2_Terminated_X_i300_to_i699INVITE(va_list *app)
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
/* set last error (or info) */
tsip_dialog_set_lasterror(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response));
tsip_dialog_set_lasterror(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response), TSIP_RESPONSE_CODE(response));
/* alert the user */
TSIP_DIALOG_INVITE_SIGNAL(self, tsip_ao_request,
@ -292,9 +292,10 @@ int c0000_Outgoing_2_Cancelling_X_oCANCEL(va_list *app)
int c0000_Cancelling_2_Terminated_X_i300_to_699(va_list *app)
{
tsip_dialog_invite_t *self = va_arg(*app, tsip_dialog_invite_t *);
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
/* set last error (or info) */
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Request cancelled");
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Request cancelled", TSIP_RESPONSE_CODE(response));
return 0;
}

View File

@ -499,7 +499,7 @@ int s0000_Inprogress_2_Terminated_X_iCANCEL(va_list *app)
ret = send_ERROR(self, self->last_iInvite, 487, "Request Cancelled", "SIP; cause=487; text=\"Request Cancelled\"");
/* set last error (or info) */
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Call Cancelled");
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Call Cancelled", tsip_event_code_dialog_terminated);
/* alert the user */
TSIP_DIALOG_INVITE_SIGNAL(self, tsip_i_request,
@ -620,7 +620,7 @@ int s0000_Ringing_2_Terminated_X_Reject(va_list *app)
TSK_FREE(reason);
/* set last error (or info) */
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Call Terminated");
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Call Terminated", tsip_event_code_dialog_terminated);
return ret;
}
@ -649,7 +649,7 @@ int s0000_Ringing_2_Terminated_X_iCANCEL(va_list *app)
ret = send_ERROR(self, self->last_iInvite, 487, "Request Cancelled", "SIP; cause=487; text=\"Request Cancelled\"");
/* set last error (or info) */
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Call Cancelled");
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Call Cancelled", tsip_event_code_dialog_terminated);
/* alert the user */
TSIP_DIALOG_INVITE_SIGNAL(self, tsip_i_request,

View File

@ -310,7 +310,7 @@ int tsip_dialog_message_Sending_2_Terminated_X_300_to_699(va_list *app)
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
/* set last error (or info) */
tsip_dialog_set_lasterror(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response));
tsip_dialog_set_lasterror(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response), TSIP_RESPONSE_CODE(response));
/* Alert the user. */
TSIP_DIALOG_MESSAGE_SIGNAL(self, tsip_ao_message,
@ -476,7 +476,7 @@ int tsip_dialog_message_OnTerminated(tsip_dialog_message_t *self)
/* Alert the user */
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminated,
TSIP_DIALOG(self)->lasterror ? TSIP_DIALOG(self)->lasterror : "Dialog terminated");
TSIP_DIALOG(self)->last_error.phrase ? TSIP_DIALOG(self)->last_error.phrase : "Dialog terminated");
/* Remove from the dialog layer. */
return tsip_dialog_remove(TSIP_DIALOG(self));

View File

@ -499,7 +499,7 @@ int tsip_dialog_options_OnTerminated(tsip_dialog_options_t *self)
/* alert user */
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminated,
TSIP_DIALOG(self)->lasterror ? TSIP_DIALOG(self)->lasterror : "Dialog terminated");
TSIP_DIALOG(self)->last_error.phrase ? TSIP_DIALOG(self)->last_error.phrase : "Dialog terminated");
/* Remove from the dialog layer. */
return tsip_dialog_remove(TSIP_DIALOG(self));

View File

@ -452,7 +452,7 @@ int tsip_dialog_publish_Trying_2_Terminated_X_300_to_699(va_list *app)
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
/* set last error (or info) */
tsip_dialog_set_lasterror(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response));
tsip_dialog_set_lasterror(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response), TSIP_RESPONSE_CODE(response));
/* Alert the user. */
TSIP_DIALOG_PUBLISH_SIGNAL(self, self->unpublishing ? tsip_ao_unpublish : tsip_ao_publish,
@ -642,7 +642,7 @@ int tsip_dialog_publish_OnTerminated(tsip_dialog_publish_t *self)
/* Alert the user */
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminated,
TSIP_DIALOG(self)->lasterror ? TSIP_DIALOG(self)->lasterror : "Dialog terminated");
TSIP_DIALOG(self)->last_error.phrase ? TSIP_DIALOG(self)->last_error.phrase : "Dialog terminated");
/* Remove from the dialog layer. */
return tsip_dialog_remove(TSIP_DIALOG(self));

View File

@ -273,7 +273,7 @@ int tsip_dialog_register_Any_2_Terminated_X_Error(va_list *app)
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
/* set last error (or info) */
tsip_dialog_set_lasterror(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response));
tsip_dialog_set_lasterror(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response), TSIP_RESPONSE_CODE(response));
/* Alert the user. */
if(response){
@ -438,7 +438,7 @@ int tsip_dialog_register_OnTerminated(tsip_dialog_register_t *self)
/* Alert the user */
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminated,
TSIP_DIALOG(self)->lasterror ? TSIP_DIALOG(self)->lasterror : "Dialog terminated");
TSIP_DIALOG(self)->last_error.phrase ? TSIP_DIALOG(self)->last_error.phrase : "Dialog terminated");
/* Remove from the dialog layer. */
return tsip_dialog_remove(TSIP_DIALOG(self));

View File

@ -305,7 +305,7 @@ int tsip_dialog_register_InProgress_2_InProgress_X_401_407_421_494(va_list *app)
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
/* set last error (or info) */
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Authentication failed");
tsip_dialog_set_lasterror(TSIP_DIALOG(self), "Authentication failed", TSIP_RESPONSE_CODE(response));
return ret;
}
@ -364,7 +364,7 @@ int tsip_dialog_register_InProgress_2_Terminated_X_300_to_699(va_list *app)
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
/* set last error (or info) */
tsip_dialog_set_lasterror(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response));
tsip_dialog_set_lasterror(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response), TSIP_RESPONSE_CODE(response));
/* Alert the user. */
TSIP_DIALOG_REGISTER_SIGNAL(self, self->unregistering ? tsip_ao_unregister : tsip_ao_register,

View File

@ -467,7 +467,10 @@ int tsip_dialog_subscribe_Trying_2_Terminated_X_300_to_699(va_list *app)
tsip_dialog_subscribe_t *self = va_arg(*app, tsip_dialog_subscribe_t *);
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
/* Alert the user. */
/* save last error */
tsip_dialog_set_lasterror_2(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response), TSIP_RESPONSE_CODE(response), response);
/* alert the user */
TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, self->unsubscribing ? tsip_ao_unsubscribe : tsip_ao_subscribe,
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
@ -489,7 +492,7 @@ int tsip_dialog_subscribe_Trying_2_Terminated_X_cancel(va_list *app)
A CANCEL request SHOULD NOT be sent to cancel a request other than INVITE.
*/
/* Alert the user */
/* alert the user */
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_request_cancelled, "Subscription cancelled");
return ret;
@ -699,8 +702,9 @@ int tsip_dialog_subscribe_OnTerminated(tsip_dialog_subscribe_t *self)
TSK_DEBUG_INFO("=== SUBSCRIBE Dialog terminated ===");
/* Alert the user */
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminated,
TSIP_DIALOG(self)->lasterror ? TSIP_DIALOG(self)->lasterror : "Dialog terminated");
TSIP_DIALOG_SIGNAL_2(self, tsip_event_code_dialog_terminated,
TSIP_DIALOG(self)->last_error.phrase ? TSIP_DIALOG(self)->last_error.phrase : "Dialog terminated",
TSIP_DIALOG(self)->last_error.message);
/* Remove from the dialog layer. */
return tsip_dialog_remove(TSIP_DIALOG(self));

View File

@ -65,11 +65,16 @@ int tsip_event_init(tsip_event_t* self, tsip_ssession_t *ss, short code, const c
return 0;
}
/* signal new event (enque) */
/* signal new event (enqueue) */
int tsip_event_signal(tsip_event_type_t type, tsip_ssession_t* ss, short code, const char *phrase)
{
return tsip_event_signal_2(type, ss, code, phrase, tsk_null);
}
int tsip_event_signal_2(tsip_event_type_t type, tsip_ssession_t* ss, short code, const char *phrase, const struct tsip_message_s* sipmessage)
{
tsip_event_t* e;
if((e = tsip_event_create(ss, code, phrase, tsk_null, type))){
if((e = tsip_event_create(ss, code, phrase, sipmessage, type))){
TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(ss->stack), e);
return 0;
}