Cljain 0.6.0-Alpha1 API documentation

Enjoy JAIN-SIP in Clojure's way.

cljain.dum

Here is a simplest example show how to use it:

  (use 'cljain.dum)
  (require '[cljain.sip.core :as sip]
           '[cljain.sip.address :as addr])

  (defmethod handle-request :MESSAGE [request transaction _]
    (println "Received: " (.getContent request))
    (send-response! 200 :in transaction :pack "I receive the message from myself."))

  (global-set-account {:user "bob" :domain "localhost" :display-name "Bob" :password "thepwd"})
  (sip/global-bind-sip-provider! (sip/sip-provider! "my-app" "localhost" 5060 "udp"))
  (sip/set-listener! (dum-listener))
  (sip/start!)

  (send-request! :MESSAGE :to (addr/address "sip:bob@localhost") :pack "Hello, Bob."
                 :on-success (fn [& {:keys [response]}]
                               (println "Fine! response: " (.getContent response)))
                 :on-failure (fn [& {:keys [response]}]
                               (println "Oops!" (.getStatusCode response)))
                 :on-timeout (fn [& _]
                               (println "Timeout, try it later.")))

Remember, if you want to send REGISTER request, prefer to use the 'register-to!' function, it will
help you to deal the automatic rigister refresh:

  (register-to! (addr/address "sip:the-registry") 3600
                :on-success (fn [response]
                              (prn "Register success."))
                :on-failure (fn [response]
                              (prn "Register failed."))
                :on-refreshed (fn [response]
                                (prn "Refreshed fine."))
                :on-refresh-failed (fn [response]
                                     (prn "Refresh failed.")))

This version cljain.dum has some limitation that if you want auto-refresh work correctly, you must use
'global-set-account' to give a root binding with *current-account* like previous.

cljain.sip.address

Public variables and functions:

cljain.sip.core

cljain.sip.header

cljain.sip.message

Public variables and functions: