ekiga r6077 - in trunk: . src/endpoints
- From: dsandras svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6077 - in trunk: . src/endpoints
- Date: Mon, 17 Mar 2008 21:43:03 +0000 (GMT)
Author: dsandras
Date: Mon Mar 17 21:43:03 2008
New Revision: 6077
URL: http://svn.gnome.org/viewvc/ekiga?rev=6077&view=rev
Log:
Moved all SIP GmConf stuff to the bridge. Added a few functions for
call forwarding. They will probably be moved to the CallManager skel
interface at a later stage, but cleanup is iterative.
Modified:
trunk/ChangeLog
trunk/src/endpoints/manager.cpp
trunk/src/endpoints/manager.h
trunk/src/endpoints/opal-gmconf-bridge.cpp
trunk/src/endpoints/sip.cpp
trunk/src/endpoints/sip.h
Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp (original)
+++ trunk/src/endpoints/manager.cpp Mon Mar 17 21:43:03 2008
@@ -1032,7 +1032,7 @@
bool
GMManager::OnIncomingConnection (OpalConnection &connection,
unsigned reason,
- PString extra)
+ const std::string & forward_uri)
{
bool res = FALSE;
@@ -1045,7 +1045,7 @@
break;
case 2:
- connection.ForwardCall (extra);
+ connection.ForwardCall (forward_uri);
res = FALSE;
break;
Modified: trunk/src/endpoints/manager.h
==============================================================================
--- trunk/src/endpoints/manager.h (original)
+++ trunk/src/endpoints/manager.h Mon Mar 17 21:43:03 2008
@@ -246,7 +246,7 @@
*/
bool OnIncomingConnection (OpalConnection &,
unsigned,
- PString);
+ const std::string & forward_uri);
/* DESCRIPTION : This callback is called when a call is established.
Modified: trunk/src/endpoints/opal-gmconf-bridge.cpp
==============================================================================
--- trunk/src/endpoints/opal-gmconf-bridge.cpp (original)
+++ trunk/src/endpoints/opal-gmconf-bridge.cpp Mon Mar 17 21:43:03 2008
@@ -67,12 +67,17 @@
keys.push_back (VIDEO_CODECS_KEY "max_frame_rate");
keys.push_back (VIDEO_CODECS_KEY "maximum_video_rx_bitrate");
+ keys.push_back (SIP_KEY "forward_host");
keys.push_back (SIP_KEY "outbound_proxy_host");
keys.push_back (SIP_KEY "dtmf_mode");
keys.push_back (NAT_KEY "binding_timeout");
keys.push_back (PERSONAL_DATA_KEY "full_name");
+ keys.push_back (CALL_FORWARDING_KEY "forward_on_busy");
+ keys.push_back (CALL_FORWARDING_KEY "always_forward");
+ keys.push_back (CALL_OPTIONS_KEY "no_answer_timeout");
+
load (keys);
}
@@ -220,6 +225,10 @@
manager.GetSIPEndpoint ()->set_dtmf_mode (gm_conf_entry_get_int (entry));
}
+ else if (key == SIP_KEY "forward_host") {
+
+ manager.GetSIPEndpoint ()->set_forward_host (gm_conf_entry_get_string (entry));
+ }
//
// NAT related keys
@@ -229,7 +238,6 @@
manager.GetSIPEndpoint ()->set_nat_binding_delay (gm_conf_entry_get_int (entry));
}
-
//
// Personal Data Key
//
@@ -237,5 +245,22 @@
manager.set_fullname (gm_conf_entry_get_string (entry));
}
+
+
+ //
+ // Misc keys
+ //
+ else if (CALL_FORWARDING_KEY "forward_on_busy") {
+
+ manager.GetSIPEndpoint ()->set_forward_on_busy (gm_conf_entry_get_bool (entry));
+ }
+ else if (CALL_FORWARDING_KEY "always_forward") {
+
+ manager.GetSIPEndpoint ()->set_unconditional_forward (gm_conf_entry_get_bool (entry));
+ }
+ else if (CALL_OPTIONS_KEY "no_answer_timeout") {
+
+ manager.GetSIPEndpoint ()->set_no_answer_timeout (gm_conf_entry_get_int (entry));
+ }
}
Modified: trunk/src/endpoints/sip.cpp
==============================================================================
--- trunk/src/endpoints/sip.cpp (original)
+++ trunk/src/endpoints/sip.cpp Mon Mar 17 21:43:03 2008
@@ -41,30 +41,10 @@
#include <sstream>
#include "sip.h"
-#include "pcss.h"
-#include "ekiga.h"
-#include "urlhandler.h"
-
-#include "main.h"
-#include "preferences.h"
-#include "statusicon.h"
-#include "misc.h"
-#ifdef HAVE_DBUS
-#include "dbus.h"
-#endif
-
-#include <gmconf.h>
-#include <gmdialog.h>
-
-#include <ptlib/ethsock.h>
-#include <opal/transcoders.h>
-#include <sip/handlers.h>
#include "presence-core.h"
#include "personal-details.h"
-#define new PNEW
-
/* The class */
GMSIPEndpoint::GMSIPEndpoint (GMManager & ep, Ekiga::ServiceCore & _core)
@@ -208,6 +188,36 @@
SIPEndPoint::SetNATBindingTimeout (PTimeInterval (0, delay));
}
+void
+GMSIPEndpoint::set_forward_host (const std::string & uri)
+{
+ forward_uri = uri;
+}
+
+void
+GMSIPEndpoint::set_forward_on_busy (bool enabled)
+{
+ forward_on_busy = enabled;
+}
+
+void
+GMSIPEndpoint::set_unconditional_forward (bool enabled)
+{
+ unconditional_forward = enabled;
+}
+
+void
+GMSIPEndpoint::set_forward_on_no_answer (bool enabled)
+{
+ forward_on_no_answer = enabled;
+}
+
+void
+GMSIPEndpoint::set_no_answer_timeout (const unsigned timeout)
+{
+ no_answer_timeout = timeout;
+}
+
bool
GMSIPEndpoint::StartListener (PString iface,
@@ -491,28 +501,10 @@
PSafePtr<OpalConnection> con = NULL;
PSafePtr<OpalCall> call = NULL;
- gchar *forward_host = NULL;
-
- guint status = CONTACT_ONLINE;
- gboolean busy_forward = FALSE;
- gboolean always_forward = FALSE;
- int no_answer_timeout = FALSE;
-
- bool res = FALSE;
-
unsigned reason = 0;
PTRACE (3, "GMSIPEndpoint\tIncoming connection");
- gnomemeeting_threads_enter ();
- forward_host = gm_conf_get_string (SIP_KEY "forward_host");
- busy_forward = gm_conf_get_bool (CALL_FORWARDING_KEY "forward_on_busy");
- always_forward = gm_conf_get_bool (CALL_FORWARDING_KEY "always_forward");
- status = gm_conf_get_int (PERSONAL_DATA_KEY "status");
- no_answer_timeout =
- gm_conf_get_int (CALL_OPTIONS_KEY "no_answer_timeout");
- gnomemeeting_threads_leave ();
-
call = endpoint.FindCallWithLock (endpoint.GetCurrentCallToken());
if (call)
con = endpoint.GetConnection (call, TRUE);
@@ -520,15 +512,11 @@
return TRUE;
}
- if (status == CONTACT_DND)
- reason = 1;
-
- else if (forward_host && always_forward)
+ if (!forward_uri.empty () && unconditional_forward)
reason = 2; // Forward
- /* We are in a call */
- else if (endpoint.GetCallingState () != GMManager::Standby) {
+ else if (endpoint.GetCallingState () != GMManager::Standby) { // TODO : to remove
- if (forward_host && busy_forward)
+ if (!forward_uri.empty () && forward_on_busy)
reason = 2; // Forward
else
reason = 1; // Reject
@@ -539,10 +527,7 @@
if (reason == 0)
NoAnswerTimer.SetInterval (0, PMIN (no_answer_timeout, 60));
- res = endpoint.OnIncomingConnection (connection, reason, forward_host);
- g_free (forward_host);
-
- return res;
+ return endpoint.OnIncomingConnection (connection, reason, forward_uri.c_str ());
}
@@ -551,20 +536,7 @@
G_GNUC_UNUSED SIPSubscribe::MWIType type,
const PString & msgs)
{
- GtkWidget *accounts_window = NULL;
-
endpoint.OnMWIReceived (to, msgs);
-
- accounts_window = GnomeMeeting::Process ()->GetAccountsWindow ();
-
- // FIXME when migrating the accounts window
- gnomemeeting_threads_enter ();
- gm_accounts_window_update_account_state (accounts_window,
- FALSE,
- to,
- NULL,
- (const char *) msgs);
- gnomemeeting_threads_leave ();
}
@@ -744,30 +716,19 @@
GMSIPEndpoint::OnNoAnswerTimeout (PTimer &,
INT)
{
- gchar *forward_host = NULL;
- gboolean forward_on_no_answer = FALSE;
-
if (endpoint.GetCallingState () == GMManager::Called) {
- gnomemeeting_threads_enter ();
- forward_host = gm_conf_get_string (SIP_KEY "forward_host");
- forward_on_no_answer =
- gm_conf_get_bool (CALL_FORWARDING_KEY "forward_on_no_answer");
- gnomemeeting_threads_leave ();
-
- if (forward_host && forward_on_no_answer) {
+ if (!forward_uri.empty () && forward_on_no_answer) {
PSafePtr<OpalCall> call =
endpoint.FindCallWithLock (endpoint.GetCurrentCallToken ());
PSafePtr<OpalConnection> con =
endpoint.GetConnection (call, TRUE);
- con->ForwardCall (forward_host);
+ con->ForwardCall (forward_uri.c_str ());
}
else
ClearAllCalls (OpalConnection::EndedByNoAnswer, FALSE);
-
- g_free (forward_host);
}
}
Modified: trunk/src/endpoints/sip.h
==============================================================================
--- trunk/src/endpoints/sip.h (original)
+++ trunk/src/endpoints/sip.h Mon Mar 17 21:43:03 2008
@@ -88,6 +88,17 @@
void set_dtmf_mode (unsigned int mode);
void set_nat_binding_delay (unsigned int delay);
+ /***/
+ /* TODO:
+ * It is probably needed to move some of those functions
+ * in the core
+ */
+ void set_forward_host (const std::string & uri);
+ void set_forward_on_busy (const bool enabled);
+ void set_unconditional_forward (const bool enabled);
+ void set_forward_on_no_answer (const bool enabled);
+ void set_no_answer_timeout (const unsigned timeout);
+
/* DESCRIPTION : /
* BEHAVIOR : Starts the listener thread on the port choosen
@@ -226,5 +237,11 @@
Ekiga::ServiceCore & core;
std::string uri_prefix;
+ std::string forward_uri;
+
+ bool forward_on_busy;
+ bool unconditional_forward;
+ bool forward_on_no_answer;
+ unsigned no_answer_timeout;
};
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]