In general telecommunication, hairpinning is returning a message from an origin endpoint back in the direction it came from as a way to get it to its destination endpoint. There are several usages.
1) Because an origin endpoint and its router in a subnetwork may not recognize that a message is intended for a destination endpoint in the same subnetwork because it only knows its public IP address, the Internet Network Address Translation (NAT) server must be able to recognize the situation and hairpin the message back to the subnetwork so that it can reach its destination.
2) In voice over IP (VoIP), hairpinning is a process in which a phone set connects to a private branch exchange (PBX) and then back out to another phone set in order to carry out a call. The entire communication takes place over a path that is longer -- sometimes much longer -- than the shortest possible circuit between the two endpoints.
All conventional telephone systems, both analog and digital, use hairpinning connections. However, in VoIP, hairpinning can often be avoided and two endpoints can be connected directly after the call has been initiated. This form of direct communication following call setup is called shuffling. In VoIP networks, hairpin connections are considered inefficient and high-end systems support shuffling.