Listen for anything that will help you remember the name. If you don't hear the name ask the other person to repeat it. If you still don't understand it ask to have if repeated slowly. If you still don't get it ask them to spell the name. Write it down if you think it is necessary.
Most people have no problem repeating or spelling their name.
Their name is very important to them. You may be making a friend because you are taking the time to remember their name. In a recent class there were two students. One named Julius and the other Julio. Both Julius and Julio had strong accents.