diff --git a/CHANGES b/CHANGES index 26d6b6057dc66c8ece52269c37bef628a2b48bf7..0854f0eebab7ac2483894ff3c3d97caefca65051 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ +SFLphone (0.4.1) / 2005-08-11 + * Use libeXosip2 + * Add blink notification for voice-message + SFLphone (0.4) / 2005-07-06 * Cleanup code * Add autotools support diff --git a/ChangeLog b/ChangeLog index 3cf42029ec02c87dbbe384bd5aa2a3ab163abc4f..6c8da483939ca9e2c1481ac5146ffd7e29974f3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Laurielle LEA (10 August 2005) version 0.4 +- Add blink notification for voice-message +- Cleanup code + Laurielle LEA (1st August 2005) version 0.4 - Add comments in header files diff --git a/README b/README index eb94683c8473c26f7f7ccab952a310e9ba48d803..62eb859d3134faf6b6dc004296e0bdd5046b4d51 100644 --- a/README +++ b/README @@ -1,5 +1,6 @@ This is SFLPhone-0.4 release. + You need ccrtp-1.3.0 which needs commoncpp2>=1.3.0 libeXosip2-1.9.1-pre15 needs libosip2-2.2.0 You also need PortAudio_v19 @@ -148,6 +149,8 @@ Don't hesitate to post your comments/suggestions/questions on the forge.novell mailing-list. +Jean-Philippe Barette-LaPierre +(jean-philippe.barrette-lapierre@savoirfairelinux.com) Laurielle Lea (laurielle.lea@savoirfairelinux.com) Jerome Oufella (jerome.oufella@savoirfairelinux.com) diff --git a/TODO b/TODO index bbedbd4c02eb068dbc61340c990117bb6c22fc97..58ead5e53a195e2e1a3a9a34d5199e2b59ac1961 100644 --- a/TODO +++ b/TODO @@ -8,7 +8,7 @@ For project core: Management of message blinking-notification Management Config like about:config in Mozilla Improvement of STUN -Add ZeroConf +Add ZeroConf support with mDNSResponder-107.1 library from apple Add IAX support Management of account (add, remove, ...) Management of exceptions diff --git a/src/audio/tonegenerator.cpp b/src/audio/tonegenerator.cpp index 6d0760f4363a65c4c5e49c35df61394b5fc42c99..140ea786a28362f5a816118a2d9ba5cfce822a92 100644 --- a/src/audio/tonegenerator.cpp +++ b/src/audio/tonegenerator.cpp @@ -17,9 +17,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <math.h> #include <iostream> #include <fstream> +#include <math.h> #include <stdlib.h> #include "audiolayer.h" diff --git a/src/audio/tonegenerator.h b/src/audio/tonegenerator.h index 26f67275ff9600238f3b75c833ee645df3f06591..de0aa541f72d82abb132f1dfe01eab898a9c344d 100644 --- a/src/audio/tonegenerator.h +++ b/src/audio/tonegenerator.h @@ -69,22 +69,42 @@ public: ToneGenerator (); ~ToneGenerator (void); - string toneZone[NB_ZONES_MAX][NB_TONES_MAX]; - + /** + * Returns id selected zone for tone choice + */ int idZoneName (const string &); + /** + * Calculate sinus with superposition of 2 frequencies + */ void generateSin (int, int, int16 *); + + /** + * Build tone according to the id-zone, with initialisation of ring tone. + * Generate sinus with frequencies alternatively by time + */ void buildTone (int, int, int16*); + + /** + * Handle the required tone + */ void toneHandle (int); + + /** + * Play the ringtone when incoming call occured + */ int playRingtone (const char*); + /////////////////////////// + // Public members variable + ////////////////////////// int16 *sample; int freq1, freq2; int time; int totalbytes; - int16 buf[SIZEBUF]; + private: /* * Initialisation of the supported tones according to the countries. @@ -100,6 +120,10 @@ private: */ int contains(const string& str, char c); + ////////////////////////// + // Private member variable + ////////////////////////// + string toneZone[NB_ZONES_MAX][NB_TONES_MAX]; ToneThread* tonethread; }; diff --git a/src/gui/guiframework.h b/src/gui/guiframework.h index f91e47c6bde9d80f43bbf1fdfcce8daddb66e105..edd4bcff7bf70ebcb09086faf5150787ff2e4009 100644 --- a/src/gui/guiframework.h +++ b/src/gui/guiframework.h @@ -45,6 +45,8 @@ public: virtual void setup (void) = 0; virtual int selectedCall (void) = 0; virtual bool isCurrentId (short) = 0; + virtual void startVoiceMessageNotification (void) = 0; + virtual void stopVoiceMessageNotification (void) = 0; /* Child class to parent class */ int outgoingCall (const string& to); diff --git a/src/gui/qt/qtGUImainwindow.cpp b/src/gui/qt/qtGUImainwindow.cpp index 4c405f70bf0cc6a765a360b460d217756404ab74..32696aa669e17d0df73de1a8295879e3a50624a6 100644 --- a/src/gui/qt/qtGUImainwindow.cpp +++ b/src/gui/qt/qtGUImainwindow.cpp @@ -1295,11 +1295,16 @@ QtGUIMainWindow::hangupLine (void) * Stop the blinking message slot and load the message-off button pixmap. */ void -QtGUIMainWindow::stopTimerMessage (void) { +QtGUIMainWindow::stopVoiceMessageNotification (void) { _msgVar = false; phoneKey_msg->setPixmap(TabMsgPixmap[FREE]); } +void +QtGUIMainWindow::startVoiceMessageNotification (void) { + _msgVar = true; +} + /** * Stop the call timer. * @@ -1348,16 +1353,8 @@ QtGUIMainWindow::volumeMicChanged (int val) { void QtGUIMainWindow::registerSlot (void) { - static bool reg = false; - _panel->saveSlot(); - if (!reg) { - registerVoIPLink(); - reg = true; - } else { - unregisterVoIPLink(); - reg = false; - } + registerVoIPLink(); } /** @@ -1383,7 +1380,7 @@ QtGUIMainWindow::blinkLineSlot (void) { // Dial the voicemail Number automatically when button is clicked void QtGUIMainWindow::button_msg (void) { - stopTimerMessage(); + stopVoiceMessageNotification(); _lcd->clearBuffer(); _lcd->appendText(get_config_fields_str(PREFERENCES, VOICEMAIL_NUM)); if (qt_outgoingCall() == -1) { diff --git a/src/gui/qt/qtGUImainwindow.h b/src/gui/qt/qtGUImainwindow.h index 8b3accef5f24aa9fda5884e903ae5a7f40711a5e..4b483ccad8d65e6c37aa9fe3cf8f7abbb2708b83 100644 --- a/src/gui/qt/qtGUImainwindow.h +++ b/src/gui/qt/qtGUImainwindow.h @@ -96,6 +96,7 @@ public: virtual void displayContext (short id); virtual string getRingtoneFile (void); virtual void setup (void); + /* * Return the id matching to the chosen line */ @@ -166,7 +167,8 @@ public: /* * Stop the blinking-signal when you check your voicemail (not used yet) */ - void stopTimerMessage (void); + void stopVoiceMessageNotification (void); + void startVoiceMessageNotification (void); /* * Manage if you selected a line before dialing @@ -184,7 +186,7 @@ public: * Manage if you are in transfer mode */ inline void setTransfer (bool b) { _transfer = b; } - inline bool getTransfer (void) {return _transfer; } + inline bool getTransfer (void) { return _transfer; } signals: void keyPressed (int); diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 7ef766632fdad99f932183c511549c3f0e2c6940..0278399cbfc005ced5d81c6d1dcad364ad5b091d 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -23,9 +23,9 @@ # include <sys/types.h> // mkdir(2) # include <sys/stat.h> // mkdir(2) -#include <sys/socket.h> // inet_ntoa() -#include <netinet/in.h> -#include <arpa/inet.h> +//#include <sys/socket.h> // inet_ntoa() +//#include <netinet/in.h> +//#include <arpa/inet.h> #include <cc++/thread.h> #include <cstdlib> @@ -64,7 +64,6 @@ ManagerImpl::ManagerImpl (void) _error = new Error(); _tone = new ToneGenerator(); - _nCalls = 0; _nCodecs = 0; _currentCallId = 0; @@ -77,7 +76,6 @@ ManagerImpl::ManagerImpl (void) _ringback = false; _exist = 0; _loaded = false; - } ManagerImpl::~ManagerImpl (void) @@ -513,7 +511,6 @@ ManagerImpl::incomingCall (short id) return _gui->incomingCall(id); } -// L'autre personne a repondu void ManagerImpl::peerAnsweredCall (short id) { @@ -604,6 +601,18 @@ ManagerImpl::isCurrentId (short id) return _gui->isCurrentId(id); } +void +ManagerImpl::startVoiceMessageNotification (void) +{ + _gui->startVoiceMessageNotification(); +} + +void +ManagerImpl::stopVoiceMessageNotification (void) +{ + _gui->stopVoiceMessageNotification(); +} + void ManagerImpl::congestion (bool var) { if (isDriverLoaded()) { @@ -643,7 +652,7 @@ ManagerImpl::ringtone (bool var) if (_ringtone != var) { _ringtone = var; } - + _zonetone = var; if (getNumberOfCalls() == 1) { // If just one line is ringing @@ -663,7 +672,7 @@ ManagerImpl::notificationIncomingCall (void) { _tone->generateSin(440, 0, buffer); - // Control volume + // Volume Control buf_ctrl_vol = new int16[size*CHANNELS]; spkrVolume = getSpkrVolume(); for (int j = 0; j < size; j++) { @@ -751,7 +760,6 @@ ManagerImpl::useStun (void) { } } - /////////////////////////////////////////////////////////////////////////////// // Private functions /////////////////////////////////////////////////////////////////////////////// @@ -791,7 +799,7 @@ ManagerImpl::createSettingsPath (void) { } } - // Load user's config + // Load user's configuration _path = _path + "/" + PROGNAME + "rc"; exist = Config::tree()->populateFromFile(_path); diff --git a/src/managerimpl.h b/src/managerimpl.h index 17a372d8d8a371f1130a3c960bbce08bb310e3fe..958e3e1c75c709e7a8e3c68c062ae70df08f22d5 100644 --- a/src/managerimpl.h +++ b/src/managerimpl.h @@ -179,6 +179,8 @@ public: void displayStatus (const string& status); int selectedCall (void); bool isCurrentId (short id); + void startVoiceMessageNotification (void); + void stopVoiceMessageNotification (void); /* * Handle audio sounds heard by a caller while they wait for their diff --git a/src/sipcall.cpp b/src/sipcall.cpp index 84fef206d8631030723a0f1ddde177a7722ecca3..a22ab74721ec62e68f2b6e29afc9f229c96fe832 100644 --- a/src/sipcall.cpp +++ b/src/sipcall.cpp @@ -26,9 +26,6 @@ // For AF_INET #include <sys/socket.h> -#include <sys/types.h> -#include <netinet/in.h> -// #include "global.h" #include "audio/audiocodec.h" diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index 3b11d5f446e849bd47117e182d9d7382f49ea0a0..a26cf65cf82e5b9040c866955dec851878e1f9e9 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -2,6 +2,8 @@ * Copyright (C) 2004-2005 Savoir-Faire Linux inc. * Author : Laurielle Lea <laurielle.lea@savoirfairelinux.com> * + * Portions Copyright (C) 2002,2003 Aymeric Moizard <jack@atosc.org> + * * 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 @@ -50,6 +52,8 @@ using namespace std; #define DEFAULT_LOCAL_PORT 10500 #define RANDOM_LOCAL_PORT ((rand() % 27250) + 5250)*2 +#define VOICE_MSG "Voice-Message" +#define LENGTH_VOICE_MSG 15 SipVoIPLink::SipVoIPLink (short id) : VoIPLink (id) { @@ -57,6 +61,7 @@ SipVoIPLink::SipVoIPLink (short id) : VoIPLink (id) _localPort = 0; _cid = 0; _reg_id = -1; + _nMsgVoicemail = 0; _evThread = new EventThread (this); _sipcallVector = new SipCallVector(); _audiortp = new AudioRtp(); @@ -120,7 +125,9 @@ SipVoIPLink::init (void) } + // Set user agent eXosip_set_user_agent(tmp.data()); + _evThread->start(); return 1; } @@ -145,7 +152,6 @@ int SipVoIPLink::setRegister (void) { int i; -// int reg_id = -1; osip_message_t *reg = NULL; string proxy = "sip:" + get_config_fields_str(SIGNALISATION, PROXY); @@ -199,6 +205,7 @@ SipVoIPLink::setRegister (void) eXosip_unlock(); Manager::instance().error()->setError(0); + return i; } @@ -209,6 +216,8 @@ SipVoIPLink::setUnregister (void) // int reg_id = -1; osip_message_t *reg = NULL; + eXosip_lock(); + if (_reg_id > 0) { _debug("UNREGISTER\n"); i = eXosip_register_build_register (_reg_id, 0, ®); @@ -218,7 +227,7 @@ SipVoIPLink::setUnregister (void) eXosip_unlock(); return -1; } - + i = eXosip_register_send_register (_reg_id, reg); if (i == -2) { _debug("cannot build registration, check the setup\n"); @@ -552,6 +561,7 @@ SipVoIPLink::getEvent (void) if (event == NULL) { return -1; } + switch (event->type) { // IP-Phone user receives a new call case EXOSIP_CALL_INVITE: // @@ -698,8 +708,11 @@ SipVoIPLink::getEvent (void) eXosip_automatic_action(); eXosip_unlock(); break; - case BAD_REQ: case UNAUTHORIZED: + setAuthentication(); + break; + + case BAD_REQ: case FORBIDDEN: case NOT_FOUND: case NOT_ALLOWED: @@ -773,6 +786,48 @@ SipVoIPLink::getEvent (void) eXosip_options_send_answer (event->tid, BUSY_HERE, NULL); } eXosip_unlock(); + } + + // Voice message + else if (event->request != NULL && MSG_IS_NOTIFY(event->request)){ + int ii; + unsigned int pos; + unsigned int pos_slash; + string *str; + string nb_msg; + osip_body_t *body; + + // Get the message body + ii = osip_message_get_body(event->request, 0, &body); + if (ii != 0) { + _debug("Cannot get body\n"); + return -1; + } + + // Analyse message body + str = new string(body->body); + pos = str->find (VOICE_MSG); + + if (pos == string::npos) { + // If the string is not found + return -1; + } + + pos_slash = str->find ("/"); + nb_msg = str->substr(pos + LENGTH_VOICE_MSG, + pos_slash - (pos + LENGTH_VOICE_MSG)); + + // Set the number of voice-message + setMsgVoicemail(atoi(nb_msg.data())); + + if (getMsgVoicemail() != 0) { + // If there is at least one voice-message, start notification + Manager::instance().startVoiceMessageNotification(); + } else { + // Stop notification when there is 0 voice message + Manager::instance().stopVoiceMessageNotification(); + } + delete str; } break; diff --git a/src/sipvoiplink.h b/src/sipvoiplink.h index e8caf1ffadb37eb31118ad4deb59129a41ce854d..f0ec02e48448003d535ec0d3fecb843b06b81958 100644 --- a/src/sipvoiplink.h +++ b/src/sipvoiplink.h @@ -1,7 +1,9 @@ /** * Copyright (C) 2004-2005 Savoir-Faire Linux inc. * Author : Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * + * + * Portions Copyright (C) 2002,2003 Aymeric Moizard <jack@atosc.org> + * * 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 @@ -125,6 +127,10 @@ public: // Use to Cancel inline void setCid (int cid) { _cid = cid; } inline int getCid (void) { return _cid; } + + // Handle voice-message + inline void setMsgVoicemail (int nMsg) { _nMsgVoicemail = nMsg; } + inline int getMsgVoicemail (void) { return _nMsgVoicemail; } private: /* @@ -215,6 +221,7 @@ private: int _localPort; int _cid; int _reg_id; + int _nMsgVoicemail; }; #endif // __SIP_VOIP_LINK_H__ diff --git a/src/skin.cpp b/src/skin.cpp index 97d1261e5540a865d095eade9092e57e71343ed3..b4d98092612bd11a6019b3b1423bcc92b142401f 100644 --- a/src/skin.cpp +++ b/src/skin.cpp @@ -20,9 +20,6 @@ #include "skin.h" -#ifndef PROGSHAREDIR -#error "You must run configure to define PREFIX and PROGSHAREDIR." -#endif const char* PIXMAP_LINE_NAMES[] = { PIXMAP_LINE0_OFF,