Moved conference factory URI from core to proxy config + check if exists before using group chat features

This commit is contained in:
Sylvain Berfini 2018-03-05 17:24:46 +01:00
parent a9e6c85493
commit 9dabd0e86b
7 changed files with 50 additions and 13 deletions

View file

@ -13,6 +13,7 @@
<entry name="reg_sendregister" overwrite="true">1</entry>
<entry name="nat_policy_ref" overwrite="true">nat_policy_default_values</entry>
<entry name="realm" overwrite="true">sip.linphone.org</entry>
<entry name="conference_factory_uri" overwrite="true">sip:conference-factory@sip.linphone.org</entry>
</section>
<section name="nat_policy_default_values">
<entry name="stun_server" overwrite="true">stun.linphone.org</entry>

View file

@ -37,7 +37,6 @@ dtmf_player_amp=0.1
ec_calibrator_cool_tones=1
[misc]
conference_factory_uri=sip:conference-factory@sip.linphone.org
max_calls=10
history_max_size=100
enable_basic_to_client_group_chat_room_migration=0

View file

@ -3,6 +3,7 @@
<!-- Global -->
<string name="default_domain">sip.linphone.org</string><!-- Set the default domain used for account creation/addresses -->
<string name="default_conference_factory_uri">sip:conference-factory@sip.linphone.org</string>
<string name="sync_account_type">org.linphone</string> <!-- Change package ! -->
<string name="sync_mimetype">vnd.android.cursor.item/org.linphone.profile</string> <!-- Change package, leave .profile at the end. Also change res/xml/contacts.xml ! -->
<string name="rls_uri">sip:rls@sip.linphone.org</string>

View file

@ -723,6 +723,15 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
mLc.migrateLogsFromRcToDb();
// Migrate existing linphone accounts to have conference factory uri set
for (ProxyConfig lpc : mLc.getProxyConfigList()) {
if (lpc.getConferenceFactoryUri() == null && lpc.getIdentityAddress().getDomain().equals(getString(R.string.default_domain))) {
lpc.edit();
lpc.setConferenceFactoryUri(getString(R.string.default_conference_factory_uri));
lpc.done();
}
}
if (mServiceContext.getResources().getBoolean(R.bool.enable_push_id)) {
initPushNotificationsService();
}

View file

@ -45,6 +45,7 @@ import org.linphone.core.Address;
import org.linphone.core.ChatRoom;
import org.linphone.core.ChatRoomListenerStub;
import org.linphone.core.Core;
import org.linphone.core.ProxyConfig;
import org.linphone.mediastream.Log;
import org.linphone.ui.ContactSelectView;
import org.linphone.contacts.ContactsUpdatedListener;
@ -336,9 +337,15 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
Address participant = mContactsSelected.get(0).getAddress();
ChatRoom chatRoom = lc.findOneToOneChatRoom(lc.getDefaultProxyConfig().getContact(), participant);
if (chatRoom == null) {
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject));
mChatRoom.addListener(mChatRoomCreationListener);
mChatRoom.addParticipant(participant);
ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null && lpc.getConferenceFactoryUri() != null) {
chatRoom = lc.getChatRoom(participant);
LinphoneActivity.instance().goToChat(chatRoom.getPeerAddress().asStringUriOnly());
} else {
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject));
mChatRoom.addListener(mChatRoomCreationListener);
mChatRoom.addParticipant(participant);
}
} else {
LinphoneActivity.instance().goToChat(chatRoom.getPeerAddress().asStringUriOnly());
}
@ -361,7 +368,14 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
ContactAddress ca = mSearchAdapter.getContacts().get(i);
removeContactFromSelection(ca);
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc == null || lpc.getConferenceFactoryUri() == null) {
ChatRoom chatRoom = lc.getChatRoom(ca.getAddress());
LinphoneActivity.instance().goToChat(chatRoom.getPeerAddress().asStringUriOnly());
} else {
removeContactFromSelection(ca);
}
}
@Override

View file

@ -78,10 +78,16 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
if (room != null) {
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly());
} else {
mWaitLayout.setVisibility(View.VISIBLE);
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject));
mChatRoom.addListener(mChatRoomCreationListener);
mChatRoom.addParticipant(participant);
ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null && lpc.getConferenceFactoryUri() != null) {
room = lc.getChatRoom(participant);
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly());
} else {
mWaitLayout.setVisibility(View.VISIBLE);
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject));
mChatRoom.addListener(mChatRoomCreationListener);
mChatRoom.addParticipant(participant);
}
}
}
}

View file

@ -41,6 +41,7 @@ import org.linphone.core.ChatRoom;
import org.linphone.core.ChatRoomListenerStub;
import org.linphone.core.Core;
import org.linphone.core.Factory;
import org.linphone.core.ProxyConfig;
import org.linphone.mediastream.Log;
public class HistoryDetailFragment extends Fragment implements OnClickListener {
@ -199,10 +200,16 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
if (room != null) {
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly());
} else {
mWaitLayout.setVisibility(View.VISIBLE);
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject));
mChatRoom.addListener(mChatRoomCreationListener);
mChatRoom.addParticipant(participant);
ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null && lpc.getConferenceFactoryUri() != null) {
room = lc.getChatRoom(participant);
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly());
} else {
mWaitLayout.setVisibility(View.VISIBLE);
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject));
mChatRoom.addListener(mChatRoomCreationListener);
mChatRoom.addParticipant(participant);
}
}
} else if (id == R.id.add_contact) {
Address addr = Factory.instance().createAddress(sipUri);