commit 37180f1b9680943cb0b5829d8648da21b3794a03
parent ea9e72c7c54e4ef25d6ad5968fd1dc8344bc6dee
Author: Dominik Schmidt <dominik@schm1dt.ch>
Date: Tue, 27 Aug 2019 16:41:03 +0200
Merge branch 'master' of gitko:siproc
Diffstat:
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/Readme.md b/Readme.md
@@ -11,12 +11,18 @@ The main process can be started as follows:
```
$ export SIPROC_REGISTRAR_URI="sip:myserver.lan"
-$ export SIPROC_ID_URI="Full Name <Account@myserver.lan>"
+$ export SIPROC_ID_URI="Full Name <sip:Account@myserver.lan>"
$ export SIPROC_USERNAME="Account"
$ 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){
@@ -458,8 +466,6 @@ int main(int argc, char **argv){
AccountConfig acfg;
acfg.idUri = idUri;
acfg.regConfig.registrarUri = reguri;
- //acfg.regConfig.registrarUri = "sip:fritz.box";
- //AuthCredInfo cred("digest", "*", "Dominik9", 0, "12345678");
AuthCredInfo cred("digest", "*", user, 0, password);
acfg.sipConfig.authCreds.push_back(cred);