Adding a new activity to manage jingle calls
authorNikita Kozlov <nikita@beem-project.com>
Sat, 23 Jan 2010 00:49:34 +0100
changeset 828 6089f3255c5f
parent 827 032cd7e2c938
child 829 f703b3e14f9a
Adding a new activity to manage jingle calls
.classpath
AndroidManifest.xml
res/layout/call.xml
res/layout/incall.xml
res/layout/jingle_call_activity.xml
res/menu/call.xml
src/com/beem/project/beem/jingle/JingleService.java
src/com/beem/project/beem/service/Contact.java
src/com/beem/project/beem/service/RosterAdapter.java
src/com/beem/project/beem/service/XmppFacade.java
src/com/beem/project/beem/service/aidl/IBeemJingleListener.aidl
src/com/beem/project/beem/service/aidl/IJingle.aidl
src/com/beem/project/beem/service/aidl/IXmppFacade.aidl
src/com/beem/project/beem/ui/Call.java
src/com/beem/project/beem/ui/CallScreen.java
src/com/beem/project/beem/ui/ContactList.java
--- a/.classpath	Sat Jan 16 21:10:23 2010 +0100
+++ b/.classpath	Sat Jan 23 00:49:34 2010 +0100
@@ -1,25 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
-	<classpathentry exported="true" kind="lib" path="libs/smackx-debug.jar"/>
-	<classpathentry exported="true" kind="lib" path="libs/smackx-jingle.jar" sourcepath="/home/nikita/devel/smack">
+	<classpathentry kind="lib" path="/home/nikita/android/platforms/android-2.0.1/android.jar">
 		<attributes>
-			<attribute name="javadoc_location" value="file:/home/nikita/devel/smack_src_3_1_0/javadoc/"/>
+			<attribute name="javadoc_location" value="file:/home/nikita/android-sdk-linux_x86-1.6_r1/docs/reference/"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry exported="true" kind="lib" path="libs/smack.jar" sourcepath="/home/marseille/smack_src_3_1_0/source">
-		<attributes>
-			<attribute name="javadoc_location" value="file:/home/nikita/devel/smack_src_3_1_0/javadoc/org/"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry exported="true" kind="lib" path="libs/smackx.jar" sourcepath="/home/nikita/devel/smack">
-		<attributes>
-			<attribute name="javadoc_location" value="file:/home/nikita/devel/smack_src_3_1_0/javadoc/"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry exported="true" kind="lib" path="libs/jlibrtp.jar">
-	<classpathentry exported="true" kind="lib" path="libs/security.jar"/>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="gen"/>
+	<classpathentry kind="lib" path="libs/jlibrtp.jar"/>
+	<classpathentry kind="lib" path="libs/smack.jar"/>
+	<classpathentry kind="lib" path="libs/smackx-debug.jar"/>
+	<classpathentry kind="lib" path="libs/smackx-jingle.jar" sourcepath="/home/nikita/devel/smack"/>
+	<classpathentry kind="lib" path="libs/smackx.jar"/>
+	<classpathentry kind="lib" path="libs/security.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
--- a/AndroidManifest.xml	Sat Jan 16 21:10:23 2010 +0100
+++ b/AndroidManifest.xml	Sat Jan 23 00:49:34 2010 +0100
@@ -66,12 +66,19 @@
 					android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
 			</intent-filter>
 		</activity>
-		<!-- Could be interesting if we would launch beem at startup
-		<receiver android:name=".tool.BeemBroadcastReceiver" android:enabled="true">
-			<intent-filter>
-				<action android:name="android.intent.action.BOOT_COMPLETED" />
+		<activity android:name=".ui.Call" android:label="Call String en dur">
+			<intent-filter android:label="Beem Connection">
+				<action
+					android:name="com.beem.project.beem.service.XmppConnectionAdapter.CONNECTION_CLOSED" />
 			</intent-filter>
-		</receiver>  -->
+		</activity>
+		<!--
+			Could be interesting if we would launch beem at startup <receiver
+			android:name=".tool.BeemBroadcastReceiver" android:enabled="true">
+			<intent-filter> <action
+			android:name="android.intent.action.BOOT_COMPLETED" />
+			</intent-filter> </receiver>
+		-->
 		<service android:name="BeemService" android:enabled="true"
 			android:label="Beem Service" android:permission="com.beem.project.beem.BEEM_SERVICE">
 			<intent-filter>
@@ -90,6 +97,6 @@
 	<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
 	<uses-permission android:name="com.beem.project.beem.BEEM_SERVICE"></uses-permission>
 	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
-	<uses-sdk android:minSdkVersion="3"/>
+	<uses-sdk android:minSdkVersion="3" />
 
 </manifest> 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/call.xml	Sat Jan 23 00:49:34 2010 +0100
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:layout_height="fill_parent" android:layout_width="fill_parent"
+	android:orientation="vertical">
+	<LinearLayout android:layout_width="fill_parent"
+		android:layout_height="fill_parent" android:orientation="vertical"
+		android:layout_weight="1">
+		<ImageView android:id="@+id/call_logo_anim" android:src="@drawable/beem_launcher_icon_color"
+			android:layout_height="fill_parent" android:layout_width="fill_parent"
+			android:layout_weight="1" />
+		<TextView android:id="@+id/call_info" android:layout_width="fill_parent"
+			android:layout_height="fill_parent" android:text="Message pour savoir ou en est la conversation"
+			android:layout_gravity="bottom" android:layout_weight="1"
+			android:gravity="center" />
+	</LinearLayout>
+	<Button android:id="@+id/call_cancel_button"
+		android:layout_height="wrap_content" android:layout_width="fill_parent"
+		android:layout_gravity="bottom" android:text="~ Close Call ~" />
+	<Button android:id="@+id/call_accept_button"
+		android:layout_height="wrap_content" android:layout_width="fill_parent"
+		android:layout_gravity="bottom" android:text="~ Accept Call ~" android:visible="true" />
+</LinearLayout>
+
--- a/res/layout/incall.xml	Sat Jan 16 21:10:23 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<AbsoluteLayout
-android:id="@+id/top_lvl_layout"
-android:layout_width="fill_parent"
-android:layout_height="fill_parent"
-android:background="#000000"
-xmlns:android="http://schemas.android.com/apk/res/android"
->
-
-   <FrameLayout android:id="@+id/mainFrame"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:layout_weight="1"
-        android:paddingTop="10dip"
-        android:paddingLeft="6dip"
-        android:paddingRight="6dip"
-        >
-
-        <!-- (1) inCallPanel: the main set of in-call UI elements -->
-        <RelativeLayout android:id="@+id/inCallPanel"
-                        android:layout_width="fill_parent"
-                        android:layout_height="fill_parent"
-                        >
-
-            <!-- Slide hints: if the "sliding card" feature is enabled,
-                 one or the other of these is visible at any given moment
-                 (see updateCardSlideHints()). -->
-
-            <!-- Slide hint and arrow *above* the main body of the card,
-                 shown when the card is in the *bottom* position. -->
-            <!-- This hint's position onscreen is static: the Y value is set
-                 so that the hint will be visible just above the top edge of
-                 the CallCard when the CallCard is in the "bottom" position.
-                 The resources here describe the portrait mode layout; see
-                 InCallScreen.ConfigurationHelper.applyConfigurationToLayout()
-                 for the differences in landscape mode. -->
-            <LinearLayout android:id="@+id/slideUp"
-                          android:orientation="vertical"
-                          android:layout_width="fill_parent"
-                          android:layout_height="wrap_content"
-                          android:layout_alignParentBottom="true"
-                          android:background="@null"
-                          android:visibility="gone"
-                          >
-                <TextView android:id="@+id/slideUpHint"
-                          android:layout_gravity="center_horizontal"
-                          android:gravity="center_horizontal"
-                          android:textAppearance="?android:attr/textAppearanceMedium"
-                          android:textColor="?android:attr/textColorSecondary"
-                          android:layout_width="wrap_content"
-                          android:layout_height="wrap_content"
-                          />
-                <ImageView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_horizontal"
-                    android:src="@android:drawable/arrow_up_float"
-                    />
-            </LinearLayout>
-
-            <!-- Slide hint and arrow *below* the main body of the card,
-                 shown when the card is in the *top* position. -->
-            <!-- This hint's position onscreen is static: the Y value is set
-                 so that the hint will be visible just below the bottom edge of
-                 the CallCard when the CallCard is in the "top" position.
-                 The resources here describe the portrait mode layout; see
-                 InCallScreen.ConfigurationHelper.applyConfigurationToLayout()
-                 for the differences in landscape mode. -->
-            <LinearLayout android:id="@+id/slideDown"
-                          android:orientation="vertical"
-                          android:layout_width="fill_parent"
-                          android:layout_height="wrap_content"
-                          android:layout_alignParentTop="true"
-                           android:background="@null"
-                          android:visibility="gone"
-                          >
-                <ImageView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_horizontal"
-                    android:src="@android:drawable/arrow_down_float"
-                    />
-                <TextView
-                    android:id="@+id/slideDownHint"
-                    android:layout_gravity="center_horizontal"
-                    android:gravity="center_horizontal"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:textColor="?android:attr/textColorSecondary"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    />                
-                <TextView
-                    android:id="@+id/stats"
-                    android:layout_gravity="center_horizontal"
-                    android:gravity="center_horizontal"
-                    android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:textColor="?android:attr/textColorSecondary"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    />
-            </LinearLayout>
-
-        </RelativeLayout>  <!-- End of inCallPanel -->
-
-    </FrameLayout>  <!-- End of mainFrame -->
-</AbsoluteLayout>
--- a/res/layout/jingle_call_activity.xml	Sat Jan 16 21:10:23 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-	android:layout_width="fill_parent" android:layout_height="wrap_content"
-	android:orientation="vertical">
-<!--         <TextView android:text="Jid:" android:id="@+id/jingledemocalljidlabel"
-		android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
-	<EditText android:id="@+id/jingledemocalljid"
-		android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText>
-	<TextView android:text="Password:" android:id="@+id/jingledemocallpasswordlabel"
-		android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
-	<EditText android:id="@+id/jingledemocallpassword"
-		android:layout_width="fill_parent" android:layout_height="wrap_content" android:inputType="textPassword" ></EditText>
-
-	<Button android:text="Connexion" android:id="@+id/jingledemocallconnectbutton"
-		android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
-	<TextView android:text="Call who :" android:id="@+id/jingledemocallreceiverlabel"
-		android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
-
-<EditText android:text="" android:id="@+id/jingledemocallreceiver" android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText>
-
-<Button android:text="Call" android:id="@+id/jingledemocallbutton" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>       -->
-<ImageView android:id="@+id/log_as_logo"
-    android:layout_width="fill_parent" android:layout_height="wrap_content"
-    android:layout_marginBottom="25px" android:layout_marginTop="42px" />
-</LinearLayout>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/res/menu/call.xml	Sat Jan 23 00:49:34 2010 +0100
@@ -0,0 +1,10 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+	<item android:id="@+id/call_speaker_on" android:visible="true"
+		android:title="~ speaker on ~" android:icon="@android:drawable/ic_lock_silent_mode_off" />
+	<item android:id="@+id/call_speaker_off" android:visible="true"
+		android:title="~ speaker off ~" android:icon="@android:drawable/ic_lock_silent_mode" />
+	<item android:id="@+id/call_hold_on" android:visible="true"
+		android:title="~ hold on ~ " android:icon="@android:drawable/ic_lock_lock" />
+	<item android:id="@+id/call_hold_on" android:visible="true"
+		android:title="~ hold on ~ " android:icon="@android:drawable/ic_menu_call" /> 
+</menu>
--- a/src/com/beem/project/beem/jingle/JingleService.java	Sat Jan 16 21:10:23 2010 +0100
+++ b/src/com/beem/project/beem/jingle/JingleService.java	Sat Jan 23 00:49:34 2010 +0100
@@ -40,7 +40,7 @@
     Flavien Astraud, November 26, 2009
     Head of the EIP Laboratory.
 
-*/
+ */
 package com.beem.project.beem.jingle;
 
 import java.util.ArrayList;
@@ -60,196 +60,248 @@
 import org.sipdroid.media.codecs.CodecManager;
 
 import android.content.Context;
+import android.net.Uri;
+import android.os.RemoteCallbackList;
+import android.os.RemoteException;
 import android.util.Log;
 import android.content.Intent;
 
-import com.beem.project.beem.ui.CallScreen;
+import com.beem.project.beem.ui.Call;
+import com.beem.project.beem.service.aidl.IBeemJingleListener;
+import com.beem.project.beem.service.aidl.IJingle;
 
-// TODO: Auto-generated Javadoc
 /**
  * Beem Jingle Service, manage jingle call.
  * @author nikita
  */
-public class JingleService {
-	private static final String TAG = "JingleService";
-	private JingleManager mJingleManager;
-	private final List<JingleMediaManager> mMediaManagers;
-	private JingleSession mIn;
-	private JingleSession mOut;
-	private Context mContext;
+public class JingleService extends IJingle.Stub {
+    private static final String TAG = "JingleService";
+    private JingleManager mJingleManager;
+    private final List<JingleMediaManager> mMediaManagers;
+    private final RemoteCallbackList<IBeemJingleListener> mRemoteJingleListeners = new RemoteCallbackList<IBeemJingleListener>();
+    private JingleSession mIn;
+    private JingleSession mOut;
+    private JingleSessionRequest mRequest;
+    private Context mContext;
+    private boolean isCaller;
+    private boolean isAccepted;
+
+    /**
+     * JingleService constructor.
+     * @param xmppConnection a valid XMPPConnection
+     */
+    public JingleService(final XMPPConnection xmppConnection,final Context ctx) {
+	BasicTransportManager bt = new BasicTransportManager();
+	mMediaManagers = new ArrayList<JingleMediaManager>();
+	mMediaManagers.add(new MicrophoneRTPManager(bt, ctx));
+	CodecManager.load();
+	mContext = ctx;
+    }
 
-	/**
-	 * JingleService constructor.
-	 * @param xmppConnection a valid XMPPConnection
-	 */
-	public JingleService(final XMPPConnection xmppConnection,final Context ctx) {
-		BasicTransportManager bt = new BasicTransportManager();
-		mMediaManagers = new ArrayList<JingleMediaManager>();
-		mMediaManagers.add(new MicrophoneRTPManager(bt, ctx));
-		CodecManager.load();
-		mContext = ctx;
-	}
+    /**
+     * finish to construct the instance.
+     * @param conn the xmppConnection used with constructor
+     */
+    public void initWhenConntected(XMPPConnection conn) {
+	mJingleManager = new JingleManager(conn, mMediaManagers);
+	mJingleManager.addJingleSessionRequestListener(new BeemJingleSessionRequestListener());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void addJingleListener(IBeemJingleListener listen) throws RemoteException {
+	if (listen != null)
+	    mRemoteJingleListeners.register(listen);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void removeJingleListener(IBeemJingleListener listen) throws RemoteException {
+	if (listen != null)
+	    mRemoteJingleListeners.unregister(listen);
+    }
 
-	/**
-	 * finish to construct the instance.
-	 * @param conn the xmppConnection used with constructor
-	 */
-	public void initWhenConntected(XMPPConnection conn) {
-		mJingleManager = new JingleManager(conn, mMediaManagers);
-		mJingleManager.addJingleSessionRequestListener(new BeemJingleSessionRequestListener());
+    /**
+     * begin a jingle call.
+     * @param receiver the call receiver
+     */
+    @Override
+    public void call(final String receiver) throws RemoteException {
+	try {
+	    mOut = mJingleManager.createOutgoingJingleSession(receiver);
+	    mOut.addListener(new BeemJingleSessionListener());
+	    mOut.startOutgoing();
+	    isCaller = true;
+	} catch (XMPPException e) {
+	    e.printStackTrace();
 	}
+    }
+
+
+    @Override
+    public void acceptCall() throws RemoteException {
+	mIn.startIncoming();
+	isCaller = false;
+    }
 
-	/**
-	 * begin a jingle call.
-	 * @param receiver the call receiver
-	 */
-	public void call(final String receiver) {
-		try {
-			mOut = mJingleManager.createOutgoingJingleSession(receiver);
-			// TODO configure out avec addMediaSession et addNegociator
-			mOut.addListener(new BeemJingleCallerSessionListener());
-			mOut.startOutgoing();
-		} catch (XMPPException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+    /**
+     * close a jingle call.
+     */
+    @Override
+    public void closeCall() throws RemoteException {
+	if (isCaller) {
+	    try {
+		if (isAccepted) {
+		    mOut.terminate();
+		} else {
+		    mOut.close();
 		}
+	    } catch (XMPPException e) {
+		e.printStackTrace();
+	    }
+	    mOut = null;
+	} else {
+	    try {
+		if (isAccepted) {
+		    mIn.terminate();
+		} else {
+		    mIn.close();
+		}		    
+	    } catch (XMPPException e) {
+		e.printStackTrace();
+	    }
+	    mIn = null;
 	}
-
-	/*private void call(PayloadType pt, TransportCandidate remoteCandidate,
-			TransportCandidate localCandidate, JingleSession jingleSession) {
+    }
 
-		audio = new JAudioLauncher(localCandidate.getPort(), remoteCandidate.getIp(),
-				remoteCandidate.getPort(), pt); 
-
-	}*/
+    /**
+     * Listen on session events.
+     * @author nikita
+     */
+    private class BeemJingleSessionListener implements JingleSessionListener {
 
 	/**
-	 * Listen on receiver session events.
-	 * @author nikita
+	 * constructor.
 	 */
-	private class BeemJingleReceiverSessionListener implements JingleSessionListener {
+	public BeemJingleSessionListener() {
+	    super();
+	}
+
+	@Override
+	public void sessionClosed(String reason, JingleSession jingleSession) {
+	    System.out.println("Session " + jingleSession.getResponder() + "closedd because " + reason);
 
-		/**
-		 * constructor.
-		 */
-		public BeemJingleReceiverSessionListener() {
-			super();
-			// TODO Auto-generated constructor stub
+	    final int n = mRemoteJingleListeners.beginBroadcast();
+	    for (int i = 0; i < n; i++) {
+		IBeemJingleListener listener = mRemoteJingleListeners.getBroadcastItem(i);
+		try {
+		    listener.sessionClosed(reason);
+		} catch (RemoteException e) {
+		    e.printStackTrace();
 		}
+	    }
+	    mRemoteJingleListeners.finishBroadcast();
+	}
 
-		@Override
-		public void sessionClosed(String reason, JingleSession jingleSession) {
-			System.out.println("Session " + jingleSession.getResponder() + "closedd because " + reason);
-			//audio.stopMedia();
+	@Override
+	public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
+	    System.out.println("Session " + jingleSession.getResponder() + " closed");
 
+	    final int n = mRemoteJingleListeners.beginBroadcast();
+	    for (int i = 0; i < n; i++) {
+		IBeemJingleListener listener = mRemoteJingleListeners.getBroadcastItem(i);
+		try {
+		    listener.sessionClosedOnError(e.getMessage());
+		} catch (RemoteException err) {
+		    err.printStackTrace();
 		}
+	    }
+	    mRemoteJingleListeners.finishBroadcast();
+	}
+
+	@Override
+	public void sessionDeclined(String reason, JingleSession jingleSession) {
+	    Log.d(TAG, "Session " + jingleSession.getResponder() + "declined because " + reason);
+	    isAccepted = false;
 
-		@Override
-		public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
-			// TODO Auto-generated method stub
-			System.out.println("Session " + jingleSession.getResponder() + " closed");
-			//audio.stopMedia();
+	    final int n = mRemoteJingleListeners.beginBroadcast();
+	    for (int i = 0; i < n; i++) {
+		IBeemJingleListener listener = mRemoteJingleListeners.getBroadcastItem(i);
+		try {
+		    listener.sessionDeclined(reason);
+		} catch (RemoteException e) {
+		    e.printStackTrace();
 		}
+	    }
+	    mRemoteJingleListeners.finishBroadcast();
 
-		@Override
-		public void sessionDeclined(String reason, JingleSession jingleSession) {
-			Log.d(TAG, "Session " + jingleSession.getResponder() + "declined because " + reason);
-		}
+	}
+
+	@Override
+	public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
+	    TransportCandidate localCandidate, JingleSession jingleSession) {
+	    Log.d(TAG, "Session " + jingleSession.getResponder() + "established");
+	    isAccepted = true;
+
+	    jingleSession.getSession().getMediaSession(pt.getName());
+	    final int n = mRemoteJingleListeners.beginBroadcast();
 
-		@Override
-		public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
-				TransportCandidate localCandidate, JingleSession jingleSession) {
-			Log.d(TAG, "Session " + jingleSession.getResponder() + "established");
-			jingleSession.getSession().getMediaSession(pt.getName());
+	    for (int i = 0; i < n; i++) {
+		IBeemJingleListener listener = mRemoteJingleListeners.getBroadcastItem(i);
+		try {
+		    listener.sessionEstablished();
+		} catch (RemoteException e) {
+		    e.printStackTrace();
 		}
+	    }
+	    mRemoteJingleListeners.finishBroadcast();
+	}
 
-		@Override
-		public void sessionMediaReceived(JingleSession jingleSession, String participant) {
-			Log.d(TAG, "Session Media received from " + participant);
-		}
+	@Override
+	public void sessionMediaReceived(JingleSession jingleSession, String participant) {
+	    Log.d(TAG, "Session Media received from " + participant);
+	}
 
-		@Override
-		public void sessionRedirected(String redirection, JingleSession jingleSession) {
-		}
+	@Override
+	public void sessionRedirected(String redirection, JingleSession jingleSession) {
 	}
+    }
+
+
+    /**
+     * Listen for a Jingle session request.
+     * @author nikita
+     */
+    private class BeemJingleSessionRequestListener implements JingleSessionRequestListener {
 
 	/**
-	 * Listen on caller session events.
-	 * @author nikita
+	 * Constructor.
 	 */
-	private class BeemJingleCallerSessionListener implements JingleSessionListener {
-
-		private static final int SLP_DURATION = 20000;
-
-		/**
-		 * constructor.
-		 */
-		public BeemJingleCallerSessionListener() {
-			super();
-			// TODO Auto-generated constructor stub
-		}
-
-		@Override
-		public void sessionClosed(final String reason, final JingleSession jingleSession) {
-			System.out.println("Session " + jingleSession.getResponder() + "closed because " + reason);
-		}
-
-		@Override
-		public void sessionClosedOnError(final XMPPException e, final JingleSession jingleSession) {
-			System.out.println("Session " + jingleSession.getResponder() + " closed on error");
-		}
-
-		@Override
-		public void sessionDeclined(final String reason, final JingleSession jingleSession) {
-			Log.d(TAG, "Session " + jingleSession.getResponder() + "declined because " + reason);
-		}
-
-		@Override
-		public void sessionEstablished(final PayloadType pt, final TransportCandidate remoteCandidate,
-				final TransportCandidate localCandidate, final JingleSession jingleSession) {
-			Log.d(TAG, "Session " + jingleSession.getResponder() + "established");
-			Intent callIntent = new Intent(mContext, CallScreen.class);
-			callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-			mContext.startActivity(callIntent);
-			//call(pt, remoteCandidate, localCandidate, jingleSession);
-		}
-
-		@Override
-		public void sessionMediaReceived(final JingleSession jingleSession, final String participant) {
-			// TODO Auto-generated method stub
-			System.out.println("Session Media received from " + participant);
-		}
-
-		@Override
-		public void sessionRedirected(final String redirection, final JingleSession jingleSession) {
-			// TODO Auto-generated method stub
-		}
+	public BeemJingleSessionRequestListener() {
+	    super();
 	}
 
-	/**
-	 * Listen for a Jingle session request.
-	 * @author nikita
-	 */
-	private class BeemJingleSessionRequestListener implements JingleSessionRequestListener {
-
-		/**
-		 * Constructor.
-		 */
-		public BeemJingleSessionRequestListener() {
-			super();
-		}
-
-		@Override
-		public void sessionRequested(JingleSessionRequest request) {
-			System.out.println("Jingle Session request from " + request.getFrom());
-			try {
-				mIn = request.accept();
-				mIn.addListener(new BeemJingleReceiverSessionListener());
-				mIn.startIncoming();
-			} catch (XMPPException e) {
-				e.printStackTrace();
-			}
-		}
+	@Override
+	public void sessionRequested(JingleSessionRequest request) {
+	    mRequest = request;
+	    try {
+		mIn = mJingleManager.createIncomingJingleSession(mRequest);
+		mIn.addListener(new BeemJingleSessionListener());
+	    } catch (XMPPException e) {
+		e.printStackTrace();
+	    }
+	    System.out.println("Jingle Session request from " + request.getFrom());
+	    isCaller = false;
+	    isAccepted = false;
+	    Intent intent = new Intent(mContext, Call.class);
+	    intent.setData(Uri.parse("jingle:"+request.getFrom()));
+	    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+	    mContext.startActivity(intent);
 	}
+    }
 
 }
--- a/src/com/beem/project/beem/service/Contact.java	Sat Jan 16 21:10:23 2010 +0100
+++ b/src/com/beem/project/beem/service/Contact.java	Sat Jan 23 00:49:34 2010 +0100
@@ -194,7 +194,6 @@
      */
     @Override
     public int describeContents() {
-	// TODO Auto-generated method stub
 	return 0;
     }
 
--- a/src/com/beem/project/beem/service/RosterAdapter.java	Sat Jan 16 21:10:23 2010 +0100
+++ b/src/com/beem/project/beem/service/RosterAdapter.java	Sat Jan 23 00:49:34 2010 +0100
@@ -64,6 +64,7 @@
 import com.beem.project.beem.R;
 import com.beem.project.beem.service.aidl.IBeemRosterListener;
 import com.beem.project.beem.utils.Status;
+import com.beem.project.beem.service.aidl.IRoster;
 
 /**
  * This class implement a Roster adapter for BEEM.
@@ -371,8 +372,6 @@
 	 */
 	@Override
 	public void presenceChanged(Presence presence) {
-	    // Log.i(TAG, "presence Changed");
-	    /* redispatch vers les IBeemRosterListener */
 	    final int n = mRemoteRosListeners.beginBroadcast();
 
 	    for (int i = 0; i < n; i++) {
@@ -385,8 +384,6 @@
 		    }
 		    listener.onPresenceChanged(new PresenceAdapter(presence));
 		} catch (RemoteException e) {
-		    // The RemoteCallbackList will take care of removing the
-		    // dead listeners.
 		    Log.w(TAG, "Error while updating roster presence entries", e);
 		}
 	    }
--- a/src/com/beem/project/beem/service/XmppFacade.java	Sat Jan 16 21:10:23 2010 +0100
+++ b/src/com/beem/project/beem/service/XmppFacade.java	Sat Jan 23 00:49:34 2010 +0100
@@ -55,6 +55,7 @@
 import com.beem.project.beem.service.aidl.IRoster;
 import com.beem.project.beem.service.aidl.IXmppConnection;
 import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.service.aidl.IJingle;
 import com.beem.project.beem.utils.PresenceType;
 
 /**
@@ -123,6 +124,14 @@
     public IChatManager getChatManager() throws RemoteException {
 	return mConnexion.getChatManager();
     }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public IJingle getJingleService() throws RemoteException {
+	return mJingle;
+    }
 
     /**
      * {@inheritDoc}
@@ -148,14 +157,6 @@
     }
 
     /* (non-Javadoc)
-     * @see com.beem.project.beem.service.aidl.IXmppFacade#call(java.lang.String)
-     */
-    @Override
-    public void call(String jid) throws RemoteException {
-	mJingle.call(jid);
-    }
-
-    /* (non-Javadoc)
      * @see com.beem.project.beem.service.aidl.IXmppFacade#getVcardAvatar(java.lang.String)
      */
     @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/aidl/IBeemJingleListener.aidl	Sat Jan 23 00:49:34 2010 +0100
@@ -0,0 +1,77 @@
+/*
+    BEEM is a videoconference application on the Android Platform.
+
+    Copyright (C) 2009 by Frederic-Charles Barthelery,
+                          Jean-Manuel Da Silva,
+                          Nikita Kozlov,
+                          Philippe Lago,
+                          Jean Baptiste Vergely,
+                          Vincent Veronis.
+
+    This file is part of BEEM.
+
+    BEEM is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    BEEM is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with BEEM.  If not, see <http://www.gnu.org/licenses/>.
+
+    Please send bug reports with examples or suggestions to
+    contact@beem-project.com or http://dev.beem-project.com/
+
+    Epitech, hereby disclaims all copyright interest in the program "Beem"
+    written by Frederic-Charles Barthelery,
+               Jean-Manuel Da Silva,
+               Nikita Kozlov,
+               Philippe Lago,
+               Jean Baptiste Vergely,
+               Vincent Veronis.
+
+    Nicolas Sadirac, November 26, 2009
+    President of Epitech.
+
+    Flavien Astraud, November 26, 2009
+    Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+/**
+ * Interface to listen for jingle sessions events
+ * @author Nikita Kozlov <nikita@beem-project.com>
+ */
+interface IBeemJingleListener {
+
+    /**
+     *  Callback to call when the session is closed
+     */
+    void sessionClosed(in String reason);
+
+    /**
+     *  Callback to call when the session is declined
+     */
+    void sessionDeclined(in String reason);
+
+    
+    /**
+     *  Callback to call when the session is closed on error
+     */
+    void sessionClosedOnError(in String error);
+
+    /**
+     * Callback to call when session is established
+     */
+    void sessionEstablished();
+    
+    /**
+     * Callback to call when session is requested
+     */
+    void sessionRequested(in String fromJID);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/service/aidl/IJingle.aidl	Sat Jan 23 00:49:34 2010 +0100
@@ -0,0 +1,70 @@
+/*
+    BEEM is a videoconference application on the Android Platform.
+
+    Copyright (C) 2009 by Frederic-Charles Barthelery,
+                          Jean-Manuel Da Silva,
+                          Nikita Kozlov,
+                          Philippe Lago,
+                          Jean Baptiste Vergely,
+                          Vincent Veronis.
+
+    This file is part of BEEM.
+
+    BEEM is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    BEEM is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with BEEM.  If not, see <http://www.gnu.org/licenses/>.
+
+    Please send bug reports with examples or suggestions to
+    contact@beem-project.com or http://dev.beem-project.com/
+
+    Epitech, hereby disclaims all copyright interest in the program "Beem"
+    written by Frederic-Charles Barthelery,
+               Jean-Manuel Da Silva,
+               Nikita Kozlov,
+               Philippe Lago,
+               Jean Baptiste Vergely,
+               Vincent Veronis.
+
+    Nicolas Sadirac, November 26, 2009
+    President of Epitech.
+
+    Flavien Astraud, November 26, 2009
+    Head of the EIP Laboratory.
+
+*/
+package com.beem.project.beem.service.aidl;
+
+import com.beem.project.beem.service.aidl.IBeemJingleListener;
+
+
+interface IJingle {
+
+    void addJingleListener(in IBeemJingleListener listen);
+    void removeJingleListener(in IBeemJingleListener listen);
+    
+        /**
+     * make a jingle audio call
+     * @param jid the receiver id
+     */
+     void call(in String jid);
+     
+     /**
+     * Accept call a jingle audio call
+     */
+     void acceptCall();
+     
+     /**
+     * close a jingle audio call
+     */
+     void closeCall();
+
+}
--- a/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl	Sat Jan 16 21:10:23 2010 +0100
+++ b/src/com/beem/project/beem/service/aidl/IXmppFacade.aidl	Sat Jan 23 00:49:34 2010 +0100
@@ -45,9 +45,10 @@
 
 import  com.beem.project.beem.service.aidl.IXmppConnection;
 import  com.beem.project.beem.service.aidl.IRoster;
+import  com.beem.project.beem.service.aidl.IJingle;
 import  com.beem.project.beem.service.aidl.IChatManager;
 import  com.beem.project.beem.service.aidl.IPrivacyListManager;
-import com.beem.project.beem.service.PresenceAdapter;
+import  com.beem.project.beem.service.PresenceAdapter;
 
 interface IXmppFacade {
 
@@ -80,6 +81,11 @@
      * Get the chat manager.
      */
     IChatManager getChatManager();
+    
+    /**
+     * Get the Jingle service.
+     */
+    IJingle getJingleService();
 
     /**
      * Change the status of the user.
@@ -90,12 +96,6 @@
 
     void sendPresencePacket(in PresenceAdapter presence);
 
-    /**
-     * make a jingle audio call
-     * @param jid the receiver id
-     */
-     void call(in String jid);
-
      /**
       * get the user vcard avatar
       * @param jid the user jid
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/Call.java	Sat Jan 23 00:49:34 2010 +0100
@@ -0,0 +1,228 @@
+/*
+    BEEM is a videoconference application on the Android Platform.
+
+    Copyright (C) 2009 by Frederic-Charles Barthelery,
+                          Jean-Manuel Da Silva,
+                          Nikita Kozlov,
+                          Philippe Lago,
+                          Jean Baptiste Vergely,
+                          Vincent Veronis.
+
+    This file is part of BEEM.
+
+    BEEM is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    BEEM is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with BEEM.  If not, see <http://www.gnu.org/licenses/>.
+
+    Please send bug reports with examples or suggestions to
+    contact@beem-project.com or http://dev.beem-project.com/
+
+    Epitech, hereby disclaims all copyright interest in the program "Beem"
+    written by Frederic-Charles Barthelery,
+               Jean-Manuel Da Silva,
+               Nikita Kozlov,
+               Philippe Lago,
+               Jean Baptiste Vergely,
+               Vincent Veronis.
+
+    Nicolas Sadirac, November 26, 2009
+    President of Epitech.
+
+    Flavien Astraud, November 26, 2009
+    Head of the EIP Laboratory.
+
+ */
+package com.beem.project.beem.ui;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.os.RemoteCallbackList;
+import android.os.RemoteException;
+
+import com.beem.project.beem.R;
+import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.service.aidl.IJingle;
+import com.beem.project.beem.service.aidl.IBeemJingleListener;
+
+/**
+ * This class is an activity which display an animation during the connection with the server.
+ * @author Da Risk <darisk972@gmail.com>
+ */
+public class Call extends Activity {
+
+    private static final Intent SERVICE_INTENT = new Intent();
+    static {
+	SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+    }
+    private ImageView mLogo;
+    private TextView mCallInfo;
+    private Animation mRotateAnim;
+    private final ServiceConnection mServConn = new BeemServiceConnection();
+    private BeemJingleSessionListener mJingleListener = new BeemJingleSessionListener();
+    private IXmppFacade mXmppFacade;
+    private Button mCloseCall;
+    private Button mAcceptCall;
+    private IJingle mJingle;
+
+    /**
+     * Constructor.
+     */
+    public Call() {
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+	super.onCreate(savedInstanceState);
+	setContentView(R.layout.call);
+	Intent callingIntent = this.getIntent();
+
+	mLogo = (ImageView) findViewById(R.id.call_logo_anim);
+	mRotateAnim = AnimationUtils.loadAnimation(this, R.anim.rotate_and_scale);
+	mCloseCall = (Button) findViewById(R.id.call_cancel_button);
+	mCloseCall.setOnClickListener(new ClickListener());
+	if (callingIntent.getData().equals("")) {
+	    mAcceptCall = (Button) findViewById(R.id.call_accept_button);
+	    mAcceptCall.setOnClickListener(new ClickListener());
+	}
+	mCallInfo = (TextView) findViewById(R.id.call_info);
+    }
+
+    @Override
+    protected void onStart() {
+	super.onStart();
+	mLogo.startAnimation(mRotateAnim);
+    }
+
+    @Override
+    protected void onResume() {
+	super.onResume();
+	if (mXmppFacade == null)
+	    bindService(Call.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
+    }
+
+    @Override
+    protected void onPause() {
+	super.onPause();
+	if (mXmppFacade != null) {
+	    try {
+		mJingle.removeJingleListener(mJingleListener);
+	    } catch (RemoteException e) {
+		e.printStackTrace();
+	    }
+	    unbindService(mServConn);
+	    mXmppFacade = null;
+	}
+    }
+
+    @Override
+    public final boolean onCreateOptionsMenu(Menu menu) {
+	super.onCreateOptionsMenu(menu);
+	MenuInflater inflater = getMenuInflater();
+	inflater.inflate(R.menu.call, menu);
+	return true;
+    }
+
+    /**
+     * Click event listener on cancel button.
+     */
+    private class ClickListener implements OnClickListener {
+
+	/**
+	 * Constructor.
+	 */
+	ClickListener() {
+	}
+
+	@Override
+	public void onClick(View v) {
+	    try {
+		mJingle.closeCall();
+	    } catch (RemoteException e) {
+		e.printStackTrace();
+	    }
+	    finish();
+	}
+    }
+
+    private class BeemJingleSessionListener extends IBeemJingleListener.Stub {
+
+	public BeemJingleSessionListener() {
+	    mCallInfo.setText("test");
+	}
+
+	@Override
+	public void sessionClosed(final String reason) {
+	    mCallInfo.setText(reason);
+	}
+
+	@Override
+	public void sessionDeclined(final String reason)  {
+	    mCallInfo.setText(reason);
+	}
+
+	@Override
+	public void sessionClosedOnError(final String error) {
+	    mCallInfo.setText(error);
+	}
+
+	@Override
+	public void sessionEstablished() {
+	    mCallInfo.setText("established");
+	}
+
+	@Override
+	public void sessionRequested(final String fromJID) {
+	    mCallInfo.setText("request by " + fromJID);
+	}
+    }
+
+    /**
+     * The service connection used to connect to the Beem service.
+     */
+    private class BeemServiceConnection implements ServiceConnection {
+
+	/**
+	 * Constructor.
+	 */
+	public BeemServiceConnection() {
+	}
+
+	@Override
+	public void onServiceConnected(ComponentName name, IBinder service) {
+	    mXmppFacade = IXmppFacade.Stub.asInterface(service);
+	    try {
+		mJingle = mXmppFacade.getJingleService();
+		mJingle.addJingleListener(mJingleListener);
+	    } catch (RemoteException e) {
+		e.printStackTrace();
+	    }
+	}
+
+	@Override
+	public void onServiceDisconnected(ComponentName name) {
+	    mXmppFacade = null;
+	}
+    }
+}
--- a/src/com/beem/project/beem/ui/CallScreen.java	Sat Jan 16 21:10:23 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-package com.beem.project.beem.ui;
-
-import org.sipdroid.media.RtpStreamReceiver;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.KeyguardManager;
-import android.content.ActivityNotFoundException;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.media.AudioManager;
-import android.os.Bundle;
-import android.os.SystemClock;
-import android.text.InputType;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.widget.EditText;
-
-import com.beem.project.beem.R;
-
-/*
- * Copyright (C) 2009 The Sipdroid Open Source Project
- * 
- * This file is part of Sipdroid (http://www.sipdroid.org)
- * 
- * Sipdroid is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- * 
- * This source code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this source code; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-public class CallScreen extends Activity implements DialogInterface.OnClickListener {
-	public static final int FIRST_MENU_ID = Menu.FIRST;
-	public static final int HANG_UP_MENU_ITEM = FIRST_MENU_ID + 1;
-	public static final int HOLD_MENU_ITEM = FIRST_MENU_ID + 2;
-	public static final int MUTE_MENU_ITEM = FIRST_MENU_ID + 3;
-	public static final int VIDEO_MENU_ITEM = FIRST_MENU_ID + 5;
-	public static final int SPEAKER_MENU_ITEM = FIRST_MENU_ID + 6;
-	public static final int TRANSFER_MENU_ITEM = FIRST_MENU_ID + 7;
-
-	private static EditText transferText;
-
-	@Override
-	public void onCreate(Bundle savedInstance){
-	    super.onCreate(savedInstance);
-	    setContentView(R.layout.incall);
-	}
-
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu) {
-		boolean result = super.onCreateOptionsMenu(menu);
-
-		MenuItem m = menu.add(0, HOLD_MENU_ITEM, 0, "R.string.menu_hold");
-		m.setIcon(android.R.drawable.stat_sys_phone_call_on_hold);
-		m = menu.add(0, SPEAKER_MENU_ITEM, 0, "R.string.menu_speaker");
-		m.setIcon(android.R.drawable.stat_sys_speakerphone);
-		m = menu.add(0, MUTE_MENU_ITEM, 0, "R.string.menu_mute");
-		m.setIcon(android.R.drawable.stat_notify_call_mute);
-		m = menu.add(0, TRANSFER_MENU_ITEM, 0, "R.string.menu_transfer");
-		m.setIcon(android.R.drawable.ic_menu_call);
-		m = menu.add(0, VIDEO_MENU_ITEM, 0, "R.string.menu_video");
-		m.setIcon(android.R.drawable.ic_menu_camera);
-		m = menu.add(0, HANG_UP_MENU_ITEM, 0, "R.string.menu_endCall");
-//		m.setIcon(android.R.drawable.stat_notify_call_end);
-				
-		return result;
-	}
-
-	public void onClick(DialogInterface dialog, int which)
-	{
-	/*	if (which == DialogInterface.BUTTON_POSITIVE)
-			Receiver.engine(this).transfer(transferText.getText().toString());*/
-	}
-
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item) {
-		boolean result = super.onOptionsItemSelected(item);
-		Intent intent = null;
-
-		switch (item.getItemId()) {
-		case HANG_UP_MENU_ITEM:
-	//		Receiver.engine(this).rejectcall();
-			break;
-			
-		case HOLD_MENU_ITEM:
-			//Receiver.engine(this).togglehold();
-			break;
-
-		case TRANSFER_MENU_ITEM:
-			//transfer();
-			break;
-			
-		case MUTE_MENU_ITEM:
-			//Receiver.engine(this).togglemute();
-			break;
-					
-		case SPEAKER_MENU_ITEM:
-			//Receiver.engine(this).speaker(RtpStreamReceiver.speakermode == AudioManager.MODE_NORMAL?
-			//		AudioManager.MODE_IN_CALL:AudioManager.MODE_NORMAL);
-			break;
-					
-		case VIDEO_MENU_ITEM:
-			/*if (Receiver.call_state == UserAgent.UA_STATE_HOLD) Receiver.engine(this).togglehold();
-			try {
-				intent = new Intent(this, org.sipdroid.sipua.ui.VideoCamera.class);
-				startActivity(intent);
-			} catch (ActivityNotFoundException e) {
-			}*/
-			break;
-		}
-
-		return result;
-	}
-	
-/*	long enabletime;
-    KeyguardManager mKeyguardManager;
-    KeyguardManager.KeyguardLock mKeyguardLock;
-    boolean enabled;
-    
-	void disableKeyguard() {
-		if (enabled) {
-			mKeyguardLock.disableKeyguard();
-			enabled = false;
-			enabletime = SystemClock.elapsedRealtime();
-		}
-	}
-	
-	void reenableKeyguard() {
-		if (!enabled) {
-			if (SystemClock.elapsedRealtime() < enabletime + 500)
-				try {
-					Thread.sleep(500);
-				} catch (InterruptedException e) {
-				}
-			mKeyguardLock.reenableKeyguard();
-			enabled = true;
-		}
-	}
-	
-	@Override
-	public void onStart() {
-		super.onStart();
-    	if (mKeyguardManager == null) {
-	        mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
-	        mKeyguardLock = mKeyguardManager.newKeyguardLock("Sipdroid");
-	        enabled = true;
-    	}
-        disableKeyguard();
-	}
-	
-	@Override
-	public void onStop() {
-		super.onStop();
-		reenableKeyguard();
-	}
-	*/
-
-}
--- a/src/com/beem/project/beem/ui/ContactList.java	Sat Jan 16 21:10:23 2010 +0100
+++ b/src/com/beem/project/beem/ui/ContactList.java	Sat Jan 23 00:49:34 2010 +0100
@@ -85,6 +85,7 @@
 import com.beem.project.beem.service.Contact;
 import com.beem.project.beem.service.PresenceAdapter;
 import com.beem.project.beem.service.aidl.IBeemRosterListener;
+import com.beem.project.beem.service.aidl.IJingle;
 import com.beem.project.beem.service.aidl.IRoster;
 import com.beem.project.beem.service.aidl.IXmppFacade;
 import com.beem.project.beem.ui.dialogs.builders.Alias;
@@ -123,6 +124,7 @@
     private String mCurGroup;
     private Contact mContact;
     private IXmppFacade mXmppFacade;
+    private IJingle mJingle;
     private SharedPreferences mSettings;
     private LayoutInflater mInflater;
 
@@ -200,7 +202,10 @@
 		    break;
 		case R.id.contact_list_context_menu_call_item:
 		    try {
-			mXmppFacade.call(mContact.getJID() + "/Beem");
+			mJingle.call(mContact.getJID() + "/Beem");
+			in = new Intent(this, Call.class);
+		    in.setData(mContact.toUri());
+		    startActivity(in);
 			result = true;
 		    } catch (RemoteException e) {
 			e.printStackTrace();
@@ -757,6 +762,7 @@
 	    mXmppFacade = IXmppFacade.Stub.asInterface(service);
 	    try {
 		mRoster = mXmppFacade.getRoster();
+		mJingle = mXmppFacade.getJingleService();
 		if (mRoster != null) {
 		    mRoster.addRosterListener(mBeemRosterListener);
 		    List<Contact> tmpContactList = mRoster.getContactList();
@@ -803,6 +809,7 @@
 	    }
 	    mXmppFacade = null;
 	    mRoster = null;
+	    mJingle = null;
 	    mListContact.clear();
 	    mListGroup.clear();
 	    mContactOnGroup.clear();