handle_connect(ConnHandle, ProtocolVersion) -> ok | error | {error,ErrorDescr}
handle_connect(ConnHandle, ProtocolVersion, Extra) -> ok | error | {error,ErrorDescr}
Types
Invoked when a new connection is established
Connections may either be established by an explicit call to megaco:connect/4 or implicitly at the first invocation of megaco:receive_message/3.
Normally a Media Gateway (MG) connects explicitly while a Media Gateway Controller (MGC) connects implicitly.
At the Media Gateway Controller (MGC) side it is possible to reject a connection request (and send a message error reply to the gateway) by returning {error, ErrorDescr}
or simply error
which generates an error descriptor with code 402 (unauthorized) and reason "Connection refused by user" (this is also the case for all unknown results, such as exit signals or throw).
See note
above about the Extra
argument in handle_message_error/4
.
handle_connect/3
(with Extra
) can also be called as a result of a call to the megaco:connect/5
function (if that function is called with the Extra
argument different than ignore_extra
.