diff options
-rw-r--r-- | src/protocol.c | 22 | ||||
-rw-r--r-- | src/sip-connection.c | 6 |
2 files changed, 22 insertions, 6 deletions
diff --git a/src/protocol.c b/src/protocol.c index 44bbd4d..7d89d6c 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -113,13 +113,14 @@ static TpCMParamSpec rakia_params[] = { { "keepalive-interval", DBUS_TYPE_UINT32_AS_STRING, G_TYPE_UINT, TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GUINT_TO_POINTER(0), PARAM_EASY }, - /* Use SRV DNS lookup to discover STUN server */ + /* Use SRV DNS lookup to discover STUN server + * (defaults to true unless stun-server is set) */ { "discover-stun", DBUS_TYPE_BOOLEAN_AS_STRING, G_TYPE_BOOLEAN, - TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GUINT_TO_POINTER(TRUE), PARAM_EASY }, + 0, NULL, PARAM_SET_SEPARATELY }, /* STUN server */ { "stun-server", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, 0, NULL, - PARAM_EASY }, + PARAM_SET_SEPARATELY }, /* STUN port */ { "stun-port", DBUS_TYPE_UINT16_AS_STRING, G_TYPE_UINT, @@ -274,6 +275,9 @@ new_connection (TpBaseProtocol *protocol, const gchar *transport; const gchar *proxy_host; guint16 port; + gboolean discover_stun; + gboolean discover_stun_valid; + const gchar *stun_server; gchar *proxy; RakiaConnectionKeepaliveMechanism keepalive_mechanism; @@ -310,6 +314,18 @@ new_connection (TpBaseProtocol *protocol, "transport", transport, NULL); + discover_stun = tp_asv_get_boolean (params, "discover-stun", + &discover_stun_valid); + stun_server = tp_asv_get_string (params, "stun-server"); + + if (!discover_stun_valid && stun_server == NULL) + discover_stun = TRUE; + + g_object_set (conn, + "discover-stun", discover_stun, + "stun-server", stun_server, + NULL); + for (i = 0; rakia_params[i].name != NULL; i++) { if (rakia_params[i].offset == PARAM_SET_SEPARATELY) diff --git a/src/sip-connection.c b/src/sip-connection.c index bf93bc4..81bcce4 100644 --- a/src/sip-connection.c +++ b/src/sip-connection.c @@ -1055,10 +1055,10 @@ rakia_connection_start_connecting (TpBaseConnection *base, rakia_conn_update_nua_keepalive_interval (self); rakia_conn_update_nua_contact_features (self); - if (priv->stun_host != NULL) - rakia_conn_resolv_stun_server (self, priv->stun_host); - else if (priv->discover_stun) + if (priv->discover_stun) rakia_conn_discover_stun_server (self); + else if (priv->stun_host != NULL) + rakia_conn_resolv_stun_server (self, priv->stun_host); DEBUG("initialized a Sofia-SIP NUA at address %p", priv->sofia_nua); |