The state FTDM_CHANNEL_STATE_RINGING is not used when there is media available. We have
FTDM_CHANNEL_PROGRESS_MEDIA for that, therefore the pri_acknowledge() call should not set
the info argument to avoid sending an indication of media to the other end, as that may cause
the other end to not generate any ringing tone and at that moment we will not be generating
any ringing tone either and the caller will hear only silence
Use uint64_t and FTDM_UINT64_FMT for flagval and "%u" for unsigned int.
Extend invalid channel id check to cover chan_id == 0 case.
Use ftdm_strlen_zero() and ftdm_array_len() instead of open-coding them.
Move some variables from global scope into local subcommand scope.
Various other little format string and variable naming fixes.
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
Auto-loading can be toggled by setting the new autoload parameter
to FTDM_FALSE/FTDM_TRUE.
Update ftdm_span_create() and ftdm_api_execute() to use the new code.
NOTE: Auto-loading of missing I/O interfaces remains enabled in both cases,
but I guess we should disable it for ftdm_api_execute().
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
"x >> 1" is _NOT_ the reverse of "1 << x"...
Use code from Sean Eron Andersen's "Bit Twiddling Hacks"
(=> http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog)
to compute the log2 value (= position in the enum) of the bitflag.
This preserves the current behaviour, which is rather odd because
it is based on the position of the value in the enum, not its
actual (bit flag) value.
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
Simplify code by using shared string constants using bool (0/1) index,
!!-operator and negation-via-XOR.
Future optimization: Preallocate and re-use of iterators, to avoid
repeatedly allocating and freeing of memory.
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
Part of my ongoing effort to split ftdm_io.c into more manageable pieces.
This change (along with others in the future) allows decoupling of the
span registry and its users, in preparation of moving all span related
functions and data structures into ftdm_span.c.
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>