From 1d895ace660869053830ed33302e0708efb6065e Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 10 Oct 2011 19:34:59 +0000 Subject: Added in configuration files / scripts and cgi-bin scripts. --- config/notify_device | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 config/notify_device (limited to 'config/notify_device') diff --git a/config/notify_device b/config/notify_device new file mode 100755 index 0000000..7d5ff2a --- /dev/null +++ b/config/notify_device @@ -0,0 +1,30 @@ +#!/usr/bin/lua +require("socket") +require("validator") + +if not arg or #arg == 0 then + print("Error - IP Address must be specified") + return 1 +end + +local address = arg[1] +local user = arg[2] or "" +if not validator.is_ipv4(address) then + print("Error - Invalid IP Address") + return 1 +end + +local msg = "NOTIFY sip:"..user.."@"..address..":5060 SIP/2.0\n".. +"Via: SIP/2.0/UDP 127.0.0.1\n".. +"From: \n".. +"To: \n".. +"Event: check-sync\n".. +"Date: "..os.date().."\n".. +"Call-ID: "..os.time().."msgto0@"..address.."\n".. +"CSeq: 102 NOTIFY\n".. +"Contact: \n".. +"Content-Length: 0\n\n" + +local s = assert(socket.udp()) +assert(s:sendto(msg, address, 5060)) +s:close() -- cgit v1.2.3