Permalink
Browse files

version 1.0.4

fix typos in Additional Terms to GNU License

enable calling messenger users from GTalk, AIM, MSN, Yahoo, ICQ

fix issue 94 and some bugs of 1.0.2

add checkin module


git-svn-id: http://sipdroid.googlecode.com/svn/trunk@244 8b64e154-0f13-11de-9106-f38757f67524
  • Loading branch information...
1 parent 73bdf8e commit d1d79af9c5eca6b4d2852b2a9fa7218416c707a1 pmerle71 committed Jul 25, 2009
View
@@ -5,11 +5,11 @@ When using the code of Sipdroid Open Source Project you must comply with the fol
1) The main activity (Sipdroid.java) allows to acess a menu. From this menu you can choose the About Box displaying legal notices and author attributions.
This functionality must be left fully intact. There must be no other activity put in front of the main activity on startup. You may not direct the user into another screen (e.g. Preferences), either on first or subsequent startups.
-The message of the About box must be unchanged, too. However, you may add further infos (e.g. Features of your modified version) to the end of the text.
+The message of the About box must be left unchanged, too. However, you may add further infos (e.g. Features of your modified version) to the end of the text.
2) Modified version may not keep the package name "org.sipdroid.sipua". It must be modified, too.
-Expressing these additional terms do not imply that you would otherwise - if they were missing - be allowed to remove the legal notices and author attributions. It is just written to make that totally clear and to avoid any discussion when a violation occurs.
+Expressing these additional terms does not imply that you would otherwise - if they were missing - be allowed to remove the legal notices and author attributions. It is just written down to make totally clear and to avoid any further discussion when a violation occurs.
i-p-tel GmbH
View
@@ -25,8 +25,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.sipdroid.sipua"
- android:versionName="1.0.3"
- android:versionCode="19">
+ android:versionName="1.0.4"
+ android:versionCode="20">
<uses-sdk android:minSdkVersion="3" />
<application android:icon="@drawable/icon64" android:label="@string/app_name">
<activity android:name=".ui.Sipdroid" android:label="@string/app_name" android:launchMode="singleInstance"
@@ -51,12 +51,17 @@
<data android:scheme="sms" />
</intent-filter>
</activity>
- <activity android:name=".ui.SIPUri" android:label="@string/sip_name">
+ <activity android:name=".ui.SIPUri" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.CALL" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sip" />
</intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.SENDTO" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <data android:scheme="imto" />
+ </intent-filter>
</activity>
<activity android:name=".ui.Activity2" android:label="@string/app_name"
android:excludeFromRecents="true" android:taskAffinity=""/>
View
@@ -219,6 +219,7 @@
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dip"
android:visibility="gone"
+ android:gravity="center"
/>
</LinearLayout>
@@ -147,7 +147,9 @@ public void run() {
android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_AUDIO);
AudioManager am = (AudioManager) Receiver.mContext.getSystemService(Context.AUDIO_SERVICE);
int oldvibrate = am.getVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER);
+ int oldvibrate2 = am.getVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION);
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,AudioManager.VIBRATE_SETTING_OFF);
+ am.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,AudioManager.VIBRATE_SETTING_OFF);
AudioTrack track = new AudioTrack(AudioManager.STREAM_MUSIC, 8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT,
4096, AudioTrack.MODE_STREAM);
track.setStereoVolume(AudioTrack.getMaxVolume()/3,AudioTrack.getMaxVolume()/3);
@@ -249,6 +251,7 @@ public void run() {
track.stop();
am.setMode(AudioManager.MODE_NORMAL);
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,oldvibrate);
+ am.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,oldvibrate2);
ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_RING,ToneGenerator.MAX_VOLUME/4*3);
tg.startTone(ToneGenerator.TONE_PROP_PROMPT);
try {
@@ -38,6 +38,7 @@
import android.content.SharedPreferences.Editor;
import android.net.Uri;
import android.os.PowerManager;
+import android.os.SystemClock;
import android.preference.PreferenceManager;
public class SipdroidEngine implements RegisterAgentListener {
@@ -51,6 +52,8 @@
/** Register Agent */
private RegisterAgent ra;
+ private KeepAliveSip ka;
+
/** UserAgentProfile */
private UserAgentProfile user_profile;
@@ -97,6 +100,7 @@ public boolean StartEngine() {
ra = new RegisterAgent(sip_provider, user_profile.from_url,
user_profile.contact_url, user_profile.username,
user_profile.realm, user_profile.passwd, this, user_profile);
+ ka = new KeepAliveSip(sip_provider,100000);
register();
listen();
@@ -136,11 +140,20 @@ public String getRemoteAddr() {
return ua.remote_media_address;
}
+ public void expire() {
+ if (ra != null && ra.CurrentState == RegisterAgent.REGISTERED) {
+ ra.CurrentState = RegisterAgent.UNREGISTERED;
+ Receiver.onText(Receiver.REGISTER_NOTIFICATION, null, 0, 0);
+ }
+ register();
+ }
+
public void register() {
- if (!Receiver.isFast(false)) {
- if (user_profile != null && !user_profile.username.equals("") &&
- !user_profile.realm.equals("") &&
- ra != null && ra.unregister()) {
+ if (user_profile == null || user_profile.username.equals("") ||
+ user_profile.realm.equals("")) return;
+ if (!Receiver.isFast()) {
+ if (ra != null && ra.unregister()) {
+ Receiver.alarm(0, LoopAlarm.class);
Receiver.onText(Receiver.REGISTER_NOTIFICATION,getUIContext().getString(R.string.reg),R.drawable.sym_presence_idle,0);
wl.acquire();
}
@@ -155,7 +168,10 @@ public void register() {
public void halt() { // modified
if (wl.isHeld())
wl.release();
- keepAlive(false);
+ if (ka != null) {
+ Receiver.alarm(0, LoopAlarm.class);
+ ka.halt();
+ }
Receiver.onText(Receiver.REGISTER_NOTIFICATION, null, 0, 0);
if (ra != null)
ra.halt();
@@ -176,22 +192,30 @@ public boolean isRegistered()
public void onUaRegistrationSuccess(RegisterAgent ra, NameAddress target,
NameAddress contact, String result) {
- if (isRegistered())
+ if (isRegistered()) {
+ if (Receiver.on_wlan)
+ Receiver.alarm(60, LoopAlarm.class);
Receiver.onText(Receiver.REGISTER_NOTIFICATION,getUIContext().getString(R.string.regok),R.drawable.sym_presence_available,0);
- else
+ } else
Receiver.onText(Receiver.REGISTER_NOTIFICATION, null, 0,0);
Receiver.registered();
if (wl.isHeld())
wl.release();
}
+ static long lasthalt;
+
/** When a UA failed on (un)registering. */
public void onUaRegistrationFailure(RegisterAgent ra, NameAddress target,
NameAddress contact, String result) {
Receiver.onText(Receiver.REGISTER_NOTIFICATION,getUIContext().getString(R.string.regfailed)+" ("+result+")",R.drawable.sym_presence_away,0);
if (wl.isHeld())
wl.release();
- updateDNS();
+ if (SystemClock.elapsedRealtime() > lasthalt + 45000) {
+ lasthalt = SystemClock.elapsedRealtime();
+ sip_provider.haltConnections();
+ updateDNS();
+ }
}
public void updateDNS() {
@@ -226,7 +250,7 @@ public void info(char c) {
public boolean call(String target_url) {
ua.printLog("UAC: CALLING " + target_url);
- if (!isRegistered() || !Receiver.isFast(true)) {
+ if (!isRegistered() || !Receiver.isFast()) {
if (PreferenceManager.getDefaultSharedPreferences(getUIContext()).getBoolean("callback",false) &&
PreferenceManager.getDefaultSharedPreferences(getUIContext()).getString("posurl","").length() > 0) {
Receiver.url("n="+Uri.decode(target_url));
@@ -272,29 +296,13 @@ public void onState(int state,String text) {
Receiver.onState(state,text);
}
- KeepAliveSip ka;
-
public void keepAlive() {
- if (ka != null && isRegistered())
+ if (ka != null && Receiver.on_wlan && isRegistered())
try {
ka.sendToken();
Receiver.alarm(60, LoopAlarm.class);
} catch (IOException e) {
if (!Sipdroid.release) e.printStackTrace();
}
}
-
- public void keepAlive(boolean on_wlan) {
- if (on_wlan) {
- if (ka == null)
- ka = new KeepAliveSip(sip_provider,60000);
- Receiver.alarm(60, LoopAlarm.class);
- } else
- if (ka != null) {
- ka.halt();
- ka = null;
- Receiver.alarm(0, LoopAlarm.class);
- }
-
- }
}
@@ -450,7 +450,7 @@ public void onCallIncoming(Call call, NameAddress callee,
return;
}
printLog("INCOMING", LogLevel.HIGH);
- if (!Receiver.isFast(true)) {
+ if (!Receiver.isFast()) {
listen();
return;
}
@@ -0,0 +1,59 @@
+package org.sipdroid.sipua.ui;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.zoolu.tools.Random;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.os.SystemClock;
+import android.preference.PreferenceManager;
+
+public class Checkin {
+
+ static long hold;
+
+ static void url(final String opt,final boolean in_call) {
+ (new Thread() {
+ public void run() {
+ try {
+ URL url = new URL(opt);
+ String line;
+ String[] lines;
+ BufferedReader in;
+
+ in = new BufferedReader(new InputStreamReader(url.openStream()));
+ for (;;) {
+ line = in.readLine();
+ if (line == null) break;
+ lines = line.split(" ");
+ if (lines.length == 2) {
+ if (PreferenceManager.getDefaultSharedPreferences(Receiver.mContext).getString("dns","").equals(lines[0])) {
+ if (in_call) {
+ hold = SystemClock.elapsedRealtime();
+ Receiver.engine(Receiver.mContext).rejectcall();
+ }
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(lines[1]));
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ Receiver.mContext.startActivity(intent);
+ }
+ }
+ }
+ in.close();
+ } catch (IOException e) {
+ if (!Sipdroid.release) e.printStackTrace();
+ }
+
+ }
+ }).start();
+ }
+
+ public static void checkin(boolean in_call) {
+ if (!in_call || SystemClock.elapsedRealtime() < hold + 5*60*1000 ||
+ Random.nextInt(5) == 1)
+ url("http://sipdroid.googlecode.com/svn/images/checkin",in_call);
+ }
+}
@@ -30,6 +30,6 @@
@Override
public void onReceive(Context context, Intent intent) {
if (!Sipdroid.release) Log.i("SipUA:","alarm");
- Receiver.engine(context).register();
+ Receiver.engine(context).expire();
}
}
@@ -34,7 +34,7 @@
public void onReceive(Context context, Intent intent) {
if (!Sipdroid.release) Log.i("SipUA:","alarm2");
if (SipStack.default_transport_protocols[0].equals(SipProvider.PROTO_TCP) &&
- Receiver.engine(context).isRegistered())
+ Receiver.mSipdroidEngine != null && Receiver.mSipdroidEngine.isRegistered())
context.startService(new Intent(context,RegisterService.class));
else
context.stopService(new Intent(context,RegisterService.class));
@@ -33,7 +33,8 @@
public void onReceive(Context context, Intent intent) {
Location loc;
- if (!Sipdroid.release) Log.i("SipUA:","location "+intent.getExtras().toString());
+ if (!Sipdroid.release) Log.i("SipUA:",intent.getExtras().keySet().toString());
+ if (Receiver.mContext == null) Receiver.mContext = context;
loc = (Location)intent.getParcelableExtra(LocationManager.KEY_LOCATION_CHANGED);
if (loc != null) {
Receiver.pos(false);
Oops, something went wrong.

0 comments on commit d1d79af

Please sign in to comment.