Interface module for the Megaco application
= 0 | megaco_incr_timer()
megaco_incr_timer() = #megaco_incr_timer{}
]]>
The record
The actual timer time.
The factor when calculating the new timer time
(
The increment value when calculating the new timer time
(
The maximum number of repetitions of the timer.
There is a special case for this field. When the
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.
Stops the Megaco application
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.
Delete the configuration of a user
Requires that the user does not have any active connection.
Lookup user information
The following Item's are valid:
Lists all active connections for this user. Returns a list of megaco_conn_handle records.
Construct a megaco_receive_handle record from user config
Current transaction id.
A positive integer or the atom
First trans id.
A positive integer, defaults to 1.
Last trans id.
A positive integer or
Wait for reply.
The timer is cancelled when a reply is received.
When a pending message is received, the timer is
cancelled and the
When the timer reaches an intermediate expire, the request is resent and the timer is restarted.
When the timer reaches the final expire, either the function
A Megaco Timer (see explanation above),
defaults to
Wait for reply after having received a pending message.
When the timer reaches an intermediate expire, the timer is restarted.
When a pending message is received, and the
A Megaco Timer (see explanation above),
defaults to
This option indicates weather the request should be resent until the reply is received, even though a pending message has been received.
Normally, after a pending message has been received, the request is not resent (since a pending message is an indication that the request has been received). But since the reply (to the request) can be lost, this behaviour has its values.
It is of course pointless to set this value to true
unless the
A
Wait for an ack.
When a request is received, some info related to the reply is store internally (e.g. the binary of the reply). This info will live until either an ack is received or this timer expires. For instance, if the same request is received again (e.g. a request with the same transaction id), the (stored) reply will be (re-) sent automatically by megaco.
If the timer is of type
A Megaco Timer (see explanation above), defaults to 30000.
Specifies the timeout time for the request-keep-alive timer.
This timer is started when the first reply to an asynchroneous
request (issued using the
Replies arriving after the timer has expired, will be
delivered using the
The timeout time can have the values:
Defaults to
Timeout time for the call proxy.
When a request is sent using the
The timeout time is in milliseconds. A value of 0 (zero) means that the proxy process will exit directly after the reply has been delivered.
An integer >= 0, defaults to 5000 (= 5 seconds).
Automatic send transaction ack when the transaction
reply has been received (see
This is used for three-way-handshake.
A
Shall ack's be accumulated or not.
This property is only valid if
If
See also
An
Maximum number of accumulated ack's. At most this many ack's will be accumulated by the transaction sender (if started and configured to accumulate ack's).
See also
An
Shall requests be accumulated or not.
If
If
See also
An
Maximum number of accumulated requests. At most this many requests will be accumulated by the transaction sender (if started and configured to accumulate requests).
See also
An
Maximum size of the accumulated requests. At most this much requests will be accumulated by the transaction sender (if started and configured to accumulate requests).
See also
An
Transaction sender timeout time. Has two functions. First, if
the value is 0, then transactions will not be accumulated
(e.g. the transaction sender process will not be started).
Second, if the value is greater then 0 and
See also
An
Automatically send pending if the timer expires before a transaction reply has been sent. This timer is also called provisional response timer.
A Megaco Timer (see explanation above), defaults to 30000.
Sent pending limit (see the MGOriginatedPendingLimit
and the MGCOriginatedPendingLimit of the megaco root package).
This parameter specifies how many pending messages that can
be sent (for a given received transaction request).
When the limit is exceeded, the transaction is aborted
(see
Note that this has no effect on the actual sending of pending transactions. This is either implicit (e.g. when receiving a re-sent transaction request for a request which is being processed) or controlled by the pending_timer, see above.
A positive integer or
Receive pending limit (see the MGOriginatedPendingLimit and the MGCOriginatedPendingLimit of the megaco root package). This parameter specifies how many pending messages that can be received (for a sent transaction request). When the limit is exceeded, the transaction is considered lost, and an error returned to the user (through the call-back function handle_trans_reply).
A positive integer or
Send callback module which exports send_message/2. The function SendMod:send_message(SendHandle, Binary) is invoked when the bytes needs to be transmitted to the remote user.
An
Encoding callback module which exports encode_message/2 and decode_message/2. The function EncodingMod:encode_message(EncodingConfig, MegacoMessage) is invoked whenever a 'MegacoMessage' record needs to be translated into an Erlang binary. The function EncodingMod:decode_message(EncodingConfig, Binary) is invoked whenever an Erlang binary needs to be translated into a 'MegacoMessage' record.
An
Encoding module config.
A
Actual protocol version.
An
Strict version control, i.e. when a message is received, verify that the version is that which was negotiated.
An
Default reply data.
Any term, defaults to the atom
Name of the user callback module. See the the reference manual for megaco_user for more info.
List of extra arguments to the user callback functions. See the the reference manual for megaco_user for more info.
If a received message contains several transaction requests,
this option indicates whether the requests should be handled
sequentially in the same process (
An
This option indicates weather the transport module should be told if a message send is a resend or not.
If false, megaco messages are sent using the
If true, megaco message re-sends are made using the
The special value flag instead indicates that the
function
A
This option specifies if the user shall be notified of received segment replies or not.
See
A
This timer is started when the segment indicated by the
When the timer finally expires, a "megaco segments not
received" (459) error message is sent to the other side
and the user is notified with a
A Megaco Timer (see explanation above),
defaults to
Shall outgoing messages be segmented or not:
Do not segment outgoing reply messages. This is usefull when either it is known that messages are never to large or that the transport protocol can handle such things on its own (e.g. TCP or SCTP).
Outgoing reply messages will be segmented as needed
(see
Outgoing reply messages will be segmented as needed
(see
Defaults to
Max message size. If the encoded message (PDU) exceeds this size, the message should be segmented, and then encoded.
A positive integer or
Update information about a user
Requires that the user is started. See megaco:user_info/2 about which items and values that are valid.
Lookup information about an active connection
Requires that the connection is active.
The process identifier of the controlling process for a connection.
Opaque send handle whose contents is internal for the send module. May be any term.
The local mid (of the connection, i.e. the own mid).
The remote mid (of the connection).
Construct a megaco_receive_handle record.
Next transaction id. A positive integer or the atom
Note that transaction id's are (currently) maintained on a per user basis so there is no way to be sure that the value returned will actually be used for a transaction sent on this connection (in case a user has several connections, which is not at all unlikely).
Last trans id.
A positive integer or
Wait for reply.
The timer is cancelled when a reply is received.
When a pending message is received, the timer is
cancelled and the
When the timer reaches an intermediate expire, the request is resent and the timer is restarted.
When the timer reaches the final expire, either the function
A Megaco Timer (see explanation above), defaults to #megaco_incr_timer{}.
Wait for reply after having received a pending message.
When the timer reaches an intermediate expire, the timer restarted.
When a pending message is received, and the
A Megaco Timer (see explanation above),
defaults to
Specifies the timeout time for the request-keep-alive timer.
This timer is started when the first reply to an asynchroneous
request (issued using the
Replies arriving after the timer has expired, will be
delivered using the
The timeout time can have the values:
Defaults to
This option indicates weather the request should be resent until the reply is received, even though a pending message has been received.
Normally, after a pending message has been received, the request is not resent (since a pending message is an indication that the request has been received). But since the reply (to the request) can be lost, this behaviour has its values.
It is of course pointless to set this value to true
unless the
A
Wait for an ack.
When a request is received, some info related to the reply is store internally (e.g. the binary of the reply). This info will live until either an ack is received or this timer expires. For instance, if the same request is received again (e.g. a request with the same transaction id), the (stored) reply will be (re-) sent automatically by megaco.
If the timer is of type
A Megaco Timer (see explanation above), defaults to 30000.
Timeout time for the call proxy.
When a request is sent using the
The timeout time is in milliseconds. A value of 0 (zero) means that the proxy process will exit directly after the reply has been delivered.
An integer >= 0, defaults to 5000 (= 5 seconds).
Automatic send transaction ack when the transaction
reply has been received (see
This is used for three-way-handshake.
A
Shall ack's be accumulated or not.
This property is only valid if
If
See also
An
Maximum number of accumulated ack's. At most this many ack's will be accumulated by the transaction sender (if started and configured to accumulate ack's).
See also
An integer, defaults to 10.
Shall requests be accumulated or not.
If
If
See also
An
Maximum number of accumulated requests. At most this many requests will be accumulated by the transaction sender (if started and configured to accumulate requests).
See also
An
Maximum size of the accumulated requests. At most this much requests will be accumulated by the transaction sender (if started and configured to accumulate requests).
See also
An
Transaction sender timeout time. Has two functions. First, if
the value is 0, then transactions will not be accumulated
(e.g. the transaction sender process will not be started).
Second, if the value is greater then 0 and
See also
An
Automatic send transaction pending if the timer expires before a transaction reply has been sent. This timer is also called provisional response timer.
A Megaco Timer (see explanation above), defaults to 30000.
Sent pending limit (see the MGOriginatedPendingLimit
and the MGCOriginatedPendingLimit of the megaco root package).
This parameter specifies how many pending messages that can
be sent (for a given received transaction request).
When the limit is exceeded, the transaction is aborted
(see
Note that this has no effect on the actual sending of pending transactions. This is either implicit (e.g. when receiving a re-sent transaction request for a request which is being processed) or controlled by the pending_timer, see above.
A positive integer or
Receive pending limit (see the MGOriginatedPendingLimit and the MGCOriginatedPendingLimit of the megaco root package). This parameter specifies how many pending messages that can be received (for a sent transaction request). When the limit is exceeded, the transaction is considered lost, and an error returned to the user (through the call-back function handle_trans_reply).
A positive integer or
Send callback module which exports send_message/2. The function SendMod:send_message(SendHandle, Binary) is invoked when the bytes needs to be transmitted to the remote user.
An
Encoding callback module which exports encode_message/2 and decode_message/2. The function EncodingMod:encode_message(EncodingConfig, MegacoMessage) is invoked whenever a 'MegacoMessage' record needs to be translated into an Erlang binary. The function EncodingMod:decode_message(EncodingConfig, Binary) is invoked whenever an Erlang binary needs to be translated into a 'MegacoMessage' record.
An
Encoding module config.
A
Actual protocol version.
An positive integer, Current default is 1.
Strict version control, i.e. when a message is received, verify that the version is that which was negotiated.
An
Default reply data.
Any term, defaults to the atom
If a received message contains several transaction requests,
this option indicates whether the requests should be handled
sequentially in the same process (
An
This option indicates weather the transport module should be told if a message send is a resend or not.
If false, megaco messages are sent using the
If true, megaco message re-sends are made using the
The special value flag instead indicates that the
function
A
This option specifies if the user shall be notified of received segment replies or not.
See
A
This timer is started when the segment indicated by the
When the timer finally expires, a "megaco segments not
received" (459) error message is sent to the other side
and the user is notified with a
A Megaco Timer (see explanation above),
defaults to
Shall outgoing messages be segmented or not:
Do not segment outgoing reply messages. This is usefull when either it is known that messages are never to large or that the transport protocol can handle such things on its own (e.g. TCP or SCTP).
Outgoing reply messages will be segmented as needed
(see
Outgoing reply messages will be segmented as needed
(see
Defaults to
Max message size. If the encoded message (PDU) exceeds this size, the message should be segmented, and then encoded.
A positive integer or
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.
Lookup system information
The following items are valid:
The text encoding config.
Lists all active connections. Returns a list of megaco_conn_handle records.
Lists all active users. Returns a list of megaco_mid()'s.
Returns an integer representing the number of requests that has originated from this Erlang node and still are active (and therefore consumes system resources).
Returns an integer representing the number of replies that has originated from this Erlang node and still are active (and therefore consumes system resources).
Returns an integer representing the number of active connections.
This function produces a list of information about the megaco application. Such as users and their config, connections and their config, statistics and so on.
This information can be produced by the functions
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 explicitly be deactivated by a local call to megaco:disconnect/2 or implicitly 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:
The MG may explicitly invoke megaco:connect/4 and use a provisioned MID of the MGC as the RemoteMid.
The MG may explicitly invoke megaco:connect/4 with the atom 'preliminary_mid' as a temporary MID of the MGC, send an intial message, the Service Change Request, to the MGC and then wait for an initial message, the Service Change Reply. When the reply arrives, the Megaco application will pick the MID of the MGC from the message header and automatically upgrade the connection to be a "normal" connection. By using this method of establishing the connection, the callback function UserMod:handle_connect/2 to be invoked twice. First with a ConnHandle with the remote_mid-field set to preliminary_mid, and then when the connection upgrade is done with the remote_mid-field set to the actual MID of the MGC.
When the MGC receives its first message, the Service Change Request, the Megaco application will automatically establish the connection by using the MG MID found in the message header as remote mid.
When a user (MG/MGC) is distributed over several nodes, it is required that the node hosting the connection already has activated the connection and that it is in the "normal" state. The RemoteMid must be a real Megaco MID and not a preliminary_mid.
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.
The connect is done in two steps: first an internal
An error with this reason is generated by the megaco application itself.
An error with this reason is caused by the user
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.
Sends one or more transaction request(s) and waits for the reply.
When sending one transaction in a message,
For some of our codecs (not binary), it is also possible
to pre-encode the actions, in which case
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
The
At
A
A
A
An
For more info about the
Sends one or more transaction request(s) but does NOT wait for a reply
When sending one transaction in a message,
For some of our codecs (not binary), it is also possible
to pre-encode the actions, in which case
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.
Given as UserData argument to UserMod:handle_trans_reply/4.
Encodes lists of action requests for one or more transaction request(s).
When encoding action requests for one transaction,
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 v3).
If no match is found for
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 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.
The argument
Note that all processing is done in the context of the calling
process. A transport module could call this function via one of the
If the message cannot be decoded the following callback function will be invoked:
UserMod:handle_syntax_error/3
If the decoded message instead of transactions contains a message error, the following callback function will be invoked:
UserMod:handle_message_error/3
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:
UserMod:handle_connect/2
For each transaction request in the decoded message the following callback function will be invoked:
UserMod:handle_trans_request/3
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:
UserMod:handle_trans_reply/4
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:
UserMod:handle_trans_ack/4
See the megaco_user module for more info about the callback arguments.
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
For further information see the
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.
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.
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
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 (generate) an SDP construct.
If a
This function performs the following transformation:
sdp() -> property_parm()
sdp_property_group() -> property_group()
sdp_property_groups() -> property_groups()
Decode (parse) a property parameter construct.
When decoding
This function performs the following transformation:
property_parm() -> sdp()
property_group() -> sdp_property_group()
property_groups() -> sdp_property_groups()
Retreive all the sdp records of type
Utility functions used to retrieve some system and application info.
The difference between the two functions is in how they get
the modules to check.
Utility function to produce a formated printout of the versions
info generated by the
The function print_version_info/0 uses the result of function
version1/0 as
Example:
{ok, V} = megaco:versions1(), megaco:format_versions(V).
This function is used to start megaco tracing at a given
It starts a tracer server and then sets the proper match spec
(according to
In the case when
In the case when
See
This function is used to stop megaco tracing.
This function is used to change the megaco trace level.
It is assumed that tracing has already been enabled (see
Retreive the (SNMP) statistic counters maintained by the megaco application. 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 all related (SNMP) statistics counters.
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
Tests if the Reply argument is correctly composed.
This function is only intended for testing purposes. It's
supposed to test the