[telepathy-gabble/master] Send <ringing> and <active> on -initiate and -accept

Will Thompson will.thompson at collabora.co.uk
Wed May 27 07:37:34 PDT 2009


For now, the UI doesn't have any way to tell the CM that it's ringing.
So Gabble sends <ringing/> when it gets a session-initiate, and
<active/> when it gets an ack for its session-accept.
---
 src/jingle-session.c                    |   11 +++++++++--
 tests/twisted/jingle/incoming-basics.py |   18 +++++++++++++++++-
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/jingle-session.c b/src/jingle-session.c
index 944038c..267cbb0 100644
--- a/src/jingle-session.c
+++ b/src/jingle-session.c
@@ -838,6 +838,8 @@ on_session_initiate (GabbleJingleSession *sess, LmMessageNode *node,
        * in XEP-0166. */
 
       set_state (sess, JS_STATE_PENDING_INITIATED, 0);
+
+      gabble_jingle_session_send_rtp_info (sess, "ringing");
     }
 }
 
@@ -1653,9 +1655,14 @@ _on_accept_reply (GObject *sess_as_obj,
   GabbleJingleSession *sess = GABBLE_JINGLE_SESSION (sess_as_obj);
 
   if (success)
-    set_state (sess, JS_STATE_ACTIVE, 0);
+    {
+      set_state (sess, JS_STATE_ACTIVE, 0);
+      gabble_jingle_session_send_rtp_info (sess, "active");
+    }
   else
-    set_state (sess, JS_STATE_ENDED, TP_CHANNEL_GROUP_CHANGE_REASON_NONE);
+    {
+      set_state (sess, JS_STATE_ENDED, TP_CHANNEL_GROUP_CHANGE_REASON_NONE);
+    }
 }
 
 static gboolean
diff --git a/tests/twisted/jingle/incoming-basics.py b/tests/twisted/jingle/incoming-basics.py
index 34be73c..61c589c 100644
--- a/tests/twisted/jingle/incoming-basics.py
+++ b/tests/twisted/jingle/incoming-basics.py
@@ -24,10 +24,17 @@ def test(jp, q, bus, conn, stream):
     # Remote end calls us
     jt.incoming_call()
 
+    # If this is a Jingle dialect that supports it, Gabble should send a
+    # <ringing/> notification when it gets the session-initiate until Telepathy
+    # has a way for the UI to do this.
+    # https://bugs.freedesktop.org/show_bug.cgi?id=21964
+    ringing_event = jp.rtp_info_event_list("ringing")
+
     nc, e = q.expect_many(
         EventPattern('dbus-signal', signal='NewChannel'),
         EventPattern('dbus-signal', signal='NewSessionHandler'),
-        )
+        *ringing_event
+        )[0:2]
     path, ct, ht, h, _ = nc.args
 
     assert ct == cs.CHANNEL_TYPE_STREAMED_MEDIA, ct
@@ -146,6 +153,15 @@ def test(jp, q, bus, conn, stream):
             args=[stream_id, cs.MEDIA_STREAM_DIRECTION_BIDIRECTIONAL, 0]),
         )
 
+    stream.send(make_result_iq(stream, acc.stanza))
+
+    # Also, if this is a Jingle dialect that supports it, Gabble should send an
+    # <active/> notification when the session-accept is acked (until the
+    # Telepathy spec lets the UI say it's not ringing any more).
+    active_event = jp.rtp_info_event("active")
+    if active_event is not None:
+        q.expect_many(active_event)
+
     # we are now both in members
     members = media_chan.GetMembers()
     assert set(members) == set([self_handle, remote_handle]), members
-- 
1.5.6.5




More information about the telepathy-commits mailing list