Interface module for the Megaco application
megaco_timer() = infinity | integer() | megaco_incr_timer() megaco_incr_timer() = #megaco_incr_timer{}
The record megaco_incr_timer
contains the following fields:
wait_for = integer()
factor = integer()
incr = integer
max_retries = infinity | infinity_restartable | integer()
infinity_restartable
, it
means that the timer is restartable as long as some
external event occurs (e.g. receipt of a pending
message for instance). But the timer will never be
restarted "by itself", i.e. when the timer expires
(whatever the timeout time), so does the timer.
Whever the timer is restarted, the timeout time will
be calculated in the usual way!start() -> ok | {error, Reason}
Types:
Reason = term()
Starts the Megaco application
Users may either explicitly be registered with megaco:start_user/2 and/or be statically configured by setting the application environment variable 'users' to a list of {UserMid, Config} tuples. See the function megaco:start_user/2 for details.
stop() -> ok | {error, Reason}
stop
Types:
Reason = term()
Stops the Megaco application
start_user(UserMid, Config) -> ok | {error, Reason}
Types:
UserMid = megaco_mid()
Config = [{user_info_item(), user_info_value()}]
Reason = term()
Initial configuration of a user
Requires the megaco application to be started. A user is either a Media Gateway (MG) or a Media Gateway Controller (MGC). One Erlang node may host many users.
A user is identified by its UserMid, which must be a legal Megaco MID.
Config is a list of {Item, Value} tuples. See megaco:user_info/2 about which items and values that are valid.
stop_user(UserMid) -> ok | {error, Reason}
Types:
UserMid = megaco_mid()
Reason = term()
user_info(UserMid, Item) -> Value | exit(Reason)
Types:
Handle = user_info_handle()
UserMid = megaco_mid()
Item = user_info_item()
Value = user_info_value()
Reason = term()
Lookup user information
The following Item's are valid:
connections
receive_handle
trans_id
undefined_serial
(in case no messages has been sent).min_trans_id
max_trans_id
infinity
,
defaults to infinity
.request_timer
long_request_timer
is started instead
(see below). No resends will be performed from this point
(since we now know that the other side has received the
request). megaco:call
will return with {error, timeout}
or the callback function handle_trans_reply
will be
called with UserReply = {error, timeout}
(if
megaco:cast
was used).#megaco_incr_timer{}
.long_request_timer
long_request_timer
is not "on it's final leg", the timer will be
restarted, and, if long_request_resend = true
, the
request will be re-sent. infinity
.long_request_resend
long_request_timer
(see above) is also set
to an incremental timer (#megaco_incr_timer{}
). boolean
,
defaults to false
.reply_timer
#megaco_incr_timer{}
,
then for each intermediate timout, the reply will be resent
(this is valid until the ack is received or
the timer expires). auto_ack
trans_ack
below). boolean
, defaults to false
.trans_ack
auto_ack
is true.auto_ack
is true, then if trans_ack
is
false
, ack's will be sent immediatelly.
If trans_ack
is true
, then
ack's will instead be sent to the transaction
sender process for accumulation and later sending
(see trans_ack_maxcount
, trans_req_maxcount
,
trans_req_maxsize
, trans_ack_maxcount
and
trans_timer
). boolean
, defaults to false
.trans_ack_maxcount
integer
, defaults to 10.trans_req
trans_req
is false
, then request(s)
will be sent immediatelly (in it's own message).trans_req
is true, then request(s) will
instead be sent to the transaction sender process for
accumulation and later sending
(see trans_ack_maxcount
, trans_req_maxcount
,
trans_req_maxsize
, trans_ack_maxcount
and
trans_timer
). boolean
, defaults to false
.trans_req_maxcount
integer
, defaults to 10.trans_req_maxsize
integer
, defaults to 2048.trans_timer
auto_ack
and trans_ack
is true or if trans_req
is true,
then transaction sender will be started and transactions
(which is depending on the values of auto_ack
,
trans_ack
and trans_req
) will be accumulated,
for later sending. integer
, defaults to 0.pending_timer
sent_pending_limit
infinity
,
defaults to infinity
.recv_pending_limit
infinity
,
defaults to infinity
. send_mod
atom
, defaults to megaco_tcp
.encoding_mod
atom
, defaults to megaco_pretty_text_encoder
.encoding_config
list
, defaults to []
.protocol_version
integer
, default is 1.strict_version
boolean
, default is true.reply_data
undefined
.user_mod
user_args
threaded
false
), or if each
request should be handled by it's own process (true
i.e. a separate process is spawned for each request). boolean
, defaults to false
. update_user_info(UserMid, Item, Value) -> ok | {error, Reason}
Types:
UserMid = megaco_mid()
Item = user_info_item()
Value = user_info_value()
Reason = term()
Update information about a user
Requires that the user is started. See megaco:user_info/2 about which items and values that are valid.
conn_info(ConnHandle, Item) -> Value | exit(Reason)
Types:
ConnHandle = #megaco_conn_handle{}
Item = conn_info_item()
Value = conn_info_value()
Reason = term()
Lookup information about an active connection
Requires that the connection is active.
control_pid
send_handle
local_mid
megaco_mid()
.remote_mid
megaco_mid()
.receive_handle
trans_id
undefined_serial
(only in case of error). max_trans_id
infinity
,
defaults to infinity
.request_timer
long_request_timer
is started instead
(see below). No resends will be performed from this point
(since we now know that the other side has received the
request). megaco:call
will return with {error, timeout}
or the callback function handle_trans_reply
will be
called with UserReply = {error, timeout}
(if
megaco:cast
was used).long_request_timer
long_request_timer
is not "on it's final leg", the timer will be
restarted, and, if long_request_resend = true
, the
request will be re-sent. infinity
.long_request_resend
long_request_timer
(see above) is also set
to an incremental timer (#megaco_incr_timer{}
). boolean
,
defaults to false
.reply_timer
#megaco_incr_timer{}
,
then for each intermediate timout, the reply will be resent
(this is valid until the ack is received or
the timer expires). auto_ack
trans_ack
below). boolean
, defaults to false
.trans_ack
auto_ack
is true. auto_ack
is true, then if trans_ack
is
false
, ack's will be sent immediatelly.
If trans_ack
is
true
, then ack's will instead be sent to the transaction
sender process for accumulation and later sending
(see trans_ack_maxcount
, trans_req_maxcount
,
trans_req_maxsize
, trans_ack_maxcount
and
trans_timer
). boolean
, defaults to false
.trans_ack_maxcount
trans_req
trans_req
is false
, then request(s)
will be sent immediatelly (in it's own message). trans_req
is true, then request(s) will
instead be sent to the transaction sender process for
accumulation and later sending
(see trans_ack_maxcount
, trans_req_maxcount
,
trans_req_maxsize
, trans_ack_maxcount
and
trans_timer
). boolean
, defaults to false
.trans_req_maxcount
integer
, defaults to 10.trans_req_maxsize
integer
, defaults to 2048.trans_timer
auto_ack
and trans_ack
is true or if trans_req
is true,
then transaction sender will be started and transactions
(which is depending on the values of auto_ack
,
trans_ack
and trans_req
) will be accumulated,
for later sending. integer
, defaults to 0.pending_timer
sent_pending_limit
infinity
,
defaults to infinity
.recv_pending_limit
infinity
,
defaults to infinity
.send_mod
atom
, defaults to megaco_tcp
.encoding_mod
atom
,
defaults to megaco_pretty_text_encoder
.encoding_config
list
, defaults to [].protocol_version
strict_version
boolean
, default is true.reply_data
undefined
.threaded
false
), or if each
request should be handled by it's own process (true
i.e. a separate process is spawned for each request). boolean
, defaults to false
. update_conn_info(ConnHandle, Item, Value) -> ok | {error, Reason}
Types:
ConnHandle = #megaco_conn_handle{}
Item = conn_info_item()
Value = conn_info_value()
Reason = term()
Update information about an active connection
Requires that the connection is activated. See megaco:conn_info/2 about which items and values that are valid.
system_info(Item) -> Value | exit(Reason)
Types:
Item = system_info_item()
Lookup system information
The following items are valid:
text_config
connections
users
n_active_requests
n_active_replies
n_active_connections
connect(ReceiveHandle, RemoteMid, SendHandle, ControlPid) -> {ok, ConnHandle} | {error, Reason}
Types:
ReceiveHandle = #megaco_receive_handle{}
RemoteMid = preliminary_mid | megaco_mid()
SendHandle = term()
ControlPid = pid()
ConnHandle = #megaco_conn_handle{}
Reason = term()
Establish a "virtual" connection
Activates a connection to a remote user. When this is done the connection can be used to send messages (with SendMod:send_message/2). The ControlPid is the identifier of a process that controls the connection. That process will be supervised and if it dies, this will be detected and the UserMod:handle_disconnect/2 callback function will be invoked. See the megaco_user module for more info about the callback arguments. The connection may also explicitly be deactivated by invoking megaco:disconnect/2.
The ControlPid may be the identity of a process residing on another Erlang node. This is useful when you want to distribute a user over several Erlang nodes. In such a case one of the nodes has the physical connection. When a user residing on one of the other nodes needs to send a request (with megaco:call/3 or megaco:cast/3), the message will encoded on the originating Erlang node, and then be forwarded to the node with the physical connection. When the reply arrives, it will be forwarded back to the originator. The distributed connection may explicitely be deactivated by a local call to megaco:disconnect/2 or implicitely when the physical connection is deactivated (with megaco:disconnect/2, killing the controlling process, halting the other node, ...).
The call of this function will trigger the callback function UserMod:handle_connect/2 to be invoked. See the megaco_user module for more info about the callback arguments.
A connection may be established in several ways:
provisioned MID
upgrade preliminary MID
automatic
distributed
An initial megaco_receive_handle record may be obtained with megaco:user_info(UserMid, receive_handle)
The send handle is provided by the preferred transport module, e.g. megaco_tcp, megaco_udp. Read the documentation about each transport module about the details.
disconnect(ConnHandle, DiscoReason) -> ok | {error, ErrReason}
Types:
ConnHandle = conn_handle()
DiscoReason = term()
ErrReason = term()
Tear down a "virtual" connection
Causes the UserMod:handle_disconnect/2 callback function to be invoked. See the megaco_user module for more info about the callback arguments.
call(ConnHandle, Actions, Options) -> {ProtocolVersion, UserReply}
Types:
ConnHandle = conn_handle()
Actions = action_reqs() | [action_reqs()]
action_reqs() = binary() | [#'ActionRequest'{}]
Options = [send_option()]
send_option() = {request_timer, megaco_timer()} | {long_request_timer, megaco_timer()} | {send_handle, term()} | {protocol_version, integer()}
UserReply = user_reply() | [user_reply()]
user_reply() = success() | failure()
success() = {ok, [#'ActionReply'{}]}
failure() = message_error() | other_error()
message_error() = {error, error_descr()}
other_error() = {error, term()}
Sends one or more transaction request(s) and waits for the reply.
When sending one transaction in a message, Actions
should be
action_reqs()
(UserReply
will then be
user_reply()
). When sending several transactions in a message,
Actions
should be [action_reqs()]
(UserReply
will then be [user_reply()]
). Each element of the list is
part of one transaction.
For some of our codecs (not binary), it is also possible
to pre-encode the actions, in which case Actions
will be
either a binary()
or [binary()]
.
The function returns when the reply arrives, when the request timer eventually times out or when the outstanding requests are explicitly cancelled.
The default values of the send options are obtained by megaco:conn_info(ConnHandle, Item). But the send options above, may explicitly be overridden.
The ProtocolVersion version is the version actually encoded in the reply message.
At success(), the UserReply contains a list of 'ActionReply' records possibly containing error indications.
A message_error(), indicates that the remote user has replied with an explicit transactionError.
An other_error(), indicates some other error such as timeout or {user_cancel, ReasonForCancel}.
cast(ConnHandle, Actions, Options) -> ok | {error, Reason}
Types:
ConnHandle = conn_handle()
Actions = action_reqs() | [action_reqs()]
action_reqs() = binary() | [#'ActionRequest'{}]
Options = [send_option()]
send_option() = {request_timer, megaco_timer()} | {long_request_timer, megaco_timer()} | {send_handle, term()} | {reply_data, reply_data()} | {protocol_version, integer()}
Reason = term()
Sends one or more transaction request(s) but does NOT wait for a reply
When sending one transaction in a message, Action
should be
action_reqs()
. When sending several transactions in a message,
Actions
should be [action_reqs()]
. Each element of the
list is part of one transaction.
For some of our codecs (not binary), it is also possible
to pre-encode the actions, in which case Actions
will be
either a binary()
or [binary()]
.
The default values of the send options are obtained by megaco:conn_info(ConnHandle, Item). But the send options above, may explicitly be overridden.
The ProtocolVersion version is the version actually encoded in the reply message.
The callback function UserMod:handle_trans_reply/4 is invoked when the reply arrives, when the request timer eventually times out or when the outstanding requests are explicitly cancelled. See the megaco_user module for more info about the callback arguments.
encode_actions(ConnHandle, Actions, Options) -> {ok, BinOrBins} | {error, Reason}
Types:
ConnHandle = conn_handle()
Actions = action_reqs() | [action_reqs()]
action_reqs() = [#'ActionRequest'{}]
Options = [send_option()]
send_option() = {request_timer, megaco_timer()} | {long_request_timer, megaco_timer()} | {send_handle, term()} | {protocol_version, integer()}
BinOrBins = binary() | [binary()]
Reason = term()
Encodes lists of action requests for one or more transaction request(s).
When encoding action requests for one transaction,
Actions
should be action_reqs()
.
When encoding action requests for several transactions,
Actions
should be [action_reqs()]
. Each element
of the list is part of one transaction.
token_tag2string(Tag) -> Result
token_tag2string(Tag, EncoderMod) -> Result
token_tag2string(Tag, EncoderMod, Version) -> Result
Types:
Tag = atom()
EncoderMod = pretty | compact | encoder_module()
encoder_module() = megaco_pretty_text_encoder | megaco_compact_text_encoder | atom()
Version = int_version() | atom_version()
int_version() = 1 | 2 | 3
atom_version() = v1 | v2 | v3 | prev3b
Result = string() | {error, Reason}
Reason = term()
Convert a token tag to a string
If no encoder module is given, the default is used (which is pretty).
If no or an unknown version is given, the best version is used (which is prev3b).
If no match is found for Tag
, Result
will be the
empty string ([]
).
cancel(ConnHandle, CancelReason) -> ok | {error, ErrReason}
Types:
ConnHandle = conn_handle()
CancelReason = term()
ErrReason = term()
Cancel all outstanding messages for this connection
This causes outstanding megaco:call/3 requests to return. The callback functions UserMod:handle_reply/4 and UserMod:handle_trans_ack/4 are also invoked where it applies. See the megaco_user module for more info about the callback arguments.
process_received_message(ReceiveHandle, ControlPid, SendHandle, BinMsg) -> ok
Types:
ReceiveHandle = #megaco_receive_handle{}
ControlPid = pid()
SendHandle = term()
BinMsg = binary()
Process a received message
This function is intended to be invoked by some transport modules when get an incoming message. Which transport that actually is used is up to the user to choose.
The message is delivered as an Erlang binary and is decoded by the encoding module stated in the receive handle together with its encoding config (also in the receive handle). Depending of the outcome of the decoding various callback functions will be invoked. See megaco_user for more info about the callback arguments.
Note that all processing is done in the context of the calling
process. A transport module could call this function via one of the
spawn
functions (e.g. spawn_opt
). See also
receive_message/4
.
If the message cannot be decoded the following callback function will be invoked:
If the decoded message instead of transactions contains a message error, the following callback function will be invoked:
If the decoded message happens to be received before the connection is established, a new "virtual" connection is established. This is typically the case for the Media Gateway Controller (MGC) upon the first Service Change. When this occurs the following callback function will be invoked:
For each transaction request in the decoded message the following callback function will be invoked:
For each transaction reply in the decoded message the reply is returned to the user. Either the originating function megaco:call/3 will return. Or in case the originating function was megaco:case/3 the following callback function will be invoked:
When a transaction acknowledgement is received it is possible that user has decided not to bother about the acknowledgement. But in case the return value from UserMod:handle_trans_request/3 indicates that the acknowledgement is important the following callback function will be invoked:
See the megaco_user module for more info about the callback arguments.
receive_message(ReceiveHandle, ControlPid, SendHandle, BinMsg) -> ok
Types:
ReceiveHandle = #megaco_receive_handle{}
ControlPid = pid()
SendHandle = term()
BinMsg = binary()
Process a received message
This is a callback function intended to be invoked by some transport modules when get an incoming message. Which transport that actually is used is up to the user to choose.
In principle, this function calls the
process_received_message/4
function via a spawn
to
perform the actual processing.
For further information see the process_received_message/4
function.
parse_digit_map(DigitMapBody) -> {ok, ParsedDigitMap} | {error, Reason}
Types:
DigitMapBody = string()
ParsedDigitMap = parsed_digit_map()
parsed_digit_map() = term()
Reason = term()
Parses a digit map body
Parses a digit map body, represented as a list of characters, into a list of state transitions suited to be evaluated by megaco:eval_digit_map/1,2.
eval_digit_map(DigitMap) -> {ok, MatchResult} | {error, Reason}
eval_digit_map(DigitMap, Timers) -> {ok, MatchResult} | {error, Reason}
Types:
DigitMap = #'DigitMapValue'{} | parsed_digit_map()
parsed_digit_map() = term()
ParsedDigitMap = term()
Timers = ignore() | reject()
ignore() = ignore | {ignore, digit_map_value()}
reject() = reject | {reject, digit_map_value()} | digit_map_value()
MatchResult = {Kind, Letters} | {Kind, Letters, Extra}
Kind = kind()
kind() = full | unambiguous
Letters = [letter()]
letter() = $0..$9 | $a .. $k
Extra = letter()
Reason = term()
Collect digit map letters according to the digit map.
When evaluating a digit map, a state machine waits for timeouts and letters reported by megaco:report_digit_event/2. The length of the various timeouts are defined in the digit_map_value() record.
When a complete sequence of valid events has been received, the result is returned as a list of letters.
There are two options for handling syntax errors (that is when an unexpected event is received when the digit map evaluator is expecting some other event). The unexpected events may either be ignored or rejected. The latter means that the evaluation is aborted and an error is returned.
report_digit_event(DigitMapEvalPid, Events) -> ok | {error, Reason}
Types:
DigitMapEvalPid = pid()
Events = Event | [Event]
Event = letter() | pause() | cancel()
letter() = $0..$9 | $a .. $k | $A .. $K
pause() = one_second() | ten_seconds()
one_second() = $s | $S
ten_seconds() = $l | $L
cancel() = $z | $Z | cancel
Reason = term()
Send one or more events to the event collector process.
Send one or more events to a process that is evaluating a digit map, that is a process that is executing megaco:eval_digit_map/1,2.
Note that the events $s | $S
, l | $L
and
$z | $Z
has nothing to do with the timers using
the same characters.
test_digit_event(DigitMap, Events) -> {ok, Kind, Letters} | {error, Reason}
Types:
DigitMap = #'DigitMapValue'{} | parsed_digit_map()
parsed_digit_map() = term()
ParsedDigitMap = term()
Timers = ignore() | reject()
ignore() = ignore | {ignore, digit_map_value()}
reject() = reject | {reject, digit_map_value()} | digit_map_value()
DigitMapEvalPid = pid()
Events = Event | [Event]
Event = letter() | pause() | cancel()
Kind = kind()
kind() = full | unambiguous
Letters = [letter()]
letter() = $0..$9 | $a .. $k | $A .. $K
pause() = one_second() | ten_seconds()
one_second() = $s | $S
ten_seconds() = $l | $L
cancel () = $z | $Z | cancel
Reason = term()
Feed digit map collector with events and return the result
This function starts the evaluation of a digit map with megaco:eval_digit_map/1 and sends a sequence of events to it megaco:report_digit_event/2 in order to simplify testing of digit maps.
encode_sdp(SDP) -> {ok, PP} | {error, Reason}
Types:
SDP = sdp_property_parm() | sdp_property_group() | sdp_property_groups() | asn1_NOVALUE
sdp_property_parm() = sdp() | property_parm()
sdp() = sdp_c() | sdp_o() | sdp_s() | sdo_i() | sdo_u() | sdo_e() | sdo_p() | sdo_c() | sdo_b() | sdo_z() | sdo_k() | sdo_a() | sdo_a_rtpmap() | sdo_a_ptime() | sdo_t() | sdo_r() | sdo_m()
sdp_v() = #megaco_sdp_v{} (Protocol version)
sdp_o() = #megaco_sdp_o{} (Owner/creator and session indentifier)
sdp_s() = #megaco_sdp_s{} (Session name)
sdp_i() = #megaco_sdp_i{} (Session information)
sdp_u() = #megaco_sdp_u{} (URI of description)
sdp_e() = #megaco_sdp_e{} (Email address)
sdp_p() = #megaco_sdp_p{} (Phone number)
sdp_c() = #megaco_sdp_c{} (Connection information)
sdp_b() = #megaco_sdp_b{} (Bandwidth information)
sdp_k() = #megaco_sdp_k{} (Encryption key)
sdp_a() = #megaco_sdp_a{} (Session attribute)
sdp_a_rtpmap() = #megaco_sdp_rtpmap{}
sdp_a_ptime() = #megaco_sdp_a_ptime{}
sdp_a_quality() = #megaco_sdp_a_quality{}
sdp_a_fmtp() = #megaco_sdp_a_fmtp{}
sdp_z() = #megaco_sdp_z{} (Time zone adjustment)
sdp_t() = #megaco_sdp_t{} (Time the session is active)
sdp_r() = #megaco_sdp_r{} (Repeat times)
sdp_m() = #megaco_sdp_m{} (Media name and transport address)
sdp_property_group() = [sdp()]
sdp_property_groups() = [sdp_property_group()]
PP = property_parm() | property_group() | property_groups() | asn1_NOVALUE
property_group() = [property_parm()]
property_groups() = [property_group()]
Reason = term()
Encode (generate) an SDP construct.
If a property_parm()
is found as part of the input
(SDP
) then it is left unchanged.
This function performs the following transformation:
decode_sdp(PP) -> {ok, SDP} | {error, Reason}
Types:
PP = property_parm() | property_group() | property_groups() | asn1_NOVALUE
property_group() = [property_parm()]
property_groups() = [property_group()]
SDP = sdp() | {property_parm(), DecodeError} | sdp_property_group() | {sdp_property_groups(), BadPPs} | asn1_NOVALUE
sdp() = sdp_c() | sdp_o() | sdp_s() | sdo_i() | sdo_u() | sdo_e() | sdo_p() | sdo_c() | sdo_b() | sdo_z() | sdo_k() | sdo_a() | sdo_a_rtpmap() | sdo_a_ptime() | sdo_t() | sdo_r() | sdo_m()
sdp_v() = #megaco_sdp_v{} (Protocol version)
sdp_o() = #megaco_sdp_o{} (Owner/creator and session indentifier)
sdp_s() = #megaco_sdp_s{} (Session name)
sdp_i() = #megaco_sdp_i{} (Session information)
sdp_u() = #megaco_sdp_u{} (URI of description)
sdp_e() = #megaco_sdp_e{} (Email address)
sdp_p() = #megaco_sdp_p{} (Phone number)
sdp_c() = #megaco_sdp_c{} (Connection information)
sdp_b() = #megaco_sdp_b{} (Bandwidth information)
sdp_k() = #megaco_sdp_k{} (Encryption key)
sdp_a() = #megaco_sdp_a{} (Session attribute)
sdp_a_rtpmap() = #megaco_sdp_rtpmap{}
sdp_a_ptime() = #megaco_sdp_a_ptime{}
sdp_a_quality() = #megaco_sdp_a_quality{}
sdp_a_fmtp() = #megaco_sdp_a_fmtp{}
sdp_z() = #megaco_sdp_z{} (Time zone adjustment)
sdp_t() = #megaco_sdp_t{} (Time the session is active)
sdp_r() = #megaco_sdp_r{} (Repeat times)
sdp_m() = #megaco_sdp_m{} (Media name and transport address)
sdp_property_group() = [sdp()]
sdp_property_groups() = [sdp_property_group()]
DecodeError = term()
Reason = term()
Decode (parse) a property parameter construct.
When decoding property_group()
or property_groups()
,
those property parameter constructs that cannot be decoded
(either because of decode error or because they are unknown),
will be returned as a two-tuple. The first element of which
will be the (ndecoded) property parameter and the other the
actual reason.
This means that the caller of this function has to expect not
only sdp-records, but also this two-tuple construct.
This function performs the following transformation:
versions1() -> {ok, VersionInfo} | {error, Reason}
versions2() -> {ok, Info} | {error, Reason}
Types:
VersionInfo = [version_info()]
version_info() = term()
Reason = term()
Utility functions used to retreive some system and application info.
The difference between the two functions is in how they get
the modules to check. versions1
uses the app-file and
versions2
uses the function application:get_key
.
print_version_info() -> void()
print_version_info(VersionInfo) -> void()
Types:
VersionInfo = [version_info()]
version_info() = term()
Utility function to produce a formated printout of the versions
info generated by the versions1
and versions2
functions.
The function print_version_info/0 uses the result of function
version1/0 as VersionInfo
.
Example:
{ok, V} = megaco:versions1(), megaco:format_versions(V).
enable_trace(Level, Destination) -> void()
Types:
Level = max | min | 0 <= integer() <= 100
Destination = File | Port | HandlerSpec | io
File = string()
Port = integer()
HandleSpec = {HandlerFun, Data}
HandleFun = fun() (two arguments)
Data = term()
This function is used to start megaco tracing at a given
Level
and direct result to the given Destination
.
It starts a tracer server and then sets the proper match spec
(according to Level
).
In the case when Destination
is File
, the printable
megaco trace events will be printed to the file File
using
plain io:format/2
.
In the case when Destination
is io
, the printable
megaco trace events will be printed on stdout using plain
io:format/2
.
Types:
Level = max | min | 0 <= integer() <= 100
This function is used to change the megaco trace level.
It is assumed that tracing has already been enabled (see
enable_trace
above).
get_stats() -> {ok, TotalStats} | {error, Reason}
get_stats(GlobalCounter) -> {ok, CounterStats} | {error, Reason}
get_stats(CallHandle) -> {ok, CallHandleStats} | {error, Reason}
get_stats(CallHandle, Counter) -> {ok, integer()} | {error, Reason}
Types:
TotalStats = [total_stats()]
total_stats() = {call_handle(), [stats()]} | {global_counter(), integer()}
GlobalCounter = global_counter()
GlobalCounterStats = integer()
CallHandle = call_handle()
CallHandleStats = [stats()]
stats() = {counter(), integer()}
Counter = counter()
counter() = medGwyGatewayNumTimerRecovery |
medGwyGatewayNumErrors
global_counter() = medGwyGatewayNumErrors
Reason = term()
Retreive the (SNMP) statistic counters. The global counters handle events that cannot be attributed to a single connection (e.g. protocol errors that occur before the connection has been properly setup).
reset_stats() -> void()
reset_stats(SendHandle) -> void()
Types:
SendHandle = send_handle()
test_request(ConnHandle, Version, EncodingMod, EncodingConfig, Actions) -> {MegaMsg, EncodeRes}
Types:
ConnHandle = conn_handle()
Version = integer()
EncodingMod = atom()
EncodingConfig = Encoding configuration
Actions = A list
MegaMsg = #'MegacoMessage'{}
EncodeRes = {ok, Bin} | {error, Reason}
Bin = binary()
Reason = term()
Tests if the Actions argument is correctly composed.
This function is only intended for testing purposes. It's
supposed to have a same kind of interface as the call or cast functions (with the additions
of the EncodingMod
and EncodingConfig
arguments). It composes a complete megaco message end
attempts to encode it. The return value, will be a tuple of
the composed megaco message and the encode result.
test_reply(ConnHandle, Version, EncodingMod, EncodingConfig, Reply) -> {MegaMsg, EncodeRes}
Types:
ConnHandle = conn_handle()
Version = integer()
EncodingMod = atom()
EncodingConfig = A list
Reply = actual_reply()
MegaMsg = #'MegacoMessage'{}
EncodeRes = {ok, Bin} | {error, Reason}
Bin = binary()
Reason = term()
Tests if the Reply argument is correctly composed.
This function is only intended for testing purposes. It's
supposed to test the actual_reply()
return value of
the callback functions
handle_trans_request
and
handle_trans_long_request
functions (with the additions of the EncodingMod
and
EncodingConfig
arguments). It composes a complete
megaco message end attempts to encode it. The return value,
will be a tuple of the composed megaco message and the
encode result.