Voice Instant Messenger Andrew Miller CS 491B Fall 2006 Professor Sun
Motivation Wanted to do a project involving networking Avid user of voice and text messaging programs Wanted to do something different Thought it would be interesting
Motivation Wanted to make something I could actually use Wanted features in a program that I couldn’t find elsewhere, so I made my own
Design Networking Audio –Recording –Encoding –Playback Message Logging Friends List GUI
Design - Networking Server –Authenticates users –Serves as a router for packets between clients Messages Status Updates –Controls and maintains friends lists
Design - Networking Client –Connects to and communicates with the server –Sends and receives messages to and from other users –Sends friend updates to server to add and remove friends
Design - Audio Audio streams recorded from a user’s microphone Sound playback of recorded or received audio streams Encoded with the Speex Codec for good compression and quality
Design - Message Logging Saves information about sent or received messages: –Who sent it –Who received it –When it was sent or received (date and time) –Saves the message itself
Design – Friends List Shows all of the user’s friends Can add and remove friends by name Name formatted how the user wants with all spaces and capitalizations saved Has a flag for user status – Away or Offline
Design - GUI Login Window –Prompts for username –Connects to server Main Window –Friends List –Message List –Friend and Message Controls
Design - GUI Main Window (cont.) –Friend and Message Controls Buttons to add and remove friends Button to send messages to one or some friends Buttons to play or delete messages Button to filter message list, showing only messages from a specific friend
Design - GUI Message Frame –Shows all recipients for a current message –Can remove recipients from the list –Can send a message to one or all current recipients –Record, discard and preview message
Implementation - Networking Server –Uses a ServerSocket to accept incoming connections –Creates a new thread to handle client Sockets Client –Connects to the server using a Socket –Uses DataInputStreams and DataOutputStreams to communciate with the server
Implementation - Audio Uses the JSpeex codec –Records to ByteArrayOutputStreams –Playback from ByteArrayInputStreams –Very odd implementation due to lack of JavaSound Support
Implementation – Message Logging Messages stored in message objects –ID of who sent the message –Array of IDs of who received it –String of date and time when the message was received Had to create my own file type – VoIM Message File (.vmf)
Implementation – Message Logging VoIM Message File –int sender id –String date and time –int number of recipients –int array of recipient ids –int message length –byte array of the message
Implementation – Friends List Friends stored in friends objects –Friend ID –Name (formatted as the user wishes) –Status (online, offline, away) Stored on the server, sent to client when it connects Status packets update the client’s friends list
Implementation - GUI Java Swing and AWT Libraries –JLists –JButtons –JLabels –JFrames –JTabbedPane –JScrollPane –All layout done with SpringLayout
Insights Schedule –Sticking to a schedule is very difficult due to unforeseen problems –Creating a practical schedule is very important Implementation –Research tools more in depth before starting work
Insights Implementation (cont.) –Java was a poor choice for both networking and sound –The JavaSound guy quit in 2004, there had been no further developments and no replacements afterward Design –Planning is very important prior to coding, it’ll save a lot of time