Dialogic And Erlang

Vance Shipley vances@REDACTED
Fri Sep 26 03:38:00 CEST 2003


Of the many ways to interface Erlang to foreign language programs
the two main ones are linked in drivers and erl_interface.  

For your case you can probably forget about the linked in driver.
For a linked in driver you have to fully cooperate with the Erlang
run time system for event handling.  Dialogic does not provide a
normal device handling mechanism (select/poll) and does not expose
real file handles.  I'm sure it would be possible to build a layer
which would wedge it in there but since it doesn;t fit the paradigm
just don't do it.

The erl_interface library provides a framework for creating "C-Nodes"
which are C language programs which implement enough of the Erlang 
external distribution protocol to appear as (hidden) nodes in a
distributed Erlang system.  With this method you have a very clean 
seperation between the Erlang system and the Dialogic C language 
environment.  They are in fact seperate OS processes communicating 
using interprocess communication (TCP/IP) and so can also be on
seperate machines altogether.  

[Editorial note:  you might want to consider the use of seperate OSes
 for these two seperate functions.  If you are tied to Windows because
 of the availability of the device drivers for your hardware you may 
 use Windows as the OS for the machine containing the cards and the 
 device drivers while utilizing Linux/FreeBSD/? for the machine running
 the Erlang node where you will develop your applications.  On the 
 other hand if you are tied to Windows for the application side you
 could employ Linux for the machine containing devices for improved
 reliability and performance.  However remember that it is not 
 neccesary to put these in seperate machines.]
                  
The erl_interface application contains two seperate libraries; ei &
erl_interface.  The latter is deprecated in favour of ei.  ei provides
you with the functions you will need to decode incoming messages from
the Erlang node(s) and to encode messages to the Erlang node(s).  You
can create an interface which attempts to recreate the Dialogic API
on the Erlanng node or you can implement the lowest level of handling
in C and communicate higher level application data to Erlang.  For
example when an event occurs on a device the your program code take
some action (i.e. stop playing a voice file), gather some data (run
ATDX_TERMMSK()) and send a simple message to Erlang with just the 
info your application requires.  This is often quicker to implement
than building the encoding/decoding for all the functions/parameters 
knowing you'll never use them all.  On the other hand you will often
make the mistake of implementing in C what you should have done in 
Erlang simply because you're more familiar with C in which case you
will miss out on the productivity gains you can realize working in 
Erlang.

Good luck,

	-Vance 

[who has written several Dialogic drivers for Erlang]



More information about the erlang-questions mailing list