 (defn get-dups[] dups)
 
 (defn debug-call [ ext n e ]
-  (log/debug ext  n  (bean e))
+  (log/debug ext n (.getID e) (bean e))
 )
 (defn reify-call-control-connection-listener [ext handler-fn]
   (log/info "reify-call-control-connection-listener" ext handler-fn)

     (first (filter (fn[c] (= ext (.getName (.getAddress c))))
                    (.getConnections call)))
  )
(defmulti transform-event (fn[event ext] (.getClass event)))

(defmethod transform-event javax.telephony.events.TermConnActiveEv [event ext]
  (log/info "transform-event" "TermConnActiveEv" ext)
  (let [ call (.getCall event )
        callers (get-callers-from-provider call)
         ]
    (log/info "transform-event!" "TermConnActiveEv" "callers" callers)
    (swap! jtapi-provider assoc-in [:calls ext ] call)
    {:operation "call" :ext ext :body {:cause (.getCause event) :meta-code (.getMetaCode event) :callers callers}}
    ))


(defmethod transform-event javax.telephony.events.TermConnDroppedEv [event ext]
        (swap! jtapi-provider assoc-in [:calls ext] nil)
        {:operation "hangup" :ext ext :body {:cause (.getCause event) :meta-code (.getMetaCode event)}}
)
(defmethod transform-event :default [event ext]
  (log/warn "transform-event" "default" ext event)
  )

(defn call-listener-handler [ ext callback-fn event]

  (log/info "reify-terminal-conn-listener" ext handler-fn)
    (reify
          TerminalConnectionListener
            (terminalConnectionActive [ this e ](  debug-call ext "terminalConnectionActive" e) (handler-fn e))
    		(terminalConnectionCreated [ this e ]( debug-call ext "terminalConnectionCreated" e))
    		(terminalConnectionDropped [ this e ]( debug-call ext "terminalConnectionDropped" e) (handler-fn e))
    		(terminalConnectionPassive [ this e ]( debug-call ext "terminalConnectionPassive" e))
    		(terminalConnectionRinging [ this e ]( debug-call ext "terminalConnectionRinging" e))
    		(terminalConnectionUnknown [ this e ]( debug-call ext "terminalConnectionUnknown" e))
    		(connectionConnected [ this e ](debug-call ext "connectionConnected" e))
    		(connectionCreated [ this e ]( debug-call ext "connectionCreated" e) )
    		(connectionDisconnected [ this e ]( debug-call ext "connectionDisconnected" e) (handler-fn e))
    		(connectionInProgress [ this e ]( debug-call ext "connectionInProgress" e) )
    		(connectionUnknown [ this e ]( debug-call ext "connectionUnknown" e) (handler-fn e))
    		(connectionFailed [ this e ]( debug-call ext "connectionFailed" e) (handler-fn e))
    		(connectionAlerting [ this e ]( debug-call ext "connectionAlerting" e))
    		(callInvalid [ this e ]( debug-call ext "callInvalid" e) (handler-fn e))
    		(callEventTransmissionEnded [ this e ]  (handler-fn e))
    		(singleCallMetaProgressStarted [ this e ]( debug-call ext "singleCallMetaProgressStarted" e))
    		(singleCallMetaProgressEnded [ this e ]( debug-call ext "singleCallMetaProgressEnded" e))
    		(singleCallMetaSnapshotStarted [ this e ]( debug-call ext "singleCallMetaSnapshotStarted" e))
    		(singleCallMetaSnapshotEnded [ this e ]( debug-call ext "singleCallMetaSnapshotEnded" e))
    		(multiCallMetaMergeStarted [ this e ]( debug-call ext "multiCallMetaMergeStarted" e))
    		(multiCallMetaMergeEnded [ this e ]( debug-call ext "multiCallMetaMergeEnded" e))
    		(multiCallMetaTransferStarted [ this e ]( debug-call ext "multiCallMetaTransferStarted" e))
    		(multiCallMetaTransferEnded [ this e ]( debug-call ext "multiCallMetaTransferEnded" e))
    		(callActive [ this e ]( debug-call ext "callActive" e) (handler-fn e))
    ))

(defn- get-addresses [provider]
