diff --git a/build-package.sh b/build-package.sh index dc0bee0e935ab4efefba029d83fc4eb599830d82..a2c775ac077e8d1f9aedf5cc837277e5f99aca2b 100755 --- a/build-package.sh +++ b/build-package.sh @@ -16,24 +16,23 @@ fi # Anonymous git http access git clone http://sflphone.org/git/sflphone.git -git checkout debian/0.9.2-4 +cd sflphone +git checkout origin/release -b release # Get system parameters arch_flag=`getconf -a|grep LONG_BIT | sed -e 's/LONG_BIT\s*//'` os_version=`lsb_release -d -s -c | sed -e '1d'` # Generate the changelog, according to the distribution and the git commit messages -git-dch --release +cp debian/changelog.$os_version debian/changelog +git-dch --debian-branch=release --release +cd .. # Remove useless git directory rm sflphone/.git/ -rf # Copy the appropriate control file based on different archtecture -if [ $arch_flag -eq 32 ];then - cp sflphone/debian/control.$os_version.i386 sflphone/debian/control -elif [ $arch_flag -eq 64 ];then - cp sflphone/debian/control.$os_version.amd64 sflphone/debian/control -fi +cp sflphone/debian/control.$os_version sflphone/debian/control echo "Building sflphone package on Ubuntu $os_version $arch_flag bit architecture...." @@ -48,6 +47,7 @@ wget -q http://www.sflphone.org/downloads/gpg/sflphone.gpg.asc -O- | gpg --impor cd sflphone-0.9.2/debian; debuild -k'Savoir-Faire Linux Inc.' # Clean +cd ../.. rm sflphone-0.9.2/ -rf rm sflphone/ -rf diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000000000000000000000000000000000..645b87bab9f9fcf59117b4c64fee8730ee87b5fb --- /dev/null +++ b/debian/changelog @@ -0,0 +1,107 @@ +sflphone (0.9.2-2ubuntu4) intrepid; urgency=low + + [ Emmanuel Milou ] + * add german translation + + [ Yun Liu ] + * Fix GUI crash in Ubuntu8.10 64bit system + + -- Yun Liu <yun.liu@savoirfairelinux.com> Thu, 08 Jan 2009 13:08:51 -0500 + +sflphone (0.9.2-2ubuntu3) intrepid; urgency=low + + [ Emmanuel Milou ] + * The main thread synchronizes the ringtone thread + * disable custom ringtone for the ALSA layer + * Fix the Makefile.am in man directory, add a SEE ALSO section + + [ Yun Liu ] + * Fix daemon crash caused by the previous patch ( for bug ticket #129) + + -- Yun Liu <yun.liu@savoirfairelinux.com> Tue, 06 Jan 2009 16:18:38 -0500 + +sflphone (0.9.2-2ubuntu2) intrepid; urgency=low + + * Fix bug ticket #129 + + -- Yun Liu <yun.liu@savoirfairelinux.com> Wed, 5 Jan 2009 15:54:53 -0500 + +sflphone (0.9.2-2ubuntu1) intrepid; urgency=low + + * Migrate from eXosip library to pjsip + * Add multiple SIP accounts support + * Fix ringtones problems + * Add a pulseaudio support + * Improve audio quality with ALSA + * Add chinese translation + * Improve spanish translation + * Migrate to a maintained C++ DBus bindings + * Clean and improve the build system + * Add build-dependency on Perl because we need pod2man to generate manpages + + -- Yun Liu <yun.liu@savoirfairelinux.com> Wed, 26 Nov 2008 09:47:53 -0500 + +sflphone (0.9.1) unstable; urgency=low + * Add a search tool in the history + * Migrate some gtk_entry_new to sexy_icon_entry_new + * Bug fix (Ticket #78): The voicemail password isn't displayed anymore in + the history tab + * Add the SIP registration expire value in the user file. + + -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Thu, 22 May 2008 11:14:25 -0500 + +sflphone (0.9.0) unstable; urgency=low + * Add history features + * Call date + * Call duration + * Mouse events in the history tab + * Smooth switch from the history tab to the calls tab + * Remove most of GTK-Critical warnings + + -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 13 May 2008 16:58:25 -0500 + +sflphone (0.9-2008-06-06) unstable; urgency=low + * Audio bug correction: capture stopped after a few minutes of conversation + with USB Plantronics sound card + + -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Tue, 06 May 2008 16:58:25 -0500 + +sflphone (0.9-2008-05-06) unstable; urgency=low + * Bug correction: account creation with the assistant + * GTK+ warnings removal + * libnotify warnings removal + * Remove aliasing on the SFLphone logo + + -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Mon, 05 May 2008 16:58:25 -0500 + +sflphone (0.9) unstable; urgency=low + * Clean dependencies ( removal of libboost ) + * Several GTK improvement and updates + -account window + -configuration window + * Migrate from GtkCheckMenuItem to GtkImageMenuItem + * ALSA standard I/O transfers: MMAP instead of R/W + * Fix speex audio quality + * IAX2 protocol + -Fix hold/unhold situation + -Add on hold music + * SIP protocol + -Ringtone on incoming call + -Fix transfer situation + * Add desktop notification ( libnotify ) + * Improve the system tray icon behaviour + * Improve registration error handling + * Register/unregister from the account window takes effect without starting back SFLphone + * Compilation warnings removal + * Call history + * Add an account configuration wizard + + -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Wed, 30 Apr 2008 16:58:25 -0500 + +sflphone (0.8.2) unstable; urgency=low + * Internationalization of the GTK GUI + * English / French + * STUN support + * Slight modifications of the graphical interface ( tooltips, dialpad, ...) + + -- Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Fri, 21 Mar 2008 11:37:53 -0500 diff --git a/debian/control.hardy.i386 b/debian/control.hardy similarity index 98% rename from debian/control.hardy.i386 rename to debian/control.hardy index e27aa52a287405eee4b7c40ae86dc13687f1f25b..f90c5d57c9b6137a9d8fe5cb308892c978091c04 100644 --- a/debian/control.hardy.i386 +++ b/debian/control.hardy @@ -7,7 +7,7 @@ Standards-Version: 3.7.3 Package: sflphone Priority: optional -Architecture: i386 +Architecture: any Depends: libgcc1 , libsamplerate0 (>=0.1.2) , libdbus-glib-1-2 (>= 0.73), libexpat1 , libgtk2.0-0 , libc6 (>= 2.3.6-6) , libglib2.0-0 (>= 2.12.0) , libcommoncpp2-1.6-0 , sflphone-iax2, libgsm1 (>=1.0.10) , libspeex1 (>=1.1.12) , libdbus-1-3, libdbus-glib-1-2, dbus-c++-1 (>=0.5.0) , libsexy2 (>=0.1.11), libcppunit-1.12-0, libasound2 (>= 1.0), libpulse0 (>= 0.9.6), libccrtp1-1.6-0, libnotify1 (>= 0.4), libsexy2 (>= 0.1), perl (>=5.5.8) Homepage: http://www.sflphone.org Description: SIP and IAX2 compatible softphone diff --git a/debian/control.hardy.amd64 b/debian/control.hardy.amd64 deleted file mode 100644 index 6e005480a3f1339c0a4fce481da316d9aa0ac422..0000000000000000000000000000000000000000 --- a/debian/control.hardy.amd64 +++ /dev/null @@ -1,17 +0,0 @@ -Source: sflphone -Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com> -Section: gnome -Priority: optional -Build-Depends: debhelper (>= 5) -Standards-Version: 3.7.3 - -Package: sflphone -Priority: optional -Architecture: amd64 -Depends: libgcc1 , libsamplerate0 (>=0.1.2) , libdbus-glib-1-2 (>= 0.73), libexpat1 , libgtk2.0-0 , libc6 (>= 2.3.6-6) , libglib2.0-0 (>= 2.12.0) , libcommoncpp2-1.6-0 , sflphone-iax2, libgsm1 (>=1.0.10) , libspeex1 (>=1.1.12) , libdbus-1-3, libdbus-glib-1-2, dbus-c++-1 (>=0.5.0) , libsexy2 (>=0.1.11), libcppunit-1.12-0, libasound2 (>= 1.0), libpulse0 (>= 0.9.6), libccrtp1-1.6-0, libnotify1 (>= 0.4), libsexy2 (>= 0.1), perl (>=5.5.8) -Homepage: http://www.sflphone.org -Description: SIP and IAX2 compatible softphone - SFLphone is meant to be a robust enterprise-class desktop phone. - SFLphone is released under the GNU General Public License. - SFLphone is being developed by the global community, and maintained by - Savoir-faire Linux, a Montreal, Quebec, Canada-based Linux consulting company. diff --git a/debian/control.intrepid.i386 b/debian/control.intrepid similarity index 98% rename from debian/control.intrepid.i386 rename to debian/control.intrepid index 5095bba2da064af511824b5e0b18a00b3d23bbb7..45e00af203e28dd5e19ad962dc2dad4f23e9acd6 100644 --- a/debian/control.intrepid.i386 +++ b/debian/control.intrepid @@ -7,7 +7,7 @@ Standards-Version: 3.8.0 Package: sflphone Priority: optional -Architecture: i386 +Architecture: any Depends: libgcc1 , libsamplerate0 (>=0.1.2) , libdbus-glib-1-2 (>= 0.73), libexpat1 , libgtk2.0-0 , libc6 (>= 2.3.6-6) , libglib2.0-0 (>= 2.12.0) , libcommoncpp2-1.6-0 , sflphone-iax2, libgsm1 (>=1.0.10) , libspeex1 (>=1.1.12) , libdbus-1-3, libdbus-glib-1-2, dbus-c++-1 (>=0.5.0) , libsexy2 (>=0.1.11), libcppunit-1.12-1, libasound2 (>= 1.0), libpulse0 (>= 0.9.6), libccrtp1-1.6-1, libnotify1 (>= 0.4), libsexy2 (>= 0.1), perl (>=5.5.8) Homepage: http://www.sflphone.org Description: SIP and IAX2 compatible softphone diff --git a/debian/control.intrepid.amd64 b/debian/control.intrepid.amd64 deleted file mode 100644 index eafb6792fa47b638c2906320d191d77528161560..0000000000000000000000000000000000000000 --- a/debian/control.intrepid.amd64 +++ /dev/null @@ -1,17 +0,0 @@ -Source: sflphone -Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com> -Section: gnome -Priority: optional -Build-Depends: debhelper (>= 5) -Standards-Version: 3.8.0 - -Package: sflphone -Priority: optional -Architecture: amd64 -Depends: libgcc1 , libsamplerate0 (>=0.1.2) , libdbus-glib-1-2 (>= 0.73), libexpat1 , libgtk2.0-0 , libc6 (>= 2.3.6-6) , libglib2.0-0 (>= 2.12.0) , libcommoncpp2-1.6-0 , sflphone-iax2, libgsm1 (>=1.0.10) , libspeex1 (>=1.1.12) , libdbus-1-3, libdbus-glib-1-2, dbus-c++-1 (>=0.5.0) , libsexy2 (>=0.1.11), libcppunit-1.12-1, libasound2 (>= 1.0), libpulse0 (>= 0.9.6), libccrtp1-1.6-1, libnotify1 (>= 0.4), libsexy2 (>= 0.1), perl (>=5.5.8) -Homepage: http://www.sflphone.org -Description: SIP and IAX2 compatible softphone - SFLphone is meant to be a robust enterprise-class desktop phone. - SFLphone is released under the GNU General Public License. - SFLphone is being developed by the global community, and maintained by - Savoir-faire Linux, a Montreal, Quebec, Canada-based Linux consulting company. diff --git a/debian/control.jaunty.i386 b/debian/control.jaunty similarity index 98% rename from debian/control.jaunty.i386 rename to debian/control.jaunty index e27aa52a287405eee4b7c40ae86dc13687f1f25b..f90c5d57c9b6137a9d8fe5cb308892c978091c04 100644 --- a/debian/control.jaunty.i386 +++ b/debian/control.jaunty @@ -7,7 +7,7 @@ Standards-Version: 3.7.3 Package: sflphone Priority: optional -Architecture: i386 +Architecture: any Depends: libgcc1 , libsamplerate0 (>=0.1.2) , libdbus-glib-1-2 (>= 0.73), libexpat1 , libgtk2.0-0 , libc6 (>= 2.3.6-6) , libglib2.0-0 (>= 2.12.0) , libcommoncpp2-1.6-0 , sflphone-iax2, libgsm1 (>=1.0.10) , libspeex1 (>=1.1.12) , libdbus-1-3, libdbus-glib-1-2, dbus-c++-1 (>=0.5.0) , libsexy2 (>=0.1.11), libcppunit-1.12-0, libasound2 (>= 1.0), libpulse0 (>= 0.9.6), libccrtp1-1.6-0, libnotify1 (>= 0.4), libsexy2 (>= 0.1), perl (>=5.5.8) Homepage: http://www.sflphone.org Description: SIP and IAX2 compatible softphone diff --git a/debian/control.jaunty.amd64 b/debian/control.jaunty.amd64 deleted file mode 100644 index 6e005480a3f1339c0a4fce481da316d9aa0ac422..0000000000000000000000000000000000000000 --- a/debian/control.jaunty.amd64 +++ /dev/null @@ -1,17 +0,0 @@ -Source: sflphone -Maintainer: SavoirFaireLinux Inc <yun.liu@savoirfairelinux.com> -Section: gnome -Priority: optional -Build-Depends: debhelper (>= 5) -Standards-Version: 3.7.3 - -Package: sflphone -Priority: optional -Architecture: amd64 -Depends: libgcc1 , libsamplerate0 (>=0.1.2) , libdbus-glib-1-2 (>= 0.73), libexpat1 , libgtk2.0-0 , libc6 (>= 2.3.6-6) , libglib2.0-0 (>= 2.12.0) , libcommoncpp2-1.6-0 , sflphone-iax2, libgsm1 (>=1.0.10) , libspeex1 (>=1.1.12) , libdbus-1-3, libdbus-glib-1-2, dbus-c++-1 (>=0.5.0) , libsexy2 (>=0.1.11), libcppunit-1.12-0, libasound2 (>= 1.0), libpulse0 (>= 0.9.6), libccrtp1-1.6-0, libnotify1 (>= 0.4), libsexy2 (>= 0.1), perl (>=5.5.8) -Homepage: http://www.sflphone.org -Description: SIP and IAX2 compatible softphone - SFLphone is meant to be a robust enterprise-class desktop phone. - SFLphone is released under the GNU General Public License. - SFLphone is being developed by the global community, and maintained by - Savoir-faire Linux, a Montreal, Quebec, Canada-based Linux consulting company. diff --git a/install_deps.sh b/install_deps.sh new file mode 100755 index 0000000000000000000000000000000000000000..c6b8556791ca7493a97fd7cc4d39d2887cf42401 --- /dev/null +++ b/install_deps.sh @@ -0,0 +1,29 @@ +#!/bin/sh +sudo apt-get install build-essential +sudo apt-get install gnome-common +sudo apt-get install libalsaplayer0 +sudo apt-get install libalsaplayer-dev +sudo apt-get install libasound2-dev +sudo apt-get install libpulse-dev +sudo apt-get install libcommoncpp2-1.6-0 +sudo apt-get install libcommoncpp2-dev +sudo apt-get install libccrtp1-1.6-1 +sudo apt-get install libccrtp-dev +sudo apt-get install libsamplerate0 +sudo apt-get install libsamplerate0-dev +sudo apt-get install libdbus-1-dev +sudo apt-get install libexpat1-dev +sudo apt-get install ffmpeg +sudo apt-get install libhal1 +sudo apt-get install libhal-dev +sudo apt-get install libcppunit-1.12-1 +sudo apt-get install libcppunit-dev + +sudo apt-get install libgtk2.0-dev +sudo apt-get install libdbus-glib-1-dev +sudo apt-get install libnotifymm-dev +sudo apt-get install libnotify1 +sudo apt-get install libsexy-dev + +sudo apt-get install libgsm1-dev +sudo apt-get install libspeex-dev diff --git a/sflphone-gtk/src/accountlist.c b/sflphone-gtk/src/accountlist.c index 893d057d24ed2776acbc99cc65c8e33617b0ed53..455b68bd088d242de087eadf01410b56868625ed 100644 --- a/sflphone-gtk/src/accountlist.c +++ b/sflphone-gtk/src/accountlist.c @@ -171,9 +171,16 @@ const gchar * account_state_name(account_state_t s) break; case ACCOUNT_STATE_ERROR_NETWORK: state = _("Network unreachable"); - + break; + case ACCOUNT_STATE_ERROR_HOST: state = _("Host unreachable"); break; + case ACCOUNT_STATE_ERROR_CONF_STUN: + state = _("Stun configuration error"); + break; + case ACCOUNT_STATE_ERROR_EXIST_STUN: + state = _("Stun server invalid"); + break; default: state = _("Invalid"); break; diff --git a/sflphone-gtk/src/accountlist.h b/sflphone-gtk/src/accountlist.h index 18b5575d87504af68f280cdc15c35db0cbada95c..1887ea974e9596770133b76533ee7551a4e41813 100644 --- a/sflphone-gtk/src/accountlist.h +++ b/sflphone-gtk/src/accountlist.h @@ -46,7 +46,12 @@ typedef enum /** The network is unreachable. The account is not registered */ ACCOUNT_STATE_ERROR_NETWORK, /** Host is unreachable. The account is not registered */ - ACCOUNT_STATE_ERROR_HOST + ACCOUNT_STATE_ERROR_HOST, + /** Stun server configuration error. The account is not registered */ + ACCOUNT_STATE_ERROR_CONF_STUN, + /** Stun server is not existing. The account is not registered */ + ACCOUNT_STATE_ERROR_EXIST_STUN + } account_state_t; /** @struct account_t diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index 51088284a4783692e34d4851f51b3b70eb691751..19b024322b132ca6795e49cc34c007ebb390ce66 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -195,6 +195,14 @@ sflphone_fill_account_list(gboolean toolbarInitialized) { a->state = ACCOUNT_STATE_ERROR_HOST; } + else if(strcmp( status , "ERROR_CONF_STUN") == 0 ) + { + a->state = ACCOUNT_STATE_ERROR_CONF_STUN; + } + else if(strcmp( status , "ERROR_EXIST_STUN") == 0 ) + { + a->state = ACCOUNT_STATE_ERROR_EXIST_STUN; + } else { a->state = ACCOUNT_STATE_INVALID; diff --git a/src/iaxvoiplink.cpp b/src/iaxvoiplink.cpp index 34d1675a0059fe1396e8bc7233ac04acb5e85eea..6d04dffcaeae225d5d75207136262f3a36705b1c 100644 --- a/src/iaxvoiplink.cpp +++ b/src/iaxvoiplink.cpp @@ -761,7 +761,7 @@ IAXVoIPLink::iaxHandleRegReply(iax_event* event) iax_destroy(_regSession); _mutexIAX.leaveMutex(); _regSession = NULL; - setRegistrationState(Bad_Authentification); + setRegistrationState(ErrorAuth); } else if (event->etype == IAX_EVENT_REGACK) { diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 85dbe73988595260fd873e566eb981cc408fc213..c6177f35fc920738250824a767cd0f07635b32f2 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -1973,15 +1973,14 @@ std::map< std::string, std::string > ManagerImpl::getAccountDetails(const Accoun (state == VoIPLink::Registered ? "REGISTERED": (state == VoIPLink::Unregistered ? "UNREGISTERED": (state == VoIPLink::Trying ? "TRYING": - (state == VoIPLink::Bad_Authentification ? "BAD_AUTHENTIFICATION": - (state == VoIPLink::Unreachable ? "UNREACHABLE": - (state == VoIPLink::Bad_Hostname ? "BAD_HOSTNAME": - (state == VoIPLink::Null ? "NULL": - (state == VoIPLink::Ready ? "READY": - (state == VoIPLink::Timeout ? "TIMEOUT": - (state == VoIPLink::Error ? "" :"ERROR")))))))))) + (state == VoIPLink::ErrorAuth ? "ERROR_AUTH": + (state == VoIPLink::ErrorNetwork ? "ERROR_NETWORK": + (state == VoIPLink::ErrorHost ? "ERROR_HOST": + (state == VoIPLink::ErrorExistStun ? "ERROR_EXIST_STUN": + (state == VoIPLink::ErrorConfStun ? "ERROR_CONF_STUN": + (state == VoIPLink::Error ? "ERROR": "ERROR"))))))))) ) - ); + ); a.insert( std::pair<std::string, std::string>( CONFIG_ACCOUNT_TYPE, accountType ) ); a.insert( std::pair<std::string, std::string>( USERNAME, getConfigString(accountID, USERNAME) ) ); @@ -2038,9 +2037,7 @@ void ManagerImpl::setAccountDetails( const std::string& accountID, const std::ma restartPjsip(); } - - } - + } saveConfig(); diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index f38992fd60881b2b3f4a07ed0f8664b9e6004e59..cc7e147a8b12f7549173727a6fa01d02d1f934ea 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -151,8 +151,10 @@ SIPVoIPLink::sendUnregister() { _debug("SEND UNREGISTER for account %s\n" , getAccountID().c_str()); - if(!_bRegister) + if(!_bRegister){ + setRegistrationState(VoIPLink::Unregistered); return true; + } _bRegister = false; diff --git a/src/useragent.cpp b/src/useragent.cpp index 513dfc3877d014f00e05e60192209da5f4973925..cb39635f05d2593c5090cd43e6c501a683aa9db1 100644 --- a/src/useragent.cpp +++ b/src/useragent.cpp @@ -91,6 +91,7 @@ pj_status_t UserAgent::sipInit() { int errPjsip = 0; int port; + validStunServer = true; /* Init SIP UA: */ //FIXME! DNS initialize here! */ @@ -110,6 +111,7 @@ pj_status_t UserAgent::sipInit() { port = RANDOM_SIP_PORT; if (!Manager::instance().behindNat(_stunServer, port)) { _debug("UserAgent: Unable to check NAT setting\n"); + validStunServer = false; return false; // hoho we can't use the random sip port too... } } @@ -339,8 +341,18 @@ bool UserAgent::addAccount(AccountID id, pjsip_regc **regc2, const std::string& //pj_mutex_lock(_mutex); std::string tmp; + SIPAccount *account; + if (!validStunServer) { + + SIPVoIPLink *voipLink; + voipLink = dynamic_cast<SIPVoIPLink *>(Manager::instance().getAccountLink(id)); + Manager::instance().getAccountLink(id)->setRegistrationState(VoIPLink::ErrorExistStun); + voipLink->setRegister(false); + return false; + } + status = pjsip_regc_create(_endpt, (void *) currentId, ®c_cb, ®c); if (status != PJ_SUCCESS) { _debug("UserAgent: Unable to create regc.\n"); @@ -414,7 +426,6 @@ bool UserAgent::removeAccount(pjsip_regc *regc) pjsip_tx_data *tdata = NULL; //pj_mutex_lock(_mutex); - if(regc) { status = pjsip_regc_unregister(regc, &tdata); if(status != PJ_SUCCESS) { @@ -540,7 +551,6 @@ void UserAgent::setStunServer(const char *server) { _useStun = false; _stunServer = std::string(""); } - } void UserAgent::regc_cb(struct pjsip_regc_cbparam *param) { @@ -552,13 +562,30 @@ void UserAgent::regc_cb(struct pjsip_regc_cbparam *param) { voipLink = dynamic_cast<SIPVoIPLink *>(Manager::instance().getAccountLink(*id)); if(!voipLink) return; - + if (param->status == PJ_SUCCESS) { if (param->code < 0 || param->code >= 300) { /* Sometimes, the status is OK, but we still failed. * So checking the code for real result */ - Manager::instance().getAccountLink(*id)->setRegistrationState(VoIPLink::Error); + _debug("UserAgent: The error is: %d\n", param->code); + switch(param->code) { + case 408: + case 606: + Manager::instance().getAccountLink(*id)->setRegistrationState(VoIPLink::ErrorConfStun); + break; + case 503: + Manager::instance().getAccountLink(*id)->setRegistrationState(VoIPLink::ErrorHost); + break; + case 401: + case 403: + case 404: + Manager::instance().getAccountLink(*id)->setRegistrationState(VoIPLink::ErrorAuth); + break; + default: + Manager::instance().getAccountLink(*id)->setRegistrationState(VoIPLink::Error); + break; + } voipLink->setRegister(false); } else { // Registration/Unregistration is success @@ -571,7 +598,7 @@ void UserAgent::regc_cb(struct pjsip_regc_cbparam *param) { } } } else { - Manager::instance().getAccountLink(*id)->setRegistrationState(VoIPLink::Error); + Manager::instance().getAccountLink(*id)->setRegistrationState(VoIPLink::ErrorAuth); voipLink->setRegister(false); } } diff --git a/src/useragent.h b/src/useragent.h index 43869e3fc7577e6748a9d7e06a2f071a0c92efc9..b37257aeae33bd46bf9fae99a5a841fc655e013e 100644 --- a/src/useragent.h +++ b/src/useragent.h @@ -57,6 +57,7 @@ private: bool _useStun; pj_str_t _stunHost; std::string _stunServer; + bool validStunServer; /** Local Extern Address is the IP address seen by peers for SIP listener */ std::string _localExternAddress; diff --git a/src/voiplink.cpp b/src/voiplink.cpp index 00c8223b5465c6c23d0c91ae67218dbdf90ed883..fe62b20467a1047fa2a1965618de1bff4abeea79 100644 --- a/src/voiplink.cpp +++ b/src/voiplink.cpp @@ -26,7 +26,7 @@ VoIPLink::VoIPLink(const AccountID& accountID) : _accountID(accountID), _localIPAddress("127.0.0.1"), _localPort(0), _initDone(false) { - setRegistrationState(VoIPLink::Null); + setRegistrationState(VoIPLink::Unregistered); } VoIPLink::~VoIPLink (void) @@ -56,25 +56,26 @@ bool VoIPLink::removeCall(const CallID& id) Call* VoIPLink::getCall(const CallID& id) { - ost::MutexLock m(_callMapMutex); - CallMap::iterator iter = _callMap.find(id); - if ( iter != _callMap.end() ) { - return iter->second; - } - return 0; + ost::MutexLock m(_callMapMutex); + CallMap::iterator iter = _callMap.find(id); + if ( iter != _callMap.end() ) { + return iter->second; + } + return 0; } -bool VoIPLink::clearCallMap() +bool +VoIPLink::clearCallMap() { - ost::MutexLock m(_callMapMutex); - CallMap::iterator iter = _callMap.begin(); - while( iter != _callMap.end() ) { - // if (iter) ? - delete iter->second; iter->second = 0; - iter++; - } - _callMap.clear(); - return true; + ost::MutexLock m(_callMapMutex); + CallMap::iterator iter = _callMap.begin(); + while( iter != _callMap.end() ) { + // if (iter) ? + delete iter->second; iter->second = 0; + iter++; + } + _callMap.clear(); + return true; } void VoIPLink::setRegistrationState(const RegistrationState state) diff --git a/src/voiplink.h b/src/voiplink.h index 00296780a34b14d0b23b61e642e14ee68a2eb725..e095c1922ccc24af99754eddd5ed79b1d2ebc83a 100644 --- a/src/voiplink.h +++ b/src/voiplink.h @@ -52,7 +52,7 @@ class VoIPLink { virtual ~VoIPLink (void); /** Contains all the state an Voip can be in */ - enum RegistrationState {Null, Ready, Unregistered, Trying, Registered, Bad_Authentification , Unreachable , Timeout, Bad_Hostname, Error}; + enum RegistrationState {Unregistered, Trying, Registered, Error, ErrorAuth , ErrorNetwork , ErrorHost, ErrorExistStun, ErrorConfStun}; typedef enum RegistrationState RegistrationState; /**