[Presence] presence completed

This commit is contained in:
Brieuc Viel 2016-04-21 15:01:02 +02:00
parent 1b966bb236
commit cefb48ef60
10 changed files with 40 additions and 283 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1,018 B

View file

@ -49,7 +49,7 @@
android:layout_alignRight="@+id/contact_picture_big"
android:adjustViewBounds="true"
android:layout_marginRight="7dp"
android:layout_marginBottom="10dp"
android:layout_marginBottom="7dp"
android:scaleType="centerInside"
android:src="@drawable/presence_unregistered" />

View file

@ -1,57 +1,24 @@
#
#This file shall not contain path referencing package name, in order to be portable when app is renamed.
#Paths to resources must be set from LinphoneManager, after creating LinphoneCore.
[net]
download_bw=380
upload_bw=380
mtu=1300
firewall_policy=ice
stun_server=85.233.205.218
[app]
animations=0
show_login_view=1
debug_popup_magic=#1234
debug=1
server_url=http://85.233.205.218:443/xmlrpc
[sip]
contact="Linphone Android" <sip:linphone.android@unknown-host>
use_info=0
use_ipv6=0
keepalive_period=30000
guess_hostname=1
inc_timeout=15
register_only_when_network_is_up=1
auto_net_state_mon=0
auto_answer_replacing_calls=1
ping_with_options=0
root_ca=/data/user/0/org.linphone/files/rootca.pem
verify_server_certs=1
verify_server_cn=1
media_encryption=zrtp
multi_transport_migration_done=1
in_call_timeout=0
delayed_timeout=4
register_only_when_upnp_is_ok=1
media_encryption_mandatory=1
sip_port=-1
sip_tcp_port=-1
sip_tls_port=-1
srtp_crypto_suites=AES_CM_256_HMAC_SHA1_80
default_proxy=0
rls_uri=sip:rls@sip.example.org
use_rls_presence=1
[video]
size=qvga
device=Android1
display=1
capture=1
[app]
sharing_server=https://www.linphone.org:444/lft.php
tunnel=disabled
push_notification=1
animations=0
show_login_view=1
debug_popup_magic=#1234
debug=1
server_url=http://85.233.205.218:443/xmlrpc
first_launch=0
[tunnel]
port=443
[rtp]
audio_rtp_port=7076
@ -60,204 +27,17 @@ audio_jitt_comp=60
video_jitt_comp=60
nortp_timeout=30
disable_upnp=1
text_rtp_port=11078
audio_adaptive_jitt_comp_enabled=1
video_adaptive_jitt_comp_enabled=1
[sound]
playback_dev_id=
ringer_dev_id=
capture_dev_id=
dtmf_player_amp=0.1
ec_calibrator_cool_tones=1
local_ring=/data/user/0/org.linphone/files/oldphone_mono.wav
remote_ring=/data/user/0/org.linphone/files/ringback.wav
playback_gain_db=0.000000
mic_gain_db=0.000000
#remove this property for any application that is not Linphone public version itself
ec_calibrator_cool_tones=1
[misc]
max_calls=10
log_collection_upload_server_url=https://www.linphone.org:444/lft.php
uuid=3ac65678-272f-47d9-8aff-19950c565687
friends_migration_done=1
user_certificates_path=/data/user/0/org.linphone/files
file_transfer_server_url=https://www.linphone.org:444/lft.php
config-uri=https://85.233.205.218/xmlrpc?username=margaux&password=cotcot&domain=sip.orangecyberdefense.com
[audio_codec_0]
mime=opus
rate=48000
channels=2
enabled=1
[audio_codec_1]
mime=SILK
rate=16000
channels=1
enabled=1
[audio_codec_2]
mime=speex
rate=16000
channels=1
enabled=1
[audio_codec_3]
mime=speex
rate=8000
channels=1
enabled=1
[audio_codec_4]
mime=PCMU
rate=8000
channels=1
enabled=1
[audio_codec_5]
mime=PCMA
rate=8000
channels=1
enabled=1
[audio_codec_6]
mime=GSM
rate=8000
channels=1
enabled=0
[audio_codec_7]
mime=G722
rate=8000
channels=1
enabled=0
[audio_codec_8]
mime=iLBC
rate=8000
channels=1
enabled=0
[audio_codec_9]
mime=mpeg4-generic
rate=16000
channels=1
enabled=0
[audio_codec_10]
mime=mpeg4-generic
rate=22050
channels=1
enabled=0
[audio_codec_11]
mime=mpeg4-generic
rate=32000
channels=1
enabled=0
[audio_codec_12]
mime=mpeg4-generic
rate=44100
channels=1
enabled=0
[audio_codec_13]
mime=mpeg4-generic
rate=48000
channels=1
enabled=0
[audio_codec_14]
mime=iSAC
rate=16000
channels=1
enabled=0
[audio_codec_15]
mime=speex
rate=32000
channels=1
enabled=0
[audio_codec_16]
mime=SILK
rate=8000
channels=1
enabled=0
[audio_codec_17]
mime=SILK
rate=12000
channels=1
enabled=0
[audio_codec_18]
mime=SILK
rate=24000
channels=1
enabled=0
[audio_codec_19]
mime=L16
rate=44100
channels=2
enabled=0
[audio_codec_20]
mime=L16
rate=44100
channels=1
enabled=0
[video_codec_0]
mime=VP8
rate=90000
enabled=1
[video_codec_1]
mime=H264
rate=90000
enabled=1
recv_fmtp=profile-level-id=42801F
[friend_1]
url="Sylvain Berfini" <sip:sylvain@sip.linphone.org>
[friend_0]
url="Margaux Clerc" <sip:margaux@sip.linphone.org>
[friend_2]
url="Jehan Monnier" <sip:jehan@sip.linphone.org>
[friend_3]
url="Marielle Rellier" <sip:marielle@sip.linphone.org>
[friend_4]
url="Simon Morlat" <sip:simon@sip.linphone.org>
[friend_5]
url="François Grisez" <sip:francois@sip.linphone.org>
[friend_5]
url="L'ami invisible'" <sip:unknab2901AT331tATA@sip.linphone.org>
[proxy_0]
reg_proxy=<sip:sip1.linphone.org;transport=tcp>
reg_route=<sip:sip1.linphone.org;transport=tcp>
reg_identity=sip:testios@sip.linphone.org
quality_reporting_enabled=0
quality_reporting_interval=0
reg_expires=3600
reg_sendregister=1
publish=1
avpf=-1
avpf_rr_interval=5
dial_escape_plus=0
privacy=32768
refkey=push_notification
publish_expires=600
[auth_info_0]
username=testios
passwd=testtest
realm=sip.linphone.org
domain=sip.linphone.org
log_collection_upload_server_url=https://www.linphone.org:444/lft.php

View file

@ -260,9 +260,9 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
});
dialog.show();
}
if (id == R.id.back) {
*/ if (id == R.id.back) {
LinphoneActivity.instance().displayContacts(false);
}
*/
}
}

View file

@ -433,15 +433,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
separatorText.setVisibility(View.VISIBLE);
}
/* ImageView icon = (ImageView) view.findViewById(R.id.contact_picture);
if (contact.hasPhoto()) {
LinphoneUtils.setImagePictureFromUri(getActivity(), icon, contact.getPhotoUri(), contact.getThumbnailUri());
} else if (contact.getPhotoUri() != null) {
icon.setImageURI(contact.getPhotoUri());
} else {
icon.setImageResource(R.drawable.avatar);
}
*/
AvatarWithPresenceImage avatarWithPresenceImage = (AvatarWithPresenceImage) view.findViewById(R.id.avatar_with_presence);
avatarWithPresenceImage.setFormatAvatarImage(AvatarWithPresenceImage.AVATAR_SMALL);
if(contact != null && contact.isLinphoneFriend()) {

View file

@ -283,13 +283,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
@Override
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
Log.e("===>> LinphoneActivity : notifyPresenceReceived 1 : "+lf.getName().toString());
/* for(AvatarWithPresenceImage listener : listeners){
Log.e("===>> LinphoneActivity : notifyPresenceReceived 2 : "+lf.getName().toString());
if(listener.isThisFriend(lf)){
listener.updatePresenceIcon(lc, lf);
}
}*/
}
};
@ -751,7 +745,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
public void displayChat(String sipUri) {
Log.e("===>>> displayChat");
if (getResources().getBoolean(R.bool.disable_chat)) {
return;
}
@ -1293,8 +1286,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
@Override
protected void onPause() {
Log.e("LinphoneActivity - onPause");
//LinphoneManager.getInstance().enableProxyPublish(false);
LinphoneManager.getInstance().enableProxyPublish(false);
getIntent().putExtra("PreviousActivity", 0);
super.onPause();
@ -1348,7 +1340,8 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
refreshAccounts();
displayMissedCalls(LinphoneManager.getLc().getMissedCallsCount());
LinphoneManager.getInstance().changeStatusToOnline();
//LinphoneManager.getInstance().changeStatusToOnline();
LinphoneManager.getInstance().enableProxyPublish(true);
if (getIntent().getIntExtra("PreviousActivity", 0) != CALL_ACTIVITY){
if (LinphoneManager.getLc().getCalls().length > 0) {
@ -1375,6 +1368,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
}
}
}
@Override

View file

@ -374,7 +374,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
if(getFriendPresenceModel() == null){
friend.enableSubscribes(true);
friend.setIncSubscribePolicy(SubscribePolicy.SPAccept);
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.TV, null);
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Offline, null);
friend.setPresenceModel(model);
}
fullName = friend.getName();

View file

@ -352,36 +352,33 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
}
public void enableProxyPublish( boolean enabled) {
changeStatusToOffline();
Log.e("==>> enableProxyPublish : "+enabled);
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
if(lc != null ) {
LinphoneProxyConfig[] proxyList = lc.getProxyConfigList();
Log.e("==>> enableProxyPublish : LC not null : "+proxyList.length);
if(!enabled)
changeStatusToOffline();
for (LinphoneProxyConfig proxyConfig : proxyList) {
Log.e("==>> enableProxyPublish : proxyList");
proxyConfig.edit();
proxyConfig.enablePublish(enabled);
proxyConfig.done();
}
if(enabled)
changeStatusToOnline();
}
}
public void changeStatusToOnline() {
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
if (isInstanciated() && lc != null && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Online) {
lc.getPresenceModel().getActivity().setType(PresenceActivityType.Online);
} else if (isInstanciated() && lc != null && !isPresenceModelActivitySet()) {
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Online, null);
if (isInstanciated() && lc != null ){
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.TV, null);
lc.setPresenceModel(model);
}
}
public void changeStatusToOnThePhone() {
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.OnThePhone) {
lc.getPresenceModel().getActivity().setType(PresenceActivityType.OnThePhone);
} else if (isInstanciated() && !isPresenceModelActivitySet()) {
if (isInstanciated() && lc != null) {
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.OnThePhone, null);
lc.setPresenceModel(model);
}
@ -389,10 +386,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
public void changeStatusToOffline() {
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
if (isInstanciated() && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Offline) {
lc.getPresenceModel().getActivity().setType(PresenceActivityType.Offline);
} else if (isInstanciated() && !isPresenceModelActivitySet()) {
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Offline, null);
if (isInstanciated() && lc != null) {
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Away, null);
lc.setPresenceModel(model);
}
}
@ -827,7 +822,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
}
public static synchronized void destroy() {
instance.enableProxyPublish(false);
if (instance == null) return;
getInstance().changeStatusToOffline();
sExited = true;
@ -870,10 +864,9 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
}
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
Log.e("===>> LinphoneManager - notifyPresenceReceived : "+lf.getName());
for(AvatarWithPresenceImage listener : listeners){
if(listener.isThisFriend(lf)){
Log.e("===>> LinphoneManager : notifyPresenceReceived 2 : "+lf.getName().toString());
Log.e("===>> LinphoneManager : notifyPresenceReceived : "+lf.getName().toString()+" - "+lf.getPresenceModel().getActivity().getType());
listener.updatePresenceIcon(lc, lf);
}
}

View file

@ -92,11 +92,10 @@ public class AvatarWithPresenceImage extends RelativeLayout implements onPresenc
friendStatusBig = (ImageView) this.findViewById(R.id.friend_status_big);
PresenceModel presenceModel = contact.getFriendPresenceModel();
PresenceBasicStatus basicStatus = presenceModel.getBasicStatus();
Log.e("===>>> updateAvatarPresence basicStatus = "+ presenceModel.getBasicStatus().toString()+" - "+ presenceModel.getActivity().getType().toString());
if (basicStatus == PresenceBasicStatus.Closed) {
friendStatusSmall.setImageResource(R.drawable.presence_unregistered);
friendStatusBig.setImageResource(R.drawable.presence_unregistered);
} else if (presenceModel.getActivity().getType() == PresenceActivityType.TV ) {
} else if ((presenceModel.getActivity().getType() == PresenceActivityType.TV ) || (presenceModel.getActivity().getType() == PresenceActivityType.Online)) {
friendStatusSmall.setImageResource(R.drawable.presence_online);
friendStatusBig.setImageResource(R.drawable.presence_online);
} else {

@ -1 +1 @@
Subproject commit 465559dd662d8e1c2a05dea873154c1d2dbdd241
Subproject commit 6a02a570180eaedf0377317758481ec82cbc791f