Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74879509 authored by android-build SharedAccount's avatar android-build SharedAccount
Browse files

Merge commit '7e8f0c74'

parents ce7f03be 7e8f0c74
Loading
Loading
Loading
Loading
+26 −27
Original line number Diff line number Diff line
@@ -381,15 +381,30 @@ class SipSessionGroup implements SipListener {
                    : listener);
        }

        public void makeCall(SipProfile peerProfile,
                SessionDescription sessionDescription) {
        // process the command in a new thread
        private void doCommandAsync(final EventObject command) {
            new Thread(new Runnable() {
                    public void run() {
                        try {
                processCommand(
                        new MakeCallCommand(peerProfile, sessionDescription));
                            processCommand(command);
                        } catch (SipException e) {
                            // TODO: find a better way to do this
                            if ((command instanceof RegisterCommand)
                                    || (command == DEREGISTER)) {
                                onRegistrationFailed(e);
                            } else {
                                onError(e);
                            }
                        }
                    }
            }).start();
        }

        public void makeCall(SipProfile peerProfile,
                SessionDescription sessionDescription) {
            doCommandAsync(
                    new MakeCallCommand(peerProfile, sessionDescription));
        }

        public void answerCall(SessionDescription sessionDescription) {
            try {
@@ -401,36 +416,20 @@ class SipSessionGroup implements SipListener {
        }

        public void endCall() {
            try {
                processCommand(END_CALL);
            } catch (SipException e) {
                onError(e);
            }
            doCommandAsync(END_CALL);
        }

        public void changeCall(SessionDescription sessionDescription) {
            try {
                processCommand(
            doCommandAsync(
                    new MakeCallCommand(mPeerProfile, sessionDescription));
            } catch (SipException e) {
                onError(e);
            }
        }

        public void register(int duration) {
            try {
                processCommand(new RegisterCommand(duration));
            } catch (SipException e) {
                onRegistrationFailed(e);
            }
            doCommandAsync(new RegisterCommand(duration));
        }

        public void unregister() {
            try {
                processCommand(DEREGISTER);
            } catch (SipException e) {
                onRegistrationFailed(e);
            }
            doCommandAsync(DEREGISTER);
        }

        public boolean isReRegisterRequired() {