Move freeswitch logic into its own controller
This commit is contained in:
parent
7c71009a46
commit
c992d1b080
11
app.moon
11
app.moon
|
@ -9,17 +9,8 @@ require "models.user"
|
|||
|
||||
class App extends lapis.Application
|
||||
@include "controllers.users"
|
||||
@include "controllers.freeswitch"
|
||||
|
||||
[index: "/"]: =>
|
||||
@user = @session.user
|
||||
render: true
|
||||
|
||||
[freeswitch: "/freeswitch"]: respond_to {
|
||||
POST: =>
|
||||
uid = @params["user"] or @params["sip_auth_username"]
|
||||
@user = Users\find extension: uid
|
||||
if not @user
|
||||
return status: 404, "no such user"
|
||||
|
||||
render: true, layout: false
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
lapis = require "lapis"
|
||||
|
||||
import respond_to from require "lapis.application"
|
||||
|
||||
require "models.user"
|
||||
|
||||
class Freeswitch extends lapis.Application
|
||||
[freeswitch: "/freeswitch"]: respond_to {
|
||||
POST: =>
|
||||
uid = @params["user"] or @params["sip_auth_username"]
|
||||
@user = Users\find extension: uid
|
||||
if not @user
|
||||
return status: 404, "no such user"
|
||||
|
||||
render: true, layout: false
|
||||
}
|
Loading…
Reference in New Issue