Commit eba29f5f authored by llea's avatar llea

New orgnisation of SFLphone

parent bddd5f68
......@@ -4,7 +4,7 @@
# Author: Laurielle Lea (laurielle.lea@savoirfairelinux.com)
#
all:
cd gsm ; make
cd src/audio/gsm ; make
cd src; make
install:
......@@ -15,5 +15,5 @@ uninstall:
clean:
cd src; make clean
cd gsm ; make clean
cd src/audio/gsm ; make clean
......@@ -17,59 +17,73 @@ SKINS = skins
RINGS = rings
METAL_SKINS = metal
ifdef ALSA
endif
INCPATH = -I. -I$(QTDIR)/include -I$(CCPPDIR)/include/cc++2 -I$(CCRTPDIR)/include -I$(OSIPDIR)/include -I$(EXOPSIP)/include -I/usr/include -I../gsm
INCPATH = -I. -I$(QTDIR)/include -I$(CCPPDIR)/include/cc++2 -I$(CCRTPDIR)/include -I$(OSIPDIR)/include -I$(EXOPSIP)/include -I/usr/include -Iaudio/gsm
CXXFLAGS = -pipe -Wall -W -g -pipe -march=i386 -mcpu=i686 -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -fpermissive -Wno-deprecated $(INCPATH)
LIBS=-L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -L/opt/lib -losip2 -leXosip -lccrtp1 -lasound `$(CCPPDIR)/bin/ccgnu2-config --flags --stdlibs`
EXTRALIBS=../gsm/libgsm.a
EXTRALIBS=audio/gsm/libgsm.a
CONFIGURE_CONF=$(shell ls ../configure.conf)
OBJS = \
audiobuffer.o \
audiocodec.o \
audiodrivers.o \
audiodriversoss.o \
audiodriversalsa.o \
audiortp.o \
configuration.o \
audio/audiobuffer.o \
audio/audiocodec.o \
audio/codecDescriptor.o \
audio/audiodrivers.o \
audio/audiodriversalsa.o \
audio/audiodriversoss.o \
audio/audiortp.o \
audio/dtmf.o \
audio/dtmfgenerator.o \
audio/tonegenerator.o \
audio/g711.o \
audio/gsmcodec.o \
audio/alaw.o \
audio/ulaw.o \
call.o \
configitem.o \
configuration.o \
configurationtree.o \
dtmf.o \
dtmfgenerator.o \
error.o \
g711.o \
eventthread.o \
gui/guiframework.o \
gui/qt/mydisplay.o \
gui/qt/numerickeypadtools.o \
gui/qt/phoneline.o \
gui/qt/point.o \
gui/qt/transqwidget.o \
gui/qt/trayicon.o \
gui/qt/trayicon.moc.o \
gui/qt/trayicon_x11.o \
gui/qt/vector.o \
gui/qt/volumecontrol.o \
gui/qt/volumecontrol.moc.o \
gui/qt/jpushbutton.o \
gui/qt/jpushbutton.moc.o \
gui/qt/numerickeypad.o \
gui/qt/numerickeypad.moc.o \
gui/qt/qjlistboxpixmap.o \
gui/qt/qtGUImainwindow.o \
gui/qt/qtGUImainwindow.moc.o \
gui/qt/configurationpanelui.o \
gui/qt/configurationpanelui.moc.o \
gui/qt/url_inputui.o \
gui/qt/url_inputui.moc.o \
main.o \
manager.o \
mydisplay.o \
numerickeypadtools.o \
phoneline.o \
point.o \
qjlistboxpixmap.o \
sip.o \
sipcall.o \
sipvoiplink.o \
skin.o \
url_inputui.o url_inputui.moc.o \
phonebookui.o phonebookui.moc.o \
configurationpanelui.o configurationpanelui.moc.o \
tonegenerator.o \
transqwidget.o \
trayicon.o trayicon.moc.o trayicon_x11.o \
jpushbutton.o jpushbutton.moc.o \
numerickeypad.o numerickeypad.moc.o \
qtGUImainwindow.o qtGUImainwindow.moc.o \
vector.o \
volumecontrol.o volumecontrol.moc.o \
stun.o udp.o
voIPLink.o \
stun.o \
udp.o
start: check prereq all
#start: check all
#start:check all
check:
ifeq ($(CONFIGURE_CONF),../configure.conf)
......@@ -81,14 +95,14 @@ endif
.cpp.o:
$(CXX) $(DEFVARS) $(CXXFLAGS) -c -o $@ $<
prereq: phonebook.ui url_input.ui configurationpanel.ui
prereq: gui/qt/phonebook.ui gui/qt/url_input.ui gui/qt/configurationpanel.ui
@echo "Making User Interface files..."
$(UIC) -o phonebookui.h phonebook.ui
$(UIC) -o phonebookui.cpp -impl phonebookui.h phonebook.ui
$(UIC) -o url_inputui.h url_input.ui
$(UIC) -o url_inputui.cpp -impl url_inputui.h url_input.ui
$(UIC) -o configurationpanelui.h configurationpanel.ui
$(UIC) -o configurationpanelui.cpp -impl configurationpanelui.h configurationpanel.ui
$(UIC) -o gui/qt/phonebookui.h gui/qt/phonebook.ui
$(UIC) -o gui/qt/phonebookui.cpp -impl gui/qt/phonebookui.h gui/qt/phonebook.ui
$(UIC) -o gui/qt/url_inputui.h gui/qt/url_input.ui
$(UIC) -o gui/qt/url_inputui.cpp -impl gui/qt/url_inputui.h gui/qt/url_input.ui
$(UIC) -o gui/qt/configurationpanelui.h gui/qt/configurationpanel.ui
$(UIC) -o gui/qt/configurationpanelui.cpp -impl gui/qt/configurationpanelui.h gui/qt/configurationpanel.ui
%.moc.cpp: %.h
$(MOC) -o $@ $<
......@@ -106,21 +120,21 @@ all: $(PROGNAME)
$(PROGNAME): $(OBJS) $(EXTRALIBS)
$(CXX) -o $@ $(OBJS) $(LIBS) $(EXTRALIBS)
install: all
mkdir -p $(BIN_DIR)
mkdir -p $(SHARE_DIR)/$(PROGNAME)
install --mode=0755 $(PROGNAME) $(BIN_DIR)
cd ..; cp -R $(PIXMAPS) $(SHARE_DIR)/$(PROGNAME)/ ; \
chmod -R a+rX $(SHARE_DIR)/$(PROGNAME)/$(PIXMAPS)
cd ..; cp -R $(SKINS) $(SHARE_DIR)/$(PROGNAME)/ ; \
chmod -R a+rX $(SHARE_DIR)/$(PROGNAME)/$(SKINS)
cd ..; cp -R $(RINGS) $(SHARE_DIR)/$(PROGNAME)/ ; \
chmod -R a+rX $(SHARE_DIR)/$(PROGNAME)/$(RINGS)
uninstall:
rm -f $(BIN_DIR)/$(PROGNAME)
rm -rf $(SHARE_DIR)/$(PROGNAME)
#install: all
# mkdir -p $(BIN_DIR)
# mkdir -p $(SHARE_DIR)/$(PROGNAME)
# install --mode=0755 $(PROGNAME) $(BIN_DIR)
# cd ..; cp -R $(PIXMAPS) $(SHARE_DIR)/$(PROGNAME)/ ; \
# chmod -R a+rX $(SHARE_DIR)/$(PROGNAME)/$(PIXMAPS)
# cd ..; cp -R $(SKINS) $(SHARE_DIR)/$(PROGNAME)/ ; \
# chmod -R a+rX $(SHARE_DIR)/$(PROGNAME)/$(SKINS)
# cd ..; cp -R $(RINGS) $(SHARE_DIR)/$(PROGNAME)/ ; \
# chmod -R a+rX $(SHARE_DIR)/$(PROGNAME)/$(RINGS)
#
#uninstall:
# rm -f $(BIN_DIR)/$(PROGNAME)
# rm -rf $(SHARE_DIR)/$(PROGNAME)
clean:
rm -f $(PROGNAME) *.o *.a *~ *.moc.cpp *.bak core.*
rm -f $(PROGNAME) *.o audio/*.o audio/gsm/*.o gui/*.o gui/qt/*.o audio/gsm/*.a *~ *.moc.cpp *.bak core.*
/**
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "g711.h"
#include "alaw.h"
Alaw::Alaw(int payload, const string& codec) : AudioCodec(payload, codec)
{
_codecName = codec;
_payload = payload;
}
Alaw::~Alaw (void)
{
}
int
Alaw::codecDecode (short *dst, unsigned char *src, unsigned int size)
{
return G711::ALawDecode (dst, src, size);
}
int
Alaw::codecEncode (unsigned char *dst, short *src, unsigned int size)
{
return G711::ALawEncode (dst, src, size);
}
/**
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ALAW_H__
#define __ALAW_H__
#include "audiocodec.h"
class Alaw : public AudioCodec {
public:
Alaw (int payload, const string& codec);
~Alaw (void);
int codecDecode (short *, unsigned char *, unsigned int);
int codecEncode (unsigned char *, short *, unsigned int);
private:
string _codecName;
int _payload;
};
#endif // __ULAW_H__
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net>
......@@ -21,7 +21,7 @@
*/
#include "audiobuffer.h"
#include "global.h"
#include "../global.h"
#include <string.h>
......
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net>
......
/*
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2,
* or (at your option) any later version.
*
* This is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with dpkg; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <endian.h>
#include <string.h>
#include <iostream>
#include <string>
#include "audiocodec.h"
#include "../configuration.h"
using namespace std;
AudioCodec::AudioCodec (int payload, const string& codec) {
_codecName = codec;
_payload = payload;
}
AudioCodec::~AudioCodec (void) {
}
void
AudioCodec::setCodecName (const string& codec)
{
_codecName = codec;
}
string
AudioCodec::getCodecName (void)
{
return _codecName;
}
/**
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CODEC_AUDIO_H__
#define __CODEC_AUDIO_H__
#include <string>
using namespace std;
class AudioCodec {
public:
AudioCodec(int payload, const string& codec);
virtual ~AudioCodec (void);
virtual int codecDecode (short *, unsigned char *, unsigned int) = 0;
virtual int codecEncode (unsigned char *, short *, unsigned int) = 0;
void setCodecName (const string& codec);
string getCodecName (void);
private:
string _codecName;
int _payload;
};
#endif // __CODEC_AUDIO_H__
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net>
......
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author : Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net>
......
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
......@@ -31,7 +31,7 @@
#include <errno.h>
#include "audiodriversalsa.h"
#include "global.h"
#include "../global.h"
#define ALSA_DEVICE "plughw:0,0"
......
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
......@@ -23,7 +23,7 @@
#include <alsa/asoundlib.h>
#include "audiodrivers.h"
#include "error.h"
#include "../error.h"
/**
......
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net>
......@@ -32,7 +32,7 @@
#include <stdio.h>
#include "audiodriversoss.h"
#include "global.h"
#include "../global.h"
AudioDriversOSS::AudioDriversOSS (DeviceMode mode, Error *error) :
......
/**
* Copyright (C) 2004 Savoir-Faire Linux inc.
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
*
* Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net>
......@@ -25,7 +25,7 @@
#include "audiodrivers.h"
#include "error.h"
#include "../error.h"
// TODO : a mettre dans config
#define AUDIO_DEVICE "/dev/dsp"
......
......@@ -20,21 +20,17 @@
#include <cstdio>
#include <cstdlib>
#include <ccrtp/rtp.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <qhostaddress.h>
#include <qstring.h>
#include <iostream>
#include <string>
#include "audiocodec.h"
#include "configuration.h"
#include "manager.h"
#include "audiortp.h"
#include "sip.h"
#include "../configuration.h"
#include "../manager.h"
#include "../user_cfg.h"
#include "../sipcall.h"
#include "../stund/stun.h"
#include <string>
using namespace ost;
using namespace std;
......@@ -44,14 +40,16 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////
AudioRtp::AudioRtp (Manager *manager) {
string svr;
this->manager = manager;
RTXThread = NULL;
_manager = manager;
_RTXThread = NULL;
if (!manager->useStun()) {
if (Config::gets("Signalisations", "SIP.sipproxy") == "") {
svr = Config::gets("Signalisations", "SIP.sipproxy");
if (get_config_fields_str(SIGNALISATION, PROXY).empty()) {
svr = get_config_fields_str(SIGNALISATION, PROXY);
}
} else {
svr = Config::gets("Signalisations", "SIP.hostPart");
svr = get_config_fields_str(SIGNALISATION, HOST_PART);
}
}
......@@ -62,24 +60,24 @@ int
AudioRtp::createNewSession (SipCall *ca) {
// Start RTP Send/Receive threads
ca->enable_audio = 1;
if (!manager->useStun()) {
symetric = false;
if (!_manager->useStun()) {
_symetric = false;
} else {
symetric = true;
_symetric = true;
}
#ifdef ALSA
if (manager->useAlsa) {
RTXThread = new AudioRtpRTX (ca, manager->audiodriver,
manager->audiodriverReadAlsa, manager, symetric);
if (_manager->useAlsa()) {
_RTXThread = new AudioRtpRTX (ca, _manager->audiodriver,
_manager->audiodriverReadAlsa, _manager, _symetric);
}
#endif
if (!manager->useAlsa) {
RTXThread = new AudioRtpRTX (ca, manager->audiodriver, NULL, manager,
symetric);
if (!_manager->useAlsa()) {
_RTXThread = new AudioRtpRTX (ca, _manager->audiodriver, NULL,_manager,
_symetric);
}
if (RTXThread->start() != 0) {
if (_RTXThread->start() != 0) {
return -1;
}
......@@ -92,13 +90,13 @@ AudioRtp::closeRtpSession (SipCall *ca) {
// This will make RTP threads finish.
ca->enable_audio = -1;
if (RTXThread != NULL) {
delete RTXThread;
RTXThread = NULL;
if (_RTXThread != NULL) {
delete _RTXThread;
_RTXThread = NULL;
}
// Flush audio read buffer
manager->audiodriver->resetDevice();
_manager->audiodriver->resetDevice();
}
////////////////////////////////////////////////////////////////////////////////
......@@ -106,46 +104,46 @@ AudioRtp::closeRtpSession (SipCall *ca) {
////////////////////////////////////////////////////////////////////////////////
AudioRtpRTX::AudioRtpRTX (SipCall *sipcall, AudioDrivers *driver,
AudioDrivers *read_driver, Manager *mngr, bool sym) {
this->time = new Time();
this->manager = mngr;
this->ca = sipcall;
this->sym =sym;
this->audioDevice = driver;
time = new Time();
_manager = mngr;
_ca = sipcall;
_sym =sym;
_audioDevice = driver;