siproc

A primitive SIP client that spawns processes for each call
git clone git://xatko.vsos.ethz.ch/siproc.git
Log | Files | Refs

Readme.md (2389B)


      1 SiProc
      2 ======
      3 
      4 SiProc is a primitive SIP Client used for call automatization by spawning a given process for each call.
      5 It uses the [pjsip](http://www.pjsip.org/) library as a backend.
      6 
      7 Usage
      8 -----
      9 
     10 The main process can be started as follows:
     11 
     12 ```
     13 $ export SIPROC_REGISTRAR_URI="sip:myserver.lan"
     14 $ export SIPROC_ID_URI="Full Name <sip:Account@myserver.lan>"
     15 $ export SIPROC_USERNAME="Account"
     16 $ export SIPROC_PASSWORD="secret"
     17 $ ./siproc /path/to/executable args...
     18 ```
     19 
     20 Additionally, one may define any of the following, which default to the values in the readme:
     21 
     22 ```
     23 $ export SIPROC_TRANSPORT_PORT="5060"
     24 ```
     25 
     26 ### Main Control
     27 
     28 The siproc executable takes multiple commands on stdin:
     29 
     30 * `QUIT`: Shuts down the program
     31 * `CALL sip:contact@remote`: Call the given sip URI
     32 
     33 ### Calls
     34 
     35 Whenever a call is made or received, `/path/to/executable` is executed, and is given the following environment variables
     36 
     37 * SIPROC_REMOTE_URI: The address of the caller
     38 * SIPROC_REMOTE_ID: Some pjsip interna, look up their documentation
     39 * SIPROC_REMOTE_CONTACT: Ditto
     40 * SIPROC_OUTGOING: Whether a call is being made (SIPROC_OUTGOING="y") or received (SIPROC_OUTGOING="n")
     41 
     42 The program can then perform actions via STDIO.
     43 Each command is separated by a newline ('\n').
     44 The following commands are supported:
     45 
     46 * `RINGING`: Let's the remote end know that we are ringing.
     47 * `ANSWER`: Answer an incoming call
     48 * `HANGUP`: Hang up a call
     49 * `TRANSFER sip:contact@remote`: Redirect a call
     50 * `DTMF string`: Dial the DTMF tones of each character in `string`
     51 * `PLAY </path/to/file.wav>`: Play a file. Multiple files can be played at the same time.
     52 * `STOP`: Stop the file that has been added last.
     53 * `MESSAGE <msg>`: Send a SIP message to the remote side
     54 * `RECORD </path/to/file.wav>`: Record the conversation to the given file. If no file is given, the current recording is stopped.
     55 
     56 The following lines can be received via stdin:
     57 
     58 * `DTMF c`: When the client receives the DTMF character `c`
     59 * `CONNECTED`: When the remote end has picked up the phone
     60 * `STOPPED /path/to/file.wav`: Playback of the given file has been terminated.
     61 * `MESSAGE <msg>`: The remote end has sent a message.
     62 
     63 When the remote end hangs up, the process is killed via SIGTERM, so you might want to catch that signal for cleaning up.
     64 
     65 To-Do
     66 -----
     67 
     68 * [ ] Expose more of pjsips features to the process!
     69 * [ ] Allow connecting to alsa devices
     70