commit aa4ad924f96d86f7299e1f447365635d0c311b41 parent 4efa24d03b1cc28bc080d0ff214dadc2c25af490 Author: Dominik Schmidt <dominik@schm1dt.ch> Date: Sun, 27 Oct 2019 01:08:27 +0200 Also add an example into the man page, not only the directories Diffstat:
M | siproc.1 | | | 51 | ++++++++++++++++++++++++++++++++++++++++++++++++++- |
1 file changed, 50 insertions(+), 1 deletion(-)
diff --git a/siproc.1 b/siproc.1 @@ -142,6 +142,55 @@ the process is killed via SIGTERM. the child may catch that signal for clean up. .SH BUGS Call forwarding does not seem to work . +.SH EXAMPLE +An example, that plays the file +.I message.wav +and hangs up afterwords is shown in the following two sections. +.PP +The parent process is made to listen on a named pipe, s.t. an outgoing call can +be placed via some outer process +. +.SS PARENT PROCESS +The parent process can be started as follows, and may then take commands via +the named pipe +.I siproc_in +. +.PP +.EX +export SIPROC_USERNAME="max" +export SIPROC_PASSWORD="max1234" +export SIPROC_ID_URI='Max Muster <sip:max@sipproxy.com>' +export SIPROC_REGISTRAR_URI='sip:sipproxy.com' + +mkfifo siproc_in +exec siproc ./handle.sh <siproc_in +.EE +. +.SS HANDLER +This is the corresponding handler +.I handle.sh +that implements the call automation logic +. +.PP +.EX +#!/bin/bash + +if [ "$SIPROC_OUTGOING" == "n" ] +then + echo "ANSWER" +fi + +while read line +do + case "$line" in + "CONNECTED") + echo "PLAY message.wav" + ;; + "STOPPED"*) + echo "HANGUP" + ;; + esac +done +.EE .SH AUTHOR Dominik Schmidt (dominik@schm1dt.ch) -