blob: de76e6c5480660de54738341c1d71f6568440ffc [file] [log] [blame]
Alexandre Lision064e1e02013-10-01 16:18:42 -04001package org.sflphone.service;
Emeric Vigier9380ae52012-09-14 17:40:39 -04002
Alexandre Savard74c1cad2012-10-24 16:39:00 -04003import android.content.Intent;
Alexandre Savard74c1cad2012-10-24 16:39:00 -04004import android.os.Bundle;
Alexandre Lisionb4e60612014-01-14 17:47:23 -05005import android.util.Log;
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -05006import org.sflphone.account.AccountDetailSrtp;
Alexandre Lisionb4e60612014-01-14 17:47:23 -05007import org.sflphone.client.CallActivity;
8import org.sflphone.model.*;
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -05009import org.sflphone.utils.SwigNativeConverter;
Alexandre Lisionb4e60612014-01-14 17:47:23 -050010
11import java.util.ArrayList;
Alexandre Lisionb4e60612014-01-14 17:47:23 -050012import java.util.Iterator;
13import java.util.Map;
Emeric Vigier9380ae52012-09-14 17:40:39 -040014
15public class CallManagerCallBack extends Callback {
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -050016
Emeric Vigier9380ae52012-09-14 17:40:39 -040017 private static final String TAG = "CallManagerCallBack";
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -050018 private SipService mService;
Alexandre Savard74c1cad2012-10-24 16:39:00 -040019
Alexandre Savard3bdce7b2012-10-24 18:27:45 -040020 static public final String CALL_STATE_CHANGED = "call-state-changed";
21 static public final String INCOMING_CALL = "incoming-call";
alision04a00182013-05-10 17:05:29 -040022 static public final String INCOMING_TEXT = "incoming-text";
alision907bde72013-06-20 14:40:37 -040023 static public final String CONF_CREATED = "conf_created";
alision806e18e2013-06-21 15:30:17 -040024 static public final String CONF_REMOVED = "conf_removed";
25 static public final String CONF_CHANGED = "conf_changed";
alisiondf1dac92013-06-27 17:35:53 -040026 static public final String RECORD_STATE_CHANGED = "record_state";
alision907bde72013-06-20 14:40:37 -040027
Alexandre Lision5f144b82014-02-11 09:59:36 -050028 static public final String ZRTP_ON = "secure_zrtp_on";
29 static public final String ZRTP_OFF = "secure_zrtp_off";
30 static public final String DISPLAY_SAS = "display_sas";
Alexandre Lision48b49eb2014-02-11 13:37:33 -050031 static public final String ZRTP_NEGOTIATION_FAILED = "zrtp_nego_failed";
32 static public final String ZRTP_NOT_SUPPORTED = "zrtp_not_supported";
Alexandre Lision5f144b82014-02-11 09:59:36 -050033
Alexandre Savard3bdce7b2012-10-24 18:27:45 -040034
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -050035 public CallManagerCallBack(SipService context) {
Alexandre Lisionb4e60612014-01-14 17:47:23 -050036 mService = context;
Alexandre Savard74c1cad2012-10-24 16:39:00 -040037 }
Emeric Vigier9380ae52012-09-14 17:40:39 -040038
39 @Override
Alexandre Lisionb4e60612014-01-14 17:47:23 -050040 public void on_call_state_changed(String callID, String newState) {
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -050041 Log.d(TAG, "on_call_state_changed : (" + callID + ", " + newState + ")");
Alexandre Lisionb4e60612014-01-14 17:47:23 -050042
Alexandre Lision3c37dca2014-02-21 14:13:26 -050043 Conference toUpdate = mService.findConference(callID);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050044
45 if (toUpdate == null) {
46 return;
47 }
48
Alexandre Lision48b49eb2014-02-11 13:37:33 -050049 Intent intent = new Intent(CALL_STATE_CHANGED);
50 intent.putExtra("CallID", callID);
51 intent.putExtra("State", newState);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050052
Alexandre Lision707f9082014-01-16 15:09:07 -050053 if (newState.equals("RINGING")) {
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050054 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_RINGING);
Alexandre Lisionb4e60612014-01-14 17:47:23 -050055 } else if (newState.equals("CURRENT")) {
Alexandre Lision651b5262014-02-21 17:14:14 -050056 if (toUpdate.isRinging()) {
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050057 toUpdate.getCallById(callID).setTimestampStart_(System.currentTimeMillis());
Alexandre Lisionb4e60612014-01-14 17:47:23 -050058 }
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050059 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_CURRENT);
Alexandre Lisionb4e60612014-01-14 17:47:23 -050060 } else if (newState.equals("HUNGUP")) {
Alexandre Lisionb4e60612014-01-14 17:47:23 -050061 Log.d(TAG, "Hanging up " + callID);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050062 SipCall call = toUpdate.getCallById(callID);
63 if (!toUpdate.hasMultipleParticipants()) {
64 if (toUpdate.isRinging() && toUpdate.isIncoming()) {
Alexandre Lision945e4612014-01-15 17:40:31 -050065 mService.mNotificationManager.publishMissedCallNotification(mService.getConferences().get(callID));
Alexandre Lisionb4e60612014-01-14 17:47:23 -050066 }
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050067 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_HUNGUP);
68 mService.mHistoryManager.insertNewEntry(toUpdate);
69 mService.getConferences().remove(toUpdate.getId());
Alexandre Lision651b5262014-02-21 17:14:14 -050070 Log.e(TAG, "Conferences :" + mService.getConferences().size());
71 Log.e(TAG, "toUpdate.getParticipants() :" + toUpdate.getParticipants().size());
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050072 } else {
73 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_HUNGUP);
74 mService.mHistoryManager.insertNewEntry(call);
Alexandre Lisionb4e60612014-01-14 17:47:23 -050075 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -050076 } else if (newState.equals("BUSY")) {
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050077 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_BUSY);
78 mService.getConferences().remove(toUpdate.getId());
Alexandre Lisionb4e60612014-01-14 17:47:23 -050079 } else if (newState.equals("FAILURE")) {
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050080 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_FAILURE);
81 mService.getConferences().remove(toUpdate.getId());
Alexandre Lisionb4e60612014-01-14 17:47:23 -050082 } else if (newState.equals("HOLD")) {
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050083 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_HOLD);
Alexandre Lisionb4e60612014-01-14 17:47:23 -050084 } else if (newState.equals("UNHOLD")) {
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050085 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_CURRENT);
86 }
87 intent.putExtra("conference", toUpdate);
88 mService.sendBroadcast(intent);
89 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -050090
Alexandre Lision3c37dca2014-02-21 14:13:26 -050091
Alexandre Savard14323be2012-10-24 10:02:13 -040092 @Override
Emeric Vigier9380ae52012-09-14 17:40:39 -040093 public void on_incoming_call(String accountID, String callID, String from) {
94 Log.d(TAG, "on_incoming_call(" + accountID + ", " + callID + ", " + from + ")");
Alexandre Lisionb4e60612014-01-14 17:47:23 -050095
Alexandre Lisionb4e60612014-01-14 17:47:23 -050096 try {
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -050097 StringMap details = mService.getConfigurationManagerJNI().getAccountDetails(accountID);
98 VectMap credentials = mService.getConfigurationManagerJNI().getCredentials(accountID);
99 Account acc = new Account(accountID, SwigNativeConverter.convertAccountToNative(details), SwigNativeConverter.convertCredentialsToNative(credentials));
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500100
101 Bundle args = new Bundle();
102 args.putString(SipCall.ID, callID);
103 args.putParcelable(SipCall.ACCOUNT, acc);
104 args.putInt(SipCall.STATE, SipCall.state.CALL_STATE_RINGING);
105 args.putInt(SipCall.TYPE, SipCall.direction.CALL_TYPE_INCOMING);
106
107 CallContact unknow = CallContact.ContactBuilder.buildUnknownContact(from);
108 args.putParcelable(SipCall.CONTACT, unknow);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500109
110 Intent toSend = new Intent(CallManagerCallBack.INCOMING_CALL);
111 toSend.setClass(mService, CallActivity.class);
112 toSend.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500113 SipCall newCall = new SipCall(args);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500114 newCall.setTimestampStart_(System.currentTimeMillis());
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500115
Alexandre Lision651b5262014-02-21 17:14:14 -0500116 Conference toAdd;
117 if (acc.useSecureLayer()) {
118 Bundle secureArgs = new Bundle();
119 secureArgs.putBoolean(SecureSipCall.DISPLAY_SAS, acc.getSrtpDetails().getDetailBoolean(AccountDetailSrtp.CONFIG_ZRTP_DISPLAY_SAS));
120 secureArgs.putBoolean(SecureSipCall.DISPLAY_SAS_ONCE, acc.getSrtpDetails().getDetailBoolean(AccountDetailSrtp.CONFIG_ZRTP_DISPLAY_SAS_ONCE));
121 secureArgs.putBoolean(SecureSipCall.DISPLAY_WARNING_ZRTP_NOT_SUPPORTED, newCall.getAccount().getSrtpDetails().getDetailBoolean(AccountDetailSrtp.CONFIG_ZRTP_NOT_SUPP_WARNING));
122 SecureSipCall secureCall = new SecureSipCall(newCall, secureArgs);
123 toAdd = new Conference(secureCall);
124 } else {
125 toAdd = new Conference(newCall);
126 }
127
Alexandre Lision945e4612014-01-15 17:40:31 -0500128 mService.getConferences().put(toAdd.getId(), toAdd);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500129
130 Bundle bundle = new Bundle();
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500131 bundle.putParcelable("conference", toAdd);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500132 toSend.putExtra("resuming", false);
133 toSend.putExtras(bundle);
134 mService.startActivity(toSend);
Alexandre Lision945e4612014-01-15 17:40:31 -0500135 mService.mMediaManager.startRing("");
136 mService.mMediaManager.obtainAudioFocus(true);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500137 } catch (Exception e) {
138 e.printStackTrace();
139 }
Alexandre Savard74c1cad2012-10-24 16:39:00 -0400140 }
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500141
alision7f18fc82013-05-01 09:37:33 -0400142 @Override
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500143 public void on_transfer_state_changed(String result) {
144 Log.w(TAG, "TRANSFER STATE CHANGED:" + result);
alision7f18fc82013-05-01 09:37:33 -0400145 }
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500146
alision43a9b362013-05-01 16:30:15 -0400147 @Override
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500148 public void on_conference_created(final String confID) {
149 Log.w(TAG, "CONFERENCE CREATED:" + confID);
alision806e18e2013-06-21 15:30:17 -0400150 Intent intent = new Intent(CONF_CREATED);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500151 Conference created = new Conference(confID);
152
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500153 StringVect all_participants = mService.getCallManagerJNI().getParticipantList(confID);
154 Log.w(TAG, "all_participants:" + all_participants.size());
155 for (int i = 0; i < all_participants.size(); ++i) {
Alexandre Lision945e4612014-01-15 17:40:31 -0500156 if (mService.getConferences().get(all_participants.get(i)) != null) {
157 created.addParticipant(mService.getConferences().get(all_participants.get(i)).getCallById(all_participants.get(i)));
158 mService.getConferences().remove(all_participants.get(i));
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500159 } else {
Alexandre Lision945e4612014-01-15 17:40:31 -0500160 Iterator<Map.Entry<String, Conference>> it = mService.getConferences().entrySet().iterator();
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500161 while (it.hasNext()) {
162 Conference tmp = it.next().getValue();
163 for (SipCall c : tmp.getParticipants()) {
164 if (c.getCallId().contentEquals(all_participants.get(i))) {
165 created.addParticipant(c);
Alexandre Lision96db8032014-01-17 16:43:51 -0500166 mService.getConferences().get(tmp.getId()).removeParticipant(c);
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500167 }
168 }
169 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500170 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500171 }
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500172 intent.putExtra("conference", created);
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500173 intent.putExtra("confID", created.getId());
Alexandre Lision945e4612014-01-15 17:40:31 -0500174 mService.getConferences().put(created.getId(), created);
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500175 mService.sendBroadcast(intent);
alision43a9b362013-05-01 16:30:15 -0400176 }
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500177
alision4a0eb092013-05-07 13:52:03 -0400178 @Override
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500179 public void on_incoming_message(String ID, String from, String msg) {
180 Log.w(TAG, "on_incoming_message:" + msg);
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500181 Intent intent = new Intent(INCOMING_TEXT);
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500182 intent.putExtra("CallID", ID);
183 intent.putExtra("From", from);
184 intent.putExtra("Msg", msg);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500185
Alexandre Lision945e4612014-01-15 17:40:31 -0500186 if (mService.getConferences().get(ID) != null) {
187 mService.getConferences().get(ID).addSipMessage(new SipMessage(true, msg));
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500188 intent.putExtra("conference", mService.getConferences().get(ID));
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500189 } else {
Alexandre Lision945e4612014-01-15 17:40:31 -0500190 Iterator<Map.Entry<String, Conference>> it = mService.getConferences().entrySet().iterator();
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500191 while (it.hasNext()) {
192 Conference tmp = it.next().getValue();
193 for (SipCall c : tmp.getParticipants()) {
194 if (c.getCallId().contentEquals(ID)) {
Alexandre Lision945e4612014-01-15 17:40:31 -0500195 mService.getConferences().get(tmp.getId()).addSipMessage(new SipMessage(true, msg));
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500196 intent.putExtra("conference", tmp);
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500197 }
198 }
199 }
200
201 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500202 mService.sendBroadcast(intent);
alision04a00182013-05-10 17:05:29 -0400203 }
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500204
alision04a00182013-05-10 17:05:29 -0400205 @Override
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500206 public void on_conference_removed(String confID) {
Alexandre Lision183bf452014-01-17 11:21:59 -0500207 Log.i(TAG, "on_conference_removed:");
alision806e18e2013-06-21 15:30:17 -0400208 Intent intent = new Intent(CONF_REMOVED);
209 intent.putExtra("confID", confID);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500210
Alexandre Lision945e4612014-01-15 17:40:31 -0500211 Conference toReInsert = mService.getConferences().get(confID);
Alexandre Lision183bf452014-01-17 11:21:59 -0500212 for (SipCall call : toReInsert.getParticipants()) {
213 mService.getConferences().put(call.getCallId(), new Conference(call));
214 }
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500215 intent.putExtra("conference", mService.getConferences().get(confID));
Alexandre Lision945e4612014-01-15 17:40:31 -0500216 mService.getConferences().remove(confID);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500217 mService.sendBroadcast(intent);
218
alision4a0eb092013-05-07 13:52:03 -0400219 }
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500220
alision4a0eb092013-05-07 13:52:03 -0400221 @Override
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500222 public void on_conference_state_changed(String confID, String state) {
Alexandre Lision183bf452014-01-17 11:21:59 -0500223 Log.i(TAG, "on_conference_state_changed:");
alision806e18e2013-06-21 15:30:17 -0400224 Intent intent = new Intent(CONF_CHANGED);
225 intent.putExtra("confID", confID);
226 intent.putExtra("State", state);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500227
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500228
Alexandre Lision183bf452014-01-17 11:21:59 -0500229 Log.i(TAG, "Received:" + intent.getAction());
230 Log.i(TAG, "State:" + state);
231
232 Conference toModify = mService.getConferences().get(confID);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500233 toModify.setCallState(confID, state);
Alexandre Lision183bf452014-01-17 11:21:59 -0500234
235 ArrayList<String> newParticipants = SwigNativeConverter.convertSwigToNative(mService.getCallManagerJNI().getParticipantList(intent.getStringExtra("confID")));
236
237 if (toModify.getParticipants().size() < newParticipants.size()) {
238 // We need to add the new participant to the conf
239 for (int i = 0; i < newParticipants.size(); ++i) {
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500240 if (toModify.getCallById(newParticipants.get(i)) == null) {
Alexandre Lision183bf452014-01-17 11:21:59 -0500241 mService.addCallToConference(toModify.getId(), newParticipants.get(i));
242 }
243 }
244 } else if (toModify.getParticipants().size() > newParticipants.size()) {
Alexandre Lision96db8032014-01-17 16:43:51 -0500245 Log.i(TAG, "toModify.getParticipants().size() > newParticipants.size()");
Alexandre Lision183bf452014-01-17 11:21:59 -0500246 for (SipCall participant : toModify.getParticipants()) {
247 if (!newParticipants.contains(participant.getCallId())) {
Alexandre Lision96db8032014-01-17 16:43:51 -0500248 mService.detachCallFromConference(toModify.getId(), participant);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500249 break;
Alexandre Lision183bf452014-01-17 11:21:59 -0500250 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500251 }
Alexandre Lision945e4612014-01-15 17:40:31 -0500252 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500253
Alexandre Lision183bf452014-01-17 11:21:59 -0500254 mService.sendBroadcast(intent);
Alexandre Savard74c1cad2012-10-24 16:39:00 -0400255 }
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500256
alisiondf1dac92013-06-27 17:35:53 -0400257 @Override
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500258 public void on_record_playback_filepath(String id, String filename) {
alisiondf1dac92013-06-27 17:35:53 -0400259 Intent intent = new Intent(RECORD_STATE_CHANGED);
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500260 intent.putExtra("callID", id);
alisiondf1dac92013-06-27 17:35:53 -0400261 intent.putExtra("file", filename);
Alexandre Lision945e4612014-01-15 17:40:31 -0500262 mService.sendBroadcast(intent);
alision04a00182013-05-10 17:05:29 -0400263 }
alisiondf1dac92013-06-27 17:35:53 -0400264
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500265 @Override
266 public void on_secure_sdes_on(String callID) {
267 Log.i(TAG, "on_secure_sdes_on");
268 }
269
270 @Override
271 public void on_secure_sdes_off(String callID) {
272 Log.i(TAG, "on_secure_sdes_off");
273 }
274
275 @Override
276 public void on_secure_zrtp_on(String callID, String cipher) {
277 Log.i(TAG, "on_secure_zrtp_on");
Alexandre Lision5f144b82014-02-11 09:59:36 -0500278 Intent intent = new Intent(ZRTP_ON);
Alexandre Lision651b5262014-02-21 17:14:14 -0500279 SecureSipCall call = (SecureSipCall) mService.getCallById(callID);
280 call.setInitialized();
281 intent.putExtra("callID", callID);
Alexandre Lision3c37dca2014-02-21 14:13:26 -0500282 intent.putExtra("conference", mService.findConference(callID));
Alexandre Lision5f144b82014-02-11 09:59:36 -0500283 mService.sendBroadcast(intent);
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500284 }
285
286 @Override
287 public void on_secure_zrtp_off(String callID) {
288 Log.i(TAG, "on_secure_zrtp_off");
Alexandre Lision651b5262014-02-21 17:14:14 -0500289 Intent intent = new Intent(ZRTP_OFF);
290 intent.putExtra("callID", callID);
291 intent.putExtra("conference", mService.findConference(callID));
Alexandre Lisiondf222a52014-02-25 09:58:57 -0500292 mService.sendBroadcast(intent);
293 }
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500294
295 @Override
296 public void on_show_sas(String callID, String sas, boolean verified) {
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500297 Log.i(TAG, "on_show_sas:" + sas);
Alexandre Lision5f144b82014-02-11 09:59:36 -0500298 Intent intent = new Intent(DISPLAY_SAS);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500299 SecureSipCall call = (SecureSipCall) mService.getCallById(callID);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500300 call.setSAS(sas);
Alexandre Lision1b932d82014-02-21 10:03:19 -0500301 call.sasConfirmedByZrtpLayer(verified);
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500302
Alexandre Lision651b5262014-02-21 17:14:14 -0500303 intent.putExtra("callID", callID);
304 intent.putExtra("SAS", sas);
305 intent.putExtra("verified", verified);
Alexandre Lision3c37dca2014-02-21 14:13:26 -0500306 intent.putExtra("conference", mService.findConference(callID));
Alexandre Lision5f144b82014-02-11 09:59:36 -0500307 mService.sendBroadcast(intent);
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500308 }
309
310 @Override
311 public void on_zrtp_not_supported(String callID) {
312 Log.i(TAG, "on_zrtp_not_supported");
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500313 Intent intent = new Intent(ZRTP_NOT_SUPPORTED);
Alexandre Lision651b5262014-02-21 17:14:14 -0500314 SecureSipCall call = (SecureSipCall) mService.getCallById(callID);
Alexandre Lisionc8037f62014-02-24 17:05:31 -0500315 call.setInitialized();
Alexandre Lision651b5262014-02-21 17:14:14 -0500316 call.setZrtpNotSupported(true);
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500317 intent.putExtra("callID", callID);
Alexandre Lision651b5262014-02-21 17:14:14 -0500318 intent.putExtra("conference", mService.findConference(callID));
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500319 mService.sendBroadcast(intent);
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500320 }
321
322 @Override
323 public void on_zrtp_negociation_failed(String callID, String reason, String severity) {
324 Log.i(TAG, "on_zrtp_negociation_failed");
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500325 Intent intent = new Intent(ZRTP_NEGOTIATION_FAILED);
Alexandre Lision651b5262014-02-21 17:14:14 -0500326 SecureSipCall call = (SecureSipCall) mService.getCallById(callID);
Alexandre Lisionc8037f62014-02-24 17:05:31 -0500327 call.setInitialized();
Alexandre Lision651b5262014-02-21 17:14:14 -0500328 call.setZrtpNotSupported(true);
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500329 intent.putExtra("callID", callID);
Alexandre Lision651b5262014-02-21 17:14:14 -0500330 intent.putExtra("conference", mService.findConference(callID));
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500331 mService.sendBroadcast(intent);
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500332 }
333
Emeric Vigier9380ae52012-09-14 17:40:39 -0400334}