blob: df5dc3805fc3beb73f845647674ef1b3d17c1a26 [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 Lisiond52cfcc2014-04-11 15:38:45 -040034 static public final String RTCP_REPORT_RECEIVED = "on_rtcp_report_received";
35
Alexandre Savard3bdce7b2012-10-24 18:27:45 -040036
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -050037 public CallManagerCallBack(SipService context) {
Alexandre Lisionb4e60612014-01-14 17:47:23 -050038 mService = context;
Alexandre Savard74c1cad2012-10-24 16:39:00 -040039 }
Emeric Vigier9380ae52012-09-14 17:40:39 -040040
41 @Override
Alexandre Lisionb4e60612014-01-14 17:47:23 -050042 public void on_call_state_changed(String callID, String newState) {
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -050043 Log.d(TAG, "on_call_state_changed : (" + callID + ", " + newState + ")");
Alexandre Lisionb4e60612014-01-14 17:47:23 -050044
Alexandre Lision3c37dca2014-02-21 14:13:26 -050045 Conference toUpdate = mService.findConference(callID);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050046
47 if (toUpdate == null) {
48 return;
49 }
50
Alexandre Lision48b49eb2014-02-11 13:37:33 -050051 Intent intent = new Intent(CALL_STATE_CHANGED);
52 intent.putExtra("CallID", callID);
53 intent.putExtra("State", newState);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050054
Alexandre Lision707f9082014-01-16 15:09:07 -050055 if (newState.equals("RINGING")) {
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050056 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_RINGING);
Alexandre Lisionb4e60612014-01-14 17:47:23 -050057 } else if (newState.equals("CURRENT")) {
Alexandre Lision651b5262014-02-21 17:14:14 -050058 if (toUpdate.isRinging()) {
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050059 toUpdate.getCallById(callID).setTimestampStart_(System.currentTimeMillis());
Alexandre Lisionb4e60612014-01-14 17:47:23 -050060 }
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050061 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_CURRENT);
Alexandre Lisionb4e60612014-01-14 17:47:23 -050062 } else if (newState.equals("HUNGUP")) {
Alexandre Lisionb4e60612014-01-14 17:47:23 -050063 Log.d(TAG, "Hanging up " + callID);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050064 SipCall call = toUpdate.getCallById(callID);
65 if (!toUpdate.hasMultipleParticipants()) {
66 if (toUpdate.isRinging() && toUpdate.isIncoming()) {
Alexandre Lision945e4612014-01-15 17:40:31 -050067 mService.mNotificationManager.publishMissedCallNotification(mService.getConferences().get(callID));
Alexandre Lisionb4e60612014-01-14 17:47:23 -050068 }
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050069 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_HUNGUP);
70 mService.mHistoryManager.insertNewEntry(toUpdate);
71 mService.getConferences().remove(toUpdate.getId());
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 Lision2cd17d32014-02-27 15:57:20 -050082 mService.getCallManagerJNI().hangUp(callID);
Alexandre Lisionb4e60612014-01-14 17:47:23 -050083 } else if (newState.equals("HOLD")) {
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050084 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_HOLD);
Alexandre Lisionb4e60612014-01-14 17:47:23 -050085 } else if (newState.equals("UNHOLD")) {
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -050086 toUpdate.setCallState(callID, SipCall.state.CALL_STATE_CURRENT);
87 }
88 intent.putExtra("conference", toUpdate);
89 mService.sendBroadcast(intent);
90 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -050091
Alexandre Lision3c37dca2014-02-21 14:13:26 -050092
Alexandre Savard14323be2012-10-24 10:02:13 -040093 @Override
Emeric Vigier9380ae52012-09-14 17:40:39 -040094 public void on_incoming_call(String accountID, String callID, String from) {
95 Log.d(TAG, "on_incoming_call(" + accountID + ", " + callID + ", " + from + ")");
Alexandre Lisionb4e60612014-01-14 17:47:23 -050096
Alexandre Lisionb4e60612014-01-14 17:47:23 -050097 try {
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -050098 StringMap details = mService.getConfigurationManagerJNI().getAccountDetails(accountID);
99 VectMap credentials = mService.getConfigurationManagerJNI().getCredentials(accountID);
100 Account acc = new Account(accountID, SwigNativeConverter.convertAccountToNative(details), SwigNativeConverter.convertCredentialsToNative(credentials));
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500101
102 Bundle args = new Bundle();
103 args.putString(SipCall.ID, callID);
104 args.putParcelable(SipCall.ACCOUNT, acc);
105 args.putInt(SipCall.STATE, SipCall.state.CALL_STATE_RINGING);
106 args.putInt(SipCall.TYPE, SipCall.direction.CALL_TYPE_INCOMING);
107
108 CallContact unknow = CallContact.ContactBuilder.buildUnknownContact(from);
109 args.putParcelable(SipCall.CONTACT, unknow);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500110
111 Intent toSend = new Intent(CallManagerCallBack.INCOMING_CALL);
112 toSend.setClass(mService, CallActivity.class);
113 toSend.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500114 SipCall newCall = new SipCall(args);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500115 newCall.setTimestampStart_(System.currentTimeMillis());
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500116
Alexandre Lision651b5262014-02-21 17:14:14 -0500117 Conference toAdd;
118 if (acc.useSecureLayer()) {
Alexandre Lision2cd17d32014-02-27 15:57:20 -0500119 SecureSipCall secureCall = new SecureSipCall(newCall);
Alexandre Lision651b5262014-02-21 17:14:14 -0500120 toAdd = new Conference(secureCall);
121 } else {
122 toAdd = new Conference(newCall);
123 }
124
Alexandre Lision945e4612014-01-15 17:40:31 -0500125 mService.getConferences().put(toAdd.getId(), toAdd);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500126
127 Bundle bundle = new Bundle();
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500128 bundle.putParcelable("conference", toAdd);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500129 toSend.putExtra("resuming", false);
130 toSend.putExtras(bundle);
131 mService.startActivity(toSend);
Alexandre Lision945e4612014-01-15 17:40:31 -0500132 mService.mMediaManager.startRing("");
133 mService.mMediaManager.obtainAudioFocus(true);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500134 } catch (Exception e) {
135 e.printStackTrace();
136 }
Alexandre Savard74c1cad2012-10-24 16:39:00 -0400137 }
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500138
alision7f18fc82013-05-01 09:37:33 -0400139 @Override
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500140 public void on_transfer_state_changed(String result) {
141 Log.w(TAG, "TRANSFER STATE CHANGED:" + result);
alision7f18fc82013-05-01 09:37:33 -0400142 }
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500143
alision43a9b362013-05-01 16:30:15 -0400144 @Override
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500145 public void on_conference_created(final String confID) {
146 Log.w(TAG, "CONFERENCE CREATED:" + confID);
alision806e18e2013-06-21 15:30:17 -0400147 Intent intent = new Intent(CONF_CREATED);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500148 Conference created = new Conference(confID);
149
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500150 StringVect all_participants = mService.getCallManagerJNI().getParticipantList(confID);
151 Log.w(TAG, "all_participants:" + all_participants.size());
152 for (int i = 0; i < all_participants.size(); ++i) {
Alexandre Lision945e4612014-01-15 17:40:31 -0500153 if (mService.getConferences().get(all_participants.get(i)) != null) {
154 created.addParticipant(mService.getConferences().get(all_participants.get(i)).getCallById(all_participants.get(i)));
155 mService.getConferences().remove(all_participants.get(i));
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500156 } else {
Alexandre Lision945e4612014-01-15 17:40:31 -0500157 Iterator<Map.Entry<String, Conference>> it = mService.getConferences().entrySet().iterator();
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500158 while (it.hasNext()) {
159 Conference tmp = it.next().getValue();
160 for (SipCall c : tmp.getParticipants()) {
161 if (c.getCallId().contentEquals(all_participants.get(i))) {
162 created.addParticipant(c);
Alexandre Lision96db8032014-01-17 16:43:51 -0500163 mService.getConferences().get(tmp.getId()).removeParticipant(c);
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500164 }
165 }
166 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500167 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500168 }
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500169 intent.putExtra("conference", created);
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500170 intent.putExtra("confID", created.getId());
Alexandre Lision945e4612014-01-15 17:40:31 -0500171 mService.getConferences().put(created.getId(), created);
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500172 mService.sendBroadcast(intent);
alision43a9b362013-05-01 16:30:15 -0400173 }
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500174
alision4a0eb092013-05-07 13:52:03 -0400175 @Override
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500176 public void on_incoming_message(String ID, String from, String msg) {
177 Log.w(TAG, "on_incoming_message:" + msg);
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500178 Intent intent = new Intent(INCOMING_TEXT);
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500179 intent.putExtra("CallID", ID);
180 intent.putExtra("From", from);
181 intent.putExtra("Msg", msg);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500182
Alexandre Lision945e4612014-01-15 17:40:31 -0500183 if (mService.getConferences().get(ID) != null) {
184 mService.getConferences().get(ID).addSipMessage(new SipMessage(true, msg));
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500185 intent.putExtra("conference", mService.getConferences().get(ID));
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500186 } else {
Alexandre Lision945e4612014-01-15 17:40:31 -0500187 Iterator<Map.Entry<String, Conference>> it = mService.getConferences().entrySet().iterator();
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500188 while (it.hasNext()) {
189 Conference tmp = it.next().getValue();
190 for (SipCall c : tmp.getParticipants()) {
191 if (c.getCallId().contentEquals(ID)) {
Alexandre Lision945e4612014-01-15 17:40:31 -0500192 mService.getConferences().get(tmp.getId()).addSipMessage(new SipMessage(true, msg));
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500193 intent.putExtra("conference", tmp);
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500194 }
195 }
196 }
197
198 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500199 mService.sendBroadcast(intent);
alision04a00182013-05-10 17:05:29 -0400200 }
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500201
alision04a00182013-05-10 17:05:29 -0400202 @Override
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500203 public void on_conference_removed(String confID) {
Alexandre Lision183bf452014-01-17 11:21:59 -0500204 Log.i(TAG, "on_conference_removed:");
alision806e18e2013-06-21 15:30:17 -0400205 Intent intent = new Intent(CONF_REMOVED);
206 intent.putExtra("confID", confID);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500207
Alexandre Lision945e4612014-01-15 17:40:31 -0500208 Conference toReInsert = mService.getConferences().get(confID);
Alexandre Lision183bf452014-01-17 11:21:59 -0500209 for (SipCall call : toReInsert.getParticipants()) {
210 mService.getConferences().put(call.getCallId(), new Conference(call));
211 }
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500212 intent.putExtra("conference", mService.getConferences().get(confID));
Alexandre Lision945e4612014-01-15 17:40:31 -0500213 mService.getConferences().remove(confID);
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500214 mService.sendBroadcast(intent);
215
alision4a0eb092013-05-07 13:52:03 -0400216 }
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500217
alision4a0eb092013-05-07 13:52:03 -0400218 @Override
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500219 public void on_conference_state_changed(String confID, String state) {
Alexandre Lision183bf452014-01-17 11:21:59 -0500220 Log.i(TAG, "on_conference_state_changed:");
alision806e18e2013-06-21 15:30:17 -0400221 Intent intent = new Intent(CONF_CHANGED);
222 intent.putExtra("confID", confID);
223 intent.putExtra("State", state);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500224
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500225
Alexandre Lision183bf452014-01-17 11:21:59 -0500226 Log.i(TAG, "Received:" + intent.getAction());
227 Log.i(TAG, "State:" + state);
228
229 Conference toModify = mService.getConferences().get(confID);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500230 toModify.setCallState(confID, state);
Alexandre Lision183bf452014-01-17 11:21:59 -0500231
232 ArrayList<String> newParticipants = SwigNativeConverter.convertSwigToNative(mService.getCallManagerJNI().getParticipantList(intent.getStringExtra("confID")));
233
234 if (toModify.getParticipants().size() < newParticipants.size()) {
235 // We need to add the new participant to the conf
236 for (int i = 0; i < newParticipants.size(); ++i) {
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500237 if (toModify.getCallById(newParticipants.get(i)) == null) {
Alexandre Lision183bf452014-01-17 11:21:59 -0500238 mService.addCallToConference(toModify.getId(), newParticipants.get(i));
239 }
240 }
241 } else if (toModify.getParticipants().size() > newParticipants.size()) {
Alexandre Lision96db8032014-01-17 16:43:51 -0500242 Log.i(TAG, "toModify.getParticipants().size() > newParticipants.size()");
Alexandre Lision183bf452014-01-17 11:21:59 -0500243 for (SipCall participant : toModify.getParticipants()) {
244 if (!newParticipants.contains(participant.getCallId())) {
Alexandre Lision96db8032014-01-17 16:43:51 -0500245 mService.detachCallFromConference(toModify.getId(), participant);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500246 break;
Alexandre Lision183bf452014-01-17 11:21:59 -0500247 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500248 }
Alexandre Lision945e4612014-01-15 17:40:31 -0500249 }
Alexandre Lisionb4e60612014-01-14 17:47:23 -0500250
Alexandre Lision183bf452014-01-17 11:21:59 -0500251 mService.sendBroadcast(intent);
Alexandre Savard74c1cad2012-10-24 16:39:00 -0400252 }
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500253
alisiondf1dac92013-06-27 17:35:53 -0400254 @Override
Alexandre Lisiona9ee4eb2014-01-15 16:20:35 -0500255 public void on_record_playback_filepath(String id, String filename) {
alisiondf1dac92013-06-27 17:35:53 -0400256 Intent intent = new Intent(RECORD_STATE_CHANGED);
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500257 intent.putExtra("callID", id);
alisiondf1dac92013-06-27 17:35:53 -0400258 intent.putExtra("file", filename);
Alexandre Lision945e4612014-01-15 17:40:31 -0500259 mService.sendBroadcast(intent);
alision04a00182013-05-10 17:05:29 -0400260 }
alisiondf1dac92013-06-27 17:35:53 -0400261
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500262 @Override
263 public void on_secure_sdes_on(String callID) {
264 Log.i(TAG, "on_secure_sdes_on");
Alexandre Lision8342eda2014-02-25 15:53:54 -0500265 SecureSipCall call = (SecureSipCall) mService.getCallById(callID);
266 call.setInitialized();
267 call.useSecureSDES(true);
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500268 }
269
270 @Override
271 public void on_secure_sdes_off(String callID) {
272 Log.i(TAG, "on_secure_sdes_off");
Alexandre Lision8342eda2014-02-25 15:53:54 -0500273 SecureSipCall call = (SecureSipCall) mService.getCallById(callID);
274 call.setInitialized();
275 call.useSecureSDES(false);
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500276 }
277
278 @Override
279 public void on_secure_zrtp_on(String callID, String cipher) {
280 Log.i(TAG, "on_secure_zrtp_on");
Alexandre Lision5f144b82014-02-11 09:59:36 -0500281 Intent intent = new Intent(ZRTP_ON);
Alexandre Lision651b5262014-02-21 17:14:14 -0500282 SecureSipCall call = (SecureSipCall) mService.getCallById(callID);
283 call.setInitialized();
Alexandre Lisione1b7f162014-02-26 16:45:32 -0500284 call.setZrtpSupport(true);
Alexandre Lision651b5262014-02-21 17:14:14 -0500285 intent.putExtra("callID", callID);
Alexandre Lision3c37dca2014-02-21 14:13:26 -0500286 intent.putExtra("conference", mService.findConference(callID));
Alexandre Lision5f144b82014-02-11 09:59:36 -0500287 mService.sendBroadcast(intent);
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500288 }
289
290 @Override
291 public void on_secure_zrtp_off(String callID) {
292 Log.i(TAG, "on_secure_zrtp_off");
Alexandre Lision651b5262014-02-21 17:14:14 -0500293 Intent intent = new Intent(ZRTP_OFF);
294 intent.putExtra("callID", callID);
Alexandre Lisione1b7f162014-02-26 16:45:32 -0500295 SecureSipCall call = (SecureSipCall) mService.getCallById(callID);
Alexandre Lision2cd17d32014-02-27 15:57:20 -0500296 // Security can be off because call was hung up
297 if (call == null)
298 return;
299
Alexandre Lisione1b7f162014-02-26 16:45:32 -0500300 call.setInitialized();
301 call.setZrtpSupport(false);
Alexandre Lision651b5262014-02-21 17:14:14 -0500302 intent.putExtra("conference", mService.findConference(callID));
Alexandre Lisiondf222a52014-02-25 09:58:57 -0500303 mService.sendBroadcast(intent);
304 }
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500305
306 @Override
307 public void on_show_sas(String callID, String sas, boolean verified) {
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500308 Log.i(TAG, "on_show_sas:" + sas);
Alexandre Lision5f144b82014-02-11 09:59:36 -0500309 Intent intent = new Intent(DISPLAY_SAS);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500310 SecureSipCall call = (SecureSipCall) mService.getCallById(callID);
Alexandre Lisiona7ab2e32014-02-14 15:33:33 -0500311 call.setSAS(sas);
Alexandre Lision1b932d82014-02-21 10:03:19 -0500312 call.sasConfirmedByZrtpLayer(verified);
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500313
Alexandre Lision651b5262014-02-21 17:14:14 -0500314 intent.putExtra("callID", callID);
315 intent.putExtra("SAS", sas);
316 intent.putExtra("verified", verified);
Alexandre Lision3c37dca2014-02-21 14:13:26 -0500317 intent.putExtra("conference", mService.findConference(callID));
Alexandre Lision5f144b82014-02-11 09:59:36 -0500318 mService.sendBroadcast(intent);
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500319 }
320
321 @Override
322 public void on_zrtp_not_supported(String callID) {
323 Log.i(TAG, "on_zrtp_not_supported");
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500324 Intent intent = new Intent(ZRTP_NOT_SUPPORTED);
Alexandre Lision651b5262014-02-21 17:14:14 -0500325 SecureSipCall call = (SecureSipCall) mService.getCallById(callID);
Alexandre Lisionc8037f62014-02-24 17:05:31 -0500326 call.setInitialized();
Alexandre Lisione1b7f162014-02-26 16:45:32 -0500327 call.setZrtpSupport(false);
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500328 intent.putExtra("callID", callID);
Alexandre Lision651b5262014-02-21 17:14:14 -0500329 intent.putExtra("conference", mService.findConference(callID));
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500330 mService.sendBroadcast(intent);
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500331 }
332
333 @Override
334 public void on_zrtp_negociation_failed(String callID, String reason, String severity) {
335 Log.i(TAG, "on_zrtp_negociation_failed");
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500336 Intent intent = new Intent(ZRTP_NEGOTIATION_FAILED);
Alexandre Lision651b5262014-02-21 17:14:14 -0500337 SecureSipCall call = (SecureSipCall) mService.getCallById(callID);
Alexandre Lisionc8037f62014-02-24 17:05:31 -0500338 call.setInitialized();
Alexandre Lisione1b7f162014-02-26 16:45:32 -0500339 call.setZrtpSupport(false);
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500340 intent.putExtra("callID", callID);
Alexandre Lision651b5262014-02-21 17:14:14 -0500341 intent.putExtra("conference", mService.findConference(callID));
Alexandre Lision48b49eb2014-02-11 13:37:33 -0500342 mService.sendBroadcast(intent);
Alexandre Lision6a13ac02014-02-04 15:58:20 -0500343 }
344
Alexandre Lisiond52cfcc2014-04-11 15:38:45 -0400345 @Override
Alexandre Lision5d3d1962014-04-11 15:53:46 -0400346 public void on_rtcp_report_received(String callID, IntegerMap stats) {
Alexandre Lisiond52cfcc2014-04-11 15:38:45 -0400347 Log.i(TAG, "on_rtcp_report_received");
348 Intent intent = new Intent(RTCP_REPORT_RECEIVED);
349 mService.sendBroadcast(intent);
350 }
351
Emeric Vigier9380ae52012-09-14 17:40:39 -0400352}