ekiga r7487 - in trunk: . lib/engine/components/opal



Author: dsandras
Date: Mon Dec 29 20:15:22 2008
New Revision: 7487
URL: http://svn.gnome.org/viewvc/ekiga?rev=7487&view=rev

Log:
Added dialog-info notifications support. This indicates with call servers
like Asterisk or OpenSER who is calling people in your roster as well as
when they are in a call.


Modified:
   trunk/ChangeLog
   trunk/lib/engine/components/opal/sip-endpoint.cpp
   trunk/lib/engine/components/opal/sip-endpoint.h

Modified: trunk/lib/engine/components/opal/sip-endpoint.cpp
==============================================================================
--- trunk/lib/engine/components/opal/sip-endpoint.cpp	(original)
+++ trunk/lib/engine/components/opal/sip-endpoint.cpp	Mon Dec 29 20:15:22 2008
@@ -163,8 +163,6 @@
 
   /* NAT Binding */
   SetNATBindingRefreshMethod (SIPEndPoint::EmptyRequest);
-
-
 }
 
 
@@ -1097,6 +1095,41 @@
 }
 
 
+void 
+Opal::Sip::EndPoint::OnDialogInfoReceived (const SIPDialogNotification & info)
+{
+  gchar* status = NULL;
+  PString uri = info.m_entity;
+  PString remote_uri = info.m_remote.m_identity;
+  PString remote_display_name = info.m_remote.m_display.IsEmpty () ? remote_uri : info.m_remote.m_display;
+
+  switch (info.m_state) {
+    case SIPDialogNotification::Proceeding:
+    case SIPDialogNotification::Early:
+      if (!remote_display_name.IsEmpty ())
+        status = g_strdup_printf (_("Incoming call from %s"), (const char *) remote_display_name);
+      else
+        status = g_strdup_printf (_("Incoming call"));
+      break;
+    case SIPDialogNotification::Confirmed:
+      if (!remote_display_name.IsEmpty ())
+        status = g_strdup_printf (_("In a call with %s"), (const char *) remote_display_name);
+      else
+        status = g_strdup_printf (_("In a call"));
+      break;
+    default:
+    case SIPDialogNotification::Trying:
+    case SIPDialogNotification::Terminated:
+      break;
+  }
+
+  if (status)
+    runtime->run_in_main (sigc::bind (sigc::ptr_fun (presence_status_in_main), this, uri, "inacall", status));
+  else
+    runtime->run_in_main (sigc::bind (sigc::ptr_fun (presence_status_in_main), this, uri, uri_presences[uri].first, uri_presences[uri].second));
+}
+
+
 void Opal::Sip::EndPoint::on_dial (std::string uri)
 {
   manager.dial (uri);

Modified: trunk/lib/engine/components/opal/sip-endpoint.h
==============================================================================
--- trunk/lib/engine/components/opal/sip-endpoint.h	(original)
+++ trunk/lib/engine/components/opal/sip-endpoint.h	Mon Dec 29 20:15:22 2008
@@ -151,12 +151,14 @@
                                  unsigned options,
                                  OpalConnection::StringOptions * stroptions);
 
-      virtual void OnPresenceInfoReceived (const PString & user,
-                                           const PString & basic,
-                                           const PString & note);
+      void OnPresenceInfoReceived (const PString & user,
+                                   const PString & basic,
+                                   const PString & note);
 
-      virtual bool OnReceivedMESSAGE (OpalTransport & transport,
-                                      SIP_PDU & pdu);
+      void OnDialogInfoReceived (const SIPDialogNotification & info);
+
+      bool OnReceivedMESSAGE (OpalTransport & transport,
+                              SIP_PDU & pdu);
 
       void OnMessageFailed (const SIPURL & messageUrl,
                             SIP_PDU::StatusCodes reason);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]