diff --git a/sflphone-client-gnome/src/config/accountconfigdialog.c b/sflphone-client-gnome/src/config/accountconfigdialog.c index f5258e4fe999b6bcaac64436ccfcbd0f94b3f22e..56bbfe0f053bdbfba40bcc883c5e1f3468892ff8 100644 --- a/sflphone-client-gnome/src/config/accountconfigdialog.c +++ b/sflphone-client-gnome/src/config/accountconfigdialog.c @@ -295,6 +295,7 @@ static GtkWidget* create_basic_tab (account_t **a) /* TODO: add curProxy, and add boxes for Proxy support */ gchar *curMailbox = ""; gchar *curUseragent = ""; + gchar *curRouteSet = ""; currentAccount = *a; @@ -311,7 +312,7 @@ static GtkWidget* create_basic_tab (account_t **a) curHostname = g_hash_table_lookup (currentAccount->properties, ACCOUNT_HOSTNAME); curPassword = g_hash_table_lookup (currentAccount->properties, ACCOUNT_PASSWORD); curUsername = g_hash_table_lookup (currentAccount->properties, ACCOUNT_USERNAME); - // curRouteSet = g_hash_table_lookup(currentAccount->properties, ACCOUNT_ROUTE); + curRouteSet = g_hash_table_lookup(currentAccount->properties, ACCOUNT_ROUTE); curMailbox = g_hash_table_lookup (currentAccount->properties, ACCOUNT_MAILBOX); curMailbox = curMailbox != NULL ? curMailbox : ""; curUseragent = g_hash_table_lookup (currentAccount->properties, ACCOUNT_USERAGENT); @@ -425,6 +426,15 @@ static GtkWidget* create_basic_tab (account_t **a) g_signal_connect (clearTextCheckbox, "toggled", G_CALLBACK (show_password_cb), entryPassword); gtk_table_attach (GTK_TABLE (table), clearTextCheckbox, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + row++; + label = gtk_label_new_with_mnemonic (_ ("_Proxy")); + gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); + entryRouteSet = gtk_entry_new (); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryRouteSet); + gtk_entry_set_text (GTK_ENTRY (entryRouteSet), curRouteSet); + gtk_table_attach (GTK_TABLE (table), entryRouteSet, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + row++; label = gtk_label_new_with_mnemonic (_ ("_Voicemail number")); gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); @@ -1436,12 +1446,12 @@ void show_account_window (account_t * a) g_strdup (ACCOUNT_REGISTRATION_EXPIRE), g_strdup ( (gchar *) gtk_entry_get_text (GTK_ENTRY (expireSpinBox)))); - /* + // TODO: uncomment this code and implement route g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_ROUTE), g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(entryRouteSet)))); - */ + g_hash_table_replace (currentAccount->properties, g_strdup (ACCOUNT_USERAGENT), diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index e4910d5e706ea5bd543c21ce1da6642fda74ce14..693a3e9fc1a1643d5b6196bc7767afb502237d9e 100644 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -98,7 +98,7 @@ SIPAccount::SIPAccount (const AccountID& accountID) , _realm (DEFAULT_REALM) , _authenticationUsername ("") , _tlsSetting (NULL) - , _dtmfType (SIPINFO) + , _dtmfType (OVERRTP) , _tlsEnable ("false") , _tlsPortStr (DEFAULT_SIP_TLS_PORT) , _tlsCaListFile ("") diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index fbd8cfbdfbb4e504d2af495953385a3643cb6008..b0ffac10c340f3d471e3f827c1a6581816bd4fb2 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -1593,12 +1593,8 @@ SIPVoIPLink::SIPStartCall (SIPCall* call, const std::string& subject UNUSED) } // Creates URI - std::string fromUri; - std::string toUri; - std::string contactUri; - - fromUri = account->getFromUri(); - toUri = call->getPeerNumber(); // expecting a fully well formed sip uri + std::string fromUri = account->getFromUri(); + std::string toUri = call->getPeerNumber(); // expecting a fully well formed sip uri std::string address = findLocalAddressFromUri (toUri, account->getAccountTransport ()); int port = findLocalPortFromUri (toUri, account->getAccountTransport ()); @@ -1608,12 +1604,10 @@ SIPVoIPLink::SIPStartCall (SIPCall* call, const std::string& subject UNUSED) ss << port; ss >> portStr; - contactUri = account->getContactHeader (address, portStr); + std::string contactUri = account->getContactHeader (address, portStr); _debug ("UserAgent: FROM uri: %s, TO uri: %s, CONTACT uri: %s", - fromUri.c_str(), - toUri.c_str(), - contactUri.c_str()); + fromUri.c_str(), toUri.c_str(), contactUri.c_str()); pj_str_t pjFrom; pj_cstr (&pjFrom, fromUri.c_str()); @@ -1640,20 +1634,20 @@ SIPVoIPLink::SIPStartCall (SIPCall* call, const std::string& subject UNUSED) status = pjsip_inv_create_uac (dialog, call->getLocalSDP()->get_local_sdp_session(), 0, &inv); - if (! (account->getServiceRoute().empty())) { - - _error ("UserAgent: Set Service-Route with %s", account->getServiceRoute().c_str()); - - pjsip_route_hdr *route_set = pjsip_route_hdr_create (_pool); - pjsip_route_hdr *routing = pjsip_route_hdr_create (_pool); - pjsip_sip_uri *url = pjsip_sip_uri_create (_pool, 0); - routing->name_addr.uri = (pjsip_uri*) url; - pj_strdup2 (_pool, &url->host, account->getServiceRoute().c_str()); - - pj_list_push_back (&route_set, pjsip_hdr_clone (_pool, routing)); - - pjsip_dlg_set_route_set (dialog, route_set); - } +// if (! (account->getServiceRoute().empty())) { +// +// _error ("UserAgent: Set Service-Route with %s", account->getServiceRoute().c_str()); +// +// pjsip_route_hdr *route_set = pjsip_route_hdr_create (_pool); +// pjsip_route_hdr *routing = pjsip_route_hdr_create (_pool); +// pjsip_sip_uri *url = pjsip_sip_uri_create (_pool, 0); +// routing->name_addr.uri = (pjsip_uri*) url; +// pj_strdup2 (_pool, &url->host, account->getServiceRoute().c_str()); +// +// pj_list_push_back (&route_set, pjsip_hdr_clone (_pool, routing)); +// +// pjsip_dlg_set_route_set (dialog, route_set); +// } PJ_ASSERT_RETURN (status == PJ_SUCCESS, false); @@ -1997,100 +1991,12 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to) // Private functions /////////////////////////////////////////////////////////////////////////////// - -bool get_dns_server_addresses (std::vector<std::string> *servers) -{ - - int server_count, i; - std::vector<std::string> nameservers; - - struct sockaddr_in current_server; - in_addr address; - // Read configuration files - - if (res_init () != 0) { - _debug ("UserAgent: Resolver initialization failed"); - return false; - } - - server_count = _res.nscount; - - for (i=0; i<server_count; i++) { - current_server = (struct sockaddr_in) _res.nsaddr_list[i]; - address = current_server.sin_addr; - nameservers.push_back (inet_ntoa (address)); - } - - *servers = nameservers; - - return true; -} - -pj_status_t SIPVoIPLink::enable_dns_srv_resolver (pjsip_endpoint *endpt, pj_dns_resolver **p_resv) -{ - - pj_status_t status; - pj_dns_resolver *resv; - std::vector <std::string> dns_servers; - int scount, i; - - _debug ("UserAgent: Enable DNS SRV resolver"); - - // Create the DNS resolver instance - status = pjsip_endpt_create_resolver (endpt, &resv); - - if (status != PJ_SUCCESS) { - _error ("UserAgent: Error: Creating the DNS resolver instance"); - return status; - } - - if (!get_dns_server_addresses (&dns_servers)) { - _error ("UserAgent: Error: while fetching DNS information"); - return -1; - } - - // Build the nameservers list needed by pjsip - if ( (scount = dns_servers.size ()) <= 0) { - _warn ("UserAgent: No server detected while fetching DNS information, stop dns resolution"); - return 0; - } - - pj_str_t nameservers[scount]; - - for (i = 0; i<scount; i++) { - _debug ("UserAgent: Server: %s", (char *) dns_servers[i].c_str()); - nameservers[i] = pj_str ( (char *) dns_servers[i].c_str()); - } - - // Update the name servers for the DNS resolver - status = pj_dns_resolver_set_ns (resv, scount, nameservers, NULL); - - if (status != PJ_SUCCESS) { - _debug ("UserAgent: Error updating the name servers for the DNS resolver"); - return status; - } - - // Set the DNS resolver instance of the SIP resolver engine - status = pjsip_endpt_set_resolver (endpt, resv); - - if (status != PJ_SUCCESS) { - _debug ("UserAgent: Error setting the DNS resolver instance of the SIP resolver engine"); - return status; - } - - *p_resv = resv; - - return PJ_SUCCESS; - -} - bool SIPVoIPLink::pjsip_init() { pj_status_t status; pjsip_inv_callback inv_cb; pj_str_t accepted; std::string name_mod; - // pj_dns_resolver *p_resv; std::string addr; name_mod = "sflphone"; @@ -2187,8 +2093,6 @@ bool SIPVoIPLink::pjsip_init() PJ_ASSERT_RETURN (status == PJ_SUCCESS, 1); - // status = enable_dns_srv_resolver (_endpt, &p_resv); - PJ_ASSERT_RETURN (status == PJ_SUCCESS, 1); // Init the callback for INVITE session: @@ -3491,7 +3395,6 @@ void sdp_media_update_cb (pjsip_inv_session *inv, pj_status_t status) } - // Get the crypto attribute containing srtp's cryptographic context (keys, cipher) CryptoOffer crypto_offer; call->getLocalSDP()->get_remote_sdp_crypto_from_offer (remote_sdp, crypto_offer);