Index: C:/Documents and Settings/peted20/My Documents/Eclipse Workspace/spark/src/java/org/jivesoftware/sparkimpl/plugin/phone/PhonePlugin.java =================================================================== --- C:/Documents and Settings/peted20/My Documents/Eclipse Workspace/spark/src/java/org/jivesoftware/sparkimpl/plugin/phone/PhonePlugin.java (revision 8500) +++ C:/Documents and Settings/peted20/My Documents/Eclipse Workspace/spark/src/java/org/jivesoftware/sparkimpl/plugin/phone/PhonePlugin.java (working copy) @@ -238,11 +238,15 @@ } if (offPhonePresence != null) { - // Set user to available when all phone calls are hung up. + // Set user to previous presence state when all phone calls are hung up. + SparkManager.getSessionManager().changePresence(offPhonePresence); + + offPhonePresence = null; + }else{ + // If no previous state available, set status to Available Presence availablePresence = new Presence(Presence.Type.available, "Available", 1, Presence.Mode.available); - SparkManager.getSessionManager().changePresence(availablePresence); - + offPhonePresence = null; } }