--- a/.classpath Sat Jan 23 00:51:15 2010 +0100
+++ b/.classpath Sat Jan 23 03:00:24 2010 +0100
@@ -1,7 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="lib" path="/home/nikita/android/platforms/android-2.0.1/android.jar">
+ <classpathentry kind="src" path=""/>
+ <classpathentry kind="lib" path="libs/asmack-jse.jar" sourcepath="/home/nikita/devel/smack">
+ <attributes>
+ <attribute name="javadoc_location" value="file:/home/nikita/devel/smack/jingle/extension/"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="lib" path="libs/jlibrtp.jar"/>
- <classpathentry kind="lib" path="libs/asmack-jse.jar"/>
+ <classpathentry kind="lib" path="libs/security.jar"/>
+ <classpathentry kind="lib" path="/home/nikita/android-sdk-linux_x86-1.6_r1/platforms/android-2.0.1/android.jar">
+ <attributes>
+ <attribute name="javadoc_location" value="file:/home/nikita/android/docs/reference/"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
--- a/src/com/beem/project/beem/jingle/JingleService.java Sat Jan 23 00:51:15 2010 +0100
+++ b/src/com/beem/project/beem/jingle/JingleService.java Sat Jan 23 03:00:24 2010 +0100
@@ -80,11 +80,11 @@
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.
@@ -144,7 +144,11 @@
@Override
public void acceptCall() throws RemoteException {
- mIn.startIncoming();
+ try {
+ mRequest.accept();
+ } catch (XMPPException e) {
+ e.printStackTrace();
+ }
isCaller = false;
}
@@ -155,22 +159,17 @@
public void closeCall() throws RemoteException {
if (isCaller) {
try {
- if (isAccepted) {
- mOut.terminate();
- } else {
- mOut.close();
- }
+ mOut.terminate("Cancelled");
+ //mOut.close();
} catch (XMPPException e) {
e.printStackTrace();
}
mOut = null;
} else {
try {
- if (isAccepted) {
- mIn.terminate();
- } else {
- mIn.close();
- }
+ mRequest.reject();
+ mIn.terminate();
+ mIn.close();
} catch (XMPPException e) {
e.printStackTrace();
}
@@ -226,7 +225,6 @@
@Override
public void sessionDeclined(String reason, JingleSession jingleSession) {
Log.d(TAG, "Session " + jingleSession.getResponder() + "declined because " + reason);
- isAccepted = false;
final int n = mRemoteJingleListeners.beginBroadcast();
for (int i = 0; i < n; i++) {
@@ -245,7 +243,6 @@
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();
@@ -291,14 +288,15 @@
try {
mIn = mJingleManager.createIncomingJingleSession(mRequest);
mIn.addListener(new BeemJingleSessionListener());
+ mIn.startIncoming();
} 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.putExtra("isCaller", false);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
}
--- a/src/com/beem/project/beem/ui/Call.java Sat Jan 23 00:51:15 2010 +0100
+++ b/src/com/beem/project/beem/ui/Call.java Sat Jan 23 03:00:24 2010 +0100
@@ -48,6 +48,7 @@
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
+import android.os.Handler;
import android.os.IBinder;
import android.view.Menu;
import android.view.MenuInflater;
@@ -82,6 +83,7 @@
private final ServiceConnection mServConn = new BeemServiceConnection();
private BeemJingleSessionListener mJingleListener = new BeemJingleSessionListener();
private IXmppFacade mXmppFacade;
+ private final Handler mHandler = new Handler();
private Button mCloseCall;
private Button mAcceptCall;
private IJingle mJingle;
@@ -102,7 +104,10 @@
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("")) {
+ if (callingIntent.getBooleanExtra("isCaller", false)) {
+ mAcceptCall = (Button) findViewById(R.id.call_accept_button);
+ mAcceptCall.setVisibility(View.GONE);
+ } else {
mAcceptCall = (Button) findViewById(R.id.call_accept_button);
mAcceptCall.setOnClickListener(new ClickListener());
}
@@ -158,43 +163,75 @@
@Override
public void onClick(View v) {
try {
- mJingle.closeCall();
+ if (v == mCloseCall)
+ mJingle.closeCall();
+ else if (v == mAcceptCall)
+ mJingle.acceptCall();
} catch (RemoteException e) {
e.printStackTrace();
}
- finish();
+ //finish();
}
}
private class BeemJingleSessionListener extends IBeemJingleListener.Stub {
+
+ /**
+ * Refresh the call activity.
+ */
+ private class RunnableChange implements Runnable {
+
+ private String mStr;
+ /**
+ * Constructor.
+ */
+ public RunnableChange(String str) {
+ mStr = str;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void run() {
+ mCallInfo.setText(mStr);
+
+ }
+ }
public BeemJingleSessionListener() {
- mCallInfo.setText("test");
}
@Override
public void sessionClosed(final String reason) {
- mCallInfo.setText(reason);
+ android.util.Log.d("TEST", "TEST " + reason);
+ mHandler.post(new RunnableChange(reason));
+ Call.this.runOnUiThread(new RunnableChange(reason));
}
@Override
public void sessionDeclined(final String reason) {
- mCallInfo.setText(reason);
+ android.util.Log.d("TEST", "TEST4 " + reason);
+ mHandler.post(new RunnableChange(reason));
}
@Override
public void sessionClosedOnError(final String error) {
- mCallInfo.setText(error);
+ android.util.Log.d("TEST", "TEST5 " + error);
+ mHandler.post(new RunnableChange(error));
}
@Override
public void sessionEstablished() {
+ android.util.Log.d("TEST", "TEST2 ");
mCallInfo.setText("established");
+ mHandler.post(new RunnableChange("ok"));
}
@Override
public void sessionRequested(final String fromJID) {
- mCallInfo.setText("request by " + fromJID);
+ android.util.Log.d("TEST", "TEST3 " + fromJID);
+ mHandler.post(new RunnableChange(fromJID));
}
}
--- a/src/com/beem/project/beem/ui/ContactList.java Sat Jan 23 00:51:15 2010 +0100
+++ b/src/com/beem/project/beem/ui/ContactList.java Sat Jan 23 03:00:24 2010 +0100
@@ -39,7 +39,7 @@
Flavien Astraud, November 26, 2009
-*/
+ */
package com.beem.project.beem.ui;
import java.util.ArrayList;
@@ -204,8 +204,9 @@
try {
mJingle.call(mContact.getJID() + "/Beem");
in = new Intent(this, Call.class);
- in.setData(mContact.toUri());
- startActivity(in);
+ in.setData(mContact.toUri());
+ in.putExtra("isCaller", true);
+ startActivity(in);
result = true;
} catch (RemoteException e) {
e.printStackTrace();
@@ -437,11 +438,11 @@
mIconsMap.put(Status.CONTACT_STATUS_AVAILABLE, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
android.R.drawable.presence_online)));
mIconsMap.put(Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT,
- new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_online)));
+ new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_online)));
mIconsMap.put(Status.CONTACT_STATUS_AWAY,
- new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_away)));
+ new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_away)));
mIconsMap.put(Status.CONTACT_STATUS_BUSY,
- new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_busy)));
+ new BitmapDrawable(BitmapFactory.decodeResource(getResources(), android.R.drawable.presence_busy)));
mIconsMap.put(Status.CONTACT_STATUS_DISCONNECT, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
android.R.drawable.presence_offline)));
mIconsMap.put(Status.CONTACT_STATUS_UNAVAILABLE, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
--- a/src/org/sipdroid/media/RtpStreamReceiver.java Sat Jan 23 00:51:15 2010 +0100
+++ b/src/org/sipdroid/media/RtpStreamReceiver.java Sat Jan 23 03:00:24 2010 +0100
@@ -58,7 +58,6 @@
public static final int SO_TIMEOUT = 200;
/** The RtpSocket */
- //RtpSocket rtp_socket = null;
RTPSession rtpSession = null;
byte[] buffer;
@@ -334,13 +333,7 @@
System.arraycopy(lin, 0, lin2, 0, REAL_BUFFER_SIZE);
}
}
- println("POOL SIZE " + DatagramPool.getInstance().getPoolSize());
track.stop();
- //if (Receiver.pstn_state == null || Receiver.pstn_state.equals("IDLE"))
- // am.setMode(AudioManager.MODE_NORMAL);
- //saveVolume();
- //am.setStreamVolume(AudioManager.STREAM_MUSIC,oldvol,0);
- //restoreSettings();
ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_RING,ToneGenerator.MAX_VOLUME/4*3);
tg.startTone(ToneGenerator.TONE_PROP_PROMPT);
try {
--- a/src/org/sipdroid/media/RtpStreamSender.java Sat Jan 23 00:51:15 2010 +0100
+++ b/src/org/sipdroid/media/RtpStreamSender.java Sat Jan 23 03:00:24 2010 +0100
@@ -44,7 +44,6 @@
private static final boolean DEBUG = true;
/** The RtpSocket */
- //private RtpSocket rtp_socket = null;
private RTPSession rtpSession = null;
/** Codec */
--- a/src/org/sipdroid/net/SipdroidSocket.java Sat Jan 23 00:51:15 2010 +0100
+++ b/src/org/sipdroid/net/SipdroidSocket.java Sat Jan 23 03:00:24 2010 +0100
@@ -42,7 +42,6 @@
impl = new PlainDatagramSocketImpl();
impl.create();
impl.bind(port,InetAddress.getByName("0"));
- android.util.Log.d("TEST","name : " + InetAddress.getByName("0"));
}
}
@@ -83,7 +82,5 @@
System.loadLibrary("OSNetworkSystem");
OSNetworkSystem.getOSNetworkSystem().oneTimeInitialization(true);
SipdroidSocket.loaded = true;
- android.util.Log.d("OSNetworkSystem", "LOADED");
-
}
}
--- a/src/org/sipdroid/net/tools/GenericPool.java Sat Jan 23 00:51:15 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-package org.sipdroid.net.tools;
-
-public class GenericPool<E> extends ObjectPool<Object> {
-
- public GenericPool(int size) {
- super(size);
- for(int i = 0; i < size; ++i) {
- checkIn(create());
- }
- }
-
- @Override
- protected E create() {
- return (E)new Object();
- }
-
- @Override
- protected boolean validate(Object o) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public E borrowItem() {
- return (E) super.checkOut();
- }
-
- public void returnItem(E o) {
- super.checkIn(o);
- }
-
-}
--- a/src/org/sipdroid/net/tools/ObjectPool.java Sat Jan 23 00:51:15 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-package org.sipdroid.net.tools;
-
-import java.util.ArrayList;
-
-public abstract class ObjectPool<E> {
- private ArrayList<Object> locked, unlocked;
-
- ObjectPool(int size){
- locked = new ArrayList<Object>(size);
- unlocked = new ArrayList<Object>(size);
- }
-
- public int getPoolSize() {
- return locked.size() + unlocked.size();
- }
-
- abstract Object create();
- abstract boolean validate( Object o );
- synchronized Object checkOut(){
- if(unlocked.size() > 0){
- Object cur = unlocked.get(0);
- unlocked.remove(cur);
- locked.add(cur);
- return(cur);
- }
- // no objects available, create a new one
- Object o = create();
- locked.add(o);
- return(o);
- }
-
- synchronized void checkIn( Object o ) {
- locked.remove( o );
- unlocked.add(o);
- }
-
-}