It's working

Lot of debugging code right now
You need STUN, because it doesn't work without it
This commit is contained in:
yanmorin
2005-09-26 19:29:57 +00:00
parent 2befedfed9
commit 085bd7ce5d
13 changed files with 193 additions and 163 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2005-09-26T10:57:16" xmi.version="1.2" >
<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2005-09-26T12:12:35" xmi.version="1.2" >
<XMI.header>
<XMI.documentation>
<XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
@ -834,7 +834,7 @@
</hierarchicalcodeblock>
</textblocks>
<header>
<codecomment tag="" text="/************************************************************************&amp;#010; requestmanager.cpp - Copyright ymorin&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/usr/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010; i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010; files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010; java code.&amp;#010; If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010; choose this file even if there are other files with the same extension in the&amp;#010; directory. If you name the file something else, it must be the only one with that&amp;#010; extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Mon Sep 26 2005 at 10:47:41&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
<codecomment tag="" text="/************************************************************************&amp;#010; requestmanager.cpp - Copyright ymorin&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/usr/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010; i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010; files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010; java code.&amp;#010; If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010; choose this file even if there are other files with the same extension in the&amp;#010; directory. If you name the file something else, it must be the only one with that&amp;#010; extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Mon Sep 26 2005 at 11:30:11&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
</header>
<classfields>
<codeclassfield parent_id="25" field_type="4" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
@ -1435,7 +1435,7 @@
</hierarchicalcodeblock>
</textblocks>
<header>
<codecomment tag="" text="/************************************************************************&amp;#010; tcpsessionio.cpp - Copyright ymorin&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/usr/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010; i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010; files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010; java code.&amp;#010; If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010; choose this file even if there are other files with the same extension in the&amp;#010; directory. If you name the file something else, it must be the only one with that&amp;#010; extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Mon Sep 26 2005 at 10:54:29&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
<codecomment tag="" text="/************************************************************************&amp;#010; tcpsessionio.cpp - Copyright ymorin&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/usr/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010; i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010; files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010; java code.&amp;#010; If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010; choose this file even if there are other files with the same extension in the&amp;#010; directory. If you name the file something else, it must be the only one with that&amp;#010; extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Mon Sep 26 2005 at 11:15:52&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
</header>
<classfields>
<codeclassfield parent_id="22" field_type="6750318" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
@ -2779,7 +2779,7 @@
</hierarchicalcodeblock>
</textblocks>
<header>
<codecomment tag="" text="/************************************************************************&amp;#010; tcpstreampool.cpp - Copyright ymorin&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/usr/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010; i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010; files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010; java code.&amp;#010; If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010; choose this file even if there are other files with the same extension in the&amp;#010; directory. If you name the file something else, it must be the only one with that&amp;#010; extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Mon Sep 26 2005 at 10:54:39&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
<codecomment tag="" text="/************************************************************************&amp;#010; tcpstreampool.cpp - Copyright ymorin&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/usr/share/apps/umbrello/headings/heading.cpp&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010; i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010; files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010; java code.&amp;#010; If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010; choose this file even if there are other files with the same extension in the&amp;#010; directory. If you name the file something else, it must be the only one with that&amp;#010; extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Mon Sep 26 2005 at 11:30:08&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
</header>
<classfields>
<codeclassfield parent_id="67" field_type="1" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
@ -5565,7 +5565,7 @@
</codeblockwithcomments>
</textblocks>
<header>
<codecomment tag="" text="/************************************************************************&amp;#010; requestmanager.h - Copyright ymorin&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/usr/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010; i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010; files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010; java code.&amp;#010; If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010; choose this file even if there are other files with the same extension in the&amp;#010; directory. If you name the file something else, it must be the only one with that&amp;#010; extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Mon Sep 26 2005 at 10:47:41&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
<codecomment tag="" text="/************************************************************************&amp;#010; requestmanager.h - Copyright ymorin&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/usr/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010; i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010; files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010; java code.&amp;#010; If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010; choose this file even if there are other files with the same extension in the&amp;#010; directory. If you name the file something else, it must be the only one with that&amp;#010; extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Mon Sep 26 2005 at 11:30:11&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
</header>
<classfields>
<codeclassfield parent_id="25" field_type="4" initialValue="" role_id="0" writeOutMethods="true" listClassName="" >
@ -6765,7 +6765,7 @@
</codeblockwithcomments>
</textblocks>
<header>
<codecomment tag="" text="/************************************************************************&amp;#010; tcpsessionio.h - Copyright ymorin&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/usr/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010; i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010; files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010; java code.&amp;#010; If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010; choose this file even if there are other files with the same extension in the&amp;#010; directory. If you name the file something else, it must be the only one with that&amp;#010; extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Mon Sep 26 2005 at 10:54:29&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
<codecomment tag="" text="/************************************************************************&amp;#010; tcpsessionio.h - Copyright ymorin&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/usr/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010; i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010; files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010; java code.&amp;#010; If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010; choose this file even if there are other files with the same extension in the&amp;#010; directory. If you name the file something else, it must be the only one with that&amp;#010; extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Mon Sep 26 2005 at 11:15:52&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
</header>
<classfields>
<codeclassfield parent_id="22" field_type="6619250" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >
@ -9048,7 +9048,7 @@
</codeblockwithcomments>
</textblocks>
<header>
<codecomment tag="" text="/************************************************************************&amp;#010; tcpstreampool.h - Copyright ymorin&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/usr/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010; i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010; files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010; java code.&amp;#010; If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010; choose this file even if there are other files with the same extension in the&amp;#010; directory. If you name the file something else, it must be the only one with that&amp;#010; extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Mon Sep 26 2005 at 10:54:39&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
<codecomment tag="" text="/************************************************************************&amp;#010; tcpstreampool.h - Copyright ymorin&amp;#010;&amp;#010;Here you can write a license for your code, some comments or any other&amp;#010;information you want to have in your generated code. To to this simply&amp;#010;configure the &quot;headings&quot; directory in uml to point to a directory&amp;#010;where you have your heading files.&amp;#010;&amp;#010;or you can just replace the contents of this file with your own.&amp;#010;If you want to do this, this file is located at&amp;#010;&amp;#010;/usr/share/apps/umbrello/headings/heading.h&amp;#010;&amp;#010;-->Code Generators searches for heading files based on the file extension&amp;#010; i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header&amp;#010; files, and for a file name ending in &quot;.java&quot; to include in all generated&amp;#010; java code.&amp;#010; If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always&amp;#010; choose this file even if there are other files with the same extension in the&amp;#010; directory. If you name the file something else, it must be the only one with that&amp;#010; extension in the directory to guarantee that Code Generator will choose it.&amp;#010;&amp;#010;you can use variables in your heading files which are replaced at generation&amp;#010;time. possible variables are : author, date, time, filename and filepath.&amp;#010;just write %variable_name%&amp;#010;&amp;#010;This file was generated on Mon Sep 26 2005 at 11:30:08&amp;#010;The original location of this file is &amp;#010;**************************************************************************/&amp;#010;" />
</header>
<classfields>
<codeclassfield parent_id="67" field_type="7274601" initialValue="" role_id="1" writeOutMethods="true" listClassName="" >

View File

@ -69,6 +69,7 @@ AudioRtp::createNewSession (SipCall *ca) {
Manager::instance().getAudioDriver()->micRingBuffer().flush();
Manager::instance().getAudioDriver()->startStream();
_debug("AudioRtp::createNewSession: starting RTX thread\n");
if (_RTXThread->start() != 0) {
return -1;
}
@ -144,13 +145,12 @@ AudioRtpRTX::initAudioRtpSession (void)
_debug("RTP: Target IP address [%s] is not correct!\n", _ca->getRemoteSdpAudioIp());
exit();
} else {
_debug("RTP: Sending to %s : %d\n", _ca->getRemoteSdpAudioIp(),
_ca->getRemoteSdpAudioPort());
_debug("RTP: Sending to %s : %d\n", _ca->getRemoteSdpAudioIp(), _ca->getRemoteSdpAudioPort());
}
// Initialization
if (!_sym) {
_sessionRecv->setSchedulingTimeout (100000);
//_sessionRecv->setSchedulingTimeout (10000);
_sessionRecv->setExpireTimeout(1000000);
_sessionSend->setSchedulingTimeout(10000);
@ -172,20 +172,19 @@ AudioRtpRTX::initAudioRtpSession (void)
(unsigned short) _ca->getRemoteSdpAudioPort());
}
_sessionRecv->setPayloadFormat(StaticPayloadFormat(
(StaticPayloadType) _ca->payload));
_sessionSend->setPayloadFormat(StaticPayloadFormat(
(StaticPayloadType) _ca->payload));
//setPayloadFormat(StaticPayloadFormat(sptPCMU));
_debug("Payload Format: %d\n", _ca->payload);
_sessionRecv->setPayloadFormat(StaticPayloadFormat((StaticPayloadType) _ca->payload));
_sessionSend->setPayloadFormat(StaticPayloadFormat((StaticPayloadType) _ca->payload));
setCancel(cancelImmediate);
_sessionSend->setMark(true);
} else {
if (!_session->addDestination (remote_ip,
(unsigned short) _ca->getRemoteSdpAudioPort())) {
if (!_session->addDestination (remote_ip, (unsigned short) _ca->getRemoteSdpAudioPort())) {
exit();
} else {
_session->setPayloadFormat(StaticPayloadFormat(
(StaticPayloadType) _ca->payload));
_session->setPayloadFormat(StaticPayloadFormat((StaticPayloadType) _ca->payload));
setCancel(cancelImmediate);
}
}
@ -246,8 +245,9 @@ AudioRtpRTX::receiveSessionForSpkr (int16* data_for_speakers,
const AppDataUnit* adu = NULL;
// Get audio data stream
do {
Thread::sleep(5); // in msec.
Thread::sleep(5); // in msec.
if (!_sym) {
adu = _sessionRecv->getData(_sessionRecv->getFirstTimestamp());
} else {
@ -286,8 +286,10 @@ AudioRtpRTX::receiveSessionForSpkr (int16* data_for_speakers,
Manager::instance().notificationIncomingCall();
}
}
Manager::instance().getAudioDriver()->startStream();
delete cd;
delete adu;
}
@ -322,14 +324,14 @@ AudioRtpRTX::run (void) {
// start running the packet queue scheduler.
if (!_sym) {
_sessionRecv->startRunning();
_sessionSend->startRunning();
_sessionSend->startRunning();
} else {
_session->startRunning();
}
while (_ca->enable_audio != -1) {
micVolume = Manager::instance().getMicroVolume();
spkrVolume = Manager::instance().getSpkrVolume();
spkrVolume = Manager::instance().getSpkrVolume();
////////////////////////////
// Send session

View File

@ -58,6 +58,7 @@ ToneThread::run (void) {
// How long do 'size' samples play ?
unsigned int play_time = (size * 1000) / SAMPLING_RATE;
unsigned int pause = (size) / SAMPLING_RATE;
while (Manager::instance().getZonetone()) {
@ -79,7 +80,7 @@ ToneThread::run (void) {
}
// next iteration later, sound is playing.
this->sleep (play_time);
this->sleep (pause);
}
}
@ -330,8 +331,8 @@ ToneGenerator::playRingtone (const char *fileName) {
file.seekg (0, ios::beg);
// allocate memory:
src = new char [length];
dst = new short[length*2];
src = new char [length];
dst = new short[length*2];
// read data as a block:
file.read (src,length);

View File

@ -146,10 +146,10 @@ GuiFramework::unregisterVoIPLink (void)
}
}
void
bool
GuiFramework::sendDtmf (short id, char code)
{
Manager::instance().sendDtmf(id, code);
return Manager::instance().sendDtmf(id, code);
}
int

View File

@ -65,7 +65,7 @@ public:
int quitApplication (void);
int sendTextMessage (short id, const std::string& message);
int accessToDirectory (void);
void sendDtmf (short id, char code);
bool sendDtmf (short id, char code);
protected:
std::string _message;

View File

@ -1,8 +1,8 @@
noinst_LTLIBRARIES = libsflphoneguiserver.la
libsflphoneguiserver_la_SOURCES = $(BUILT_SOURCES) guiserverimpl.cpp \
responsemessage.cpp request.cpp requestfactory.cpp argtokenizer.cpp tcpsessionio.cpp \
requestmanager.cpp
responsemessage.cpp request.cpp requestfactory.cpp argtokenizer.cpp tcpsessionio.cpp \
requestmanager.cpp sessionio.cpp tcpstreampool.cpp
libsflphoneguiserver_la_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\"
libsflphoneguiserver_la_LIBADD =
@ -10,4 +10,5 @@ libsflphoneguiserver_la_LIBADD =
AM_CPPFLAGS = -I$(top_srcdir) $(libccext2_CFLAGS)
noinst_HEADERS = responsemessage.h request.h requestfactory.h subcall.h \
argtokenizer.h tcpsessionio.h requestmanager.h guiserver.h guiserverimpl.h
argtokenizer.h tcpsessionio.h requestmanager.h guiserver.h guiserverimpl.h sessionio.h \
tcpsessionio.h tcpstreampool.h

View File

@ -21,6 +21,7 @@
#include <iostream>
#include "tcpsessionio.h"
#include "../../global.h"
RequestManager::RequestManager() : _sessionIO(0)
{
@ -56,10 +57,10 @@ RequestManager::exec()
// std::cin.good() is only there to close the server when
// we do a CTRL+D
while(std::cin.good()) {
while(_sessionIO->good() && std::cin.good()) {
if (_sessionIO->receive(input)) {
_debug("Receive Input...: %s\n", input.c_str());
request = _factory.create(input);
outputResponse = request->execute();
@ -122,6 +123,7 @@ RequestManager::flushWaitingRequest()
void
RequestManager::sendResponse(const ResponseMessage& response) {
if (_sessionIO) {
_debug("Sending output...\n");
_sessionIO->send(response.toString());
}

View File

@ -10,8 +10,6 @@
//
//
#include "tcpsessionio.h"
#include "../../global.h"
const int TCPSessionIO::PORT = 3999;
const char * const TCPSessionIO::IP = "127.0.0.1";
@ -36,10 +34,8 @@ bool
TCPSessionIO::good()
{
if (_clientStream) { // just in case
_debug("_clientStream->good() == %d\n", _clientStream->good());
return _clientStream->good();
}
_debug("_clientStream doesn't exists yet...");
return false;
}

View File

@ -517,26 +517,25 @@ ManagerImpl::accessToDirectory (void)
return 1;
}
int
bool
ManagerImpl::sendDtmf (short id, char code)
{
int sendType = get_config_fields_int(SIGNALISATION, SEND_DTMF_AS);
switch (sendType) {
int sendType = get_config_fields_int(SIGNALISATION, SEND_DTMF_AS);
switch (sendType) {
// SIP INFO
case 0:
_voIPLinkVector.at(DFT_VOIP_LINK)->carryingDTMFdigits(id, code);
return 1;
return true;
break;
// Audio way
case 1:
return 1;
return false;
break;
// rfc 2833
case 2:
return 1;
return false;
break;
default:

View File

@ -164,9 +164,9 @@ public:
* Handle choice of the DTMF-send-way
*
* @param id: callid of the line.
* @param code: pressed key.
* @param code: pressed key.
*/
int sendDtmf (short id, char code);
bool sendDtmf (short id, char code);
int incomingCall (short id);

View File

@ -36,16 +36,24 @@ using namespace std;
SipCall::SipCall (short id, CodecDescriptorVector* cdv)
{
_id = id; // Same id of Call object
_cid = 0; // call id, from the sipvoiplink
_did = 0; // dialog id
_tid = 0; // transaction id
_id = id; // Same id of Call object
_cid = 0; // call id, from the sipvoiplink
_did = 0; // dialog id
_tid = 0; // transaction id
alloc();
_cdv = cdv;
_audiocodec = NULL;
_standby = false;
enable_audio = -1;
_standby = false;
_status_code = 0;
alloc(); // char* allocation
_cdv = cdv;
_audiocodec = NULL;
enable_audio = -1;
_state = 0;
_local_audio_port = 0;
_remote_sdp_audio_port = 0;
_local_sendrecv = 0; /* _SENDRECV, _SENDONLY, _RECVONLY */
_remote_sendrecv = 0;
}
@ -558,80 +566,83 @@ SipCall::answeredCall(eXosip_event_t *event) {
void
SipCall::answeredCall_without_hold (eXosip_event_t *event)
{
SipCall *ca = this;
SipCall *ca = this;
if (ca->enable_audio == 1 && event->response != NULL) {
sdp_message_t *sdp = eXosip_get_sdp_info (event->response);
if (sdp != NULL) {
/* audio is started and session has just been modified */
ca->enable_audio = -1;
sdp_message_free (sdp);
}
}
if (ca->enable_audio != 1) { /* audio is started */
sdp_connection_t *conn;
sdp_media_t *remote_med;
char *tmp = NULL;
sdp_message_t *local_sdp = eXosip_get_sdp_info (event->request);
sdp_message_t *remote_sdp = eXosip_get_sdp_info (event->response);
if (remote_sdp == NULL) {
_debug("No remote SDP body found for call\n");
/* TODO: remote_sdp = retreive from ack above */
} else {
conn = eXosip_get_audio_connection (remote_sdp);
if (conn != NULL && conn->c_addr != NULL) {
snprintf (_remote_sdp_audio_ip, 49, "%s", conn->c_addr);
}
remote_med = eXosip_get_audio_media (remote_sdp);
if (remote_med != NULL && remote_med->m_port != NULL) {
_remote_sdp_audio_port = atoi (remote_med->m_port);
}
if (_remote_sdp_audio_port > 0 && _remote_sdp_audio_ip[0] != '\0' &&
remote_med != NULL) {
tmp = (char *) osip_list_get (remote_med->m_payloads, 0);
}
if (tmp != NULL) {
ca->payload = atoi (tmp);
_debug("For outgoing call: ca->payload = %d\n", ca->payload);
setAudioCodec(_cdv->at(0)->alloc(ca->payload, ""));
}
if (ca->enable_audio == 1 && event->response != NULL) {
sdp_message_t *sdp = eXosip_get_sdp_info (event->response);
if (sdp != NULL) {
/* audio is started and session has just been modified */
ca->enable_audio = -1;
sdp_message_free (sdp);
}
}
if (ca->enable_audio != 1) { /* audio is started */
sdp_message_t *remote_sdp;
sdp_message_t *local_sdp;
if (local_sdp == NULL) {
_debug("SDP body was probably in the ACK (TODO)\n");
}
local_sdp = eXosip_get_sdp_info (event->request);
remote_sdp = eXosip_get_sdp_info (event->response);
if (remote_sdp == NULL) {
_debug("No remote SDP body found for call\n");
/* TODO: remote_sdp = retreive from ack above */
if (remote_sdp != NULL && local_sdp != NULL) {
sdp_media_t *local_med;
int audio_port = 0;
local_med = eXosip_get_audio_media (local_sdp);
if (local_med != NULL && local_med->m_port != NULL) {
audio_port = atoi (local_med->m_port);
}
if (tmp != NULL && audio_port > 0
&& _remote_sdp_audio_port > 0
&& _remote_sdp_audio_ip[0] != '\0') {
/* search if stream is sendonly or recvonly */
_remote_sendrecv = sdp_analyse_attribute (remote_sdp, remote_med);
_local_sendrecv = sdp_analyse_attribute (local_sdp, local_med);
if (_local_sendrecv == _SENDRECV) {
if (_remote_sendrecv == _SENDONLY)
_local_sendrecv = _RECVONLY;
else if (_remote_sendrecv == _RECVONLY)
_local_sendrecv = _SENDONLY;
}
if (local_sdp == NULL) {
_debug("SDP body was probably in the ACK (TODO)\n");
}
if (remote_sdp != NULL && local_sdp != NULL) {
sdp_connection_t *conn;
sdp_media_t *local_med;
sdp_media_t *remote_med;
char *tmp = NULL;
int audio_port = 0;
conn = eXosip_get_audio_connection (remote_sdp);
if (conn != NULL && conn->c_addr != NULL) {
snprintf (_remote_sdp_audio_ip, 49, "%s", conn->c_addr);
}
remote_med = eXosip_get_audio_media (remote_sdp);
if (remote_med != NULL && remote_med->m_port != NULL) {
_remote_sdp_audio_port = atoi (remote_med->m_port);
}
local_med = eXosip_get_audio_media (local_sdp);
if (local_med != NULL && local_med->m_port != NULL) {
audio_port = atoi (local_med->m_port);
}
if (_remote_sdp_audio_port > 0
&& _remote_sdp_audio_ip[0] != '\0' && remote_med != NULL) {
tmp = (char *) osip_list_get (remote_med->m_payloads, 0);
}
if (tmp != NULL) {
ca->payload = atoi (tmp);
_debug("For outgoing call: ca->payload = %d\n", ca->payload);
setAudioCodec(_cdv->at(0)->alloc(ca->payload, ""));
}
if (tmp != NULL
&& audio_port > 0
&& _remote_sdp_audio_port > 0
&& _remote_sdp_audio_ip[0] != '\0') {
/* search if stream is sendonly or recvonly */
_remote_sendrecv =
sdp_analyse_attribute (remote_sdp, remote_med);
_local_sendrecv = sdp_analyse_attribute (local_sdp, local_med);
if (_local_sendrecv == _SENDRECV) {
if (_remote_sendrecv == _SENDONLY)
_local_sendrecv = _RECVONLY;
else if (_remote_sendrecv == _RECVONLY)
_local_sendrecv = _SENDONLY;
}
}
}
sdp_message_free (local_sdp);
sdp_message_free (remote_sdp);
}
}
}
sdp_message_free (local_sdp);
sdp_message_free (remote_sdp);
}
}
int
@ -773,18 +784,24 @@ SipCall::sdp_analyse_attribute (sdp_message_t * sdp, sdp_media_t * med)
void
SipCall::alloc(void) {
this->_reason_phrase = new char[50];
this->_textinfo = new char[256];
this->_remote_uri = new char[256];
this->_remote_sdp_audio_ip = new char[50];
this->_reason_phrase = new char[50];
this->_textinfo = new char[256];
this->_remote_uri = new char[256];
this->_remote_sdp_audio_ip = new char[50];
// initialize the strings...
this->_reason_phrase[0] = '\0';
this->_textinfo[0] = '\0';
this->_remote_uri[0] = '\0';
strcpy(this->_remote_sdp_audio_ip, "0.0.0.0");
}
void
SipCall::dealloc(void) {
delete _reason_phrase;
delete _textinfo;
delete _remote_uri;
delete _remote_sdp_audio_ip;
delete [] _reason_phrase;
delete [] _textinfo;
delete [] _remote_uri;
delete [] _remote_sdp_audio_ip;
}
void

View File

@ -120,24 +120,24 @@ private:
CodecDescriptorVector* _cdv;
AudioCodec* _audiocodec;
short _id;
int _cid; // call id
int _did; // dialog id
int _tid; // transaction id
bool _standby; // wait for a cid and did when outgoing call is made
int _status_code;
char* _reason_phrase;
char* _textinfo;
char* _remote_uri;
char* _remote_sdp_audio_ip;
int _state;
int _local_audio_port;
int _remote_sdp_audio_port;
int _local_sendrecv; /* _SENDRECV, _SENDONLY, _RECVONLY */
int _remote_sendrecv; /* _SENDRECV, _SENDONLY, _RECVONLY */
short _id;
int _cid; // call id
int _did; // dialog id
int _tid; // transaction id
bool _standby; // wait for a cid and did when outgoing call is made
int _status_code;
char* _reason_phrase;
char* _textinfo;
char* _remote_uri;
char* _remote_sdp_audio_ip;
int _state;
int _local_audio_port;
int _remote_sdp_audio_port;
int _local_sendrecv; /* _SENDRECV, _SENDONLY, _RECVONLY */
int _remote_sendrecv; /* _SENDRECV, _SENDONLY, _RECVONLY */
};
#endif // __SIP_CALL_H__

View File

@ -135,6 +135,7 @@ SipVoIPLink::terminate(void)
int
SipVoIPLink::setRegister (void)
{
_debug("SipVoIPLink::setRegister()\n");
int i;
osip_message_t *reg = NULL;
@ -410,6 +411,7 @@ SipVoIPLink::onhold (short id)
sdp_message_free (local_sdp);
if (i != 0) {
osip_message_free (invite);
osip_free (tmp);
return -1;
}
osip_message_set_body (invite, tmp, strlen (tmp));
@ -469,6 +471,7 @@ SipVoIPLink::offhold (short id)
sdp_message_free (local_sdp);
if (i != 0) {
osip_message_free (invite);
osip_free (tmp);
return -1;
}
osip_message_set_body (invite, tmp, strlen (tmp));
@ -545,9 +548,10 @@ SipVoIPLink::getEvent (void)
if (event == NULL) {
return -1;
}
}
_debug("GetEvent : %d\n", event->type);
Manager::instance().displayErrorText(event->type, "getEvent");
switch (event->type) {
// IP-Phone user receives a new call
case EXOSIP_CALL_INVITE: //
@ -691,18 +695,26 @@ SipVoIPLink::getEvent (void)
return -1;
}
break;
case EXOSIP_CALL_RELEASED:
id = findCallIdInitial(event);
_debug("Id Released: %d\n", id);
//TODO: find the id...
//Manager::instance().displayErrorText(0, "getEvent:CallReleased");
break;
case EXOSIP_CALL_REQUESTFAILURE:
id = findCallId(event);
// Handle 4XX errors
switch (event->response->status_code) {
case AUTH_REQUIRED:
_debug("EXOSIP_CALL_REQUESTFAILURE :: AUTH_REQUIRED\n");
eXosip_lock();
eXosip_automatic_action();
eXosip_unlock();
break;
case UNAUTHORIZED:
_debug("EXOSIP_CALL_REQUESTFAILURE :: UNAUTHORIZED\n");
setAuthentication();
break;
@ -757,7 +769,7 @@ SipVoIPLink::getEvent (void)
break;
case EXOSIP_REGISTRATION_FAILURE: // 2
Manager::instance().displayError("getEvent:Registration Failure");
Manager::instance().displayError("getEvent : Registration Failure\n");
break;
case EXOSIP_MESSAGE_NEW:
@ -828,13 +840,8 @@ SipVoIPLink::getEvent (void)
}
break;
case EXOSIP_CALL_RELEASED:
//TODO: find the id...
Manager::instance().displayErrorText(0, "getEvent:CallReleased");
break;
default:
Manager::instance().displayErrorText(event->type, "getEvent:default");
//Manager::instance().displayErrorText(event->type, "getEvent:default");
return -1;
break;
}
@ -979,6 +986,7 @@ SipVoIPLink::sdp_hold_call (sdp_message_t * sdp)
/* we need to add a global attribute with a field set to "sendonly" */
sdp_message_a_attribute_add (sdp, -1, osip_strdup ("sendonly"), NULL);
}
return 0;
}
@ -1138,7 +1146,7 @@ SipVoIPLink::getLocalIp (void)
char* myIPAddress = new char[65];
ret = eXosip_guess_localip (2, myIPAddress, 64);
setLocalIpAddress(std::string(myIPAddress));
delete [] myIPAddress;
delete [] myIPAddress;
return ret;
}
@ -1251,7 +1259,6 @@ SipVoIPLink::startCall (short id, const string& from, const string& to,
if (i != 0) {
return -1; // error when building the invite
}
int payload;
unsigned int nb;
@ -1277,10 +1284,14 @@ SipVoIPLink::startCall (short id, const string& from, const string& to,
snprintf(rtpmap, 127, "a=rtpmap: %d %s/%d\r\n", payload,
Manager::instance().getCodecDescVector()->at(i)->rtpmapPayload(payload).data(), SAMPLING_RATE);
strcat(rtpmap_attr, rtpmap);
strcat(rtpmap_attr, rtpmap);
}
}
// http://www.antisip.com/documentation/eXosip2/group__howto1__initialize.html
// tell sip if we support SIP extension like 100rel
// osip_message_set_supported (invite, "100rel");
/* add sdp body */
{
char tmp[4096];
@ -1294,9 +1305,10 @@ SipVoIPLink::startCall (short id, const string& from, const string& to,
"c=IN IP4 %s\r\n"
"t=0 0\r\n"
"m=audio %s RTP/AVP %s\r\n"
"%s",
"%s",
localip, localip, port, media_audio, rtpmap_attr);
// media_audio should be one, two or three numbers?
_debug("%s %d", tmp, strlen(tmp));
osip_message_set_body (invite, tmp, strlen (tmp));
osip_message_set_content_type (invite, "application/sdp");
}