Commit 315cbc2d authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2977] Added DTMF type configuration on a per account basis in GUI

parent 9d97dd07
......@@ -90,6 +90,8 @@ GtkWidget * displayNameEntry;
GtkWidget * security_tab;
GtkWidget * advanced_tab;
GtkWidget * overrtp;
GHashTable * directIpCallsProperties = NULL;
// Credentials
......@@ -134,6 +136,25 @@ is_iax_enabled(void)
}
void
select_dtmf_type( void )
{
DEBUG("DTMF selection changed\n");
if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(overrtp) ) )
{
// dbus_set_audio_manager( ALSA );
DEBUG("Selected DTMF over RTP");
}
else {
// dbus_set_audio_manager( PULSEAUDIO );
DEBUG("Selected DTMF over SIP");
}
}
static GPtrArray* getNewCredential (GHashTable * properties) {
GtkTreeIter iter;
......@@ -1119,6 +1140,53 @@ GtkWidget* create_advanced_tab (account_t **a) {
return ret;
}
GtkWidget* create_codecs_configuration (account_t **a) {
// Main widget
GtkWidget *ret, *codecs, *dtmf, *box, *frame, *sipinfo, *table;
account_t *currentAccount = *a;
gchar *currentDtmfType = "";
gboolean dtmf_are_rtp = TRUE;
ret = gtk_vbox_new(FALSE, 10);
gtk_container_set_border_width(GTK_CONTAINER(ret), 10);
box = codecs_box (a);
// Box for the codecs
gnome_main_section_new (_("Codecs"), &codecs);
gtk_box_pack_start (GTK_BOX(ret), codecs, FALSE, FALSE, 0);
gtk_widget_set_size_request (GTK_WIDGET (codecs), -1, 200);
gtk_widget_show (codecs);
gtk_container_add (GTK_CONTAINER (codecs) , box);
// Box for dtmf
gnome_main_section_new_with_table (_("DTMF"), &dtmf, &table, 1, 2);
gtk_box_pack_start (GTK_BOX(ret), dtmf, FALSE, FALSE, 0);
gtk_widget_show (dtmf);
currentDtmfType = g_hash_table_lookup (currentAccount->properties, g_strdup(ACCOUNT_DTMF_TYPE));
if (g_strcasecmp(currentDtmfType, OVERRTP) != 0) {
dtmf_are_rtp = FALSE;
}
overrtp = gtk_radio_button_new_with_label( NULL, _("RTP") );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(overrtp), dtmf_are_rtp);
gtk_table_attach ( GTK_TABLE( table ), overrtp, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
sipinfo = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(overrtp), _("SIP"));
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(sipinfo), !dtmf_are_rtp);
g_signal_connect(G_OBJECT(sipinfo), "clicked", G_CALLBACK(select_dtmf_type), NULL);
gtk_table_attach ( GTK_TABLE( table ), sipinfo, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show_all(ret);
return ret;
}
void show_account_window (account_t * a) {
GtkWidget * notebook;
......@@ -1277,6 +1345,13 @@ void show_account_window (account_t * a) {
}
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(overrtp))) {
g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_DTMF_TYPE), g_strdup(OVERRTP));
}
else {
g_hash_table_replace(currentAccount->properties, g_strdup(ACCOUNT_DTMF_TYPE), g_strdup(SIPINFO));
}
gchar* keyExchange = (gchar *)gtk_combo_box_get_active_text(GTK_COMBO_BOX(keyExchangeCombo));
if (g_strcasecmp(keyExchange, "ZRTP") == 0) {
......
......@@ -900,7 +900,7 @@ GtkWidget* create_audio_configuration()
return ret;
}
/*
GtkWidget* create_codecs_configuration (account_t **a) {
// Main widget
......@@ -922,3 +922,4 @@ GtkWidget* create_codecs_configuration (account_t **a) {
return ret;
}
*/
......@@ -62,6 +62,7 @@
#define ACCOUNT_REGISTRATION_EXPIRE "Account.expire"
#define ACCOUNT_SIP_STUN_SERVER "STUN.server"
#define ACCOUNT_SIP_STUN_ENABLED "STUN.enable"
#define ACCOUNT_DTMF_TYPE "Account.dtmfType"
#define ACCOUNT_HOSTNAME "hostname"
#define ACCOUNT_USERNAME "username"
#define ACCOUNT_PASSWORD "password"
......@@ -135,6 +136,10 @@ log4c_category_t* log4c_sfl_gtk_category;
#define ALSA 0
#define PULSEAUDIO 1
/** DTMF type */
#define OVERRTP "overrtp"
#define SIPINFO "sipinfo"
/** Notification levels */
#define __NOTIF_LEVEL_MIN 0
#define __NOTIF_LEVEL_MED 1
......
......@@ -65,6 +65,7 @@ typedef enum RegistrationState {
#define CONFIG_ACCOUNT_RESOLVE_ONCE "Account.resolveOnce"
#define CONFIG_ACCOUNT_REGISTRATION_EXPIRE "Account.expire"
#define CONFIG_CREDENTIAL_NUMBER "Credential.count"
#define ACCOUNT_DTMF_TYPE "Account.dtmfType"
#define HOSTNAME "hostname"
#define USERNAME "username"
......@@ -117,6 +118,7 @@ typedef enum RegistrationState {
#define REGISTRATION_STATE_CODE "Registration.code"
#define REGISTRATION_STATE_DESCRIPTION "Registration.description"
class Account{
public:
......
......@@ -3277,6 +3277,8 @@ std::map<std::string, std::string> ManagerImpl::getAccountDetails (
accountID, STUN_ENABLE)));
a.insert(std::pair<std::string, std::string>(STUN_SERVER, getConfigString(
accountID, STUN_SERVER)));
a.insert(std::pair<std::string, std::string>(ACCOUNT_DTMF_TYPE, getConfigString(
accountID, ACCOUNT_DTMF_TYPE)));
RegistrationState state;
std::string registrationStateCode;
......@@ -3561,6 +3563,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
std::string publishedPort;
std::string stunEnable;
std::string stunServer;
std::string dtmfType;
std::string srtpEnable;
std::string srtpRtpFallback;
std::string zrtpDisplaySas;
......@@ -3620,6 +3623,10 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
stunServer = iter->second;
}
if((iter = map_cpy.find(ACCOUNT_DTMF_TYPE)) != map_cpy.end()) {
dtmfType = iter->second;
}
if ((iter = map_cpy.find(SRTP_ENABLE)) != map_cpy.end()) {
srtpEnable = iter->second;
}
......@@ -3749,6 +3756,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
setConfig(accountID, STUN_ENABLE, stunEnable);
setConfig(accountID, STUN_SERVER, stunServer);
setConfig(accountID, ACCOUNT_DTMF_TYPE, dtmfType);
// The TLS listener is unique and globally defined through IP2IP_PROFILE
if (accountID == IP2IP_PROFILE)
......
......@@ -363,6 +363,11 @@ void SIPAccount::loadConfig()
setPublishedAddress (Manager::instance().getConfigString (_accountID, PUBLISHED_ADDRESS));
if(Manager::instance().getConfigString (_accountID, ACCOUNT_DTMF_TYPE) == OVERRTPSTR)
_dtmfType = OVERRTP;
else
_dtmfType = SIPINFO;
// Init TLS settings if the user wants to use TLS
bool tlsEnabled = Manager::instance().getConfigBool (_accountID, TLS_ENABLE);
......
......@@ -33,6 +33,9 @@
enum DtmfType { OVERRTP, SIPINFO};
#define OVERRTPSTR "overrtp"
#define SIPINFOSTR "sipinfo"
class SIPVoIPLink;
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment