Erlang-controlled relay