Skip to content
This repository was archived by the owner on Nov 15, 2018. It is now read-only.

Commit 113531f

Browse files
committed
adding day queries, sorting, state, setting root via environment variable
1 parent 470d056 commit 113531f

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

Dockerfile

+6-5
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@ RUN ./configure -C
3030
RUN make && make install
3131
#RUN make cd-sounds-install && make cd-moh-install
3232
# need external DNS for resolving host names for BMLTs
33-
COPY conf/ /usr/local/freeswitch/conf/
34-
COPY scripts/ /usr/local/freeswitch/scripts
33+
3534

3635
RUN touch /usr/local/freeswitch/log/freeswitch.log \
3736
&& echo "export TERM=xterm" >> /root/.bashrc \
38-
&& echo "export PATH=$PATH:/usr/local/freeswitch/bin" >> /root/.bashrc
39-
40-
RUN apt-get install nano
37+
&& echo "export PATH=$PATH:/usr/local/freeswitch/bin" >> /root/.bashrc \
38+
&& apt-get install nano
4139

4240
EXPOSE 5060/tcp
4341
EXPOSE 5060/udp
@@ -46,4 +44,7 @@ EXPOSE 5080/udp
4644
EXPOSE 8080/tcp
4745
EXPOSE 16400-16410/udp
4846

47+
COPY conf/ /usr/local/freeswitch/conf/
48+
COPY scripts/ /usr/local/freeswitch/scripts
49+
4950
ENTRYPOINT ["./entrypoint.sh"]

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ build:
66
debug:
77
docker run -it --name freeswitch \
88
--entrypoint=/bin/bash \
9+
-e BMLT_ROOT_SERVER="http://bmlt-aggregator.archsearch.org/eccbc87e4b5ce2fe28308fd9f2a7baf3/bmltfed/main_server" \
910
-p 5060:5060/tcp \
1011
-p 5060:5060/udp \
1112
-p 5080:5080/tcp \

scripts/bmltvox.lua

+8-4
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ while (session:ready() == true) do
2222
lat = postcode_lookup_data["results"][1]["geometry"]["location"]["lat"]
2323
lng = postcode_lookup_data["results"][1]["geometry"]["location"]["lng"]
2424

25-
session:speak("Searching meeting information for " .. location);
25+
local daysoftheweek={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}
26+
local day=daysoftheweek[os.date("*t").wday]
2627

27-
raw_data = api:execute("curl", "http://bmlt.ncregion-na.org/main_server/client_interface/json/index.php?switcher=GetSearchResults&sort_keys=weekday_tinyint,start_time&bmlt_settings_id=1459228577&long_val=" .. lng .. "&lat_val=" .. lat .. "&geo_width=-10&search_form=1&script_name=%2Findex.php&satellite=%2Findex.php&supports_ajax=yes&no_ajax_check=yes");
28+
session:speak("Searching meeting information for " .. day .. " in " .. location);
29+
30+
-- The root server should be selected by DNIS
31+
raw_data = api:execute("curl", os.getenv("BMLT_ROOT_SERVER") .. "/client_interface/json/index.php?switcher=GetSearchResults&sort_key=distance_in_miles,start_time&long_val=" .. lng .. "&lat_val=" .. lat .. "&geo_width=-10&weekdays[]=" .. os.date("*t").wday);
2832

2933
if raw_data ~= "" then
3034
bmlt_data = JSON:decode(raw_data);
@@ -37,7 +41,7 @@ while (session:ready() == true) do
3741
result = bmlt_data[i];
3842
session:speak("result number " .. i);
3943
session:speak(result["meeting_name"]);
40-
session:speak("starts at " .. result["start_time"]);
41-
session:speak("meets at " .. result["location_street"] .. " in " .. result["location_municipality"]);
44+
session:speak("starts at " .. result["start_time"] .. " hours.");
45+
session:speak("meets at " .. result["location_street"] .. " in " .. result["location_municipality"] .. ", " .. result["location_province"]);
4246
end
4347
end

0 commit comments

Comments
 (0)