Attempt to autodetect the nonportable pthread kill all other threads.

YSIP channel supports reinvite and config file (for codecs for now).


git-svn-id: http://voip.null.ro/svn/yate@180 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2005-01-10 01:40:05 +00:00
parent 734b91e980
commit dbbd564a9b
5 changed files with 79 additions and 6 deletions

View File

@ -226,6 +226,9 @@ DataBlock.o: @srcdir@/DataBlock.cpp $(MKDEPS) @srcdir@/telengine.h @srcdir@/tele
Mutex.o: @srcdir@/Mutex.cpp $(MKDEPS) @srcdir@/telengine.h
$(COMPILE) @MUTEX_HACK@ -c $<
Thread.o: @srcdir@/Thread.cpp $(MKDEPS) @srcdir@/telengine.h
$(COMPILE) @THREAD_KILL@ -c $<
%.o: @srcdir@/%.cpp $(MKDEPS) @srcdir@/telengine.h
$(COMPILE) -c $<

View File

@ -0,0 +1,40 @@
[general]
; This section sets global variables of the implementation
; port: int: SIP UDP port
;port=5060
[codecs]
; This section allows to individually enable or disable the codecs
; default: bool: Enable all unlisted codecs by default
;default=enable
; mulaw: bool: Companded-only G711 mu-law (PCMU/8000)
;mulaw=default
; alaw: bool: Companded-only G711 a-law (PCMU/8000)
;alaw=default
; gsm: bool: European GSM 06.10 (GSM/8000)
;gsm=default
; lpc10: bool: Linear Prediction Codec (LPC/8000)
;lpc10=default
; slin: bool: Signed Linear 16-bit uncompressed (L16/8000)
;slin=default
; g723: bool: ITU G.723 all variations (G723/8000)
;g723=default
; g726: bool: ITU G.726 32-bit (G726-32/8000)
;g726=default
; g728: bool: ITU G.728 all variations (G728/8000)
;g728=default
; g729: bool: ITU G.729 all variations (G729/8000)
;g729=default

View File

@ -73,6 +73,29 @@ fi
AC_MSG_RESULT([$have_mutex_settype])
AC_SUBST(MUTEX_HACK)
THREAD_KILL=""
AC_MSG_CHECKING([for pthread_kill_other_threads_np declaration])
AC_LANG_SAVE
AC_LANG_C
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_TRY_COMPILE([
#include <unistd.h>
#include <pthread.h>
],[
pthread_kill_other_threads_np();
],
have_pthread_kill="yes",
have_pthread_kill="no"
)
CFLAGS="$SAVE_CFLAGS"
AC_LANG_RESTORE
if [[ "$have_pthread_kill" = "yes" ]]; then
THREAD_KILL="-DTHREAD_KILL"
fi
AC_MSG_RESULT([$have_pthread_kill])
AC_SUBST(THREAD_KILL)
# Check for compile options
INLINE_FLAGS=""
AC_ARG_ENABLE(inline,AC_HELP_STRING([--enable-inline],[Enable inlining of functions]),want_inline=$enableval,want_inline=auto)

View File

@ -237,7 +237,7 @@ void ThreadPrivate::killall()
// last solution - a REALLY BIG tool!
// usually too big since many libraries have threads of their own...
if (sledgehammer) {
#ifdef __linux__
#ifdef THREAD_KILL
Debug(DebugGoOn,"Brutally killing remaining threads!");
::pthread_kill_other_threads_np();
#else
@ -355,7 +355,7 @@ void Thread::yield()
void Thread::preExec()
{
#ifdef __linux__
#ifdef THREAD_KILL
::pthread_kill_other_threads_np();
#endif
}

View File

@ -195,6 +195,8 @@ private:
String m_rtpAddr;
String m_rtpPort;
String m_rtpFormat;
int m_rtpSession;
int m_rtpVersion;
String m_formats;
};
@ -616,7 +618,8 @@ YateSIPConnection* YateSIPConnection::find(const SIPDialog& id)
// Incoming call constructor - after call.route but before call.execute
YateSIPConnection::YateSIPConnection(Message& msg, SIPTransaction* tr)
: m_tr(tr), m_hungup(false), m_byebye(true), m_state(Incoming)
: m_tr(tr), m_hungup(false), m_byebye(true), m_state(Incoming),
m_rtpSession(0), m_rtpVersion(0)
{
Debug(DebugAll,"YateSIPConnection::YateSIPConnection(%p) [%p]",tr,this);
s_mutex.lock();
@ -637,7 +640,8 @@ YateSIPConnection::YateSIPConnection(Message& msg, SIPTransaction* tr)
// Outgoing call constructor - in call.execute handler
YateSIPConnection::YateSIPConnection(Message& msg, const String& uri)
: m_tr(0), m_hungup(false), m_byebye(true), m_state(Outgoing), m_uri(uri)
: m_tr(0), m_hungup(false), m_byebye(true), m_state(Outgoing), m_uri(uri),
m_rtpSession(0), m_rtpVersion(0)
{
Debug(DebugAll,"YateSIPConnection::YateSIPConnection(%p,'%s') [%p]",
&msg,uri.c_str(),this);
@ -814,11 +818,14 @@ SDPBody* YateSIPConnection::createSDP(const char* addr, const char* port, const
{
Debug(DebugAll,"YateSIPConnection::createSDP('%s','%s','%s') [%p]",
addr,port,formats,this);
int t = Time::now() / 10000000000ULL;
if (m_rtpSession)
++m_rtpVersion;
else
m_rtpVersion = m_rtpSession = Time::now() / 10000000000ULL;
String tmp;
tmp << "IN IP4 " << addr;
String owner;
owner << "1001 " << t << " " << t << " " << tmp;
owner << "1 " << m_rtpSession << " " << m_rtpVersion << " " << tmp;
String frm(format ? format : formats);
if (frm.null())
frm = "alaw,mulaw";