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.core
Public variables and functions:
- *sip-provider*
- already-bound-provider?
- dialog?
- gen-call-id-header
- global-bind-sip-provider!
- global-unbind-sip-provider!
- listening-point
- new-client-transcation!
- new-dialog!
- new-server-transaction!
- provider-can-be-found?
- send-request!
- set-listener!
- sip-factory
- sip-provider
- sip-provider!
- sip-stack
- stack-name
- start!
- stop-and-release!
- transaction?
cljain.sip.header
Public variables and functions:
- accept
- accept-encoding
- accept-language
- alert-info
- allow
- allow-events
- authentication-info
- authorization
- call-id
- call-info
- contact
- content-disposition
- content-encoding
- content-language
- content-length
- content-type
- cseq
- date
- defheader
- error-info
- event
- expires
- extension
- from
- gen-branch
- gen-tag
- header?
- in-reply-to
- max-forwards
- mime-version
- min-expires
- organization
- priority
- proxy-authenticate
- proxy-authorization
- proxy-require
- r-ack
- r-seq
- reason
- record-route
- refer-to
- reply-to
- require
- retry-after
- route
- server
- sip-etag
- sip-if-match
- subject
- subscription-state
- supported
- time-stamp
- to
- unsupported
- user-agent
- via
- warning
- wildcard-contact
- www-authenticate
cljain.sip.message
Public variables and functions: