Difference between revisions of "Pluto-asterisk"

From LinuxMCE
Jump to: navigation, search
 
Line 2: Line 2:
 
[[Category:LinuxMCE_Devices]]
 
[[Category:LinuxMCE_Devices]]
 
== About the package ==
 
== About the package ==
The Asterisk is a LinuxMCE device witch controls (or better say tries to control) [[asterisk-LinuxMCE|asterisk]] server.
+
The Asterisk Device is a LinuxMCE device which controls (or better say tries to control) [[asterisk-LinuxMCE|asterisk]] server.
  
 
It gets and sends DCE commands and events on one side, and on the other it communicates with [[asterisk-LinuxMCE|asterisk]] via a socket (usually port 5038, for more connection details check ''/etc/asterisk/manager.conf'').
 
It gets and sends DCE commands and events on one side, and on the other it communicates with [[asterisk-LinuxMCE|asterisk]] via a socket (usually port 5038, for more connection details check ''/etc/asterisk/manager.conf'').
Line 11: Line 11:
 
When receiving a command Asterisk will create push into a queue the AMI command needed to be sent to asterisk (queue is needed because we have only 1 socket opened to asterisk manager) this is done in ''AsteriskManager'' class.
 
When receiving a command Asterisk will create push into a queue the AMI command needed to be sent to asterisk (queue is needed because we have only 1 socket opened to asterisk manager) this is done in ''AsteriskManager'' class.
  
There is another thread continuously listening to the socket, the main functionality is in ''RingDetectHandler'' class. It does much more than just detecting rings, it also detects hangups and all other events and then sends them to Telecom_Plugin as DCE events.
+
There is another thread continuously listening to the socket, the main functionality is in ''RingDetectHandler'' class. It does much more than just detecting rings, it also detects hangups and all other events and then sends them to [[Telecom_Plugin]] as DCE events.
  
 
There is a also small thread running once in about 1 min. checking for users voicemails.
 
There is a also small thread running once in about 1 min. checking for users voicemails.

Revision as of 14:16, 8 October 2007

About the package

The Asterisk Device is a LinuxMCE device which controls (or better say tries to control) asterisk server.

It gets and sends DCE commands and events on one side, and on the other it communicates with asterisk via a socket (usually port 5038, for more connection details check /etc/asterisk/manager.conf).

The protocol used in this communications is AMI [1], it allows us to send commands to asterisk (like dial, redirect, hangup) and receive events (like ring, dial, hangup, conference).

Design

When receiving a command Asterisk will create push into a queue the AMI command needed to be sent to asterisk (queue is needed because we have only 1 socket opened to asterisk manager) this is done in AsteriskManager class.

There is another thread continuously listening to the socket, the main functionality is in RingDetectHandler class. It does much more than just detecting rings, it also detects hangups and all other events and then sends them to Telecom_Plugin as DCE events.

There is a also small thread running once in about 1 min. checking for users voicemails.

map_ringext

Is a map which stores all active channels and how they are connected. Some of the data is stored more than once (like 2 different extensions 200 and 201 speaking to each other will have 2 entries in the map with practically same content), but this way it's easier to keep all data in one place and detect hangups of either of the channels.

Conferences are stored as special extensions having pattern C000X where X is 1,2..any number.

All manipulation of this map is done in RingDetectHandler::handleToken

Warning on 1.2.x

The RingDetectHandler::handleToken was written by inspecting the data sent by asterisk in different situations. No full documentation exists (well, you may read asterisk source code), so it may not handle all cases. Also it may be VERY sensitive on future upgrade to asterisk 1.2.x.