Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root@work:/usr/local/kamailio/etc/kamailio# cat ./routing.lua
- function sleep(n)
- if n > 0 then
- os.execute("/bin/ping -i 1 -c " .. (tonumber(n) + 1) .. " localhost > /dev/null")
- end
- end
- function route_request(name)
- local method = sr.pv.get("$rm")
- if method == "INVITE" then
- sr.sl.send_reply("100", "Trying...")
- sleep(5)
- sr.hdr.append_to_reply("Contact: <sip:1111@1.1.1.1>;q=1\n")
- sr.tm.t_newtran()
- sr.tm.t_reply("302", "Redirect")
- elseif method == "CANCEL" then
- print("Got cancel")
- elseif method == "ACK" then
- sr.tm.t_newtran()
- end
- end
- root@work:/usr/local/kamailio/etc/kamailio#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement