General update.
This commit is contained in:
parent
a23934417d
commit
691cdc659c
|
@ -135,6 +135,14 @@ bool SipSession::setToUri(const char* toUri)
|
|||
return (ret == 0);
|
||||
}
|
||||
|
||||
bool SipSession::setSilentHangup(bool silent)
|
||||
{
|
||||
int ret = tsip_ssession_set(this->handle,
|
||||
TSIP_SSESSION_SET_SILENT_HANGUP(silent ? tsk_true : tsk_false),
|
||||
TSIP_SSESSION_SET_NULL());
|
||||
return (ret == 0);
|
||||
}
|
||||
|
||||
unsigned SipSession::getId()
|
||||
{
|
||||
return (unsigned)tsip_ssession_get_id(this->handle);
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
bool setExpires(unsigned expires);
|
||||
bool setFromUri(const char* fromUri);
|
||||
bool setToUri(const char* toUri);
|
||||
bool setSilentHangup(bool silent);
|
||||
unsigned getId();
|
||||
|
||||
#if !defined(SWIG)
|
||||
|
|
|
@ -46,17 +46,33 @@ typedef enum tsip_event_type_e
|
|||
}
|
||||
tsip_event_type_t;
|
||||
|
||||
// 7xx ==> errors
|
||||
#define tsip_event_code_dialog_transport_error 702
|
||||
#define tsip_event_code_dialog_global_error 703
|
||||
#define tsip_event_code_dialog_message_error 704
|
||||
|
||||
// 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
|
||||
|
||||
// 9xx ==> Informational
|
||||
#define tsip_event_code_dialog_connecting 900
|
||||
#define tsip_event_code_dialog_connected 901
|
||||
#define tsip_event_code_dialog_terminating 902
|
||||
#define tsip_event_code_dialog_terminated 903
|
||||
#define tsip_event_code_stack_started 950
|
||||
#define tsip_event_code_stack_stopped 951
|
||||
#define tsip_event_code_stack_failed_to_start 952
|
||||
#define tsip_event_code_stack_failed_to_stop 953
|
||||
|
||||
/* ====== From "tinySIP\include\tinysip\tsip_api_register.h" ====== */
|
||||
typedef enum tsip_register_event_type_e
|
||||
{
|
||||
tsip_i_register,
|
||||
tsip_ai_register,
|
||||
tsip_o_register,
|
||||
tsip_ao_register,
|
||||
|
||||
|
||||
tsip_i_unregister,
|
||||
tsip_ai_unregister,
|
||||
tsip_o_unregister,
|
||||
tsip_ao_unregister,
|
||||
}
|
||||
tsip_register_event_type_t;
|
||||
|
@ -65,18 +81,12 @@ tsip_register_event_type_t;
|
|||
typedef enum tsip_subscribe_event_type_e
|
||||
{
|
||||
tsip_i_subscribe,
|
||||
tsip_ai_subscribe,
|
||||
tsip_o_subscribe,
|
||||
tsip_ao_subscribe,
|
||||
|
||||
tsip_i_unsubscribe,
|
||||
tsip_ai_unsubscribe,
|
||||
tsip_o_unsubscribe,
|
||||
tsip_ao_unsubscribe,
|
||||
|
||||
tsip_i_notify,
|
||||
tsip_ai_notify,
|
||||
tsip_o_notify,
|
||||
tsip_ao_notify
|
||||
}
|
||||
tsip_subscribe_event_type_t;
|
||||
|
@ -85,13 +95,9 @@ tsip_subscribe_event_type_t;
|
|||
typedef enum tsip_publish_event_type_e
|
||||
{
|
||||
tsip_i_publish,
|
||||
tsip_ai_publish,
|
||||
tsip_o_publish,
|
||||
tsip_ao_publish,
|
||||
|
||||
tsip_i_unpublish,
|
||||
tsip_ai_unpublish,
|
||||
tsip_o_unpublish,
|
||||
tsip_ao_unpublish
|
||||
}
|
||||
tsip_publish_event_type_t;
|
||||
|
@ -100,8 +106,6 @@ tsip_publish_event_type_t;
|
|||
typedef enum tsip_message_event_type_e
|
||||
{
|
||||
tsip_i_message,
|
||||
tsip_ai_message,
|
||||
tsip_o_message,
|
||||
tsip_ao_message,
|
||||
}
|
||||
tsip_message_event_type_t;
|
||||
|
@ -110,8 +114,6 @@ tsip_message_event_type_t;
|
|||
typedef enum tsip_options_event_type_e
|
||||
{
|
||||
tsip_i_options,
|
||||
tsip_ai_options,
|
||||
tsip_o_options,
|
||||
tsip_ao_options,
|
||||
}
|
||||
tsip_options_event_type_t;
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
%newobject getSipHeaderValue;
|
||||
%newobject getSipHeaderParamValue;
|
||||
// don't seem to work
|
||||
%newobject takeSessionOwnership;
|
||||
|
||||
|
||||
/* Sip Stack */
|
||||
%include SipStack.i
|
||||
|
|
|
@ -50,7 +50,7 @@ public class MessagingEvent : SipEvent {
|
|||
|
||||
public MessagingSession takeSessionOwnership() {
|
||||
IntPtr cPtr = tinyWRAPPINVOKE.MessagingEvent_takeSessionOwnership(swigCPtr);
|
||||
MessagingSession ret = (cPtr == IntPtr.Zero) ? null : new MessagingSession(cPtr, false);
|
||||
MessagingSession ret = (cPtr == IntPtr.Zero) ? null : new MessagingSession(cPtr, true);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,11 @@ public class SipSession : IDisposable {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public bool setSilentHangup(bool silent) {
|
||||
bool ret = tinyWRAPPINVOKE.SipSession_setSilentHangup(swigCPtr, silent);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public uint getId() {
|
||||
uint ret = tinyWRAPPINVOKE.SipSession_getId(swigCPtr);
|
||||
return ret;
|
||||
|
|
|
@ -237,9 +237,7 @@ namespace test
|
|||
session.Reject();
|
||||
}
|
||||
break;
|
||||
case tsip_message_event_type_t.tsip_ai_message:
|
||||
case tsip_message_event_type_t.tsip_ao_message:
|
||||
case tsip_message_event_type_t.tsip_o_message:
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,4 +11,14 @@ using System;
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
public class tinyWRAP {
|
||||
public static readonly int tsip_event_code_dialog_transport_error = tinyWRAPPINVOKE.tsip_event_code_dialog_transport_error_get();
|
||||
public static readonly int tsip_event_code_global_error = tinyWRAPPINVOKE.tsip_event_code_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_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();
|
||||
public static readonly int tsip_event_code_dialog_connected = tinyWRAPPINVOKE.tsip_event_code_dialog_connected_get();
|
||||
public static readonly int tsip_event_code_dialog_terminating = tinyWRAPPINVOKE.tsip_event_code_dialog_terminating_get();
|
||||
public static readonly int tsip_event_code_dialog_terminated = tinyWRAPPINVOKE.tsip_event_code_dialog_terminated_get();
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -319,6 +319,9 @@ class tinyWRAPPINVOKE {
|
|||
[DllImport("tinyWRAP", EntryPoint="CSharp_SipSession_setToUri")]
|
||||
public static extern bool SipSession_setToUri(HandleRef jarg1, string jarg2);
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_SipSession_setSilentHangup")]
|
||||
public static extern bool SipSession_setSilentHangup(HandleRef jarg1, bool jarg2);
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_SipSession_getId")]
|
||||
public static extern uint SipSession_getId(HandleRef jarg1);
|
||||
|
||||
|
@ -526,6 +529,36 @@ class tinyWRAPPINVOKE {
|
|||
[DllImport("tinyWRAP", EntryPoint="CSharp_SipStack_stop")]
|
||||
public static extern bool SipStack_stop(HandleRef jarg1);
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_tsip_event_code_dialog_transport_error_get")]
|
||||
public static extern int tsip_event_code_dialog_transport_error_get();
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_tsip_event_code_global_error_get")]
|
||||
public static extern int tsip_event_code_global_error_get();
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_tsip_event_code_dialog_message_error_get")]
|
||||
public static extern int tsip_event_code_dialog_message_error_get();
|
||||
|
||||
[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_cancelled_get")]
|
||||
public static extern int tsip_event_code_dialog_request_cancelled_get();
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_tsip_event_code_dialog_request_sent_get")]
|
||||
public static extern int tsip_event_code_dialog_request_sent_get();
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_tsip_event_code_dialog_connecting_get")]
|
||||
public static extern int tsip_event_code_dialog_connecting_get();
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_tsip_event_code_dialog_connected_get")]
|
||||
public static extern int tsip_event_code_dialog_connected_get();
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_tsip_event_code_dialog_terminating_get")]
|
||||
public static extern int tsip_event_code_dialog_terminating_get();
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_tsip_event_code_dialog_terminated_get")]
|
||||
public static extern int tsip_event_code_dialog_terminated_get();
|
||||
|
||||
[DllImport("tinyWRAP", EntryPoint="CSharp_DialogEventUpcast")]
|
||||
public static extern IntPtr DialogEventUpcast(IntPtr objectRef);
|
||||
|
||||
|
|
|
@ -1096,6 +1096,20 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_SipSession_setToUri(void * jarg1, cha
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_SipSession_setSilentHangup(void * jarg1, unsigned int jarg2) {
|
||||
unsigned int jresult ;
|
||||
SipSession *arg1 = (SipSession *) 0 ;
|
||||
bool arg2 ;
|
||||
bool result;
|
||||
|
||||
arg1 = (SipSession *)jarg1;
|
||||
arg2 = jarg2 ? true : false;
|
||||
result = (bool)(arg1)->setSilentHangup(arg2);
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_SipSession_getId(void * jarg1) {
|
||||
unsigned int jresult ;
|
||||
SipSession *arg1 = (SipSession *) 0 ;
|
||||
|
@ -1966,6 +1980,106 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_SipStack_stop(void * jarg1) {
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_transport_error_get() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int) 702;
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_global_error_get() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int) 703;
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_message_error_get() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int) 704;
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_request_incoming_get() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int) 800;
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_request_cancelled_get() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int) 801;
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_request_sent_get() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int) 802;
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_connecting_get() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int) 900;
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_connected_get() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int) 901;
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_terminating_get() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int) 902;
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_tsip_event_code_dialog_terminated_get() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int) 903;
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT SipEvent * SWIGSTDCALL CSharp_DialogEventUpcast(DialogEvent *objectRef) {
|
||||
return (SipEvent *)objectRef;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,5 @@
|
|||
|
||||
public enum tsip_message_event_type_t {
|
||||
tsip_i_message,
|
||||
tsip_ai_message,
|
||||
tsip_o_message,
|
||||
tsip_ao_message
|
||||
}
|
||||
|
|
|
@ -9,7 +9,5 @@
|
|||
|
||||
public enum tsip_options_event_type_t {
|
||||
tsip_i_options,
|
||||
tsip_ai_options,
|
||||
tsip_o_options,
|
||||
tsip_ao_options
|
||||
}
|
||||
|
|
|
@ -9,11 +9,7 @@
|
|||
|
||||
public enum tsip_publish_event_type_t {
|
||||
tsip_i_publish,
|
||||
tsip_ai_publish,
|
||||
tsip_o_publish,
|
||||
tsip_ao_publish,
|
||||
tsip_i_unpublish,
|
||||
tsip_ai_unpublish,
|
||||
tsip_o_unpublish,
|
||||
tsip_ao_unpublish
|
||||
}
|
||||
|
|
|
@ -9,11 +9,7 @@
|
|||
|
||||
public enum tsip_register_event_type_t {
|
||||
tsip_i_register,
|
||||
tsip_ai_register,
|
||||
tsip_o_register,
|
||||
tsip_ao_register,
|
||||
tsip_i_unregister,
|
||||
tsip_ai_unregister,
|
||||
tsip_o_unregister,
|
||||
tsip_ao_unregister
|
||||
}
|
||||
|
|
|
@ -9,15 +9,9 @@
|
|||
|
||||
public enum tsip_subscribe_event_type_t {
|
||||
tsip_i_subscribe,
|
||||
tsip_ai_subscribe,
|
||||
tsip_o_subscribe,
|
||||
tsip_ao_subscribe,
|
||||
tsip_i_unsubscribe,
|
||||
tsip_ai_unsubscribe,
|
||||
tsip_o_unsubscribe,
|
||||
tsip_ao_unsubscribe,
|
||||
tsip_i_notify,
|
||||
tsip_ai_notify,
|
||||
tsip_o_notify,
|
||||
tsip_ao_notify
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class MessagingEvent extends SipEvent {
|
|||
|
||||
public MessagingSession takeSessionOwnership() {
|
||||
long cPtr = tinyWRAPJNI.MessagingEvent_takeSessionOwnership(swigCPtr, this);
|
||||
return (cPtr == 0) ? null : new MessagingSession(cPtr, false);
|
||||
return (cPtr == 0) ? null : new MessagingSession(cPtr, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,6 +82,10 @@ public class SipSession {
|
|||
return tinyWRAPJNI.SipSession_setToUri(swigCPtr, this, toUri);
|
||||
}
|
||||
|
||||
public boolean setSilentHangup(boolean silent) {
|
||||
return tinyWRAPJNI.SipSession_setSilentHangup(swigCPtr, this, silent);
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return tinyWRAPJNI.SipSession_getId(swigCPtr, this);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class MessagingEvent extends SipEvent {
|
|||
|
||||
public MessagingSession takeSessionOwnership() {
|
||||
long cPtr = tinyWRAPJNI.MessagingEvent_takeSessionOwnership(swigCPtr, this);
|
||||
return (cPtr == 0) ? null : new MessagingSession(cPtr, false);
|
||||
return (cPtr == 0) ? null : new MessagingSession(cPtr, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,6 +82,10 @@ public class SipSession {
|
|||
return tinyWRAPJNI.SipSession_setToUri(swigCPtr, this, toUri);
|
||||
}
|
||||
|
||||
public boolean setSilentHangup(boolean silent) {
|
||||
return tinyWRAPJNI.SipSession_setSilentHangup(swigCPtr, this, silent);
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return tinyWRAPJNI.SipSession_getId(swigCPtr, this);
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
|
||||
package org.doubango.tinyWRAP;
|
||||
|
||||
public class tinyWRAP {
|
||||
public class tinyWRAP implements tinyWRAPConstants {
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.39
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing--modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package org.doubango.tinyWRAP;
|
||||
|
||||
public interface tinyWRAPConstants {
|
||||
public final static int tsip_event_code_dialog_transport_error = 702;
|
||||
public final static int tsip_event_code_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_connecting = 900;
|
||||
public final static int tsip_event_code_dialog_connected = 901;
|
||||
public final static int tsip_event_code_dialog_terminating = 902;
|
||||
public final static int tsip_event_code_dialog_terminated = 903;
|
||||
}
|
|
@ -54,6 +54,7 @@ class tinyWRAPJNI {
|
|||
public final static native boolean SipSession_setExpires(long jarg1, SipSession jarg1_, long jarg2);
|
||||
public final static native boolean SipSession_setFromUri(long jarg1, SipSession jarg1_, String jarg2);
|
||||
public final static native boolean SipSession_setToUri(long jarg1, SipSession jarg1_, String jarg2);
|
||||
public final static native boolean SipSession_setSilentHangup(long jarg1, SipSession jarg1_, boolean jarg2);
|
||||
public final static native long SipSession_getId(long jarg1, SipSession jarg1_);
|
||||
public final static native long new_MessagingSession(long jarg1, SipStack jarg1_);
|
||||
public final static native void delete_MessagingSession(long jarg1);
|
||||
|
|
|
@ -1548,6 +1548,23 @@ SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipSession_1s
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipSession_1setSilentHangup(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) {
|
||||
jboolean jresult = 0 ;
|
||||
SipSession *arg1 = (SipSession *) 0 ;
|
||||
bool arg2 ;
|
||||
bool result;
|
||||
|
||||
(void)jenv;
|
||||
(void)jcls;
|
||||
(void)jarg1_;
|
||||
arg1 = *(SipSession **)&jarg1;
|
||||
arg2 = jarg2 ? true : false;
|
||||
result = (bool)(arg1)->setSilentHangup(arg2);
|
||||
jresult = (jboolean)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipSession_1getId(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
|
||||
jlong jresult = 0 ;
|
||||
SipSession *arg1 = (SipSession *) 0 ;
|
||||
|
|
|
@ -10,8 +10,6 @@ package org.doubango.tinyWRAP;
|
|||
|
||||
public enum tsip_message_event_type_t {
|
||||
tsip_i_message,
|
||||
tsip_ai_message,
|
||||
tsip_o_message,
|
||||
tsip_ao_message;
|
||||
|
||||
public final int swigValue() {
|
||||
|
|
|
@ -10,8 +10,6 @@ package org.doubango.tinyWRAP;
|
|||
|
||||
public enum tsip_options_event_type_t {
|
||||
tsip_i_options,
|
||||
tsip_ai_options,
|
||||
tsip_o_options,
|
||||
tsip_ao_options;
|
||||
|
||||
public final int swigValue() {
|
||||
|
|
|
@ -10,12 +10,8 @@ package org.doubango.tinyWRAP;
|
|||
|
||||
public enum tsip_publish_event_type_t {
|
||||
tsip_i_publish,
|
||||
tsip_ai_publish,
|
||||
tsip_o_publish,
|
||||
tsip_ao_publish,
|
||||
tsip_i_unpublish,
|
||||
tsip_ai_unpublish,
|
||||
tsip_o_unpublish,
|
||||
tsip_ao_unpublish;
|
||||
|
||||
public final int swigValue() {
|
||||
|
|
|
@ -10,12 +10,8 @@ package org.doubango.tinyWRAP;
|
|||
|
||||
public enum tsip_register_event_type_t {
|
||||
tsip_i_register,
|
||||
tsip_ai_register,
|
||||
tsip_o_register,
|
||||
tsip_ao_register,
|
||||
tsip_i_unregister,
|
||||
tsip_ai_unregister,
|
||||
tsip_o_unregister,
|
||||
tsip_ao_unregister;
|
||||
|
||||
public final int swigValue() {
|
||||
|
|
|
@ -10,16 +10,10 @@ package org.doubango.tinyWRAP;
|
|||
|
||||
public enum tsip_subscribe_event_type_t {
|
||||
tsip_i_subscribe,
|
||||
tsip_ai_subscribe,
|
||||
tsip_o_subscribe,
|
||||
tsip_ao_subscribe,
|
||||
tsip_i_unsubscribe,
|
||||
tsip_ai_unsubscribe,
|
||||
tsip_o_unsubscribe,
|
||||
tsip_ao_unsubscribe,
|
||||
tsip_i_notify,
|
||||
tsip_ai_notify,
|
||||
tsip_o_notify,
|
||||
tsip_ao_notify;
|
||||
|
||||
public final int swigValue() {
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
|
||||
package org.doubango.tinyWRAP;
|
||||
|
||||
public class tinyWRAP {
|
||||
public class tinyWRAP implements tinyWRAPConstants {
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.39
|
||||
*
|
||||
* Do not make changes to this file unless you know what you are doing--modify
|
||||
* the SWIG interface file instead.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
package org.doubango.tinyWRAP;
|
||||
|
||||
public interface tinyWRAPConstants {
|
||||
public final static int tsip_event_code_dialog_transport_error = 702;
|
||||
public final static int tsip_event_code_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_connecting = 900;
|
||||
public final static int tsip_event_code_dialog_connected = 901;
|
||||
public final static int tsip_event_code_dialog_terminating = 902;
|
||||
public final static int tsip_event_code_dialog_terminated = 903;
|
||||
}
|
|
@ -54,6 +54,7 @@ class tinyWRAPJNI {
|
|||
public final static native boolean SipSession_setExpires(long jarg1, SipSession jarg1_, long jarg2);
|
||||
public final static native boolean SipSession_setFromUri(long jarg1, SipSession jarg1_, String jarg2);
|
||||
public final static native boolean SipSession_setToUri(long jarg1, SipSession jarg1_, String jarg2);
|
||||
public final static native boolean SipSession_setSilentHangup(long jarg1, SipSession jarg1_, boolean jarg2);
|
||||
public final static native long SipSession_getId(long jarg1, SipSession jarg1_);
|
||||
public final static native long new_MessagingSession(long jarg1, SipStack jarg1_);
|
||||
public final static native void delete_MessagingSession(long jarg1);
|
||||
|
|
|
@ -1548,6 +1548,23 @@ SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipSession_1s
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipSession_1setSilentHangup(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) {
|
||||
jboolean jresult = 0 ;
|
||||
SipSession *arg1 = (SipSession *) 0 ;
|
||||
bool arg2 ;
|
||||
bool result;
|
||||
|
||||
(void)jenv;
|
||||
(void)jcls;
|
||||
(void)jarg1_;
|
||||
arg1 = *(SipSession **)&jarg1;
|
||||
arg2 = jarg2 ? true : false;
|
||||
result = (bool)(arg1)->setSilentHangup(arg2);
|
||||
jresult = (jboolean)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_SipSession_1getId(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
|
||||
jlong jresult = 0 ;
|
||||
SipSession *arg1 = (SipSession *) 0 ;
|
||||
|
|
|
@ -10,8 +10,6 @@ package org.doubango.tinyWRAP;
|
|||
|
||||
public enum tsip_message_event_type_t {
|
||||
tsip_i_message,
|
||||
tsip_ai_message,
|
||||
tsip_o_message,
|
||||
tsip_ao_message;
|
||||
|
||||
public final int swigValue() {
|
||||
|
|
|
@ -10,8 +10,6 @@ package org.doubango.tinyWRAP;
|
|||
|
||||
public enum tsip_options_event_type_t {
|
||||
tsip_i_options,
|
||||
tsip_ai_options,
|
||||
tsip_o_options,
|
||||
tsip_ao_options;
|
||||
|
||||
public final int swigValue() {
|
||||
|
|
|
@ -10,12 +10,8 @@ package org.doubango.tinyWRAP;
|
|||
|
||||
public enum tsip_publish_event_type_t {
|
||||
tsip_i_publish,
|
||||
tsip_ai_publish,
|
||||
tsip_o_publish,
|
||||
tsip_ao_publish,
|
||||
tsip_i_unpublish,
|
||||
tsip_ai_unpublish,
|
||||
tsip_o_unpublish,
|
||||
tsip_ao_unpublish;
|
||||
|
||||
public final int swigValue() {
|
||||
|
|
|
@ -10,12 +10,8 @@ package org.doubango.tinyWRAP;
|
|||
|
||||
public enum tsip_register_event_type_t {
|
||||
tsip_i_register,
|
||||
tsip_ai_register,
|
||||
tsip_o_register,
|
||||
tsip_ao_register,
|
||||
tsip_i_unregister,
|
||||
tsip_ai_unregister,
|
||||
tsip_o_unregister,
|
||||
tsip_ao_unregister;
|
||||
|
||||
public final int swigValue() {
|
||||
|
|
|
@ -10,16 +10,10 @@ package org.doubango.tinyWRAP;
|
|||
|
||||
public enum tsip_subscribe_event_type_t {
|
||||
tsip_i_subscribe,
|
||||
tsip_ai_subscribe,
|
||||
tsip_o_subscribe,
|
||||
tsip_ao_subscribe,
|
||||
tsip_i_unsubscribe,
|
||||
tsip_ai_unsubscribe,
|
||||
tsip_o_unsubscribe,
|
||||
tsip_ao_unsubscribe,
|
||||
tsip_i_notify,
|
||||
tsip_ai_notify,
|
||||
tsip_o_notify,
|
||||
tsip_ao_notify;
|
||||
|
||||
public final int swigValue() {
|
||||
|
|
|
@ -393,6 +393,7 @@ sub DESTROY {
|
|||
*setExpires = *tinyWRAPc::SipSession_setExpires;
|
||||
*setFromUri = *tinyWRAPc::SipSession_setFromUri;
|
||||
*setToUri = *tinyWRAPc::SipSession_setToUri;
|
||||
*setSilentHangup = *tinyWRAPc::SipSession_setSilentHangup;
|
||||
*getId = *tinyWRAPc::SipSession_getId;
|
||||
sub DISOWN {
|
||||
my $self = shift;
|
||||
|
@ -789,40 +790,32 @@ package tinyWRAP;
|
|||
*tsip_event_register = *tinyWRAPc::tsip_event_register;
|
||||
*tsip_event_subscribe = *tinyWRAPc::tsip_event_subscribe;
|
||||
*tsip_event_dialog = *tinyWRAPc::tsip_event_dialog;
|
||||
*tsip_event_code_dialog_transport_error = *tinyWRAPc::tsip_event_code_dialog_transport_error;
|
||||
*tsip_event_code_global_error = *tinyWRAPc::tsip_event_code_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_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;
|
||||
*tsip_event_code_dialog_connected = *tinyWRAPc::tsip_event_code_dialog_connected;
|
||||
*tsip_event_code_dialog_terminating = *tinyWRAPc::tsip_event_code_dialog_terminating;
|
||||
*tsip_event_code_dialog_terminated = *tinyWRAPc::tsip_event_code_dialog_terminated;
|
||||
*tsip_i_register = *tinyWRAPc::tsip_i_register;
|
||||
*tsip_ai_register = *tinyWRAPc::tsip_ai_register;
|
||||
*tsip_o_register = *tinyWRAPc::tsip_o_register;
|
||||
*tsip_ao_register = *tinyWRAPc::tsip_ao_register;
|
||||
*tsip_i_unregister = *tinyWRAPc::tsip_i_unregister;
|
||||
*tsip_ai_unregister = *tinyWRAPc::tsip_ai_unregister;
|
||||
*tsip_o_unregister = *tinyWRAPc::tsip_o_unregister;
|
||||
*tsip_ao_unregister = *tinyWRAPc::tsip_ao_unregister;
|
||||
*tsip_i_subscribe = *tinyWRAPc::tsip_i_subscribe;
|
||||
*tsip_ai_subscribe = *tinyWRAPc::tsip_ai_subscribe;
|
||||
*tsip_o_subscribe = *tinyWRAPc::tsip_o_subscribe;
|
||||
*tsip_ao_subscribe = *tinyWRAPc::tsip_ao_subscribe;
|
||||
*tsip_i_unsubscribe = *tinyWRAPc::tsip_i_unsubscribe;
|
||||
*tsip_ai_unsubscribe = *tinyWRAPc::tsip_ai_unsubscribe;
|
||||
*tsip_o_unsubscribe = *tinyWRAPc::tsip_o_unsubscribe;
|
||||
*tsip_ao_unsubscribe = *tinyWRAPc::tsip_ao_unsubscribe;
|
||||
*tsip_i_notify = *tinyWRAPc::tsip_i_notify;
|
||||
*tsip_ai_notify = *tinyWRAPc::tsip_ai_notify;
|
||||
*tsip_o_notify = *tinyWRAPc::tsip_o_notify;
|
||||
*tsip_ao_notify = *tinyWRAPc::tsip_ao_notify;
|
||||
*tsip_i_publish = *tinyWRAPc::tsip_i_publish;
|
||||
*tsip_ai_publish = *tinyWRAPc::tsip_ai_publish;
|
||||
*tsip_o_publish = *tinyWRAPc::tsip_o_publish;
|
||||
*tsip_ao_publish = *tinyWRAPc::tsip_ao_publish;
|
||||
*tsip_i_unpublish = *tinyWRAPc::tsip_i_unpublish;
|
||||
*tsip_ai_unpublish = *tinyWRAPc::tsip_ai_unpublish;
|
||||
*tsip_o_unpublish = *tinyWRAPc::tsip_o_unpublish;
|
||||
*tsip_ao_unpublish = *tinyWRAPc::tsip_ao_unpublish;
|
||||
*tsip_i_message = *tinyWRAPc::tsip_i_message;
|
||||
*tsip_ai_message = *tinyWRAPc::tsip_ai_message;
|
||||
*tsip_o_message = *tinyWRAPc::tsip_o_message;
|
||||
*tsip_ao_message = *tinyWRAPc::tsip_ao_message;
|
||||
*tsip_i_options = *tinyWRAPc::tsip_i_options;
|
||||
*tsip_ai_options = *tinyWRAPc::tsip_ai_options;
|
||||
*tsip_o_options = *tinyWRAPc::tsip_o_options;
|
||||
*tsip_ao_options = *tinyWRAPc::tsip_ao_options;
|
||||
1;
|
||||
|
|
|
@ -2885,7 +2885,7 @@ XS(_wrap_MessagingEvent_takeSessionOwnership) {
|
|||
}
|
||||
arg1 = reinterpret_cast< MessagingEvent * >(argp1);
|
||||
result = (MessagingSession *)((MessagingEvent const *)arg1)->takeSessionOwnership();
|
||||
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MessagingSession, 0 | SWIG_SHADOW); argvi++ ;
|
||||
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MessagingSession, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
|
||||
|
||||
XSRETURN(argvi);
|
||||
fail:
|
||||
|
@ -3729,6 +3729,44 @@ XS(_wrap_SipSession_setToUri) {
|
|||
}
|
||||
|
||||
|
||||
XS(_wrap_SipSession_setSilentHangup) {
|
||||
{
|
||||
SipSession *arg1 = (SipSession *) 0 ;
|
||||
bool arg2 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
bool val2 ;
|
||||
int ecode2 = 0 ;
|
||||
int argvi = 0;
|
||||
bool result;
|
||||
dXSARGS;
|
||||
|
||||
if ((items < 2) || (items > 2)) {
|
||||
SWIG_croak("Usage: SipSession_setSilentHangup(self,silent);");
|
||||
}
|
||||
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_SipSession, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SipSession_setSilentHangup" "', argument " "1"" of type '" "SipSession *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< SipSession * >(argp1);
|
||||
ecode2 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
|
||||
if (!SWIG_IsOK(ecode2)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SipSession_setSilentHangup" "', argument " "2"" of type '" "bool""'");
|
||||
}
|
||||
arg2 = static_cast< bool >(val2);
|
||||
result = (bool)(arg1)->setSilentHangup(arg2);
|
||||
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
|
||||
|
||||
|
||||
XSRETURN(argvi);
|
||||
fail:
|
||||
|
||||
|
||||
SWIG_croak_null();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XS(_wrap_SipSession_getId) {
|
||||
{
|
||||
SipSession *arg1 = (SipSession *) 0 ;
|
||||
|
@ -5857,6 +5895,7 @@ static swig_command_info swig_commands[] = {
|
|||
{"tinyWRAPc::SipSession_setExpires", _wrap_SipSession_setExpires},
|
||||
{"tinyWRAPc::SipSession_setFromUri", _wrap_SipSession_setFromUri},
|
||||
{"tinyWRAPc::SipSession_setToUri", _wrap_SipSession_setToUri},
|
||||
{"tinyWRAPc::SipSession_setSilentHangup", _wrap_SipSession_setSilentHangup},
|
||||
{"tinyWRAPc::SipSession_getId", _wrap_SipSession_getId},
|
||||
{"tinyWRAPc::new_MessagingSession", _wrap_new_MessagingSession},
|
||||
{"tinyWRAPc::delete_MessagingSession", _wrap_delete_MessagingSession},
|
||||
|
@ -6262,21 +6301,61 @@ XS(SWIG_init) {
|
|||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_event_dialog)));
|
||||
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_transport_error", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(702)));
|
||||
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_global_error", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(703)));
|
||||
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_message_error", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(704)));
|
||||
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_incoming", TRUE | 0x2 | GV_ADDMULTI);
|
||||
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_cancelled", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(801)));
|
||||
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)));
|
||||
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_connecting", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(900)));
|
||||
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_connected", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(901)));
|
||||
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_terminating", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(902)));
|
||||
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_terminated", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(903)));
|
||||
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_i_register", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_i_register)));
|
||||
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_ai_register", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ai_register)));
|
||||
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_o_register", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_o_register)));
|
||||
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_ao_register", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ao_register)));
|
||||
|
@ -6287,16 +6366,6 @@ XS(SWIG_init) {
|
|||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_i_unregister)));
|
||||
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_ai_unregister", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ai_unregister)));
|
||||
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_o_unregister", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_o_unregister)));
|
||||
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_ao_unregister", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ao_unregister)));
|
||||
|
@ -6307,16 +6376,6 @@ XS(SWIG_init) {
|
|||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_i_subscribe)));
|
||||
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_ai_subscribe", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ai_subscribe)));
|
||||
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_o_subscribe", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_o_subscribe)));
|
||||
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_ao_subscribe", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ao_subscribe)));
|
||||
|
@ -6327,16 +6386,6 @@ XS(SWIG_init) {
|
|||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_i_unsubscribe)));
|
||||
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_ai_unsubscribe", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ai_unsubscribe)));
|
||||
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_o_unsubscribe", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_o_unsubscribe)));
|
||||
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_ao_unsubscribe", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ao_unsubscribe)));
|
||||
|
@ -6347,16 +6396,6 @@ XS(SWIG_init) {
|
|||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_i_notify)));
|
||||
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_ai_notify", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ai_notify)));
|
||||
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_o_notify", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_o_notify)));
|
||||
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_ao_notify", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ao_notify)));
|
||||
|
@ -6367,16 +6406,6 @@ XS(SWIG_init) {
|
|||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_i_publish)));
|
||||
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_ai_publish", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ai_publish)));
|
||||
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_o_publish", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_o_publish)));
|
||||
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_ao_publish", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ao_publish)));
|
||||
|
@ -6387,16 +6416,6 @@ XS(SWIG_init) {
|
|||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_i_unpublish)));
|
||||
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_ai_unpublish", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ai_unpublish)));
|
||||
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_o_unpublish", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_o_unpublish)));
|
||||
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_ao_unpublish", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ao_unpublish)));
|
||||
|
@ -6407,16 +6426,6 @@ XS(SWIG_init) {
|
|||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_i_message)));
|
||||
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_ai_message", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ai_message)));
|
||||
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_o_message", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_o_message)));
|
||||
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_ao_message", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ao_message)));
|
||||
|
@ -6427,16 +6436,6 @@ XS(SWIG_init) {
|
|||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_i_options)));
|
||||
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_ai_options", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ai_options)));
|
||||
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_o_options", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_o_options)));
|
||||
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_ao_options", TRUE | 0x2 | GV_ADDMULTI);
|
||||
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(tsip_ao_options)));
|
||||
|
|
|
@ -233,6 +233,7 @@ class SipSession(_object):
|
|||
def setExpires(self, *args): return _tinyWRAP.SipSession_setExpires(self, *args)
|
||||
def setFromUri(self, *args): return _tinyWRAP.SipSession_setFromUri(self, *args)
|
||||
def setToUri(self, *args): return _tinyWRAP.SipSession_setToUri(self, *args)
|
||||
def setSilentHangup(self, *args): return _tinyWRAP.SipSession_setSilentHangup(self, *args)
|
||||
def getId(self): return _tinyWRAP.SipSession_getId(self)
|
||||
SipSession_swigregister = _tinyWRAP.SipSession_swigregister
|
||||
SipSession_swigregister(SipSession)
|
||||
|
@ -445,41 +446,33 @@ tsip_event_publish = _tinyWRAP.tsip_event_publish
|
|||
tsip_event_register = _tinyWRAP.tsip_event_register
|
||||
tsip_event_subscribe = _tinyWRAP.tsip_event_subscribe
|
||||
tsip_event_dialog = _tinyWRAP.tsip_event_dialog
|
||||
tsip_event_code_dialog_transport_error = _tinyWRAP.tsip_event_code_dialog_transport_error
|
||||
tsip_event_code_global_error = _tinyWRAP.tsip_event_code_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_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
|
||||
tsip_event_code_dialog_connected = _tinyWRAP.tsip_event_code_dialog_connected
|
||||
tsip_event_code_dialog_terminating = _tinyWRAP.tsip_event_code_dialog_terminating
|
||||
tsip_event_code_dialog_terminated = _tinyWRAP.tsip_event_code_dialog_terminated
|
||||
tsip_i_register = _tinyWRAP.tsip_i_register
|
||||
tsip_ai_register = _tinyWRAP.tsip_ai_register
|
||||
tsip_o_register = _tinyWRAP.tsip_o_register
|
||||
tsip_ao_register = _tinyWRAP.tsip_ao_register
|
||||
tsip_i_unregister = _tinyWRAP.tsip_i_unregister
|
||||
tsip_ai_unregister = _tinyWRAP.tsip_ai_unregister
|
||||
tsip_o_unregister = _tinyWRAP.tsip_o_unregister
|
||||
tsip_ao_unregister = _tinyWRAP.tsip_ao_unregister
|
||||
tsip_i_subscribe = _tinyWRAP.tsip_i_subscribe
|
||||
tsip_ai_subscribe = _tinyWRAP.tsip_ai_subscribe
|
||||
tsip_o_subscribe = _tinyWRAP.tsip_o_subscribe
|
||||
tsip_ao_subscribe = _tinyWRAP.tsip_ao_subscribe
|
||||
tsip_i_unsubscribe = _tinyWRAP.tsip_i_unsubscribe
|
||||
tsip_ai_unsubscribe = _tinyWRAP.tsip_ai_unsubscribe
|
||||
tsip_o_unsubscribe = _tinyWRAP.tsip_o_unsubscribe
|
||||
tsip_ao_unsubscribe = _tinyWRAP.tsip_ao_unsubscribe
|
||||
tsip_i_notify = _tinyWRAP.tsip_i_notify
|
||||
tsip_ai_notify = _tinyWRAP.tsip_ai_notify
|
||||
tsip_o_notify = _tinyWRAP.tsip_o_notify
|
||||
tsip_ao_notify = _tinyWRAP.tsip_ao_notify
|
||||
tsip_i_publish = _tinyWRAP.tsip_i_publish
|
||||
tsip_ai_publish = _tinyWRAP.tsip_ai_publish
|
||||
tsip_o_publish = _tinyWRAP.tsip_o_publish
|
||||
tsip_ao_publish = _tinyWRAP.tsip_ao_publish
|
||||
tsip_i_unpublish = _tinyWRAP.tsip_i_unpublish
|
||||
tsip_ai_unpublish = _tinyWRAP.tsip_ai_unpublish
|
||||
tsip_o_unpublish = _tinyWRAP.tsip_o_unpublish
|
||||
tsip_ao_unpublish = _tinyWRAP.tsip_ao_unpublish
|
||||
tsip_i_message = _tinyWRAP.tsip_i_message
|
||||
tsip_ai_message = _tinyWRAP.tsip_ai_message
|
||||
tsip_o_message = _tinyWRAP.tsip_o_message
|
||||
tsip_ao_message = _tinyWRAP.tsip_ao_message
|
||||
tsip_i_options = _tinyWRAP.tsip_i_options
|
||||
tsip_ai_options = _tinyWRAP.tsip_ai_options
|
||||
tsip_o_options = _tinyWRAP.tsip_o_options
|
||||
tsip_ao_options = _tinyWRAP.tsip_ao_options
|
||||
|
||||
|
||||
|
|
|
@ -3590,6 +3590,17 @@ SWIG_AsVal_long (PyObject *obj, long* val)
|
|||
}
|
||||
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_AsVal_bool (PyObject *obj, bool *val)
|
||||
{
|
||||
int r = PyObject_IsTrue(obj);
|
||||
if (r == -1)
|
||||
return SWIG_ERROR;
|
||||
if (val) *val = r ? true : false;
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_AsVal_int (PyObject * obj, int *val)
|
||||
{
|
||||
|
@ -3606,17 +3617,6 @@ SWIG_AsVal_int (PyObject * obj, int *val)
|
|||
}
|
||||
|
||||
|
||||
SWIGINTERN int
|
||||
SWIG_AsVal_bool (PyObject *obj, bool *val)
|
||||
{
|
||||
int r = PyObject_IsTrue(obj);
|
||||
if (r == -1)
|
||||
return SWIG_ERROR;
|
||||
if (val) *val = r ? true : false;
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------
|
||||
* C++ director class methods
|
||||
|
@ -4713,7 +4713,7 @@ SWIGINTERN PyObject *_wrap_MessagingEvent_takeSessionOwnership(PyObject *SWIGUNU
|
|||
}
|
||||
arg1 = reinterpret_cast< MessagingEvent * >(argp1);
|
||||
result = (MessagingSession *)((MessagingEvent const *)arg1)->takeSessionOwnership();
|
||||
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MessagingSession, 0 | 0 );
|
||||
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MessagingSession, SWIG_POINTER_OWN | 0 );
|
||||
return resultobj;
|
||||
fail:
|
||||
return NULL;
|
||||
|
@ -5423,6 +5423,37 @@ fail:
|
|||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_SipSession_setSilentHangup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
SipSession *arg1 = (SipSession *) 0 ;
|
||||
bool arg2 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
bool val2 ;
|
||||
int ecode2 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
PyObject * obj1 = 0 ;
|
||||
bool result;
|
||||
|
||||
if (!PyArg_ParseTuple(args,(char *)"OO:SipSession_setSilentHangup",&obj0,&obj1)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SipSession, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SipSession_setSilentHangup" "', argument " "1"" of type '" "SipSession *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< SipSession * >(argp1);
|
||||
ecode2 = SWIG_AsVal_bool(obj1, &val2);
|
||||
if (!SWIG_IsOK(ecode2)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SipSession_setSilentHangup" "', argument " "2"" of type '" "bool""'");
|
||||
}
|
||||
arg2 = static_cast< bool >(val2);
|
||||
result = (bool)(arg1)->setSilentHangup(arg2);
|
||||
resultobj = SWIG_From_bool(static_cast< bool >(result));
|
||||
return resultobj;
|
||||
fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_SipSession_getId(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
SipSession *arg1 = (SipSession *) 0 ;
|
||||
|
@ -7322,6 +7353,7 @@ static PyMethodDef SwigMethods[] = {
|
|||
{ (char *)"SipSession_setExpires", _wrap_SipSession_setExpires, METH_VARARGS, NULL},
|
||||
{ (char *)"SipSession_setFromUri", _wrap_SipSession_setFromUri, METH_VARARGS, NULL},
|
||||
{ (char *)"SipSession_setToUri", _wrap_SipSession_setToUri, METH_VARARGS, NULL},
|
||||
{ (char *)"SipSession_setSilentHangup", _wrap_SipSession_setSilentHangup, METH_VARARGS, NULL},
|
||||
{ (char *)"SipSession_getId", _wrap_SipSession_getId, METH_VARARGS, NULL},
|
||||
{ (char *)"SipSession_swigregister", SipSession_swigregister, METH_VARARGS, NULL},
|
||||
{ (char *)"new_MessagingSession", _wrap_new_MessagingSession, METH_VARARGS, NULL},
|
||||
|
@ -8139,41 +8171,33 @@ SWIG_init(void) {
|
|||
SWIG_Python_SetConstant(d, "tsip_event_register",SWIG_From_int(static_cast< int >(tsip_event_register)));
|
||||
SWIG_Python_SetConstant(d, "tsip_event_subscribe",SWIG_From_int(static_cast< int >(tsip_event_subscribe)));
|
||||
SWIG_Python_SetConstant(d, "tsip_event_dialog",SWIG_From_int(static_cast< int >(tsip_event_dialog)));
|
||||
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_transport_error",SWIG_From_int(static_cast< int >(702)));
|
||||
SWIG_Python_SetConstant(d, "tsip_event_code_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_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)));
|
||||
SWIG_Python_SetConstant(d, "tsip_event_code_dialog_terminated",SWIG_From_int(static_cast< int >(903)));
|
||||
SWIG_Python_SetConstant(d, "tsip_i_register",SWIG_From_int(static_cast< int >(tsip_i_register)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ai_register",SWIG_From_int(static_cast< int >(tsip_ai_register)));
|
||||
SWIG_Python_SetConstant(d, "tsip_o_register",SWIG_From_int(static_cast< int >(tsip_o_register)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ao_register",SWIG_From_int(static_cast< int >(tsip_ao_register)));
|
||||
SWIG_Python_SetConstant(d, "tsip_i_unregister",SWIG_From_int(static_cast< int >(tsip_i_unregister)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ai_unregister",SWIG_From_int(static_cast< int >(tsip_ai_unregister)));
|
||||
SWIG_Python_SetConstant(d, "tsip_o_unregister",SWIG_From_int(static_cast< int >(tsip_o_unregister)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ao_unregister",SWIG_From_int(static_cast< int >(tsip_ao_unregister)));
|
||||
SWIG_Python_SetConstant(d, "tsip_i_subscribe",SWIG_From_int(static_cast< int >(tsip_i_subscribe)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ai_subscribe",SWIG_From_int(static_cast< int >(tsip_ai_subscribe)));
|
||||
SWIG_Python_SetConstant(d, "tsip_o_subscribe",SWIG_From_int(static_cast< int >(tsip_o_subscribe)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ao_subscribe",SWIG_From_int(static_cast< int >(tsip_ao_subscribe)));
|
||||
SWIG_Python_SetConstant(d, "tsip_i_unsubscribe",SWIG_From_int(static_cast< int >(tsip_i_unsubscribe)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ai_unsubscribe",SWIG_From_int(static_cast< int >(tsip_ai_unsubscribe)));
|
||||
SWIG_Python_SetConstant(d, "tsip_o_unsubscribe",SWIG_From_int(static_cast< int >(tsip_o_unsubscribe)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ao_unsubscribe",SWIG_From_int(static_cast< int >(tsip_ao_unsubscribe)));
|
||||
SWIG_Python_SetConstant(d, "tsip_i_notify",SWIG_From_int(static_cast< int >(tsip_i_notify)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ai_notify",SWIG_From_int(static_cast< int >(tsip_ai_notify)));
|
||||
SWIG_Python_SetConstant(d, "tsip_o_notify",SWIG_From_int(static_cast< int >(tsip_o_notify)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ao_notify",SWIG_From_int(static_cast< int >(tsip_ao_notify)));
|
||||
SWIG_Python_SetConstant(d, "tsip_i_publish",SWIG_From_int(static_cast< int >(tsip_i_publish)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ai_publish",SWIG_From_int(static_cast< int >(tsip_ai_publish)));
|
||||
SWIG_Python_SetConstant(d, "tsip_o_publish",SWIG_From_int(static_cast< int >(tsip_o_publish)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ao_publish",SWIG_From_int(static_cast< int >(tsip_ao_publish)));
|
||||
SWIG_Python_SetConstant(d, "tsip_i_unpublish",SWIG_From_int(static_cast< int >(tsip_i_unpublish)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ai_unpublish",SWIG_From_int(static_cast< int >(tsip_ai_unpublish)));
|
||||
SWIG_Python_SetConstant(d, "tsip_o_unpublish",SWIG_From_int(static_cast< int >(tsip_o_unpublish)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ao_unpublish",SWIG_From_int(static_cast< int >(tsip_ao_unpublish)));
|
||||
SWIG_Python_SetConstant(d, "tsip_i_message",SWIG_From_int(static_cast< int >(tsip_i_message)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ai_message",SWIG_From_int(static_cast< int >(tsip_ai_message)));
|
||||
SWIG_Python_SetConstant(d, "tsip_o_message",SWIG_From_int(static_cast< int >(tsip_o_message)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ao_message",SWIG_From_int(static_cast< int >(tsip_ao_message)));
|
||||
SWIG_Python_SetConstant(d, "tsip_i_options",SWIG_From_int(static_cast< int >(tsip_i_options)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ai_options",SWIG_From_int(static_cast< int >(tsip_ai_options)));
|
||||
SWIG_Python_SetConstant(d, "tsip_o_options",SWIG_From_int(static_cast< int >(tsip_o_options)));
|
||||
SWIG_Python_SetConstant(d, "tsip_ao_options",SWIG_From_int(static_cast< int >(tsip_ao_options)));
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
return m;
|
||||
|
|
|
@ -85,6 +85,7 @@ typedef enum opt_type_e
|
|||
opt_sec, /* --sec 1800 */
|
||||
opt_sid, /* --sid 1234 */
|
||||
opt_sigcomp, /* --sigcomp */
|
||||
opt_silent, /* --silent */
|
||||
opt_smsc, /* --smsc +3315245856 */
|
||||
opt_to, /* --to sip:alice@open-ims.test */
|
||||
}
|
||||
|
|
|
@ -53,58 +53,77 @@ int session_handle_event(const tsip_event_t *sipevent);
|
|||
int session_tostring(const session_t* session);
|
||||
|
||||
/* our SIP callback function */
|
||||
int stack_callback(const tsip_event_t *sipevent)
|
||||
int stack_callback(const tsip_event_t *_event)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if(!sipevent){ /* should never happen ...but who know? */
|
||||
if(!_event){ /* should never happen ...but who know? */
|
||||
TSK_DEBUG_WARN("Null SIP event.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsk_safeobj_lock(ctx);
|
||||
|
||||
switch(sipevent->type){
|
||||
switch(_event->type){
|
||||
case tsip_event_register:
|
||||
{ /* REGISTER */
|
||||
ret = register_handle_event(sipevent);
|
||||
ret = register_handle_event(_event);
|
||||
break;
|
||||
}
|
||||
case tsip_event_invite:
|
||||
{ /* INVITE */
|
||||
ret = invite_handle_event(sipevent);
|
||||
ret = invite_handle_event(_event);
|
||||
break;
|
||||
}
|
||||
case tsip_event_message:
|
||||
{ /* MESSAGE */
|
||||
ret = message_handle_event(sipevent);
|
||||
ret = message_handle_event(_event);
|
||||
break;
|
||||
}
|
||||
case tsip_event_options:
|
||||
{ /* OPTIONS */
|
||||
ret = options_handle_event(sipevent);
|
||||
ret = options_handle_event(_event);
|
||||
break;
|
||||
}
|
||||
case tsip_event_publish:
|
||||
{ /* PUBLISH */
|
||||
ret = publish_handle_event(sipevent);
|
||||
ret = publish_handle_event(_event);
|
||||
break;
|
||||
}
|
||||
case tsip_event_subscribe:
|
||||
{ /* SUBSCRIBE */
|
||||
ret = subscribe_handle_event(sipevent);
|
||||
ret = subscribe_handle_event(_event);
|
||||
break;
|
||||
}
|
||||
|
||||
case tsip_event_dialog:
|
||||
{ /* Common to all dialogs */
|
||||
ret = session_handle_event(sipevent);
|
||||
ret = session_handle_event(_event);
|
||||
break;
|
||||
}
|
||||
|
||||
case tsip_event_stack:
|
||||
{
|
||||
switch(_event->code){
|
||||
case tsip_event_code_stack_started:
|
||||
TSK_DEBUG_INFO("Stack started");
|
||||
break;
|
||||
case tsip_event_code_stack_stopped:
|
||||
TSK_DEBUG_INFO("Stack stopped");
|
||||
break;
|
||||
case tsip_event_code_stack_failed_to_start:
|
||||
TSK_DEBUG_INFO("Stack failed to start");
|
||||
break;
|
||||
case tsip_event_code_stack_failed_to_stop:
|
||||
TSK_DEBUG_INFO("Stack failed to stop");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{ /* Unsupported */
|
||||
TSK_DEBUG_WARN("%d not supported as SIP event.", sipevent->type);
|
||||
TSK_DEBUG_WARN("%d not supported as SIP event.", _event->type);
|
||||
ret = -3;
|
||||
break;
|
||||
}
|
||||
|
@ -438,27 +457,28 @@ int session_tostring(const session_t* session)
|
|||
|
||||
|
||||
/* handle events -common to all sessions */
|
||||
int session_handle_event(const tsip_event_t *sipevent)
|
||||
int session_handle_event(const tsip_event_t *_event)
|
||||
{
|
||||
const session_t* session;
|
||||
|
||||
/* Find associated session */
|
||||
if(!(session = session_get_by_sid(ctx->sessions, tsip_ssession_get_id(sipevent->ss)))){
|
||||
if(!(session = session_get_by_sid(ctx->sessions, tsip_ssession_get_id(_event->ss)))){
|
||||
TSK_DEBUG_WARN("Failed to match session event.");
|
||||
return -1;
|
||||
}
|
||||
switch(sipevent->code)
|
||||
switch(_event->code)
|
||||
{
|
||||
/* === 7xx ==> errors === */
|
||||
case tsip_event_code_transport_error:
|
||||
case tsip_event_code_global_error:
|
||||
case tsip_event_code_message_error:
|
||||
case tsip_event_code_dialog_transport_error:
|
||||
case tsip_event_code_dialog_global_error:
|
||||
case tsip_event_code_dialog_message_error:
|
||||
/* do not guess that the dialog is terminated, wait for "tsip_event_code_dialog_terminated" event */
|
||||
break;
|
||||
|
||||
/* === 8xx ==> success === */
|
||||
case tsip_event_code_request_incoming:
|
||||
case tsip_event_code_request_cancelled:
|
||||
case tsip_event_code_request_sent:
|
||||
case tsip_event_code_dialog_request_incoming:
|
||||
case tsip_event_code_dialog_request_cancelled:
|
||||
case tsip_event_code_dialog_request_sent:
|
||||
break;
|
||||
|
||||
/* === 9xx ==> Informational === */
|
||||
|
@ -468,6 +488,12 @@ int session_handle_event(const tsip_event_t *sipevent)
|
|||
tsk_list_remove_item_by_data(ctx->sessions, session);
|
||||
break;
|
||||
}
|
||||
|
||||
case tsip_event_code_dialog_connected:
|
||||
((session_t*)session)->connected = tsk_true;
|
||||
break;
|
||||
case tsip_event_code_dialog_terminating:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -576,6 +602,13 @@ const session_t* session_handle_cmd(cmd_type_t cmd, const opts_L_t* opts)
|
|||
{ /* Will be handled by the caller */
|
||||
break;
|
||||
}
|
||||
case opt_silent:
|
||||
{ /* valueless option */
|
||||
ret = tsip_ssession_set(session->handle,
|
||||
TSIP_SSESSION_SET_SILENT_HANGUP(tsk_true),
|
||||
TSIP_SSESSION_SET_NULL());
|
||||
break;
|
||||
}
|
||||
case opt_to:
|
||||
{ /* You should use TSIP_SSESSION_SET_OPTION(TSIP_SSESSION_OPTION_TO, value)
|
||||
instead of TSIP_SSESSION_SET_HEADER() to set the destination URI. */
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
%%proxy_ip 192.168.0.13 # IP address or FQDN
|
||||
%%proxy_port 5081
|
||||
%%proxy_trans tcp # udp, tcp, tls or sctp
|
||||
%%expires 100 # expires used by all dialogs
|
||||
%%expires 36 # expires used by all dialogs
|
||||
%%sleep-sec 1.0 # number of seconds to wait before sending next sip message
|
||||
|
||||
%%reg-sid
|
||||
|
@ -41,9 +41,9 @@
|
|||
# sleep
|
||||
#++sleep --sec $$(sleep-sec)
|
||||
|
||||
# subscribe to reg event package
|
||||
#++sub --to sip:$$(user)@$$(domain) --xp $$(expires) --header Event=reg --header Accept=application/reginfo+xml \
|
||||
# --header Allow-Events=refer, presence, presence.winfo, xcap-diff, conference >>(sub-reg-sid)
|
||||
# subscribe to reg event package (silent hangup)
|
||||
++sub --to sip:$$(user)@$$(domain) --xp $$(expires) --silent --header Event=reg --header Accept=application/reginfo+xml \
|
||||
--header Allow-Events=refer, presence, presence.winfo, xcap-diff, conference >>(sub-reg-sid)
|
||||
|
||||
#subscribe to presence event package (alice)
|
||||
#++sub --to sip:alice@$$(domain) --xp $$(expires) --header Event=presence --header Supported=eventlist\
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -273,6 +273,7 @@ replace:
|
|||
"sec"i % { opt->type = opt_sec; } |
|
||||
"sid"i % { opt->type = opt_sid; } |
|
||||
"sigcomp"i % { opt->type = opt_sigcomp; } |
|
||||
"silent"i % { opt->type = opt_silent; } |
|
||||
"smsc"i % { opt->type = opt_smsc; } |
|
||||
"to"i % { opt->type = opt_to; }
|
||||
)** >10 |
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
extern ctx_t* ctx;
|
||||
|
||||
int invite_handle_event(const tsip_event_t *sipevent)
|
||||
int invite_handle_event(const tsip_event_t *_event)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -30,17 +30,17 @@ extern ctx_t* ctx;
|
|||
tsk_bool_t is_valid_telnum(const tsip_uri_t* uri);
|
||||
tsk_buffer_t* sms_submit(const tsip_uri_t* smsc, const tsip_uri_t* dest, const char* ascii_pay);
|
||||
|
||||
int message_handle_event(const tsip_event_t *sipevent)
|
||||
int message_handle_event(const tsip_event_t *_event)
|
||||
{
|
||||
const tsip_message_event_t* msg_event = TSIP_MESSAGE_EVENT(sipevent);
|
||||
const tsip_message_event_t* msg_event = TSIP_MESSAGE_EVENT(_event);
|
||||
const session_t* session = tsk_null;
|
||||
tsip_ssession_id_t sid;
|
||||
int ret = 0;
|
||||
|
||||
/* Find associated session */
|
||||
sid = tsip_ssession_get_id(sipevent->ss);
|
||||
sid = tsip_ssession_get_id(_event->ss);
|
||||
if(!(session = session_get_by_sid(ctx->sessions, sid))){
|
||||
if(tsip_ssession_have_ownership(sipevent->ss)){
|
||||
if(tsip_ssession_have_ownership(_event->ss)){
|
||||
/* it's or own session and we fail to match it ==> should never happen */
|
||||
TSK_DEBUG_ERROR("Failed to match session event.");
|
||||
ret = -2;
|
||||
|
@ -49,7 +49,7 @@ int message_handle_event(const tsip_event_t *sipevent)
|
|||
else{
|
||||
/* it's a "server-side-session" */
|
||||
session_t* _session;
|
||||
if((_session = session_server_create(st_message, sipevent->ss)) && (session = _session)){
|
||||
if((_session = session_server_create(st_message, _event->ss)) && (session = _session)){
|
||||
tsk_list_push_back_data(ctx->sessions, (void**)&_session);
|
||||
}
|
||||
else{
|
||||
|
@ -62,18 +62,10 @@ int message_handle_event(const tsip_event_t *sipevent)
|
|||
|
||||
|
||||
switch(msg_event->type){
|
||||
|
||||
/* Informational */
|
||||
case tsip_o_message: /* Outgoing MESSAGE */
|
||||
{ /* Request successfully sent (you cannot suppose that the remote peer has received the request) ==> Informational */
|
||||
TSK_DEBUG_INFO("Transport layer successfully sent MESSAGE request");
|
||||
break;
|
||||
}
|
||||
|
||||
case tsip_ao_message: /* Answer to outgoing MESSAGE */
|
||||
{
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing MESSAGE. Code=%d", TSIP_RESPONSE_CODE(sipevent->sipmessage));
|
||||
if(TSIP_RESPONSE_IS_2XX(sipevent->sipmessage)){
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing MESSAGE. Code=%d", TSIP_RESPONSE_CODE(_event->sipmessage));
|
||||
if(TSIP_RESPONSE_IS_2XX(_event->sipmessage)){
|
||||
TSK_DEBUG_INFO("Message successfully sent.");
|
||||
}
|
||||
break;
|
||||
|
@ -81,11 +73,11 @@ int message_handle_event(const tsip_event_t *sipevent)
|
|||
|
||||
case tsip_i_message: /* Incoming MESSAGE */
|
||||
{
|
||||
const char* content_type = TSIP_MESSAGE_CONTENT_TYPE(sipevent->sipmessage);
|
||||
const char* content_type = TSIP_MESSAGE_CONTENT_TYPE(_event->sipmessage);
|
||||
|
||||
TSK_DEBUG_INFO("Event: Incoming MESSAGE.");
|
||||
if(TSIP_MESSAGE_HAS_CONTENT(sipevent->sipmessage)){
|
||||
const tsk_buffer_t* content = TSIP_MESSAGE_CONTENT(sipevent->sipmessage);
|
||||
if(TSIP_MESSAGE_HAS_CONTENT(_event->sipmessage)){
|
||||
const tsk_buffer_t* content = TSIP_MESSAGE_CONTENT(_event->sipmessage);
|
||||
TSK_DEBUG_INFO("MESSAGE Content-Type: %s", content_type);
|
||||
TSK_DEBUG_INFO("MESSAGE Content: %s", content->data);
|
||||
}
|
||||
|
@ -105,13 +97,6 @@ int message_handle_event(const tsip_event_t *sipevent)
|
|||
break;
|
||||
}
|
||||
|
||||
/* Server events (For whose dev. Server Side IMS Services) */
|
||||
case tsip_ai_message: /* Answer to Incoming MESSAGE */
|
||||
{
|
||||
TSK_DEBUG_WARN("Event not supported by Client Framework.");
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{ /* Any other event */
|
||||
TSK_DEBUG_WARN("%d not a valid SIP Messaging event.", msg_event->type);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
_BEGIN_DECLS
|
||||
|
||||
int message_handle_event(const tsip_event_t *sipevent);
|
||||
int message_handle_event(const tsip_event_t *_event);
|
||||
tsip_ssession_id_t message_handle_cmd(cmd_type_t cmd, const opts_L_t* opts);
|
||||
|
||||
_END_DECLS
|
||||
|
|
|
@ -25,14 +25,14 @@ extern ctx_t* ctx;
|
|||
|
||||
int options_hack_aor(const tsip_response_t* resp);
|
||||
|
||||
int options_handle_event(const tsip_event_t *sipevent)
|
||||
int options_handle_event(const tsip_event_t *_event)
|
||||
{
|
||||
const tsip_options_event_t* opt_event = TSIP_OPTIONS_EVENT(sipevent);
|
||||
const tsip_options_event_t* opt_event = TSIP_OPTIONS_EVENT(_event);
|
||||
const session_t* session;
|
||||
tsip_ssession_id_t sid;
|
||||
|
||||
/* Find associated session */
|
||||
sid = tsip_ssession_get_id(sipevent->ss);
|
||||
sid = tsip_ssession_get_id(_event->ss);
|
||||
if(!(session = session_get_by_sid(ctx->sessions, sid))){
|
||||
TSK_DEBUG_WARN("Failed to match session event.");
|
||||
return -1;
|
||||
|
@ -40,13 +40,11 @@ int options_handle_event(const tsip_event_t *sipevent)
|
|||
|
||||
switch(opt_event->type){
|
||||
case tsip_i_options: /* incoming OPTIONS */
|
||||
case tsip_ai_options: /* answer to incoming OPTIONS */
|
||||
case tsip_o_options: /* outgoing OPTIONS */
|
||||
break;
|
||||
case tsip_ao_options: /* answer to outgoing OPTIONS */
|
||||
#if HACK_AOR
|
||||
if(TSIP_MESSAGE_IS_RESPONSE(sipevent->sipmessage)){
|
||||
options_hack_aor(sipevent->sipmessage);
|
||||
if(TSIP_MESSAGE_IS_RESPONSE(_event->sipmessage)){
|
||||
options_hack_aor(_event->sipmessage);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
|
|
@ -23,43 +23,44 @@
|
|||
|
||||
extern ctx_t* ctx;
|
||||
|
||||
int publish_handle_event(const tsip_event_t *sipevent)
|
||||
int publish_handle_event(const tsip_event_t *_event)
|
||||
{
|
||||
const tsip_publish_event_t* pub_event = TSIP_PUBLISH_EVENT(sipevent);
|
||||
const tsip_publish_event_t* pub_event = TSIP_PUBLISH_EVENT(_event);
|
||||
const session_t* session;
|
||||
tsip_ssession_id_t sid;
|
||||
|
||||
/* Find associated session */
|
||||
sid = tsip_ssession_get_id(sipevent->ss);
|
||||
sid = tsip_ssession_get_id(_event->ss);
|
||||
if(!(session = session_get_by_sid(ctx->sessions, sid))){
|
||||
TSK_DEBUG_WARN("Failed to match session event.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch(pub_event->type){
|
||||
|
||||
/* Informational */
|
||||
case tsip_o_publish: /* Outgoing PUBLISH */
|
||||
case tsip_o_unpublish: /* Outgoing PUBLISH */
|
||||
{ /* Request successfully sent (you cannot suppose that the remote peer has received the request) ==> Informational */
|
||||
TSK_DEBUG_INFO("Transport layer successfully sent (un)PUBLISH request");
|
||||
break;
|
||||
}
|
||||
|
||||
case tsip_ao_publish: /* Answer to outgoing PUBLISH */
|
||||
{
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing PUBLISH. Code=%d", TSIP_RESPONSE_CODE(sipevent->sipmessage));
|
||||
if(TSIP_RESPONSE_IS_2XX(sipevent->sipmessage)){
|
||||
SESSION(session)->connected = tsk_true;
|
||||
if(_event->sipmessage){
|
||||
if(TSIP_MESSAGE_IS_RESPONSE(_event->sipmessage)){
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing PUBLISH. Code=%d and phrase=%s",
|
||||
_event->sipmessage->line.response.status_code, _event->sipmessage->line.response.reason_phrase);
|
||||
}
|
||||
else{
|
||||
// request
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case tsip_ao_unpublish: /* Answer to outgoing unPUBLISH */
|
||||
{
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing unPUBLISH. Code=%d", TSIP_RESPONSE_CODE(sipevent->sipmessage));
|
||||
if(TSIP_RESPONSE_IS_2XX(sipevent->sipmessage)){
|
||||
SESSION(session)->connected = tsk_false;
|
||||
if(_event->sipmessage){
|
||||
if(TSIP_MESSAGE_IS_RESPONSE(_event->sipmessage)){
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing UNPUBLISH. Code=%d and phrase=%s",
|
||||
_event->sipmessage->line.response.status_code, _event->sipmessage->line.response.reason_phrase);
|
||||
}
|
||||
else{
|
||||
// request
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -67,8 +68,6 @@ int publish_handle_event(const tsip_event_t *sipevent)
|
|||
/* Server events (For whose dev. Server Side IMS Services) */
|
||||
case tsip_i_publish: /* Incoming PUBLISH */
|
||||
case tsip_i_unpublish: /* Incoming unPUBLISH */
|
||||
case tsip_ai_publish: /* Answer to Incoming PUBLISH */
|
||||
case tsip_ai_unpublish: /* Answer to Incoming unPUBLISH */
|
||||
{
|
||||
TSK_DEBUG_WARN("Event not support by Client Framework.");
|
||||
break;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
_BEGIN_DECLS
|
||||
|
||||
int publish_handle_event(const tsip_event_t *sipevent);
|
||||
int publish_handle_event(const tsip_event_t *_event);
|
||||
tsip_ssession_id_t publish_handle_cmd(cmd_type_t cmd, const opts_L_t* opts);
|
||||
|
||||
_END_DECLS
|
||||
|
|
|
@ -23,43 +23,43 @@
|
|||
|
||||
extern ctx_t* ctx;
|
||||
|
||||
int register_handle_event(const tsip_event_t *sipevent)
|
||||
int register_handle_event(const tsip_event_t *_event)
|
||||
{
|
||||
const tsip_register_event_t* reg_event = TSIP_REGISTER_EVENT(sipevent);
|
||||
const tsip_register_event_t* reg_event = TSIP_REGISTER_EVENT(_event);
|
||||
const session_t* session;
|
||||
tsip_ssession_id_t sid;
|
||||
|
||||
/* Find associated session */
|
||||
sid = tsip_ssession_get_id(sipevent->ss);
|
||||
sid = tsip_ssession_get_id(_event->ss);
|
||||
if(!(session = session_get_by_sid(ctx->sessions, sid))){
|
||||
TSK_DEBUG_WARN("Failed to match session event.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch(reg_event->type){
|
||||
|
||||
/* Informational */
|
||||
case tsip_o_register: /* Outgoing REGISTER */
|
||||
case tsip_o_unregister: /* Outgoing REGISTER */
|
||||
{ /* Request successfully sent (you cannot suppose that the remote peer has received the request) ==> Informational */
|
||||
TSK_DEBUG_INFO("Transport layer successfully sent (un)REGISTER request");
|
||||
break;
|
||||
}
|
||||
|
||||
switch(reg_event->type){
|
||||
case tsip_ao_register: /* Answer to outgoing REGISTER */
|
||||
{
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing REGISTER. Code=%d", TSIP_RESPONSE_CODE(sipevent->sipmessage));
|
||||
if(TSIP_RESPONSE_IS_2XX(sipevent->sipmessage)){
|
||||
SESSION(session)->connected = tsk_true;
|
||||
if(_event->sipmessage){
|
||||
if(TSIP_MESSAGE_IS_RESPONSE(_event->sipmessage)){
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing REGISTER. Code=%d and phrase=%s",
|
||||
_event->sipmessage->line.response.status_code, _event->sipmessage->line.response.reason_phrase);
|
||||
}
|
||||
else{
|
||||
// request
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case tsip_ao_unregister: /* Answer to outgoing unREGISTER */
|
||||
{
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing unREGISTER. Code=%d", TSIP_RESPONSE_CODE(sipevent->sipmessage));
|
||||
if(TSIP_RESPONSE_IS_2XX(sipevent->sipmessage)){
|
||||
SESSION(session)->connected = tsk_false;
|
||||
if(_event->sipmessage){
|
||||
if(TSIP_MESSAGE_IS_RESPONSE(_event->sipmessage)){
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing unREGISTER. Code=%d and phrase=%s",
|
||||
_event->sipmessage->line.response.status_code, _event->sipmessage->line.response.reason_phrase);
|
||||
}
|
||||
else{
|
||||
// request
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -67,8 +67,6 @@ int register_handle_event(const tsip_event_t *sipevent)
|
|||
/* Server events (For whose dev. Server Side IMS Services) */
|
||||
case tsip_i_register: /* Incoming REGISTER */
|
||||
case tsip_i_unregister: /* Incoming unREGISTER */
|
||||
case tsip_ai_register: /* Answer to Incoming REGISTER */
|
||||
case tsip_ai_unregister: /* Answer to Incoming unREGISTER */
|
||||
{
|
||||
TSK_DEBUG_WARN("Event not support by Client Framework.");
|
||||
break;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
_BEGIN_DECLS
|
||||
|
||||
int register_handle_event(const tsip_event_t *sipevent);
|
||||
int register_handle_event(const tsip_event_t *_event);
|
||||
tsip_ssession_id_t register_handle_cmd(cmd_type_t cmd, const opts_L_t* opts);
|
||||
|
||||
_END_DECLS
|
||||
|
|
|
@ -23,14 +23,14 @@
|
|||
|
||||
extern ctx_t* ctx;
|
||||
|
||||
int subscribe_handle_event(const tsip_event_t *sipevent)
|
||||
int subscribe_handle_event(const tsip_event_t *_event)
|
||||
{
|
||||
const tsip_subscribe_event_t* sub_event = TSIP_SUBSCRIBE_EVENT(sipevent);
|
||||
const tsip_subscribe_event_t* sub_event = TSIP_SUBSCRIBE_EVENT(_event);
|
||||
const session_t* session;
|
||||
tsip_ssession_id_t sid;
|
||||
|
||||
/* Find associated session */
|
||||
sid = tsip_ssession_get_id(sipevent->ss);
|
||||
sid = tsip_ssession_get_id(_event->ss);
|
||||
if(!(session = session_get_by_sid(ctx->sessions, sid))){
|
||||
TSK_DEBUG_WARN("Failed to match session event.");
|
||||
return -1;
|
||||
|
@ -38,29 +38,30 @@ int subscribe_handle_event(const tsip_event_t *sipevent)
|
|||
|
||||
|
||||
switch(sub_event->type){
|
||||
|
||||
/* Informational */
|
||||
case tsip_o_subscribe: /* Outgoing SUBSCRIBE */
|
||||
case tsip_o_unsubscribe: /* Outgoing SUBSCRIBE */
|
||||
{ /* Request successfully sent (you cannot suppose that the remote peer has received the request) ==> Informational */
|
||||
TSK_DEBUG_INFO("Transport layer successfully sent (un)SUBSCRIBE request");
|
||||
break;
|
||||
}
|
||||
|
||||
case tsip_ao_subscribe: /* Answer to outgoing SUBSCRIBE */
|
||||
{
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing SUBSCRIBE. Code=%d", TSIP_RESPONSE_CODE(sipevent->sipmessage));
|
||||
if(TSIP_RESPONSE_IS_2XX(sipevent->sipmessage)){
|
||||
SESSION(session)->connected = tsk_true;
|
||||
if(_event->sipmessage){
|
||||
if(TSIP_MESSAGE_IS_RESPONSE(_event->sipmessage)){
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing SUBSCRIBE. Code=%d and phrase=%s",
|
||||
_event->sipmessage->line.response.status_code, _event->sipmessage->line.response.reason_phrase);
|
||||
}
|
||||
else{
|
||||
// request
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case tsip_ao_unsubscribe: /* Answer to outgoing unSUBSCRIBE */
|
||||
{
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing unSUBSCRIBE. Code=%d", TSIP_RESPONSE_CODE(sipevent->sipmessage));
|
||||
if(TSIP_RESPONSE_IS_2XX(sipevent->sipmessage)){
|
||||
SESSION(session)->connected = tsk_false;
|
||||
if(_event->sipmessage){
|
||||
if(TSIP_MESSAGE_IS_RESPONSE(_event->sipmessage)){
|
||||
TSK_DEBUG_INFO("Event: Answer to outgoing unSUBSCRIBE. Code=%d and phrase=%s",
|
||||
_event->sipmessage->line.response.status_code, _event->sipmessage->line.response.reason_phrase);
|
||||
}
|
||||
else{
|
||||
// request
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -68,9 +69,9 @@ int subscribe_handle_event(const tsip_event_t *sipevent)
|
|||
case tsip_i_notify: /* Incoming NOTIFY */
|
||||
{
|
||||
TSK_DEBUG_INFO("Event: Incoming NOTIFY.");
|
||||
if(TSIP_MESSAGE_HAS_CONTENT(sipevent->sipmessage)){
|
||||
const tsk_buffer_t* content = TSIP_MESSAGE_CONTENT(sipevent->sipmessage);
|
||||
TSK_DEBUG_INFO("NOTIFY Content-Type: %s", TSIP_MESSAGE_CONTENT_TYPE(sipevent->sipmessage));
|
||||
if(TSIP_MESSAGE_HAS_CONTENT(_event->sipmessage)){
|
||||
const tsk_buffer_t* content = TSIP_MESSAGE_CONTENT(_event->sipmessage);
|
||||
TSK_DEBUG_INFO("NOTIFY Content-Type: %s", TSIP_MESSAGE_CONTENT_TYPE(_event->sipmessage));
|
||||
TSK_DEBUG_INFO("NOTIFY Content: %s", content->data);
|
||||
}
|
||||
break;
|
||||
|
@ -79,8 +80,6 @@ int subscribe_handle_event(const tsip_event_t *sipevent)
|
|||
/* Server events (For whose dev. Server Side IMS Services) */
|
||||
case tsip_i_subscribe: /* Incoming SUBSCRIBE */
|
||||
case tsip_i_unsubscribe: /* Incoming unSUBSCRIBE */
|
||||
case tsip_ai_subscribe: /* Answer to Incoming SUBSCRIBE */
|
||||
case tsip_ai_unsubscribe: /* Answer to Incoming unSUBSCRIBE */
|
||||
{
|
||||
TSK_DEBUG_WARN("Event not support by Client Framework.");
|
||||
break;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
_BEGIN_DECLS
|
||||
|
||||
int subscribe_handle_event(const tsip_event_t *sipevent);
|
||||
int subscribe_handle_event(const tsip_event_t *_event);
|
||||
tsip_ssession_id_t subscribe_handle_cmd(cmd_type_t cmd, const opts_L_t* opts);
|
||||
|
||||
_END_DECLS
|
||||
|
|
|
@ -367,10 +367,13 @@ int thttp_session_signal(thttp_session_t *self, thttp_action_type_t atype)
|
|||
tsk_safeobj_lock(self);
|
||||
again:
|
||||
tsk_list_foreach(item, self->dialogs){
|
||||
item = tsk_object_ref(item);
|
||||
thttp_dialog_fsm_act((thttp_dialog_t*)item->data, atype, tsk_null, tsk_null);
|
||||
/* As the above action could terminate the dialog (which means change the content of self->dialogs)
|
||||
* => list becomes unsafe */
|
||||
goto again;
|
||||
if(!(item = tsk_object_unref(item))){
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
|
||||
switch(atype){
|
||||
|
|
|
@ -65,6 +65,44 @@ tsk_list_item_t* tsk_list_item_create()
|
|||
return tsk_object_new(tsk_list_item_def_t);
|
||||
}
|
||||
|
||||
/**@ingroup tsk_list_group
|
||||
* Locks the list to avoid concurrent access. The list should be unlocked using
|
||||
* @ref tsk_list_unlock.
|
||||
* @param list The list to lock.
|
||||
* @retval zero if succeed and non-zero error code otherwise.
|
||||
* @sa @ref tsk_list_unlock
|
||||
*/
|
||||
int tsk_list_lock(tsk_list_t* list)
|
||||
{
|
||||
if(list){
|
||||
if(!list->mutex){
|
||||
list->mutex = tsk_mutex_create();
|
||||
}
|
||||
return tsk_mutex_lock(list->mutex);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**@ingroup tsk_list_group
|
||||
* UnLocks a previously locked list.
|
||||
* @param list The list to unlock.
|
||||
* @retval zero if succeed and non-zero error code otherwise.
|
||||
* @sa @ref tsk_list_lock
|
||||
*/
|
||||
int tsk_list_unlock(tsk_list_t* list)
|
||||
{
|
||||
if(list && list->mutex){
|
||||
return tsk_mutex_unlock(list->mutex);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**@ingroup tsk_list_group
|
||||
* Remove an item from the @a list.
|
||||
* @param list the list from which to remove the @a item.
|
||||
|
@ -543,6 +581,11 @@ static tsk_object_t* tsk_list_dtor(tsk_object_t *self)
|
|||
tsk_object_unref(item);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* destroy the on-demand mutex */
|
||||
if(list->mutex){
|
||||
tsk_mutex_destroy(&list->mutex);
|
||||
}
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_WARN("Cannot free an uninitialized list");
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#define _TINYSAK_LIST_H_
|
||||
|
||||
#include "tinysak_config.h"
|
||||
#include "tsk_mutex.h"
|
||||
#include "tsk_object.h"
|
||||
|
||||
TSK_BEGIN_DECLS
|
||||
|
@ -61,8 +62,10 @@ tsk_list_item_t;
|
|||
typedef struct tsk_list_s
|
||||
{
|
||||
TSK_DECLARE_OBJECT;
|
||||
|
||||
tsk_list_item_t* head; /**< The head of the linked list. */
|
||||
tsk_list_item_t* tail; /**< The tail of the linked list. */
|
||||
tsk_mutex_handle_t* mutex; /**< on-demand mutex. */
|
||||
}
|
||||
tsk_list_t;
|
||||
|
||||
|
@ -86,6 +89,9 @@ typedef int (*tsk_list_func_predicate)(const tsk_list_item_t* item, const void*
|
|||
TINYSAK_API tsk_list_t* tsk_list_create();
|
||||
TINYSAK_API tsk_list_item_t* tsk_list_item_create();
|
||||
|
||||
TINYSAK_API int tsk_list_lock(tsk_list_t* list);
|
||||
TINYSAK_API int tsk_list_unlock(tsk_list_t* list);
|
||||
|
||||
TINYSAK_API void tsk_list_remove_item(tsk_list_t* list, tsk_list_item_t* item);
|
||||
TINYSAK_API tsk_list_item_t* tsk_list_pop_item_by_data(tsk_list_t* list, const tsk_object_t * tskobj);
|
||||
TINYSAK_API void tsk_list_remove_item_by_data(tsk_list_t* list, const tsk_object_t * tskobj);
|
||||
|
|
|
@ -185,8 +185,13 @@ tsk_object_t* tsk_object_unref(tsk_object_t *self)
|
|||
{
|
||||
if(self){
|
||||
tsk_object_header_t* objhdr = TSK_OBJECT_HEADER(self);
|
||||
if(objhdr->refCount && !--objhdr->refCount){ // If refCount is == 0 then, nothing should happen.
|
||||
tsk_object_delete(self);
|
||||
if(objhdr->refCount){ // If refCount is == 0 then, nothing should happen.
|
||||
if(!--objhdr->refCount){
|
||||
tsk_object_delete(self);
|
||||
return tsk_null;
|
||||
}
|
||||
}
|
||||
else{
|
||||
return tsk_null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,8 +106,8 @@ static int tsk_runnable_deinit(tsk_runnable_t *self)
|
|||
*/
|
||||
int tsk_runnable_start(tsk_runnable_t *self, const tsk_object_def_t *objdef)
|
||||
{
|
||||
int ret = -1;
|
||||
if(self){
|
||||
int ret = -1;
|
||||
if(self->running) return -2;
|
||||
else if(!self->run) return -3;
|
||||
else if(tsk_runnable_init(self, objdef)) return -4;
|
||||
|
@ -123,8 +123,30 @@ int tsk_runnable_start(tsk_runnable_t *self, const tsk_object_def_t *objdef)
|
|||
//self->running = tsk_true;
|
||||
|
||||
self->started = tsk_true;
|
||||
return 0;
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**@ingroup tsk_runnable_group
|
||||
* To indicate whether the enqueued data is important or not.
|
||||
* @param self The runnable object
|
||||
* @param important @a tsk_true or @a tsk_false. If set to @a tsk_true, the thread will not be joined
|
||||
* until all data in the queue have been consumed.
|
||||
*/
|
||||
int tsk_runnable_set_important(tsk_runnable_t *self, tsk_bool_t important)
|
||||
{
|
||||
if(self){
|
||||
self->important = important;
|
||||
return 0;
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**@ingroup tsk_runnable_group
|
||||
|
|
|
@ -52,14 +52,17 @@ typedef void * (*tsk_runnable_func_run)(void* self);
|
|||
/**@ingroup tsk_runnable_group
|
||||
* @def TSK_RUNNABLE_RUN_END
|
||||
*/
|
||||
#define TSK_RUNNABLE_RUN_BEGIN(self) \
|
||||
TSK_RUNNABLE(self)->running = tsk_true; \
|
||||
for(;;) { \
|
||||
#define TSK_RUNNABLE_RUN_BEGIN(self) \
|
||||
TSK_RUNNABLE(self)->running = tsk_true; \
|
||||
for(;;) { \
|
||||
tsk_semaphore_decrement(TSK_RUNNABLE(self)->semaphore); \
|
||||
if(!TSK_RUNNABLE(self)->running) break; \
|
||||
if(!TSK_RUNNABLE(self)->running && \
|
||||
(!TSK_RUNNABLE(self)->important) || (TSK_RUNNABLE(self)->important && TSK_LIST_IS_EMPTY(TSK_RUNNABLE(self)->objects))) \
|
||||
break;
|
||||
|
||||
|
||||
#define TSK_RUNNABLE_RUN_END(self) \
|
||||
} \
|
||||
#define TSK_RUNNABLE_RUN_END(self) \
|
||||
} \
|
||||
TSK_RUNNABLE(self)->running = tsk_false;
|
||||
|
||||
/**@ingroup tsk_runnable_group
|
||||
|
@ -70,10 +73,10 @@ typedef void * (*tsk_runnable_func_run)(void* self);
|
|||
*/
|
||||
#define TSK_RUNNABLE_ENQUEUE(self, ...) \
|
||||
{ \
|
||||
if(TSK_RUNNABLE(self) && TSK_RUNNABLE(self)->initialized){ \
|
||||
tsk_object_t *object = tsk_object_new(TSK_RUNNABLE(self)->objdef, __VA_ARGS__); \
|
||||
tsk_list_push_back_data(TSK_RUNNABLE(self)->objects, &object); \
|
||||
tsk_semaphore_increment(TSK_RUNNABLE(self)->semaphore); \
|
||||
if((self) && TSK_RUNNABLE(self)->initialized){ \
|
||||
tsk_object_t *object = tsk_object_new(TSK_RUNNABLE(self)->objdef, ##__VA_ARGS__); \
|
||||
tsk_list_push_back_data(TSK_RUNNABLE(self)->objects, &object); \
|
||||
tsk_semaphore_increment(TSK_RUNNABLE(self)->semaphore); \
|
||||
} \
|
||||
else{ \
|
||||
TSK_DEBUG_WARN("Invalid/uninitialized runnable object."); \
|
||||
|
@ -82,9 +85,9 @@ typedef void * (*tsk_runnable_func_run)(void* self);
|
|||
|
||||
#define TSK_RUNNABLE_ENQUEUE_OBJECT(self, object) \
|
||||
{ \
|
||||
if(TSK_RUNNABLE(self) && TSK_RUNNABLE(self)->initialized){ \
|
||||
tsk_list_push_back_data(TSK_RUNNABLE(self)->objects, (void**)&object); \
|
||||
tsk_semaphore_increment(TSK_RUNNABLE(self)->semaphore); \
|
||||
if((self) && (self)->initialized){ \
|
||||
tsk_list_push_back_data(TSK_RUNNABLE(self)->objects, (void**)&object); \
|
||||
tsk_semaphore_increment(TSK_RUNNABLE(self)->semaphore); \
|
||||
} \
|
||||
else{ \
|
||||
TSK_DEBUG_WARN("Invalid/uninitialized runnable object."); \
|
||||
|
@ -94,7 +97,8 @@ typedef void * (*tsk_runnable_func_run)(void* self);
|
|||
|
||||
/**@ingroup tsk_runnable_group
|
||||
*/
|
||||
#define TSK_RUNNABLE_POP_FIRST(self) tsk_list_pop_first_item(TSK_RUNNABLE(self)->objects)
|
||||
#define TSK_RUNNABLE_POP_FIRST(self) \
|
||||
tsk_list_pop_first_item(TSK_RUNNABLE(self)->objects)
|
||||
|
||||
|
||||
/**@ingroup tsk_runnable_group
|
||||
|
@ -113,6 +117,11 @@ typedef struct tsk_runnable_s
|
|||
tsk_bool_t running;
|
||||
tsk_bool_t started;
|
||||
tsk_bool_t initialized;
|
||||
/** whether the enqueued data are important or not.
|
||||
* if yes, the thread will not be joined until all data in the queue have been consumed.
|
||||
* default value: tsk_false
|
||||
*/
|
||||
tsk_bool_t important;
|
||||
|
||||
tsk_list_t *objects;
|
||||
}
|
||||
|
@ -120,11 +129,12 @@ tsk_runnable_t;
|
|||
|
||||
/**@ingroup tsk_runnable_group
|
||||
*/
|
||||
#define TSK_DECLARE_RUNNABLE tsk_runnable_t runnable
|
||||
#define TSK_DECLARE_RUNNABLE tsk_runnable_t __runnable__
|
||||
|
||||
TINYSAK_API tsk_runnable_t* tsk_runnable_create();
|
||||
|
||||
TINYSAK_API int tsk_runnable_start(tsk_runnable_t *self, const tsk_object_def_t *objdef);
|
||||
TINYSAK_API int tsk_runnable_set_important(tsk_runnable_t *self, tsk_bool_t important);
|
||||
TINYSAK_API int tsk_runnable_enqueue(tsk_runnable_t *self, ...);
|
||||
TINYSAK_API int tsk_runnable_stop(tsk_runnable_t *self);
|
||||
|
||||
|
|
|
@ -163,7 +163,8 @@ int tsk_timer_manager_stop(tsk_timer_manager_handle_t *self)
|
|||
return -1;
|
||||
}
|
||||
|
||||
tsk_mutex_lock(manager->mutex);
|
||||
// all functions called below are thread-safe ==> do not lock
|
||||
// "mainthread" uses manager->mutex and runs in a separate thread ==> deadlock
|
||||
|
||||
if(TSK_RUNNABLE(manager)->running){
|
||||
if(ret = tsk_runnable_stop(TSK_RUNNABLE(manager))){
|
||||
|
@ -177,12 +178,11 @@ int tsk_timer_manager_stop(tsk_timer_manager_handle_t *self)
|
|||
goto bail;
|
||||
}
|
||||
else{
|
||||
return 0; /* already running. */
|
||||
ret = 0; /* already running. */
|
||||
goto bail;
|
||||
}
|
||||
|
||||
bail:
|
||||
tsk_mutex_unlock(manager->mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -257,6 +257,8 @@ static void *run(void* self)
|
|||
return tsk_null;
|
||||
}
|
||||
|
||||
TSK_DEBUG_INFO("Timer manager run()::enter");
|
||||
|
||||
TSK_RUNNABLE_RUN_BEGIN(manager);
|
||||
|
||||
if(curr = TSK_RUNNABLE_POP_FIRST(manager)){
|
||||
|
@ -269,6 +271,8 @@ static void *run(void* self)
|
|||
|
||||
TSK_RUNNABLE_RUN_END(manager);
|
||||
|
||||
TSK_DEBUG_INFO("Timer manager run()::exit");
|
||||
|
||||
return tsk_null;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,6 @@ TSIP_BEGIN_DECLS
|
|||
typedef enum tsip_invite_event_type_e
|
||||
{
|
||||
tsip_i_invite,
|
||||
tsip_ai_invite,
|
||||
tsip_o_invite,
|
||||
tsip_ao_invite,
|
||||
}
|
||||
tsip_invite_event_type_t;
|
||||
|
|
|
@ -41,8 +41,6 @@ TSIP_BEGIN_DECLS
|
|||
typedef enum tsip_message_event_type_e
|
||||
{
|
||||
tsip_i_message,
|
||||
tsip_ai_message,
|
||||
tsip_o_message,
|
||||
tsip_ao_message,
|
||||
}
|
||||
tsip_message_event_type_t;
|
||||
|
|
|
@ -41,8 +41,6 @@ TSIP_BEGIN_DECLS
|
|||
typedef enum tsip_options_event_type_e
|
||||
{
|
||||
tsip_i_options,
|
||||
tsip_ai_options,
|
||||
tsip_o_options,
|
||||
tsip_ao_options,
|
||||
}
|
||||
tsip_options_event_type_t;
|
||||
|
|
|
@ -41,13 +41,9 @@ TSIP_BEGIN_DECLS
|
|||
typedef enum tsip_publish_event_type_e
|
||||
{
|
||||
tsip_i_publish,
|
||||
tsip_ai_publish,
|
||||
tsip_o_publish,
|
||||
tsip_ao_publish,
|
||||
|
||||
tsip_i_unpublish,
|
||||
tsip_ai_unpublish,
|
||||
tsip_o_unpublish,
|
||||
tsip_ao_unpublish
|
||||
}
|
||||
tsip_publish_event_type_t;
|
||||
|
|
|
@ -41,13 +41,9 @@ TSIP_BEGIN_DECLS
|
|||
typedef enum tsip_register_event_type_e
|
||||
{
|
||||
tsip_i_register,
|
||||
tsip_ai_register,
|
||||
tsip_o_register,
|
||||
tsip_ao_register,
|
||||
|
||||
|
||||
tsip_i_unregister,
|
||||
tsip_ai_unregister,
|
||||
tsip_o_unregister,
|
||||
tsip_ao_unregister,
|
||||
}
|
||||
tsip_register_event_type_t;
|
||||
|
|
|
@ -41,18 +41,12 @@ TSIP_BEGIN_DECLS
|
|||
typedef enum tsip_subscribe_event_type_e
|
||||
{
|
||||
tsip_i_subscribe,
|
||||
tsip_ai_subscribe,
|
||||
tsip_o_subscribe,
|
||||
tsip_ao_subscribe,
|
||||
|
||||
tsip_i_unsubscribe,
|
||||
tsip_ai_unsubscribe,
|
||||
tsip_o_unsubscribe,
|
||||
tsip_ao_unsubscribe,
|
||||
|
||||
tsip_i_notify,
|
||||
tsip_ai_notify,
|
||||
tsip_o_notify,
|
||||
tsip_ao_notify
|
||||
}
|
||||
tsip_subscribe_event_type_t;
|
||||
|
|
|
@ -60,8 +60,8 @@ TSIP_BEGIN_DECLS
|
|||
#define TSIP_DIALOG_TIMER_SCHEDULE(name, TX) \
|
||||
self->timer##TX.id = tsk_timer_manager_schedule(TSIP_DIALOG_GET_STACK(self)->timer_mgr, self->timer##TX.timeout, TSK_TIMER_CALLBACK_F(tsip_dialog_##name##_timer_callback), self)
|
||||
|
||||
#define TSIP_DIALOG_SIGNAL(self, type, code, phrase) \
|
||||
tsip_event_signal(type, TSIP_DIALOG(self)->ss, code, phrase)
|
||||
#define TSIP_DIALOG_SIGNAL(self, code, phrase) \
|
||||
tsip_event_signal(tsip_event_dialog, TSIP_DIALOG(self)->ss, code, phrase)
|
||||
|
||||
#define TSIP_DIALOG_SHUTDOWN_TIMEOUT 2000 /* miliseconds. */
|
||||
|
||||
|
@ -142,7 +142,7 @@ typedef struct tsip_dialog_s
|
|||
}
|
||||
tsip_dialog_t;
|
||||
|
||||
#define TSIP_DECLARE_DIALOG tsip_dialog_t dialog
|
||||
#define TSIP_DECLARE_DIALOG tsip_dialog_t __dialog__
|
||||
|
||||
typedef tsk_list_t tsip_dialogs_L_t;
|
||||
/*
|
||||
|
|
|
@ -47,29 +47,34 @@ typedef enum tsip_event_type_e
|
|||
tsip_event_register,
|
||||
tsip_event_subscribe,
|
||||
|
||||
tsip_event_dialog
|
||||
tsip_event_dialog,
|
||||
tsip_event_stack,
|
||||
}
|
||||
tsip_event_type_t;
|
||||
|
||||
/** SIP codes associated to an internal event */
|
||||
typedef enum tsip_event_code_e
|
||||
{
|
||||
/* 100-699 are reserved codes */
|
||||
/* SIP codes associated to an internal event */
|
||||
// 100-699 are reserved codes
|
||||
|
||||
/* 7xx ==> errors */
|
||||
tsip_event_code_transport_error = 702,
|
||||
tsip_event_code_global_error = 703,
|
||||
tsip_event_code_message_error = 704,
|
||||
// 7xx ==> errors
|
||||
#define tsip_event_code_dialog_transport_error 702
|
||||
#define tsip_event_code_dialog_global_error 703
|
||||
#define tsip_event_code_dialog_message_error 704
|
||||
|
||||
/* 8xx ==> success */
|
||||
tsip_event_code_request_incoming = 800,
|
||||
tsip_event_code_request_cancelled = 801,
|
||||
tsip_event_code_request_sent = 802,
|
||||
// 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
|
||||
|
||||
// 9xx ==> Informational
|
||||
#define tsip_event_code_dialog_connecting 900
|
||||
#define tsip_event_code_dialog_connected 901
|
||||
#define tsip_event_code_dialog_terminating 902
|
||||
#define tsip_event_code_dialog_terminated 903
|
||||
#define tsip_event_code_stack_started 950
|
||||
#define tsip_event_code_stack_stopped 951
|
||||
#define tsip_event_code_stack_failed_to_start 952
|
||||
#define tsip_event_code_stack_failed_to_stop 953
|
||||
|
||||
/* 9xx ==> Informational */
|
||||
tsip_event_code_dialog_terminated = 900,
|
||||
}
|
||||
tsip_event_code_t;
|
||||
|
||||
typedef struct tsip_event_s
|
||||
{
|
||||
|
@ -82,9 +87,12 @@ typedef struct tsip_event_s
|
|||
|
||||
tsip_event_type_t type;
|
||||
struct tsip_message_s *sipmessage;
|
||||
|
||||
//! copy of stack user data (needed by sessionless events)
|
||||
const void* userdata;
|
||||
}
|
||||
tsip_event_t;
|
||||
#define TSIP_DECLARE_EVENT tsip_event_t sipevent
|
||||
#define TSIP_DECLARE_EVENT tsip_event_t __sipevent__
|
||||
|
||||
TINYSIP_GEXTERN const tsk_object_def_t *tsip_event_def_t;
|
||||
|
||||
|
|
|
@ -66,7 +66,8 @@ typedef enum tsip_ssession_param_type_e
|
|||
sstype_to,
|
||||
sstype_from,
|
||||
sstype_nocontact,
|
||||
sstype_expires
|
||||
sstype_expires,
|
||||
sstype_silent_hangup
|
||||
}
|
||||
tsip_ssession_param_type_t;
|
||||
|
||||
|
@ -79,6 +80,7 @@ tsip_ssession_param_type_t;
|
|||
#define TSIP_SSESSION_SET_FROM(FROM_URI_STR) sstype_from, (const char*)FROM_URI_STR
|
||||
#define TSIP_SSESSION_SET_NO_CONTACT(ENABLED_BOOL) sstype_nocontact, (tsk_bool_t)ENABLED_BOOL
|
||||
#define TSIP_SSESSION_SET_EXPIRES(VALUE_UINT) sstype_expires, (unsigned)VALUE_UINT
|
||||
#define TSIP_SSESSION_SET_SILENT_HANGUP(ENABLED_BOOL) sstype_silent_hangup, (tsk_bool_t)ENABLED_BOOL
|
||||
#define TSIP_SSESSION_SET_NULL() sstype_null
|
||||
|
||||
typedef struct tsip_ssession_s
|
||||
|
@ -97,6 +99,7 @@ typedef struct tsip_ssession_s
|
|||
struct tsip_uri_s* from;
|
||||
struct tsip_uri_s* to;
|
||||
int64_t expires;
|
||||
tsk_bool_t silent_hangup;
|
||||
}
|
||||
tsip_ssession_t;
|
||||
|
||||
|
|
|
@ -180,6 +180,15 @@ tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* m
|
|||
case tsip_PUBLISH:
|
||||
{
|
||||
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_EXPIRES_VA_ARGS(TSK_TIME_MS_2_S(self->expires)));
|
||||
/* add caps in Accept-Contact headers */
|
||||
tsk_list_foreach(item, self->ss->caps){
|
||||
char* value = tsk_null;
|
||||
tsk_sprintf(&value, "*;%s", TSK_PARAM(item->data)->value);
|
||||
if(value){
|
||||
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_DUMMY_VA_ARGS("Accept-Contact", value));
|
||||
TSK_FREE(value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -294,8 +303,7 @@ tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* m
|
|||
TSK_OBJECT_SAFE_FREE(uri);
|
||||
}
|
||||
// Service routes
|
||||
tsk_list_foreach(item, TSIP_DIALOG_GET_STACK(self)->service_routes)
|
||||
{
|
||||
tsk_list_foreach(item, TSIP_DIALOG_GET_STACK(self)->service_routes){
|
||||
TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_ROUTE_VA_ARGS(item->data));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -435,8 +435,7 @@ int tsip_dialog_invite_OnTerminated(tsip_dialog_invite_t *self)
|
|||
TSK_DEBUG_INFO("=== INVITE Dialog terminated ===");
|
||||
|
||||
/* Alert the user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_dialog,
|
||||
tsip_event_code_dialog_terminated, "Dialog terminated");
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminated, "Dialog terminated");
|
||||
|
||||
/* Remove from the dialog layer. */
|
||||
return tsip_dialog_remove(TSIP_DIALOG(self));
|
||||
|
|
|
@ -122,6 +122,7 @@ tsip_dialog_t* tsip_dialog_layer_find(const tsip_dialog_layer_t *self, const cha
|
|||
int tsip_dialog_layer_shutdownAll(tsip_dialog_layer_t *self)
|
||||
{
|
||||
if(self){
|
||||
tsk_bool_t wait = tsk_false;
|
||||
tsk_list_item_t *item;
|
||||
tsip_dialog_t *dialog;
|
||||
tsip_dialog_type_t regtype = tsip_dialog_REGISTER;
|
||||
|
@ -146,37 +147,79 @@ int tsip_dialog_layer_shutdownAll(tsip_dialog_layer_t *self)
|
|||
}
|
||||
|
||||
phase1:
|
||||
/* Phase 1 - shutdown all except register */
|
||||
/* Phase 1 - shutdown all except register and silent_hangup */
|
||||
TSK_DEBUG_INFO("== Shutting down - Phase-1 started ==");
|
||||
phase1_loop:
|
||||
tsk_list_foreach(item, self->dialogs){
|
||||
dialog = item->data;
|
||||
if(dialog->type != tsip_dialog_REGISTER){
|
||||
tsip_dialog_shutdown(dialog, tsk_null);
|
||||
if(dialog->type != tsip_dialog_REGISTER && !dialog->ss->silent_hangup){
|
||||
item = tsk_object_ref(item);
|
||||
if(!tsip_dialog_shutdown(dialog, tsk_null)){
|
||||
wait = tsk_true;
|
||||
}
|
||||
|
||||
// if "tsip_dialog_shutdown()" remove the dialog, then
|
||||
// "self->dialogs" will be unsafe
|
||||
if(!(item = tsk_object_unref(item))){
|
||||
goto phase1_loop;
|
||||
}
|
||||
}
|
||||
}
|
||||
tsk_safeobj_unlock(self);
|
||||
|
||||
/* wait until phase-1 is completed */
|
||||
tsk_condwait_timedwait(self->shutdown.condwait, TSIP_DIALOG_SHUTDOWN_TIMEOUT);
|
||||
if(wait){
|
||||
tsk_condwait_timedwait(self->shutdown.condwait, TSIP_DIALOG_SHUTDOWN_TIMEOUT);
|
||||
}
|
||||
|
||||
/* lock and goto phase2 */
|
||||
tsk_safeobj_lock(self);
|
||||
wait = tsk_false;
|
||||
goto phase2;
|
||||
|
||||
phase2:
|
||||
/* Phase 2 - unregister */
|
||||
TSK_DEBUG_INFO("== Shutting down - Phase-2 started ==");
|
||||
self->shutdown.phase2 = tsk_true;
|
||||
phase2_loop:
|
||||
tsk_list_foreach(item, self->dialogs){
|
||||
dialog = item->data;
|
||||
if(dialog->type == tsip_dialog_REGISTER){
|
||||
tsip_dialog_shutdown(dialog, tsk_null);
|
||||
item = tsk_object_ref(item);
|
||||
if(!tsip_dialog_shutdown(dialog, tsk_null)){
|
||||
wait = tsk_true;
|
||||
}
|
||||
// if "tsip_dialog_shutdown()" remove the dialog, then
|
||||
// "self->dialogs" will be unsafe
|
||||
if(!(item = tsk_object_unref(item))){
|
||||
goto phase2_loop;
|
||||
}
|
||||
}
|
||||
}
|
||||
tsk_safeobj_unlock(self);
|
||||
|
||||
/* wait until phase-2 is completed */
|
||||
tsk_condwait_timedwait(self->shutdown.condwait, TSIP_DIALOG_SHUTDOWN_TIMEOUT);
|
||||
if(wait){
|
||||
tsk_condwait_timedwait(self->shutdown.condwait, TSIP_DIALOG_SHUTDOWN_TIMEOUT);
|
||||
}
|
||||
|
||||
|
||||
/* Phase 3 - silenthangup (dialogs will be terminated immediately) */
|
||||
TSK_DEBUG_INFO("== Shutting down - Phase-3 ==");
|
||||
phase3_loop:
|
||||
tsk_list_foreach(item, self->dialogs){
|
||||
dialog = item->data;
|
||||
if(dialog->ss->silent_hangup){
|
||||
item = tsk_object_ref(item);
|
||||
tsip_dialog_shutdown(dialog, tsk_null);
|
||||
|
||||
// if "tsip_dialog_shutdown()" remove the dialog, then
|
||||
// "self->dialogs" will be unsafe
|
||||
if(!(item = tsk_object_unref(item))){
|
||||
goto phase3_loop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
return 0;
|
||||
|
|
|
@ -245,7 +245,7 @@ int tsip_dialog_message_Started_2_Receiving_X_recvMESSAGE(va_list *app)
|
|||
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_MESSAGE_SIGNAL(self, tsip_i_message,
|
||||
tsip_event_code_request_incoming, "Incoming Request.", request);
|
||||
tsip_event_code_dialog_request_incoming, "Incoming Request.", request);
|
||||
|
||||
/* Update last incoming MESSAGE */
|
||||
TSK_OBJECT_SAFE_FREE(self->last_iMessage);
|
||||
|
@ -452,8 +452,7 @@ int tsip_dialog_message_OnTerminated(tsip_dialog_message_t *self)
|
|||
TSK_DEBUG_INFO("=== MESSAGE Dialog terminated ===");
|
||||
|
||||
/* Alert the user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_dialog,
|
||||
tsip_event_code_dialog_terminated, "Dialog terminated");
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminated, "Dialog terminated");
|
||||
|
||||
/* Remove from the dialog layer. */
|
||||
return tsip_dialog_remove(TSIP_DIALOG(self));
|
||||
|
|
|
@ -232,6 +232,9 @@ int tsip_dialog_options_Started_2_Sending_X_sendOPTIONS(va_list *app)
|
|||
TSIP_DIALOG(self)->running = tsk_true;
|
||||
tsip_dialog_set_curr_action(TSIP_DIALOG(self), action);
|
||||
|
||||
/* alert the user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_connecting, "Dialog connecting");
|
||||
|
||||
return send_OPTIONS(self);
|
||||
}
|
||||
|
||||
|
@ -244,7 +247,7 @@ int tsip_dialog_options_Started_2_Receiving_X_recvOPTIONS(va_list *app)
|
|||
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_OPTIONS_SIGNAL(self, tsip_i_options,
|
||||
tsip_event_code_request_incoming, "Incoming Request.", request);
|
||||
tsip_event_code_dialog_request_incoming, "Incoming Request.", request);
|
||||
|
||||
return send_response(self, 200, "OK", request); // Wait for accept
|
||||
}
|
||||
|
|
|
@ -63,19 +63,32 @@ int tsip_dialog_publish_Trying_2_Terminated_X_300_to_699(va_list *app);
|
|||
int tsip_dialog_publish_Trying_2_Terminated_X_cancel(va_list *app);
|
||||
int tsip_dialog_publish_Connected_2_Trying_X_publish(va_list *app);
|
||||
int tsip_dialog_publish_Any_2_Trying_X_hangup(va_list *app);
|
||||
int tsip_dialog_publish_Any_2_Trying_X_shutdown(va_list *app);
|
||||
int tsip_dialog_publish_Any_2_Terminated_X_transportError(va_list *app);
|
||||
int tsip_dialog_publish_Any_2_Terminated_X_Error(va_list *app);
|
||||
|
||||
|
||||
/* ======================== conds ======================== */
|
||||
int _fsm_cond_unpublishing(tsip_dialog_publish_t* dialog, tsip_message_t* message)
|
||||
static tsk_bool_t _fsm_cond_unpublishing(tsip_dialog_publish_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return dialog->unpublishing ? 1 : 0;
|
||||
return dialog->unpublishing;
|
||||
}
|
||||
int _fsm_cond_publishing(tsip_dialog_publish_t* dialog, tsip_message_t* message)
|
||||
static tsk_bool_t _fsm_cond_publishing(tsip_dialog_publish_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return !_fsm_cond_unpublishing(dialog, message);
|
||||
}
|
||||
|
||||
static tsk_bool_t _fsm_cond_silent_hangup(tsip_dialog_publish_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return TSIP_DIALOG(dialog)->ss->silent_hangup;
|
||||
}
|
||||
static tsk_bool_t _fsm_cond_not_silent_hangup(tsip_dialog_publish_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return !TSIP_DIALOG(dialog)->ss->silent_hangup;
|
||||
}
|
||||
#define _fsm_cond_silent_shutdown _fsm_cond_silent_hangup
|
||||
#define _fsm_cond_not_silent_shutdown _fsm_cond_not_silent_hangup
|
||||
|
||||
|
||||
/* ======================== actions ======================== */
|
||||
typedef enum _fsm_action_e
|
||||
|
@ -89,7 +102,8 @@ typedef enum _fsm_action_e
|
|||
_fsm_action_2xx,
|
||||
_fsm_action_401_407_421_494,
|
||||
_fsm_action_423,
|
||||
_fsm_action_300_to_699,
|
||||
_fsm_action_300_to_699,
|
||||
_fsm_action_shutdown_timedout, /* Any -> Terminated */
|
||||
_fsm_action_transporterror,
|
||||
_fsm_action_error,
|
||||
}
|
||||
|
@ -256,10 +270,18 @@ int tsip_dialog_publish_init(tsip_dialog_publish_t *self)
|
|||
*/
|
||||
// Any -> (transport error) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_transporterror, _fsm_state_Terminated, tsip_dialog_publish_Any_2_Terminated_X_transportError, "tsip_dialog_publish_Any_2_Terminated_X_transportError"),
|
||||
// Any -> (transport error) -> Terminated
|
||||
// Any -> (error) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_error, _fsm_state_Terminated, tsip_dialog_publish_Any_2_Terminated_X_Error, "tsip_dialog_publish_Any_2_Terminated_X_Error"),
|
||||
// Any -> (hangup) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_hangup, _fsm_state_Trying, tsip_dialog_publish_Any_2_Trying_X_hangup, "tsip_dialog_publish_Any_2_Trying_X_hangup"),
|
||||
TSK_FSM_ADD(tsk_fsm_state_any, _fsm_action_hangup, _fsm_cond_not_silent_hangup, _fsm_state_Trying, tsip_dialog_publish_Any_2_Trying_X_hangup, "tsip_dialog_publish_Any_2_Trying_X_hangup"),
|
||||
// Any -> (silenthangup) -> Terminated
|
||||
TSK_FSM_ADD(tsk_fsm_state_any, _fsm_action_hangup, _fsm_cond_silent_hangup, _fsm_state_Terminated, tsk_null, "tsip_dialog_publish_Any_2_Trying_X_silenthangup"),
|
||||
// Any -> (shutdown) -> Trying
|
||||
TSK_FSM_ADD(tsk_fsm_state_any, _fsm_action_shutdown, _fsm_cond_not_silent_shutdown, _fsm_state_Trying, tsip_dialog_publish_Any_2_Trying_X_shutdown, "tsip_dialog_publish_Any_2_Trying_X_shutdown"),
|
||||
// Any -> (silentshutdown) -> Terminated
|
||||
TSK_FSM_ADD(tsk_fsm_state_any, _fsm_action_shutdown, _fsm_cond_silent_shutdown, _fsm_state_Terminated, tsk_null, "tsip_dialog_publishe_Any_2_Trying_X_silentshutdown"),
|
||||
// Any -> (shutdown timedout) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_shutdown_timedout, _fsm_state_Terminated, tsk_null, "tsip_dialog_publish_shutdown_timedout"),
|
||||
|
||||
TSK_FSM_ADD_NULL());
|
||||
|
||||
|
@ -294,6 +316,9 @@ int tsip_dialog_publish_Started_2_Trying_X_publish(va_list *app)
|
|||
TSIP_DIALOG(self)->running = tsk_true;
|
||||
tsip_dialog_set_curr_action(TSIP_DIALOG(self), action);
|
||||
|
||||
/* alert the user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_connecting, "Dialog connecting");
|
||||
|
||||
return send_PUBLISH(self);
|
||||
}
|
||||
|
||||
|
@ -329,6 +354,8 @@ int tsip_dialog_publish_Trying_2_Connected_X_2xx(va_list *app)
|
|||
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
|
||||
int ret;
|
||||
|
||||
tsk_bool_t first_time_to_connect = (TSIP_DIALOG(self)->state == tsip_initial);
|
||||
|
||||
/* RFC 3903 - 4.1. Identification of Published Event State
|
||||
For each successful PUBLISH request, the ESC will generate and assign
|
||||
an entity-tag and return it in the SIP-ETag header field of the 2xx
|
||||
|
@ -339,11 +366,15 @@ int tsip_dialog_publish_Trying_2_Connected_X_2xx(va_list *app)
|
|||
tsk_strupdate(&self->etag, SIP_ETag->value);
|
||||
}
|
||||
|
||||
/* Alert the user. */
|
||||
/* Alert the user (session)*/
|
||||
TSIP_DIALOG_PUBLISH_SIGNAL(self, self->unpublishing ? tsip_ao_unpublish : tsip_ao_publish,
|
||||
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
|
||||
/* Alert the user (dialog)*/
|
||||
if(first_time_to_connect){ /* PUBLISH not dialog oriented ...but */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_connected, "Dialog connected");
|
||||
}
|
||||
|
||||
/* Update the dialog state. */
|
||||
/* Update the dialog state */
|
||||
if((ret = tsip_dialog_update(TSIP_DIALOG(self), response))){
|
||||
return ret;
|
||||
}
|
||||
|
@ -401,8 +432,7 @@ int tsip_dialog_publish_Trying_2_Trying_X_423(va_list *app)
|
|||
send_PUBLISH(self);
|
||||
}
|
||||
else{
|
||||
TSIP_DIALOG_PUBLISH_SIGNAL(self, self->unpublishing ? tsip_ao_unpublish : tsip_ao_publish,
|
||||
tsip_event_code_message_error, "Invalid SIP response.", response);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_message_error, "Received invalid SIP response");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -436,8 +466,7 @@ int tsip_dialog_publish_Trying_2_Terminated_X_cancel(va_list *app)
|
|||
ret = tsip_transac_layer_cancel_by_dialog(TSIP_DIALOG_GET_STACK(self)->layer_transac, TSIP_DIALOG(self));
|
||||
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_PUBLISH_SIGNAL(self, self->unpublishing ? tsip_ao_unpublish : tsip_ao_publish,
|
||||
tsip_event_code_request_cancelled, "Subscription cancelled", tsk_null);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_request_cancelled, "Subscription cancelled");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -470,17 +499,28 @@ int tsip_dialog_publish_Any_2_Trying_X_hangup(va_list *app)
|
|||
va_arg(*app, const tsip_message_t *);
|
||||
action = va_arg(*app, const tsip_action_t *);
|
||||
|
||||
///* Schedule timeout (shutdown). */
|
||||
//if(shuttingdown){
|
||||
// TSIP_DIALOG_PUBLISH_TIMER_SCHEDULE(shutdown);
|
||||
//}
|
||||
|
||||
//self->unpublishing = tsk_true;
|
||||
//return send_PUBLISH(self, rt_remove);
|
||||
|
||||
/* Set current action */
|
||||
tsip_dialog_set_curr_action(TSIP_DIALOG(self), action);
|
||||
|
||||
/* Alert the user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminating, "Terminating dialog");
|
||||
|
||||
self->unpublishing = tsk_true;
|
||||
return send_PUBLISH(self);
|
||||
}
|
||||
|
||||
/* Any -> (shutdown) -> Trying
|
||||
*/
|
||||
int tsip_dialog_publish_Any_2_Trying_X_shutdown(va_list *app)
|
||||
{
|
||||
tsip_dialog_publish_t *self = va_arg(*app, tsip_dialog_publish_t *);
|
||||
|
||||
/* schedule shutdow timeout */
|
||||
TSIP_DIALOG_PUBLISH_TIMER_SCHEDULE(shutdown);
|
||||
|
||||
/* Alert the user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminating, "Terminating dialog");
|
||||
|
||||
self->unpublishing = tsk_true;
|
||||
return send_PUBLISH(self);
|
||||
}
|
||||
|
@ -493,8 +533,7 @@ int tsip_dialog_publish_Any_2_Terminated_X_transportError(va_list *app)
|
|||
/*const tsip_message_t *message = va_arg(*app, const tsip_message_t *);*/
|
||||
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_PUBLISH_SIGNAL(self, self->unpublishing ? tsip_ao_unpublish : tsip_ao_publish,
|
||||
tsip_event_code_transport_error, "Transport error.", tsk_null);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_transport_error, "Transport error.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -512,8 +551,7 @@ int tsip_dialog_publish_Any_2_Terminated_X_Error(va_list *app)
|
|||
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
|
||||
}
|
||||
else{
|
||||
TSIP_DIALOG_PUBLISH_SIGNAL(self, self->unpublishing ? tsip_ao_unpublish : tsip_ao_publish,
|
||||
tsip_event_code_global_error, "Global error.", tsk_null);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_global_error, "Global error.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -592,8 +630,7 @@ int tsip_dialog_publish_OnTerminated(tsip_dialog_publish_t *self)
|
|||
TSK_DEBUG_INFO("=== PUBLISH Dialog terminated ===");
|
||||
|
||||
/* Alert the user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_dialog,
|
||||
tsip_event_code_dialog_terminated, "Dialog terminated");
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminated, "Dialog terminated");
|
||||
|
||||
/* Remove from the dialog layer. */
|
||||
return tsip_dialog_remove(TSIP_DIALOG(self));
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "tsk_debug.h"
|
||||
#include "tsk_time.h"
|
||||
|
||||
#define DEBUG_STATE_MACHINE 0
|
||||
#define DEBUG_STATE_MACHINE 1
|
||||
#define TSIP_DIALOG_REGISTER_TIMER_SCHEDULE(TX) TSIP_DIALOG_TIMER_SCHEDULE(register, TX)
|
||||
#define TSIP_DIALOG_REGISTER_SIGNAL(self, type, code, phrase, message) \
|
||||
tsip_register_event_signal(type, TSIP_DIALOG(self)->ss, code, phrase, message)
|
||||
|
@ -74,15 +74,26 @@ int tsip_dialog_register_Any_2_Terminated_X_Error(va_list *app);
|
|||
|
||||
|
||||
/* ======================== conds ======================== */
|
||||
tsk_bool_t _fsm_cond_unregistering(tsip_dialog_register_t* dialog, tsip_message_t* message)
|
||||
static tsk_bool_t _fsm_cond_unregistering(tsip_dialog_register_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return dialog->unregistering;
|
||||
}
|
||||
int _fsm_cond_registering(tsip_dialog_register_t* dialog, tsip_message_t* message)
|
||||
static tsk_bool_t _fsm_cond_registering(tsip_dialog_register_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return !_fsm_cond_unregistering(dialog, message);
|
||||
}
|
||||
|
||||
static tsk_bool_t _fsm_cond_silent_hangup(tsip_dialog_register_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return TSIP_DIALOG(dialog)->ss->silent_hangup;
|
||||
}
|
||||
static tsk_bool_t _fsm_cond_not_silent_hangup(tsip_dialog_register_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return !TSIP_DIALOG(dialog)->ss->silent_hangup;
|
||||
}
|
||||
#define _fsm_cond_silent_shutdown _fsm_cond_silent_hangup
|
||||
#define _fsm_cond_not_silent_shutdown _fsm_cond_not_silent_hangup
|
||||
|
||||
/* ======================== actions ======================== */
|
||||
typedef enum _fsm_action_e
|
||||
{
|
||||
|
@ -262,11 +273,15 @@ int tsip_dialog_register_init(tsip_dialog_register_t *self)
|
|||
* === Any ===
|
||||
*/
|
||||
// Any -> (hangup) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_hangup, _fsm_state_Trying, tsip_dialog_register_Any_2_Trying_X_hangup, "tsip_dialog_register_Any_2_Trying_X_hangup"),
|
||||
TSK_FSM_ADD(tsk_fsm_state_any, _fsm_action_hangup, _fsm_cond_not_silent_hangup, _fsm_state_Trying, tsip_dialog_register_Any_2_Trying_X_hangup, "tsip_dialog_register_Any_2_Trying_X_hangup"),
|
||||
// Any -> (silenthangup) -> Terminated
|
||||
TSK_FSM_ADD(tsk_fsm_state_any, _fsm_action_hangup, _fsm_cond_silent_hangup, _fsm_state_Terminated, tsk_null, "tsip_dialog_register_Any_2_Trying_X_silenthangup"),
|
||||
// Any -> (shutdown) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_shutdown, _fsm_state_Trying, tsip_dialog_register_Any_2_Trying_X_shutdown, "tsip_dialog_register_Any_2_Trying_X_shutdown"),
|
||||
TSK_FSM_ADD(tsk_fsm_state_any, _fsm_action_shutdown, _fsm_cond_not_silent_shutdown, _fsm_state_Trying, tsip_dialog_register_Any_2_Trying_X_shutdown, "tsip_dialog_register_Any_2_Trying_X_shutdown"),
|
||||
// Any -> (silentshutdown) -> Terminated
|
||||
TSK_FSM_ADD(tsk_fsm_state_any, _fsm_action_shutdown, _fsm_cond_silent_shutdown, _fsm_state_Terminated, tsk_null, "tsip_dialog_register_Any_2_Trying_X_silentshutdown"),
|
||||
// Any -> (shutdown timedout) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_shutdown_timedout, _fsm_state_Terminated, tsk_null, "tsip_dialog_register_** Shutdown timedout"),
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_shutdown_timedout, _fsm_state_Terminated, tsk_null, "tsip_dialog_register_shutdown_timedout"),
|
||||
// Any -> (transport error) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_transporterror, _fsm_state_Terminated, tsip_dialog_register_Any_2_Terminated_X_transportError, "tsip_dialog_register_Any_2_Terminated_X_transportError"),
|
||||
// Any -> (error) -> Terminated
|
||||
|
@ -304,6 +319,9 @@ int tsip_dialog_register_Started_2_Trying_X_register(va_list *app)
|
|||
TSIP_DIALOG(self)->running = tsk_true;
|
||||
tsip_dialog_set_curr_action(TSIP_DIALOG(self), action);
|
||||
|
||||
/* alert the user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_connecting, "Dialog connecting");
|
||||
|
||||
return send_REGISTER(self, tsk_true);
|
||||
}
|
||||
|
||||
|
@ -326,6 +344,8 @@ int tsip_dialog_register_Trying_2_Connected_X_2xx(va_list *app)
|
|||
tsip_dialog_register_t *self = va_arg(*app, tsip_dialog_register_t *);
|
||||
const tsip_response_t *response = va_arg(*app, const tsip_response_t *);
|
||||
|
||||
tsk_bool_t first_time_to_connect = (TSIP_DIALOG(self)->state == tsip_initial);
|
||||
|
||||
/* - Set P-associated-uriS
|
||||
* - Update service-routes
|
||||
* - Update Pats
|
||||
|
@ -375,7 +395,7 @@ int tsip_dialog_register_Trying_2_Connected_X_2xx(va_list *app)
|
|||
}
|
||||
|
||||
/* 3GPP TS 24.229 - 5.1.1.2 Initial registration */
|
||||
if((TSIP_DIALOG(self)->state ==tsip_initial)){
|
||||
if(first_time_to_connect){
|
||||
tsk_bool_t barred = tsk_true;
|
||||
const tsk_list_item_t *item;
|
||||
const tsip_uri_t *uri;
|
||||
|
@ -409,7 +429,7 @@ int tsip_dialog_register_Trying_2_Connected_X_2xx(va_list *app)
|
|||
}
|
||||
}
|
||||
|
||||
/* Update the dialog state. */
|
||||
/* Update the dialog state */
|
||||
if((ret = tsip_dialog_update(TSIP_DIALOG(self), response))){
|
||||
return ret;
|
||||
}
|
||||
|
@ -421,9 +441,13 @@ int tsip_dialog_register_Trying_2_Connected_X_2xx(va_list *app)
|
|||
self->timerrefresh.timeout = tsip_dialog_get_newdelay(TSIP_DIALOG(self), response);
|
||||
TSIP_DIALOG_REGISTER_TIMER_SCHEDULE(refresh);
|
||||
|
||||
/* Alert the user. */
|
||||
/* Alert the user (session) */
|
||||
TSIP_DIALOG_REGISTER_SIGNAL(self, tsip_ao_register,
|
||||
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
|
||||
/* Alert the user (dialog) */
|
||||
if(first_time_to_connect){
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_connected, "Dialog connected");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -435,7 +459,7 @@ int tsip_dialog_register_Trying_2_Terminated_X_2xx(va_list *app)
|
|||
tsip_dialog_register_t *self = va_arg(*app, tsip_dialog_register_t *);
|
||||
const tsip_message_t *message = va_arg(*app, const tsip_message_t *);
|
||||
|
||||
/* Alert the user. */
|
||||
/* Alert the user */
|
||||
TSIP_DIALOG_REGISTER_SIGNAL(self, tsip_ao_unregister,
|
||||
TSIP_RESPONSE_CODE(message), TSIP_RESPONSE_PHRASE(message), message);
|
||||
|
||||
|
@ -530,8 +554,7 @@ int tsip_dialog_register_Trying_2_Terminated_X_cancel(va_list *app)
|
|||
ret = tsip_transac_layer_cancel_by_dialog(TSIP_DIALOG_GET_STACK(self)->layer_transac, TSIP_DIALOG(self));
|
||||
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_REGISTER_SIGNAL(self, self->unregistering ? tsip_ao_unregister : tsip_ao_register,
|
||||
tsip_event_code_request_cancelled, "Registration cancelled", tsk_null);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_request_cancelled, "Registration cancelled");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -567,6 +590,9 @@ int tsip_dialog_register_Any_2_Trying_X_hangup(va_list *app)
|
|||
/* Set current action */
|
||||
tsip_dialog_set_curr_action(TSIP_DIALOG(self), action);
|
||||
|
||||
/* Alert the user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminating, "Terminating dialog");
|
||||
|
||||
self->unregistering = tsk_true;
|
||||
return send_REGISTER(self, tsk_true);
|
||||
}
|
||||
|
@ -580,6 +606,9 @@ int tsip_dialog_register_Any_2_Trying_X_shutdown(va_list *app)
|
|||
/* schedule shutdow timeout */
|
||||
TSIP_DIALOG_REGISTER_TIMER_SCHEDULE(shutdown);
|
||||
|
||||
/* alert user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminating, "Terminating dialog");
|
||||
|
||||
self->unregistering = tsk_true;
|
||||
return send_REGISTER(self, tsk_true);
|
||||
}
|
||||
|
@ -592,8 +621,7 @@ int tsip_dialog_register_Any_2_Terminated_X_transportError(va_list *app)
|
|||
/*const tsip_message_t *message = va_arg(*app, const tsip_message_t *);*/
|
||||
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_REGISTER_SIGNAL(self, self->unregistering ? tsip_ao_unregister : tsip_ao_register,
|
||||
tsip_event_code_transport_error, "Transport error.", tsk_null);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_transport_error, "Transport error.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -611,8 +639,7 @@ int tsip_dialog_register_Any_2_Terminated_X_Error(va_list *app)
|
|||
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
|
||||
}
|
||||
else{
|
||||
TSIP_DIALOG_REGISTER_SIGNAL(self, self->unregistering ? tsip_ao_unregister : tsip_ao_register,
|
||||
tsip_event_code_global_error, "Global error.", tsk_null);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_global_error, "Global error.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -716,12 +743,10 @@ int send_REGISTER(tsip_dialog_register_t *self, tsk_bool_t initial)
|
|||
}
|
||||
|
||||
if(!(ret = tsip_dialog_request_send(TSIP_DIALOG(self), request))){
|
||||
TSIP_DIALOG_REGISTER_SIGNAL(self, self->unregistering ? tsip_o_unregister : tsip_o_register,
|
||||
tsip_event_code_request_sent, "(un)REGISTER request successfully sent.", request);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_request_sent, "(un)REGISTER request successfully sent.");
|
||||
}
|
||||
else{
|
||||
TSIP_DIALOG_REGISTER_SIGNAL(self, self->unregistering ? tsip_ao_unregister : tsip_ao_register,
|
||||
tsip_event_code_transport_error, "Transport error.", tsk_null);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_transport_error, "Transport error.");
|
||||
}
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(request);
|
||||
|
@ -748,8 +773,7 @@ int tsip_dialog_register_OnTerminated(tsip_dialog_register_t *self)
|
|||
}
|
||||
|
||||
/* Alert the user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_dialog,
|
||||
tsip_event_code_dialog_terminated, "Dialog terminated");
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminated, "Dialog terminated");
|
||||
|
||||
/* Remove from the dialog layer. */
|
||||
return tsip_dialog_remove(TSIP_DIALOG(self));
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
|
||||
|
||||
#define DEBUG_STATE_MACHINE 0
|
||||
#define DEBUG_STATE_MACHINE 1
|
||||
#define TSIP_DIALOG_SUBSCRIBE_TIMER_SCHEDULE(TX) TSIP_DIALOG_TIMER_SCHEDULE(subscribe, TX)
|
||||
#define TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, type, code, phrase, message) \
|
||||
tsip_subscribe_event_signal(type, TSIP_DIALOG(self)->ss, code, phrase, message)
|
||||
|
@ -74,16 +74,16 @@ int tsip_dialog_subscribe_Any_2_Terminated_X_Error(va_list *app);
|
|||
|
||||
|
||||
/* ======================== conds ======================== */
|
||||
tsk_bool_t _fsm_cond_unsubscribing(tsip_dialog_subscribe_t* dialog, tsip_message_t* message)
|
||||
static tsk_bool_t _fsm_cond_unsubscribing(tsip_dialog_subscribe_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return dialog->unsubscribing;
|
||||
}
|
||||
tsk_bool_t _fsm_cond_subscribing(tsip_dialog_subscribe_t* dialog, tsip_message_t* message)
|
||||
static tsk_bool_t _fsm_cond_subscribing(tsip_dialog_subscribe_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return !_fsm_cond_unsubscribing(dialog, message);
|
||||
}
|
||||
|
||||
tsk_bool_t _fsm_cond_notify_terminated(tsip_dialog_subscribe_t* dialog, tsip_message_t* message)
|
||||
static tsk_bool_t _fsm_cond_notify_terminated(tsip_dialog_subscribe_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
const tsip_header_Subscription_State_t *hdr_state;
|
||||
if((hdr_state = (const tsip_header_Subscription_State_t*)tsip_message_get_header(message, tsip_htype_Subscription_State)))
|
||||
|
@ -93,12 +93,22 @@ tsk_bool_t _fsm_cond_notify_terminated(tsip_dialog_subscribe_t* dialog, tsip_mes
|
|||
}
|
||||
return tsk_false;
|
||||
}
|
||||
|
||||
tsk_bool_t _fsm_cond_notify_not_terminated(tsip_dialog_subscribe_t* dialog, tsip_message_t* message)
|
||||
static tsk_bool_t _fsm_cond_notify_not_terminated(tsip_dialog_subscribe_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return !_fsm_cond_notify_terminated(dialog, message);
|
||||
}
|
||||
|
||||
static tsk_bool_t _fsm_cond_silent_hangup(tsip_dialog_subscribe_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return TSIP_DIALOG(dialog)->ss->silent_hangup;
|
||||
}
|
||||
static tsk_bool_t _fsm_cond_not_silent_hangup(tsip_dialog_subscribe_t* dialog, tsip_message_t* message)
|
||||
{
|
||||
return !TSIP_DIALOG(dialog)->ss->silent_hangup;
|
||||
}
|
||||
#define _fsm_cond_silent_shutdown _fsm_cond_silent_hangup
|
||||
#define _fsm_cond_not_silent_shutdown _fsm_cond_not_silent_hangup
|
||||
|
||||
/* ======================== actions ======================== */
|
||||
typedef enum _fsm_action_e
|
||||
{
|
||||
|
@ -284,11 +294,15 @@ int tsip_dialog_subscribe_init(tsip_dialog_subscribe_t *self)
|
|||
* === Any ===
|
||||
*/
|
||||
// Any -> (hangup) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_hangup, _fsm_state_Trying, tsip_dialog_subscribe_Any_2_Trying_X_hangup, "tsip_dialog_subscribe_Any_2_Trying_X_hangup"),
|
||||
TSK_FSM_ADD(tsk_fsm_state_any, _fsm_action_hangup, _fsm_cond_not_silent_hangup, _fsm_state_Trying, tsip_dialog_subscribe_Any_2_Trying_X_hangup, "tsip_dialog_subscribe_Any_2_Trying_X_hangup"),
|
||||
// Any -> (silenthangup) -> Terminated
|
||||
TSK_FSM_ADD(tsk_fsm_state_any, _fsm_action_hangup, _fsm_cond_silent_hangup, _fsm_state_Terminated, tsk_null, "tsip_dialog_subscribe_Any_2_Trying_X_silenthangup"),
|
||||
// Any -> (shutdown) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_shutdown, _fsm_state_Trying, tsip_dialog_subscribe_Any_2_Trying_X_shutdown, "tsip_dialog_subscribe_Any_2_Trying_X_shutdown"),
|
||||
TSK_FSM_ADD(tsk_fsm_state_any, _fsm_action_shutdown, _fsm_cond_not_silent_shutdown, _fsm_state_Trying, tsip_dialog_subscribe_Any_2_Trying_X_shutdown, "tsip_dialog_subscribe_Any_2_Trying_X_shutdown"),
|
||||
// Any -> (silentshutdown) -> Terminated
|
||||
TSK_FSM_ADD(tsk_fsm_state_any, _fsm_action_shutdown, _fsm_cond_silent_shutdown, _fsm_state_Terminated, tsk_null, "tsip_dialog_subscribe_Any_2_Trying_X_silentshutdown"),
|
||||
// Any -> (shutdown timedout) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_shutdown_timedout, _fsm_state_Terminated, tsk_null, "tsip_dialog_subscribe_** Shutdown timedout"),
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_shutdown_timedout, _fsm_state_Terminated, tsk_null, "tsip_dialog_subscribe_shutdown_timedout"),
|
||||
// Any -> (transport error) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_transporterror, _fsm_state_Terminated, tsip_dialog_subscribe_Any_2_Terminated_X_transportError, "tsip_dialog_subscribe_Any_2_Terminated_X_transportError"),
|
||||
// Any -> (error) -> Terminated
|
||||
|
@ -327,6 +341,9 @@ int tsip_dialog_subscribe_Started_2_Trying_X_subscribe(va_list *app)
|
|||
TSIP_DIALOG(self)->running = tsk_true;
|
||||
tsip_dialog_set_curr_action(TSIP_DIALOG(self), action);
|
||||
|
||||
/* alert the user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_connecting, "Dialog connecting");
|
||||
|
||||
return send_SUBSCRIBE(self);
|
||||
}
|
||||
|
||||
|
@ -362,15 +379,21 @@ int tsip_dialog_subscribe_Trying_2_Connected_X_2xx(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. */
|
||||
TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, self->unsubscribing ? tsip_ao_unsubscribe : tsip_ao_subscribe,
|
||||
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
|
||||
tsk_bool_t first_time_to_connect = (TSIP_DIALOG(self)->state == tsip_initial);
|
||||
|
||||
/* Update the dialog state. */
|
||||
if((ret = tsip_dialog_update(TSIP_DIALOG(self), response))){
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Alert the user(session) */
|
||||
TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, self->unsubscribing ? tsip_ao_unsubscribe : tsip_ao_subscribe,
|
||||
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
|
||||
/* Alert the user(dialog) */
|
||||
if(first_time_to_connect){
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_connected, "Dialog connected");
|
||||
}
|
||||
|
||||
/* Reset current action */
|
||||
tsip_dialog_set_curr_action(TSIP_DIALOG(self), tsk_null);
|
||||
|
||||
|
@ -424,8 +447,7 @@ int tsip_dialog_subscribe_Trying_2_Trying_X_423(va_list *app)
|
|||
send_SUBSCRIBE(self);
|
||||
}
|
||||
else{
|
||||
TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, self->unsubscribing ? tsip_ao_unsubscribe : tsip_ao_subscribe,
|
||||
tsip_event_code_message_error, "Invalid SIP response.", response);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_message_error, "Received invalid SIP response.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -459,8 +481,7 @@ int tsip_dialog_subscribe_Trying_2_Terminated_X_cancel(va_list *app)
|
|||
ret = tsip_transac_layer_cancel_by_dialog(TSIP_DIALOG_GET_STACK(self)->layer_transac, TSIP_DIALOG(self));
|
||||
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, self->unsubscribing ? tsip_ao_unsubscribe : tsip_ao_subscribe,
|
||||
tsip_event_code_request_cancelled, "Subscription cancelled", tsk_null);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_request_cancelled, "Subscription cancelled");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -508,7 +529,7 @@ int tsip_dialog_subscribe_Connected_2_Connected_X_NOTIFY(va_list *app)
|
|||
|
||||
/* Alert the user */
|
||||
TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, tsip_i_notify,
|
||||
tsip_event_code_request_incoming, "Incoming NOTIFY.", request);
|
||||
tsip_event_code_dialog_request_incoming, "Incoming NOTIFY.", request);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -522,7 +543,7 @@ int tsip_dialog_subscribe_Connected_2_Terminated_X_NOTIFY(va_list *app)
|
|||
|
||||
/* Alert the user */
|
||||
TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, tsip_i_notify,
|
||||
tsip_event_code_request_incoming, "Incoming NOTIFY.", request);
|
||||
tsip_event_code_dialog_request_incoming, "Incoming NOTIFY.", request);
|
||||
|
||||
return send_200NOTIFY(self, request);
|
||||
}
|
||||
|
@ -541,6 +562,9 @@ int tsip_dialog_subscribe_Any_2_Trying_X_hangup(va_list *app)
|
|||
/* Set current action */
|
||||
tsip_dialog_set_curr_action(TSIP_DIALOG(self), action);
|
||||
|
||||
/* Alert the user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminating, "Terminating dialog");
|
||||
|
||||
self->unsubscribing = tsk_true;
|
||||
return send_SUBSCRIBE(self);
|
||||
}
|
||||
|
@ -554,6 +578,9 @@ int tsip_dialog_subscribe_Any_2_Trying_X_shutdown(va_list *app)
|
|||
/* schedule shutdow timeout */
|
||||
TSIP_DIALOG_SUBSCRIBE_TIMER_SCHEDULE(shutdown);
|
||||
|
||||
/* alert user */
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminating, "Terminating dialog");
|
||||
|
||||
self->unsubscribing = tsk_true;
|
||||
return send_SUBSCRIBE(self);
|
||||
}
|
||||
|
@ -566,8 +593,7 @@ int tsip_dialog_subscribe_Any_2_Terminated_X_transportError(va_list *app)
|
|||
/* const tsip_response_t *response = va_arg(*app, const tsip_response_t *); */
|
||||
|
||||
/* Alert the user. */
|
||||
TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, self->unsubscribing ? tsip_ao_unsubscribe : tsip_ao_subscribe,
|
||||
tsip_event_code_transport_error, "Transport error.", tsk_null);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_transport_error, "Transport error.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -585,8 +611,7 @@ int tsip_dialog_subscribe_Any_2_Terminated_X_Error(va_list *app)
|
|||
TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response);
|
||||
}
|
||||
else{
|
||||
TSIP_DIALOG_SUBSCRIBE_SIGNAL(self, self->unsubscribing ? tsip_ao_unsubscribe : tsip_ao_subscribe,
|
||||
tsip_event_code_global_error, "Global error.", tsk_null);
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_global_error, "Global error.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -653,8 +678,7 @@ 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_dialog,
|
||||
tsip_event_code_dialog_terminated, "Dialog terminated");
|
||||
TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_terminated, "Dialog terminated");
|
||||
|
||||
/* Remove from the dialog layer. */
|
||||
return tsip_dialog_remove(TSIP_DIALOG(self));
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
*/
|
||||
#include "tsip.h"
|
||||
|
||||
#include "tinysip/tsip_event.h"
|
||||
|
||||
#include "tinysip/parsers/tsip_parser_uri.h"
|
||||
|
||||
#include "tinysip/transactions/tsip_transac_layer.h"
|
||||
|
@ -60,6 +62,14 @@ static void *run(void* self);
|
|||
/**@defgroup tsip_stack_group 3GPP IMS/LTE Stack
|
||||
*/
|
||||
|
||||
extern tsip_event_t* tsip_event_create(tsip_ssession_t* ss, short code, const char* phrase, const tsip_message_t* sipmessage, tsip_event_type_t type);
|
||||
#define TSIP_STACK_SIGNAL(self, code, phrase) \
|
||||
{ \
|
||||
tsip_event_t* e; \
|
||||
if((e = tsip_event_create(tsk_null, code, phrase, tsk_null, tsip_event_stack))){ \
|
||||
TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(self), e); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Internal function used to set all user's parameters */
|
||||
int __tsip_stack_set(tsip_stack_t *self, va_list* app)
|
||||
|
@ -403,6 +413,8 @@ tsip_stack_handle_t* tsip_stack_create(tsip_stack_callback_f callback, const cha
|
|||
|
||||
stack->network.proxy_cscf_port = 5060;
|
||||
stack->network.proxy_cscf_type = tnet_socket_type_udp_ipv4;
|
||||
// all events should be delivered to the user before the stack stop
|
||||
tsk_runnable_set_important(TSK_RUNNABLE(stack), tsk_true);
|
||||
|
||||
/* === DNS context ===
|
||||
* Because of TSIP_STACK_SET_DNS_SERVER(), ctx should be created before calling __tsip_stack_set()
|
||||
|
@ -543,12 +555,16 @@ int tsip_stack_start(tsip_stack_handle_t *self)
|
|||
|
||||
stack->started = tsk_true;
|
||||
|
||||
/* Signal to the end-user that the stack has been started */
|
||||
TSIP_STACK_SIGNAL(self, tsip_event_code_stack_started, "Stack started");
|
||||
|
||||
TSK_DEBUG_INFO("SIP STACK -- START");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bail:
|
||||
TSIP_STACK_SIGNAL(self, tsip_event_code_stack_failed_to_start, "Stack failed to start");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -641,6 +657,19 @@ int tsip_stack_stop(tsip_stack_handle_t *self)
|
|||
one_failed = tsk_true;
|
||||
}
|
||||
|
||||
/* Signal to the end-user that the stack has been stopped
|
||||
* should be done before tsk_runnable_stop() which will stop the thread
|
||||
* responsible for the callbacks. The enqueued data have been marked as "important".
|
||||
* As both the timer manager and the transport layer have been stoped there is no
|
||||
* chance to got additional events */
|
||||
if(one_failed){
|
||||
TSIP_STACK_SIGNAL(self, tsip_event_code_stack_failed_to_stop, "Stack failed to stop");
|
||||
}
|
||||
else{
|
||||
TSIP_STACK_SIGNAL(self, tsip_event_code_stack_stopped, "Stack stopped");
|
||||
}
|
||||
|
||||
/* Stop runnable (run() thread) */
|
||||
if((ret = tsk_runnable_stop(TSK_RUNNABLE(stack)))){
|
||||
TSK_DEBUG_WARN("Failed to stop the stack");
|
||||
one_failed = tsk_true;
|
||||
|
@ -735,6 +764,7 @@ static void *run(void* self)
|
|||
if((curr = TSK_RUNNABLE_POP_FIRST(stack))){
|
||||
tsip_event_t *sipevent = (tsip_event_t*)curr->data;
|
||||
if(stack->callback){
|
||||
sipevent->userdata = stack->userdata; // needed by sessionless events
|
||||
stack->callback(sipevent);
|
||||
}
|
||||
tsk_object_unref(curr);
|
||||
|
|
|
@ -50,20 +50,19 @@ tsip_event_t* tsip_event_create(tsip_ssession_t* ss, short code, const char* phr
|
|||
/* initialize a sip sevent */
|
||||
int tsip_event_init(tsip_event_t* self, tsip_ssession_t *ss, short code, const char *phrase, const tsip_message_t* sipmessage, tsip_event_type_t type)
|
||||
{
|
||||
if(self && ss && ss->stack){
|
||||
self->ss = tsk_object_ref(ss);
|
||||
self->code = code;
|
||||
tsk_strupdate(&(self->phrase), phrase);
|
||||
self->type = type;
|
||||
if(sipmessage){
|
||||
self->sipmessage = tsk_object_ref((void*)sipmessage);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else{
|
||||
if(!self){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
self->ss = tsk_object_ref(ss);
|
||||
self->code = code;
|
||||
tsk_strupdate(&(self->phrase), phrase);
|
||||
self->type = type;
|
||||
if(sipmessage){
|
||||
self->sipmessage = tsk_object_ref((void*)sipmessage);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* signal new event (enque) */
|
||||
|
|
|
@ -196,6 +196,12 @@ int __tsip_ssession_set(tsip_ssession_t *self, va_list *app)
|
|||
break;
|
||||
}
|
||||
|
||||
case sstype_silent_hangup:
|
||||
{ /* sstype_silent_hangup, (tsk_bool_t)ENABLED_BOOL */
|
||||
self->silent_hangup = va_arg(*app, tsk_bool_t);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{ /* va_list will be unsafe => exit */
|
||||
TSK_DEBUG_ERROR("NOT SUPPORTED as valid pname %d.", curr);
|
||||
|
|
Loading…
Reference in New Issue