diff --git a/Makefile b/Makefile index 63c8b57f..5192425d 100644 --- a/Makefile +++ b/Makefile @@ -70,4 +70,10 @@ tar: .PHONY: doc doc: - make -C core/ doc \ No newline at end of file + make -C core/ doc + +.PHONY: install-ser-cfg +install-ser-cfg: + make -C core/ install-ser-cfg + + diff --git a/Makefile.defs b/Makefile.defs index 990296a9..4c202ef7 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -86,6 +86,9 @@ LOCALBASE ?= /usr/local prefix = $(PREFIX) BASEDIR ?= basedir = $(BASEDIR) +# for install-ser-cfg +SERPREFIX ?= /opt/ser-sems +ser-prefix = $(SERPREFIX) # Redhat users should use sems.redhat instead of sems # the file will be to $(bin-prefix)/$(bin-dir)/sems copied. @@ -105,6 +108,8 @@ bin-dir = sbin/ modules-dir = lib/sems/plug-in/ audio-dir = lib/sems/audio/ +ser-cfg-dir = etc/ser/ + ifeq ($(OS), linux) doc-dir = share/doc/sems/ man-dir = share/man/ @@ -132,6 +137,7 @@ bin-target = $(prefix)/$(bin-dir) cfg-target = $(prefix)/$(cfg-dir) modules-target = $(prefix)/$(modules-dir) audio-target = $(prefix)/$(audio-dir) +ser-cfg-target =$(ser-prefix)/$(ser-cfg-dir) ifeq ($(OS), solaris) #use GNU versions diff --git a/core/Makefile b/core/Makefile index 7bac28a7..fef13db3 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1,14 +1,6 @@ NAME=sems LIBNAME=sems.so -# version number -VERSION = 2 -PATCHLEVEL = 0 -SUBLEVEL = 1 -EXTRAVERSION = -iptelorg - -RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) - PLUGIN_DIR=plug-in SRCS=$(filter-out $(NAME).cpp, $(wildcard *.cpp)) HDRS=$(SRCS:.cpp=.h) @@ -84,6 +76,17 @@ install-modules: $(PLUGIN_DIR) $(modules-prefix)/$(modules-dir) install-modules-cfg: $(PLUGIN_DIR) $(modules-prefix)/$(modules-dir) $(MAKE) -C $(PLUGIN_DIR) install-cfg +install-ser-cfg: etc/ser-sems.cfg + mkdir -p $(ser-cfg-target) + + if [ ! -f $(ser-cfg-target)/ser-sems.cfg ]; then \ + $(INSTALL-CFG) etc/ser-sems.cfg $(ser-cfg-target) ; \ + fi + $(INSTALL-CFG) etc/ser-sems.cfg $(ser-cfg-target)ser-sems.cfg.default + @echo \*\*\* installed ser-sems.cfg at $(ser-cfg-target)ser-sems.cfg + @echo \*\*\* run $(ser-prefix)/sbin/ser -f $(ser-cfg-target)ser-sems.cfg + @echo \*\*\* to start ser for sems. + install-audio: $(audio-prefix)/$(audio-dir) -@for f in $(AUDIO_FILES) ; do \ if [ -n "wav/$$f" ]; then \ diff --git a/core/etc/ser-sems.cfg b/core/etc/ser-sems.cfg new file mode 100644 index 00000000..c27c95b9 --- /dev/null +++ b/core/etc/ser-sems.cfg @@ -0,0 +1,79 @@ +# ser for sems configuration +# +# This is a simple SER configuration for using SER +# as SIP stack for SEMS. It passes every message +# directly to SEMS. +# +# Application and application parameters need to be +# set in P-App-Name/P-App-Param headers of the INVITE. +# +# To install SER 0.9.6 for SEMS in /opt/ser-sems, +# use the following commands: +# wget ftp.iptel.org/pub/sems/ser-0.9.6-sems.tar.gz +# tar xzvf ser-0.9.6-sems.tar.gz; cd ser-0.9.6-sems +# make install PREFIX=/opt/ser-sems +# + +# set listen parameter if you want SEMS to be reachable +# from one interface only: +# listen=eth0 + +# +# listen on this port +port=5070 + +# connection SER->SEMS +unix_sock="/tmp/ser_sock" + +# SEMS sends its own signature +server_signature=0 + +# we only need sl and tm +loadmodule "/opt/ser-sems/lib/ser/modules/sl.so" +loadmodule "/opt/ser-sems/lib/ser/modules/tm.so" + +# we want provisional replies in SEMS +modparam("tm", "pass_provisional_replies", 1) + +# passes "P-App-Name" and +# "P-App-Param" headers with the INVITE +modparam("tm", "tw_append", + "app_headers:hdr[P-App-Name];hdr[P-App-Param]") + +# for DTMF in SIP INFO we need content-length, -type +# and body +modparam( "tm", "tw_append", + "dtmf_info:hdr[Content-Length];hdr[Content-Type];msg[body]") + +# main routing logic +route{ + # make transaction + if (!t_newtran()){ + sl_send_reply("500","could not create transaction"); + break; + } + + # actively absorb ACKs + if (method == "ACK") { + t_relay(); + break; + } + + # pass everything to SEMS + if (method=="INVITE") { + if(!t_write_unix("/tmp/sems_sock","sems/app_headers")){ + log("could not contact sems\n"); + t_reply("500","could not contact media server"); + } + } else if (method=="INFO") { + if(!t_write_unix("/tmp/sems_sock","sems/dtmf_info")){ + log("could not contact sems\n"); + t_reply("500","could not contact media server"); + } + } else { # no need for special appends + if(!t_write_unix("/tmp/sems_sock","sems")){ + log("could not contact sems\n"); + t_reply("500","could not contact media server"); + } + } +}