[Asterisk-Dev] Architecture for CTI

Jonathan Tew jonathan at ultracart.com
Tue Dec 9 21:41:09 MST 2003


I've been investigating the possibility of building CTI functionality in 
to Asterisk for call center environments.   Using the manager interface 
it's possible to listen to call events for all the calls.  So I could 
write a CTI server that connected to * over the manager interface and 
listened to the call events.  The clients would then connect to the 
server and identify themselves (as SIP/myname for instance).  So it 
would be fairly easy for the CTI server to route the appropriate events 
to the client that is concerned with them.

So now is where call variables come in to the mix.  As I see it, 
Asterisk already supports channel variables that can be set via AGI 
commands, etc.  So with the addition of some code at the bottom of 
pbx_builtin_setvar_helper we could generate more manager events that 
could be used by the CTI server.  My sample code would be:

        if (value) {
                manager_event(EVENT_FLAG_CALL, "SetVariable",
                        "Channel: %s\r\n"
                        "Uniqueid: %s\r\n"
                        "Value: %s\r\n",
                        chan->name, chan->uniqueid, name, value);
                manager_event(EVENT_FLAG_CALL, "RemoveVariable",
                        "Channel: %s\r\n"
                        "Uniqueid: %s\r\n"
                        "Name: %s\r\n",
                        chan->name, chan->uniqueid, name);

So now the CTI server would know about the variables associated with the 
inbound channel.  Presumably you would set these variables in an AGI 
application (that authenticated their account or something). 

Here is the part I'm not sure of.  When a call is delivered to an agent 
that's in a queue there are really three channels involved.  For the 
sake of an example:
Zap/1-1 (Inbound Call)
Agent/1002 (Agent Channel representing my slot in the queue)
Sip/jtew (My SIP connection)

The channel variables that would be set by the AGI application would be 
attached to Zap/1-1.  Would there be an elegant way to propagate the 
variables across the other two channels (generating events through the 
manager interface) so that the CTI server would know that Sip/jtew has a 
call with a set of variables associate with it?  If there was then it 
would be possible to write an application that talked to the CTI server 
and from the information about it's own channels it could do screen 
pops, etc.

I would really appreciate anyones thoughts on this subject.  Especially 
those that are working on the agent queueing, etc.

Jonathan Tew

More information about the asterisk-dev mailing list