siproc

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

commit aaba845392ac1d37786166ca3cde8420ac5901c4
parent f27423ab9435c32d8214739c1b0db555aa8f1f1b
Author: Dominik Schmidt <dominik@schm1dt.ch>
Date:   Sat, 16 Nov 2019 18:18:13 +0100

Allow users to give codec priorities via environment variables

Diffstat:
Msiproc.1 | 8++++++++
Msrc/siproc.cpp | 24++++++++++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/siproc.1 b/siproc.1 @@ -52,6 +52,14 @@ it to distinct values, since the softphone binds to it. .TP .B SIPROC_LOG_LEVEL The verbosity of the pjsua-library. Smaller values yield less noise on stdout. +.TP +.B SIPROC_CODEC_PRIORITIES +Set the priorities of different codecs used by pjsua. +It must be of the form +.B <name>:<prio>[,<name>:<prio>...] +Setting the priority to 0 disables the codec. +For a list of all available codecs, refer to the output of +.B siproc-parameters . .SS SUBPROCESS ENVIRONMENT VARIABLES The processes spawned by siproc are passed the following environment variables: diff --git a/src/siproc.cpp b/src/siproc.cpp @@ -541,6 +541,30 @@ int main(int argc, char **argv){ EpConfig ep_cfg; ep_cfg.logConfig.level = atoi(env_or_default("SIPROC_LOG_LEVEL", "5"));; ep.libInit(ep_cfg); + + char *codec_prios; + if((codec_prios = getenv("SIPROC_CODEC_PRIORITIES"))){ + + while(codec_prios != NULL){ + char *name = codec_prios; + codec_prios = strstr(codec_prios, ","); + if(codec_prios != NULL){ + *codec_prios++='\0'; + } + char *prio = strstr(name, ":"); + if(prio == NULL){ + fprintf(stderr, "Codecs string malformed. Should be <name>:<prio>[,<name>:<prio>...]"); + break; + } + *prio++='\0'; + int prio_i = atoi(prio); + if(prio_i < 0 || prio_i > 255){ + fprintf(stderr, "Codec priority must be in [0,255]"); + } + ep.codecSetPriority(string(name), prio_i); + } + } + AudDevManager &adm = ep.audDevManager(); adm.setNullDev();