Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
63 lines (54 sloc) 2.86 KB
(ns ^{:doc "place doc string here"
:author "ruiyun"}
(:require [cljain.sip.core :as core]
[cljain.sip.header :as header]
[cljain.sip.address :as addr]
[cljain.sip.dialog :as dlg]
[cljain.sip.message :as msg]
[cljain.sip.transaction :as trans]
[cljain.dum :as dum]))
(org.apache.log4j.PropertyConfigurator/configure "")
;(core/global-bind-sip-provider! (core/sip-provider! "test" "" 5060 "udp"))
;(dum/initialize! :user "reuiyun" :domain "notbook" :display-name "Ruiyun Wen")
;(def bob (cljain.sip.address/address (cljain.sip.address/sip-uri "" :port 5070 :user "bob") "Bob henry"))
;(cljain.dum/send-request! :INVITE :to bob :pack {:type :application :sub-type :sdp :content "Welcome message"}
; :on-success (fn [a b c] (prn "success!" (dlg/send-ack! b (dlg/ack b 1))))
; :on-failure (fn [a b c] (prn "faliure!" a))
; :on-timeout (fn [a] (prn "tiemout" a)))
;(dum/register-to (addr/address (addr/sip-uri "" :port 5070)) 40
; :on-success #(prn "register-to has success!")
; :on-failure #(prn "register-to has failed!")
; :on-refreshed #(prn "register refresh has success!")
; :on-refresh-failed #(prn "register refresh has failed!"))
;(use 'cljain.dum)
;(require '[cljain.sip.core :as sip]
; '[cljain.sip.address :as addr])
;(def-request-handler :MESSAGE [request transaction dialog]
; (println "Received: " (.getContent request))
; (send-response! 200 :in transaction :pack "I receive your message."))
;(sip/global-bind-sip-provider! (sip/sip-provider! "my-app" "localhost" 5060 "udp"))
;(initialize! :user "bob" :domain "home" :display-name "Bob")
;(send-request! :MESSAGE :to (addr/address "sip:alice@localhost") :pack "Hello, Alice."
; :on-success (fn [_ _ response] (println "Fine! response: " (.getContent response)))
; :on-failure (fn [_ _ response] (println "Oops!" (.getStatusCode response)))
; :on-timeout (fn [_] (println "Timeout, try it later.")))
(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-alter-account :user "bob" :domain "localhost" :display-name "Bob")
(sip/global-bind-sip-provider! (sip/sip-provider! "my-app" "localhost" 5060 "udp"))
(sip/set-listener! (dum-listener))
(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.")))
Jump to Line
Something went wrong with that request. Please try again.