Modules

Module index




Module: cti.lsp

Author: Dmitry Chernyak
Version: 1.1

The Computer Telephony Integration (CTI) protocol simple client

Location: http://en.feautec.pp.ru/store/libs/cti.lsp

The Computer Telephony Integration (CTI) protocol simple client

This library is a hack, compatible to Samsung iDCS 500

example:
 (load "cti.lsp")
 (set 'socket (net-connect "ats.myoffice.com" 5002))
 (net-send socket CTI:session-init)
 (while true
   (if (= 0 (net-peek socket)) (sleep 100))
   (unless msglen (set 'msglen (CTI:get-message-len-s socket)))
   (if (and msglen (set 'buf (CTI:get-message-s socket msglen)))
     (begin
       (set 'msglen nil)
       (set 'lst (map char (explode buf)))
       (println lst)                      ; print out raw protocol data
       (if (= (first lst) 68)             ; detect incoming call
         (println (CTI:decode-D lst)))))) ; print out incoming call

- § -

CTI:get-message-len-s

syntax: (CTI:get-message-len-s socket)

Receive message length header from socket, non-blocking

parameter: socket - soket

return: int length or nil

- § -

CTI:get-message-s

syntax: (CTI:get-message-s socket len)

Rceive message off length len from socket, non-blocking

parameter: socket - soket
parameter: len - message length from string message or nil

- § -

CTI:msg2string

syntax: (CTI:msg2string msg)

Transform CTI message's part to a valid string

parameter: msg - the slice of of (map char (explode buf))
where buf is a result of CTI:get-message-s

In fact this is doesn't needed because all the message parts have a counted format.
But I don't have the docs now.

- § -

CTI:decode-D

syntax: (CTI:decode-D lst)

Extract incoming call info from lst data

return: (from to ext-from ext-to)

- § -

CTI:decode-T

syntax: (CTI:decode-T lst)

Extract call transfer info from lst data

return: (from ext dst ext-from)

- § -

CTI:format-phone

syntax: (CTI:format-phone str)

Format phone string as "X XXX XXX-XXXX"

The length of the str must be at least 7 signs

return: formated phone string

- § -

CTI:format-call

syntax: (CTI:format-call call get-addrbook)

Format call string

parameter: call - the result of decode-D
all list elements are strings

parameter: get-addrbook - function to convert phone number string to an owner name

return: string call representation

- § -

CTI:format-transfer

syntax: (CTI:format-transfer call get-addrbook)

Format call string

parameter: call - the result of decode-T
all list elements are strings

parameter: get-addrbook - function to convert phone number string to an owner name

return: string call representation

- ∂ -

generated with newLISP  and newLISPdoc