diff --git a/Makefile.am b/Makefile.am index 8dc7f28e1dde2b564673fec2b447e5a6df0620d3..f774bdf57cdde3095aa6082adb35b7f09a5c383c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,6 +9,6 @@ unittest: ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = libs src ringtones po man +SUBDIRS = libs src ringtones po man test EXTRA_DIST = m4/*.m4 tools/*.sh platform/* images/* README.gentoo diff --git a/sflphone-gtk/src/accountlist.c b/sflphone-gtk/src/accountlist.c index 455b68bd088d242de087eadf01410b56868625ed..0ef19c096590c0a161f1cec0b33393b024727a0b 100644 --- a/sflphone-gtk/src/accountlist.c +++ b/sflphone-gtk/src/accountlist.c @@ -271,3 +271,15 @@ int account_list_get_iax_account_number( void ){ return n; } + +gchar * account_list_get_ordered_list (void) { + + gchar *order=""; + guint i; + + for( i=0; i<account_list_get_size(); i++ ) + { + order = g_strconcat (account_list_get_nth (i)->accountID, "/", NULL); + } + return order; +} diff --git a/sflphone-gtk/src/accountlist.h b/sflphone-gtk/src/accountlist.h index 1887ea974e9596770133b76533ee7551a4e41813..6456e521d09fa99859a57fcd8e29cf7ba0eeecfb 100644 --- a/sflphone-gtk/src/accountlist.h +++ b/sflphone-gtk/src/accountlist.h @@ -182,6 +182,7 @@ int account_list_get_sip_account_number( void ); */ int account_list_get_iax_account_number( void ); +gchar * account_list_get_ordered_list (void); #endif diff --git a/sflphone-gtk/src/call.c b/sflphone-gtk/src/call.c index 4df77fccf423e86cd6701f862efed245d75d3ad1..05a67d373fd908133cc3cddcb40bdaca21b0040e 100644 --- a/sflphone-gtk/src/call.c +++ b/sflphone-gtk/src/call.c @@ -96,7 +96,22 @@ void create_new_call (gchar *to, gchar *from, call_state_t state, gchar *account *new_call = call; } -void +void create_new_call_from_details (const gchar *call_id, GHashTable *details, call_t **call) +{ + gchar *from, *to, *accountID; + call_t *new_call; + GHashTable *call_details; + + accountID = g_hash_table_lookup (details, "ACCOUNTID"); + to = g_hash_table_lookup (details, "PEER_NUMBER"); + from = g_markup_printf_escaped("\"\" <%s>", to); + + create_new_call (from, from, CALL_STATE_DIALING, accountID, &new_call); + *call = new_call; +} + + + void free_call_t (call_t *c) { g_free (c->callID); diff --git a/sflphone-gtk/src/call.h b/sflphone-gtk/src/call.h index 91f1db5d88116b69b18ce87ddab1cb9538ba899d..b32ba9920ce0a95ca27853e6b982bccca77f08c7 100644 --- a/sflphone-gtk/src/call.h +++ b/sflphone-gtk/src/call.h @@ -143,6 +143,9 @@ call_get_recipient( const call_t *); void create_new_call (gchar *, gchar *, call_state_t, gchar *, call_t **); +void +create_new_call_from_details (const gchar *, GHashTable *, call_t **); + void attach_thumbnail (call_t *, GdkPixbuf *); diff --git a/sflphone-gtk/src/config/configwindow.c b/sflphone-gtk/src/config/configwindow.c index 11cc6a27ef3a299058841357d6aa4f7e338bf309..fc8cd2c1cab0f8f0b0ccc6a156bb959ce47393de 100644 --- a/sflphone-gtk/src/config/configwindow.c +++ b/sflphone-gtk/src/config/configwindow.c @@ -300,6 +300,10 @@ account_move(gboolean moveUp, gpointer data) account_list_move_up(indice); else account_list_move_down(indice); + + + // Set the order in the configuration file + dbus_set_accounts_order (account_list_get_ordered_list ()); } /** diff --git a/sflphone-gtk/src/dbus/configurationmanager-glue.h b/sflphone-gtk/src/dbus/configurationmanager-glue.h index 996fb2d3cddbb113a3ca28775e9b2ad766ed2b1f..41addebde9c99e47aab2a5ca8777ecd2dfdff962 100644 --- a/sflphone-gtk/src/dbus/configurationmanager-glue.h +++ b/sflphone-gtk/src/dbus/configurationmanager-glue.h @@ -125,6 +125,43 @@ static inline #endif gboolean +org_sflphone_SFLphone_ConfigurationManager_set_accounts_order (DBusGProxy *proxy, const char * IN_order, GError **error) + +{ + return dbus_g_proxy_call (proxy, "setAccountsOrder", error, G_TYPE_STRING, IN_order, G_TYPE_INVALID, G_TYPE_INVALID); +} + +typedef void (*org_sflphone_SFLphone_ConfigurationManager_set_accounts_order_reply) (DBusGProxy *proxy, GError *error, gpointer userdata); + +static void +org_sflphone_SFLphone_ConfigurationManager_set_accounts_order_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data) +{ + DBusGAsyncData *data = (DBusGAsyncData*) user_data; + GError *error = NULL; + dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID); + (*(org_sflphone_SFLphone_ConfigurationManager_set_accounts_order_reply)data->cb) (proxy, error, data->userdata); + return; +} + +static +#ifdef G_HAVE_INLINE +inline +#endif +DBusGProxyCall* +org_sflphone_SFLphone_ConfigurationManager_set_accounts_order_async (DBusGProxy *proxy, const char * IN_order, org_sflphone_SFLphone_ConfigurationManager_set_accounts_order_reply callback, gpointer userdata) + +{ + DBusGAsyncData *stuff; + stuff = g_new (DBusGAsyncData, 1); + stuff->cb = G_CALLBACK (callback); + stuff->userdata = userdata; + return dbus_g_proxy_begin_call (proxy, "setAccountsOrder", org_sflphone_SFLphone_ConfigurationManager_set_accounts_order_async_callback, stuff, g_free, G_TYPE_STRING, IN_order, G_TYPE_INVALID); +} +static +#ifdef G_HAVE_INLINE +inline +#endif +gboolean org_sflphone_SFLphone_ConfigurationManager_remove_account (DBusGProxy *proxy, const char * IN_accoundID, GError **error) { diff --git a/sflphone-gtk/src/dbus/dbus.c b/sflphone-gtk/src/dbus/dbus.c index 9eabf1a43227ccddb9ab5f54bf585b53f69c3164..517673db281e2cede51a5229bd078a9d7c13e8f7 100644 --- a/sflphone-gtk/src/dbus/dbus.c +++ b/sflphone-gtk/src/dbus/dbus.c @@ -153,16 +153,25 @@ call_state_cb (DBusGProxy *proxy UNUSED, } } else - { //The callID is unknow, threat it like a new call + { + // The callID is unknow, threat it like a new call + // If it were an incoming call, we won't be here + // It means that a new call has been initiated with an other client (cli for instance) if ( strcmp(state, "RINGING") == 0 ) { - g_print ("New ringing call! %s\n",callID); - call_t * c = g_new0 (call_t, 1); - c->accountID = g_strdup("1"); - c->callID = g_strdup(callID); - c->from = g_strdup("\"\" <>"); - c->state = CALL_STATE_RINGING; - sflphone_incoming_call (c); + call_t *new_call; + GHashTable *call_details; + + g_print ("New ringing call! accountID: %s\n", callID); + + // We fetch the details associated to the specified call + call_details = dbus_get_call_details (callID); + create_new_call_from_details (callID, call_details, &new_call); + + // Restore the callID to be synchronous with the daemon + new_call->callID = g_strdup(callID); + + sflphone_incoming_call (new_call); } } } @@ -1549,4 +1558,28 @@ void dbus_set_hook_settings (GHashTable * settings){ } } +GHashTable* dbus_get_call_details (const gchar *callID) +{ + GError *error = NULL; + GHashTable *details = NULL; + + org_sflphone_SFLphone_CallManager_get_call_details (callManagerProxy, callID, &details, &error); + if (error){ + g_print ("Error calling org_sflphone_SFLphone_CallManager_get_call_details\n"); + g_error_free (error); + } + + return details; +} + +void dbus_set_accounts_order (const gchar* order) { + + GError *error = NULL; + + org_sflphone_SFLphone_ConfigurationManager_set_accounts_order (configurationManagerProxy, order, &error); + if (error){ + g_print ("Error calling org_sflphone_SFLphone_ConfigurationManager_set_accounts_order\n"); + g_error_free (error); + } +} diff --git a/sflphone-gtk/src/dbus/dbus.h b/sflphone-gtk/src/dbus/dbus.h index 220e0557336c0f854d4c887e31994b71d9950692..6f64cfe30a1afa9cf1a1af72c27150f561dd16dd 100644 --- a/sflphone-gtk/src/dbus/dbus.h +++ b/sflphone-gtk/src/dbus/dbus.h @@ -477,4 +477,8 @@ void dbus_set_hook_settings (GHashTable *); gboolean dbus_get_is_recording(const call_t *); +GHashTable* dbus_get_call_details (const gchar* callID); + +void dbus_set_accounts_order (const gchar* order); + #endif diff --git a/src/dbus/callmanager.cpp b/src/dbus/callmanager.cpp index 9830253434321f52eddf4fcc3bf584e2ba68cdac..e013410ad59c63693896cd68bb70a40c7fed976c 100644 --- a/src/dbus/callmanager.cpp +++ b/src/dbus/callmanager.cpp @@ -140,11 +140,10 @@ CallManager::getCurrentCodecName(const std::string& callID) std::map< std::string, std::string > -CallManager::getCallDetails( const std::string& callID UNUSED ) +CallManager::getCallDetails( const std::string& callID ) { _debug("CallManager::getCallDetails received\n"); - std::map<std::string, std::string> a; - return a; + return Manager::instance().getCallDetails (callID); } std::string diff --git a/src/dbus/configurationmanager-glue.h b/src/dbus/configurationmanager-glue.h index 2e744ae93a3cfb757a5ae684b2707e8d506cd4fc..c79de5f0ac84710d2f0409b466fd174705942aa8 100644 --- a/src/dbus/configurationmanager-glue.h +++ b/src/dbus/configurationmanager-glue.h @@ -23,6 +23,7 @@ public: register_method(ConfigurationManager_adaptor, getAccountDetails, _getAccountDetails_stub); register_method(ConfigurationManager_adaptor, setAccountDetails, _setAccountDetails_stub); register_method(ConfigurationManager_adaptor, addAccount, _addAccount_stub); + register_method(ConfigurationManager_adaptor, setAccountsOrder, _setAccountsOrder_stub); register_method(ConfigurationManager_adaptor, removeAccount, _removeAccount_stub); register_method(ConfigurationManager_adaptor, getAccountList, _getAccountList_stub); register_method(ConfigurationManager_adaptor, sendRegister, _sendRegister_stub); @@ -106,6 +107,11 @@ public: { "details", "a{ss}", true }, { 0, 0, 0 } }; + static ::DBus::IntrospectedArgument setAccountsOrder_args[] = + { + { "order", "s", true }, + { 0, 0, 0 } + }; static ::DBus::IntrospectedArgument removeAccount_args[] = { { "accoundID", "s", true }, @@ -428,6 +434,7 @@ public: { "getAccountDetails", getAccountDetails_args }, { "setAccountDetails", setAccountDetails_args }, { "addAccount", addAccount_args }, + { "setAccountsOrder", setAccountsOrder_args }, { "removeAccount", removeAccount_args }, { "getAccountList", getAccountList_args }, { "sendRegister", sendRegister_args }, @@ -527,6 +534,7 @@ public: virtual std::map< std::string, std::string > getAccountDetails(const std::string& accountID) = 0; virtual void setAccountDetails(const std::string& accountID, const std::map< std::string, std::string >& details) = 0; virtual void addAccount(const std::map< std::string, std::string >& details) = 0; + virtual void setAccountsOrder(const std::string& order) = 0; virtual void removeAccount(const std::string& accoundID) = 0; virtual std::vector< std::string > getAccountList() = 0; virtual void sendRegister(const std::string& accountID, const int32_t& expire) = 0; @@ -648,6 +656,15 @@ private: ::DBus::ReturnMessage reply(call); return reply; } + ::DBus::Message _setAccountsOrder_stub(const ::DBus::CallMessage &call) + { + ::DBus::MessageIter ri = call.reader(); + + std::string argin1; ri >> argin1; + setAccountsOrder(argin1); + ::DBus::ReturnMessage reply(call); + return reply; + } ::DBus::Message _removeAccount_stub(const ::DBus::CallMessage &call) { ::DBus::MessageIter ri = call.reader(); diff --git a/src/dbus/configurationmanager-introspec.xml b/src/dbus/configurationmanager-introspec.xml index 3316647310bb096f5b69aeadef7c802e50049e37..be283c820a6e7eedfe35a5c2b264e8be4f3b1f71 100644 --- a/src/dbus/configurationmanager-introspec.xml +++ b/src/dbus/configurationmanager-introspec.xml @@ -17,6 +17,10 @@ <arg type="a{ss}" name="details" direction="in"/> </method> + <method name="setAccountsOrder"> + <arg type="s" name="order" direction="in"/> + </method> + <method name="removeAccount"> <arg type="s" name="accoundID" direction="in"/> </method> diff --git a/src/dbus/configurationmanager.cpp b/src/dbus/configurationmanager.cpp index a82eaf1d7c946ae244871f8217b2f72b7e5dd056..09be9dc26c1fcb5a9beb0d49fe32247478a98a97 100644 --- a/src/dbus/configurationmanager.cpp +++ b/src/dbus/configurationmanager.cpp @@ -109,14 +109,12 @@ ConfigurationManager::getRingtoneList( ) std::vector< std::string > ConfigurationManager::getCodecList( ) { - _debug("ConfigurationManager::getCodecList received\n"); return Manager::instance().getCodecList(); } std::vector< std::string > ConfigurationManager::getCodecDetails( const int32_t& payload ) { - _debug("ConfigurationManager::getCodecList received\n"); return Manager::instance().getCodecDetails( payload ); } @@ -450,3 +448,8 @@ std::map<std::string,std::string> ConfigurationManager::getHookSettings (void) { void ConfigurationManager::setHookSettings (const std::map<std::string, std::string>& settings) { Manager::instance().setHookSettings (settings); } + +void ConfigurationManager::setAccountsOrder (const std::string& order) { + Manager::instance().setAccountsOrder (order); +} + diff --git a/src/dbus/configurationmanager.h b/src/dbus/configurationmanager.h index 19adba0422e1ff501a07a049ceb5fafb210f2289..4b05ac76f87b0793d2344d937dfc32eee998ae93 100644 --- a/src/dbus/configurationmanager.h +++ b/src/dbus/configurationmanager.h @@ -109,6 +109,8 @@ public: std::vector< std::string > getAddressbookList ( void ); void setAddressbookList( const std::vector< std::string >& list ); + void setAccountsOrder (const std::string& order); + std::map<std::string, std::string> getHookSettings (void); void setHookSettings (const std::map<std::string, std::string>& settings); diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index ba90279fdfd4e7654e5d6394efe423681371870b..b661c209d42e7e112d047f63c366eb3f1109e38f 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -708,7 +708,7 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId) stopTone(true); - _debug("Incoming call %s\n", call->getCallId().data()); + _debug("Incoming call %s for account %s\n", call->getCallId().data(), accountId.c_str()); associateCallToAccount(call->getCallId(), accountId); @@ -1204,6 +1204,7 @@ ManagerImpl::initConfigFile ( bool load_user_value ) fill_config_int(CONFIG_AUDIO , DFT_AUDIO_MANAGER); fill_config_int(CONFIG_PA_VOLUME_CTRL , YES_STR); fill_config_int(CONFIG_SIP_PORT, DFT_SIP_PORT); + fill_config_str(CONFIG_ACCOUNTS_ORDER, ""); section = ADDRESSBOOK; fill_config_int (ADDRESSBOOK_MAX_RESULTS, "25"); @@ -2126,22 +2127,53 @@ ManagerImpl::setConfig(const std::string& section, const std::string& name, int return _config.setConfigTreeItem(section, name, valueStream.str()); } + +void ManagerImpl::setAccountsOrder (const std::string& order) +{ + // Set the new config + setConfig (PREFERENCES, CONFIG_ACCOUNTS_ORDER, order); +} + std::vector< std::string > ManagerImpl::getAccountList() { - std::vector< std::string > v; + std::vector< std::string > v; + std::vector< std::string > account_order; + int i; - AccountMap::iterator iter = _accountMap.begin(); - while ( iter != _accountMap.end() ) { - if ( iter->second != 0 ) { - _debug("Account List: %s\n", iter->first.data()); - v.push_back(iter->first.data()); + account_order = loadAccountOrder (); + AccountMap::iterator iter; + // If no order has been set, load the default one + // ie according to the creation date. + if (account_order.size () == 0) { + iter = _accountMap.begin (); + while ( iter != _accountMap.end() ) { + if ( iter->second != 0 ) { + v.push_back(iter->first.data()); + } + iter++; + } } - iter++; - } - _debug("Size: %d\n", v.size()); - return v; + + // Otherelse, load the custom one + // ie according to the saved order + else { + + for (i=0; i<account_order.size (); i++) { + // This account has not been loaded, so we ignore it + if ( (iter=_accountMap.find (account_order[i])) != _accountMap.end() ) + { + // If the account is valid + if (iter->second != 0) + { + v.push_back (iter->first.data ()); + } + } + } + } + + return v; } std::map< std::string, std::string > ManagerImpl::getAccountDetails(const AccountID& accountID) @@ -2338,47 +2370,61 @@ ManagerImpl::getNewCallID() return random_id.str(); } - short -ManagerImpl::loadAccountMap() +std::vector <std::string> ManagerImpl::loadAccountOrder (void) { - short nbAccount = 0; - TokenList sections = _config.getSections(); - std::string accountType; - Account* tmpAccount; + std::string account_list; + std::vector <std::string> account_vect; + account_list = getConfigString (PREFERENCES, CONFIG_ACCOUNTS_ORDER); + return unserialize (account_list); +} - TokenList::iterator iter = sections.begin(); - while(iter != sections.end()) { - // Check if it starts with "Account:" (SIP and IAX pour le moment) - if ((int)(iter->find("Account:")) == -1) { - iter++; - continue; - } - accountType = getConfigString(*iter, CONFIG_ACCOUNT_TYPE); - if (accountType == "SIP") { - tmpAccount = AccountCreator::createAccount(AccountCreator::SIP_ACCOUNT, *iter); - } - else if (accountType == "IAX") { - tmpAccount = AccountCreator::createAccount(AccountCreator::IAX_ACCOUNT, *iter); - } - else { - _debug("Unknown %s param in config file (%s)\n", CONFIG_ACCOUNT_TYPE, accountType.c_str()); - } + short +ManagerImpl::loadAccountMap() +{ - _debug("tmpAccount.getRegistrationState() %i \n ",tmpAccount->getRegistrationState()); - if (tmpAccount != NULL) { + short nbAccount = 0; + TokenList sections = _config.getSections(); + std::string accountType; + Account* tmpAccount; + std::vector <std::string> account_order; + + TokenList::iterator iter = sections.begin(); + + while(iter != sections.end()) { + // Check if it starts with "Account:" (SIP and IAX pour le moment) + if ((int)(iter->find("Account:")) == -1) { + iter++; + continue; + } - _debug(" %s \n", iter->c_str()); - _accountMap[iter->c_str()] = tmpAccount; - nbAccount++; - } + accountType = getConfigString(*iter, CONFIG_ACCOUNT_TYPE); + + if (accountType == "SIP") { + tmpAccount = AccountCreator::createAccount(AccountCreator::SIP_ACCOUNT, *iter); + } + + else if (accountType == "IAX") { + tmpAccount = AccountCreator::createAccount(AccountCreator::IAX_ACCOUNT, *iter); + } + + else { + _debug("Unknown %s param in config file (%s)\n", CONFIG_ACCOUNT_TYPE, accountType.c_str()); + } - iter++; - } - _debug("nbAccount loaded %i \n",nbAccount); - return nbAccount; + if (tmpAccount != NULL) { + _debug(" %s \n", iter->c_str()); + _accountMap[iter->c_str()] = tmpAccount; + nbAccount++; + } + + iter++; + } + + _debug("nbAccount loaded %i \n",nbAccount); + return nbAccount; } void @@ -2675,3 +2721,44 @@ bool ManagerImpl::removeCallConfig(const CallID& callID) { return false; } +std::map< std::string, std::string > ManagerImpl::getCallDetails(const CallID& callID) { + + std::map<std::string, std::string> call_details; + AccountID accountid; + Account *account; + VoIPLink *link; + Call *call; + + // We need here to retrieve the call information attached to the call ID + // To achieve that, we need to get the voip link attached to the call + // But to achieve that, we need to get the account the call was made with + + // So first we fetch the account + accountid = getAccountFromCall (callID); + + // Then the VoIP link this account is linked with (IAX2 or SIP) + if ( (account=getAccount (accountid)) != 0) { + link = account->getVoIPLink (); + + if (link) { + call = link->getCall (callID); + } + + } + + if (call) + { + call_details.insert (std::pair<std::string, std::string> ("ACCOUNTID", accountid)); + call_details.insert (std::pair<std::string, std::string> ("PEER_NUMBER", call->getPeerNumber ())); + call_details.insert (std::pair<std::string, std::string> ("PEER_NAME", call->getPeerName ())); + } + else + { + _debug ("Error: Managerimpl - getCallDetails ()\n"); + call_details.insert (std::pair<std::string, std::string> ("ACCOUNTID", AccountNULL)); + call_details.insert (std::pair<std::string, std::string> ("PEER_NUMBER", "Unknown")); + call_details.insert (std::pair<std::string, std::string> ("PEER_NAME", "Unknown")); + } + + return call_details; +} diff --git a/src/managerimpl.h b/src/managerimpl.h index 35426796f9fa969afe3d62be723feac3c0704096..86578e3285c0f4090a36823dce39b8429069f19a 100644 --- a/src/managerimpl.h +++ b/src/managerimpl.h @@ -282,6 +282,11 @@ class ManagerImpl { */ std::vector< std::string > getAccountList(); + /** + * Set the account order in the config file + */ + void setAccountsOrder (const std::string& order); + /** * Retrieve details about a given account * @param accountID The account identifier @@ -289,6 +294,13 @@ class ManagerImpl { */ std::map< std::string, std::string > getAccountDetails(const AccountID& accountID); + /** + * Retrieve details about a given call + * @param callID The account identifier + * @return std::map< std::string, std::string > The call details + */ + std::map< std::string, std::string > getCallDetails(const CallID& callID); + /** * Save the details of an existing account, given the account ID * This will load the configuration map with the given data. @@ -1056,6 +1068,13 @@ class ManagerImpl { */ short loadAccountMap(); + /** + * Load the accounts order set by the user from the sflphonedrc config file + * @return std::vector<std::string> A vector containing the account ID's + */ + std::vector<std::string> loadAccountOrder (); + + /** * Unload the account (delete them) */ diff --git a/src/sipaccount.cpp b/src/sipaccount.cpp index 0dceb51243d46872583ee509a55f79bcdc6b5647..b72eb15e0f9bcbb78c60230b0ecddf2b18af0467 100644 --- a/src/sipaccount.cpp +++ b/src/sipaccount.cpp @@ -40,7 +40,6 @@ SIPAccount::SIPAccount(const AccountID& accountID) } - SIPAccount::~SIPAccount() { /* One SIP account less connected to the sip voiplink */ diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index df38379106c088a69e9cc2093d885952d521a191..41121e3daf3e8a3a6bc7f6c2396ed5cc3311e266 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -28,12 +28,9 @@ #include <netinet/in.h> #include <arpa/nameser.h> #include <resolv.h> -//extern struct state _res; - #define CAN_REINVITE 1 - /**************** EXTERN VARIABLES AND FUNCTIONS (callbacks) **************************/ /* @@ -47,11 +44,11 @@ void get_remote_sdp_from_offer( pjsip_rx_data *rdata, pjmedia_sdp_session** r_sd int getModId(); /** - * * Set audio (SDP) configuration for a call - * * localport, localip, localexternalport - * * @param call a SIPCall valid pointer - * * @return bool True - * */ + * Set audio (SDP) configuration for a call + * localport, localip, localexternalport + * @param call a SIPCall valid pointer + * @return bool True + */ bool setCallAudioLocal(SIPCall* call, std::string localIP, bool stun, std::string server); void handle_incoming_options (pjsip_rx_data *rxdata); @@ -178,8 +175,6 @@ SIPVoIPLink* SIPVoIPLink::_instance = NULL; , _useStun(false) , _clients(0) { - _debug("SIPVoIPLink::~SIPVoIPLink(): sipvoiplink constructor called \n"); - // to get random number for RANDOM_PORT srand (time(NULL)); @@ -191,7 +186,6 @@ SIPVoIPLink* SIPVoIPLink::_instance = NULL; SIPVoIPLink::~SIPVoIPLink() { - _debug("SIPVoIPLink::~SIPVoIPLink(): sipvoiplink destructor called \n"); terminate(); } diff --git a/src/sipvoiplink.h b/src/sipvoiplink.h index 5536f9936f4773ba14d6a0218436d80f9d955c2f..c49479ede8769e6cc8fb24d676f25b592994dc50 100644 --- a/src/sipvoiplink.h +++ b/src/sipvoiplink.h @@ -42,7 +42,7 @@ class AudioRtp; #define RANDOM_SIP_PORT rand() % 64000 + 1024 // To set the verbosity. From 0 (min) to 6 (max) -#define PJ_LOG_LEVEL 6 +#define PJ_LOG_LEVEL 0 /** * @file sipvoiplink.h diff --git a/src/user_cfg.h b/src/user_cfg.h index bbe146804e23ee1c2f1faafd7571e3d18f876084..d0522277ea45fa17b22d0f732f00f82a20bb9e78 100644 --- a/src/user_cfg.h +++ b/src/user_cfg.h @@ -61,6 +61,7 @@ #define CONFIG_AUDIO "Audio.api" /** Audio manager (ALSA or pulseaudio) */ #define CONFIG_PA_VOLUME_CTRL "Pulseaudio.volumeCtrl" /** Whether or not PA should modify volume of other applications on the same sink */ #define CONFIG_SIP_PORT "SIP.portNum" +#define CONFIG_ACCOUNTS_ORDER "Accounts.order" /** To restore account order */ #define SIGNALISATION "VoIPLink" /** Section Signalisation */ #define PLAY_DTMF "DTMF.playDtmf" /** Whether or not should play dtmf */ diff --git a/test/TestMain.cpp b/test/TestMain.cpp index 310732ac596991664f6365d5563f3873c4ef5720..1bca8aeab19da9bab970ca4a6d462370aa775493 100644 --- a/test/TestMain.cpp +++ b/test/TestMain.cpp @@ -6,8 +6,7 @@ int main(int argc, const char* argv[]) CppUnit::TextTestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); - runner.run(); + return runner.run(); - return 0; } diff --git a/test/run-tests b/test/run-tests new file mode 100755 index 0000000000000000000000000000000000000000..9b5d01405c9e5f6883b58946d129ae17b0b43f91 --- /dev/null +++ b/test/run-tests @@ -0,0 +1,24 @@ +#!/bin/bash + +myname="`basename $0`" +failures=0 + +for f in * +do + # Skip ourself + if [ "$f" = "$myname" ]; then + continue + fi + + if [ -x "$f" ]; then + echo + echo "=== Running [$f] test ===" + # Warning, libCppUnit returns 0 on failure. + ./"$f" && { + echo Warning: Failure in $f. + failures=$((failures+1)) + } + fi +done + +echo "Tests finshed, there were $failures failures."