Commits

Miki Tebeka committed 59a273c

Log and render voice correctly

Comments (0)

Files changed (1)

src/duderemember.clj

         hiccup.page-helpers
         ring.util.response
         ring.util.servlet)
-  (:require [compojure.route :as route]))
+  (:require [compojure.route :as route]
+            [clojure.contrib.logging :as log]))
 
 (defn digits-only [phone]
   (apply str (re-seq #"[0-9]+" phone)))
     (for [message messages]
       [:div {:class "message"}
        "Time: " (format-time (:time message)) [:br]
-       "Text:" [:br]
-       (:text message)])))
+       (if (nil? (:url message))
+         ["Text:" [:br] (:text message)]
+         [:a {:href (:url message)} "Play"])])))
 
 (defn format-phone [phone]
   (format "%s-%s-%s" (subs phone 0 3) (subs phone 3 6) (subs phone 6)))
   (subs phone 2))
 
 (defn twilio-sms [params]
+  (log/info (str "SMS: " params))
   (let [phone (normalize-phone (params "From"))
         text (params "Body")
         user (phone->user phone)]
                             "Check out http://dude-remember.appspot.com"]))))
 
 (defn twilio-voice [params]
+  (log/info (str "VOICE: " params))
   (let [phone (normalize-phone (params "From"))
         user (phone->user phone)]
     (if (nil? user)