I don't have the wire color codes handy, will look them up is some one else doesn't chime in. Your problem is the wires from the trailer system don't always match up with the coded wires in the harness setup--that is, there are several black wires that are connected to the color coded ones from the harness.
During this repair, you might take the time to get rid of the metal junction box and wire nuts and replace everything with a multipost terminal block. I have attached photos to show what I have done to correct the factory lazy man's way...
The blue wire is the trailer brake for sure. You may have to connect one of the red wires while it is connected to 12-volt source to the others and see which light(s) come on. You have running lights, stop/turn/flashers, trailer brakes and battery charge lines. Been a while since I did this, and was lucky enough to mark all wires before detaching.
2016 Tiffin 40 QBH
2015 38RSSA, traded
2005 TK3 #1869, 10 yrs of memories,
2017 F450 KR--one more Ford is it
2009 F450 4x4-died; 2010 F450-retired