This is the mechanism given in my lecture handout:
I have a problem with the third species along. Surely the negatively charged oxygen would protonate before the other oxygen would. Also, why does this reaction work at all? The amine group is more basic than the "alcohol group" that must leave to form the amide so why wouldn't that protonate first and then just leave (i.e no reaction)?