Types
ConnHandle = conn_handle()
ProtocolVersion = protocol_version()
UserReply = success() | failure()
success() = {ok, result()}
result() = transaction_result() | segment_result()
transaction_result() = action_reps()
segment_result() = {segment_no(), last_segment(), action_reps()}
action_reps() = [action_reply()]
failure() = {error, reason()} | {error, ReplyNo, reason()}
reason() = transaction_reason() | segment_reason() | user_cancel_reason() | send_reason() | other_reason()
transaction_reason() = error_desc()
segment_reason() = {segment_no(), last_segment(), error_desc()}
other_reason() = timeout | {segment_timeout, missing_segments()} | exceeded_recv_pending_limit | term()
last_segment() = bool()
missing_segments() = [segment_no()]
user_cancel_reason() = {user_cancel, reason_for_user_cancel()}
reason_for_user_cancel() = term()
send_reason() = send_cancelled_reason() | send_failed_reason()
send_cancelled_reason() = {send_message_cancelled, reason_for_send_cancel()}
reason_for_send_cancel() = term()
send_failed_reason() = {send_message_failed, reason_for_send_failure()}
reason_for_send_failure() = term()
ReplyData = reply_data()
ReplyNo = integer() > 0
reply_data() = term()
Extra = term()
Optionally invoked for a transaction reply
The sender of a transaction request has the option of deciding, whether the originating Erlang process should synchronously wait (megaco:call/3) for a reply or if the message should be sent asynchronously (megaco:cast/3) and the processing of the reply should be delegated this callback function.
Note that if the reply is segmented (split into several smaller messages; segments), then some extra info, segment number and an indication if all segments of a reply has been received or not, is also included in the UserReply.
The ReplyData defaults to megaco:lookup(ConnHandle, reply_data), but may be explicitly overridden by a megaco:cast/3 option in order to forward info about the calling context of the originating process.
At success(), the UserReply either contains:
-
A list of 'ActionReply' records possibly containing error indications.
-
A tuple of size three containing: the segment number, the last segment indicator and finally a list of 'ActionReply' records possibly containing error indications. This is of course only possible if the reply was segmented.
failure() indicates an local or external error and can be one of the following:
-
A transaction_reason(), indicates that the remote user has replied with an explicit transactionError.
-
A segment_reason(), indicates that the remote user has replied with an explicit transactionError for this segment. This is of course only possible if the reply was segmented.
-
A user_cancel_reason(), indicates that the request has been canceled by the user. reason_for_user_cancel() is the reason given in the call to the cancel function.
-
A send_reason(), indicates that the transport module send_message function did not send the message. The reason for this can be:
-
send_cancelled_reason() - the message sending was deliberately cancelled. reason_for_send_cancel() is the reason given in the cancel return from the send_message function.
-
send_failed_reason() - an error occurred while attempting to send the message.
-
An other_reason(), indicates some other error such as:
-
timeout - the reply failed to arrive before the request timer expired.
-
{segment_timeout, missing_segments()} - one or more segments was not delivered before the expire of the segment timer.
-
exceeded_recv_pending_limit - the pending limit was exceeded for this request.
See note above about the Extra argument in handle_trans_reply/5.