mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
This set of changes fixes problems with the handling of iax2_user and iax2_peer objects. It was very possible for a thread to still hold a reference to one of these objects while a reload operation tries to delete them. The fix here is to ensure that all references to these objects are tracked so that they can't go away while still in use. To accomplish this, I used the astobj2 reference counted object model. This code has been in one of Luigi Rizzo's branches for a long time and was primarily developed by one of his students, Marta Carbone. I wanted to go ahead and bring this in to 1.4 because there are other problems similar to the ones fixed by these changes, so we might as well go ahead and use the new astobj if we're going to go through all of the work necessary to fix the problems. As a nice side benefit of these changes, peer and user handling got more efficient. Using astobj2 lets us not hold the container lock for peers or users nearly as long while iterating. Also, by changing a define at the top of chan_iax2.c, the objects will be distributed in a hash table, drastically increasing lookup speed in these containers, which will have a very big impact on systems that have a large number of users or peers. The use of the hash table will be made the default in trunk. It is not the default in 1.4 because it changes the behavior slightly. Previously, since peers and users were stored in memory in the same order they were specified in the configuration file, you could influence peer and user matching order based on the order they are specified in the configuration. The hash table does not guarantee any order in the container, so this behavior will be going away. It just means that you have to be a little more careful ensuring that peers and users are matched explicitly and not forcing chan_iax2 to have to guess which user is the right one based on secret, host, and access list settings, instead of simply using the username. If you have any questions, feel free to ask on the asterisk-dev list. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80362 65c4cc65-6c06-0410-ace0-fbb531ad65f3
68 lines
2.8 KiB
Plaintext
68 lines
2.8 KiB
Plaintext
Inter-Asterisk eXchange Protocol
|
|
================================
|
|
|
|
Usage:
|
|
======
|
|
The format for the dialing string on Asterisk is:
|
|
IAX/[user@]peer[:exten[@context]]
|
|
|
|
(Note, []'s denote optional fields). The peer is either an IP address
|
|
or a peer as specified in the /etc/asterisk/iax.conf file. Exten is
|
|
an optional requested extension (otherwise "s" will be used), and
|
|
"context" is an optional context to request. The user is an optional
|
|
username specified in the peer's iax.conf. If the user is not specified,
|
|
the peer will select one.
|
|
|
|
The peer uses a score to determine the best user entry to match against if
|
|
one is not specified:
|
|
|
|
1. User entry with secret and no ACL specified.
|
|
2. User entry with secret specified and ACL specified.
|
|
3. User entry with no secret specified and no ACL specified.
|
|
4. User entry with no secret specified and ACL specified.
|
|
5. User entry matched via username.
|
|
|
|
The higher the score the better it is with 5 being an exact match and the maximum
|
|
score possible.
|
|
|
|
Protocol and rationale:
|
|
=======================
|
|
IAX is a simple, low overhead and low bandwidth VoIP protocol designed to
|
|
allow multiple Asterisk PBX's to communicate with one another without
|
|
the overhead of more complex protocols like H.323. Payload is sent with
|
|
a header overhead of only 4 octets. Control functions (and one payload packet
|
|
per minute or so) is sent with a more complex header of 12 octets.
|
|
|
|
IAX is slightly stateful.
|
|
|
|
IAX contains two kinds of packets: The full header packet type, which
|
|
contains much information about the frame, in addition to its contents,
|
|
and the mini header type, which is used only for non-reliable voice
|
|
packet delivery.
|
|
|
|
All packets are immediately transmitted. Packets are received, but not
|
|
delivered to the actual channels until a given time quantum has passed, in
|
|
order to try to eliminate jitter.
|
|
|
|
All full header packets must be ackd (except, obviously for the ACK packets
|
|
themselves and not so obviously for hangup packets). The "timestamp" field of
|
|
ack packets is not the normal offset, but rather a quote of the timestamp as
|
|
included with the original packet that you're acking, and likewise the
|
|
seqno field is the seqno of the packet you're acking, not your own seqno,
|
|
and you do not increment your own sequence number. ACKing is based on the
|
|
sequence number.
|
|
|
|
See iax.h for a description of the frame formats.
|
|
|
|
IAX internal frames use the AST_FRAME_IAX type. The subclass of these
|
|
frames is the IAX control number, as seen in iax.h. The first frame sent
|
|
must be an AST_FRAME_IAX with the control AST_IAX_CONTROL_NEW.
|
|
|
|
The AST_IAX_CONTROL_NEW establishes a new connection.
|
|
|
|
The first frame sent MUST be an AST_CONTROL_NEW to start a connection.
|
|
|
|
IAX connnections may require authentication using either simple plaintext
|
|
passwords or an md5 challenge/response pair.
|
|
|