siproc

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

commit 83c50369ad87aea6353171a448600bae47fddd90
parent d34f3ff3ea706524d5aa66284fe098b856964790
Author: Dominik Schmidt <dominik@schm1dt.ch>
Date:   Sat, 24 Aug 2019 10:04:32 +0200

Add the SIPROC_TRANSPORT_PORT environment option.

This can be used to set the port we bind to, which we have to do when we run
more than one daemon on the same machine.

Diffstat:
Readme.md | 6++++++
src/siproc.cpp | 10+++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/Readme.md b/Readme.md @@ -17,6 +17,12 @@ $ export SIPROC_PASSWORD="secret" $ ./siproc /path/to/executable args... ``` +Additionally, one may define any of the following, which default to the values in the readme: + +``` +$ export SIPROC_TRANSPORT_PORT="5060" +``` + ### Main Control The siproc executable takes multiple commands on stdin: diff --git a/src/siproc.cpp b/src/siproc.cpp @@ -396,6 +396,14 @@ void MyCall::fork_on(char **args, bool outgoing){ } } +const char* env_or_default(const char* name, const char* default_value){ + char *env = getenv(name); + if(env == NULL){ + return default_value; + } + return env; +} + void usage(){ fprintf(stderr, "Usage: siproc <executable> [args...]\n\n" @@ -444,7 +452,7 @@ int main(int argc, char **argv){ adm.setNullDev(); TransportConfig tcfg; - tcfg.port = 5060; + tcfg.port = atoi(env_or_default("SIPROC_TRANSPORT_PORT", "5060")); try { ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg); } catch(Error &err){