If the last used PT was a different one, check if it was an unknown PT.
If it was, then DTX can remain active, as the packet would have been
blocked.
Change-Id: Icc8bf195c30a2252b392bbccfeef34b91078ddd6
The stub is used for unknown payload types. Specialise the handler
function for it with an extra check for DTX usage. This effectively
blocks RTP packets with unknown payload types if DTX has been
configured. Forwarding RTP packets with unknown payload types can
interfere with a clean output stream generated by the DTX buffer.
Change-Id: I6f0aa9654946d2877b963cd13cec7c3f5c8b1c54
Shutting down a DTX buffer means that it may restart at an unknown later
time. Reset TS tracking when shutting it down so that if it does
restart, it receives a fresh TS state, instead of continuing on the
previous timestamps, which may then be wrong.
Change-Id: I9c7978e2f335eab32982c4739917ca5ce0c27eb6
Extend PT tracker to not just track the most used PT, but also which PT
has been used last. Use a simple circular array.
Use this new tracking to determine whether a DTX buffer should remain
active. The "most used PT" approach isn't reliable for this, as it leads
to a DTX buffer restarting only after the PT has become the "most used,"
so only after about 10 packets. Meanwhile a newly appearing SSRC would
have a new DTX buffer active immediately. Being strict about which PT
was used last resolves this inconsistency.
Change-Id: If912e4d10e6737a82f6adc0b19d502075aa18a93
If a packet is received for a codec that should have an active DTX but
doesn't, drop the packet instead of forwarding it without being
processed. In this case we expect that some other codec has an active
DTX buffer, and forwarding the packet would interfere with a clean
output stream.
Change-Id: I162ba6f314b804123a6a3957feb7435a319ad2b9
The GLib slice allocator has been obsoleted. Having a mixture of two
allocators can lead to hidden issues on systems that use different
implementations. Take the leap and replace everything with g_new/g_free.
Change-Id: I025c8383ef47b2c2472573360407fd6a6ca339b3
Media IDs are supposed to be unique. Non-RFC OSRTP may however lead to
duplicated media sections with the same media ID. Use a hash table to
track which media IDs have already been seen, and ignore any duplicates.
Change-Id: I9de5fdf3165fc4326862af708aec3d4f6736cb12
This mode is only supposed to be used by cases when:
- in-dialog offerer doesn't have own MoH capabilities; and
- still want the recipient to hear the MoH music; hence
- an offerer checks whether a recipient is capable of MoH,
and launches a player based on given capabilities;
- the rest functions the same as with usual MoH hold;
Other information:
- `mode=reflect` is only to be used within dialog,
so, it's not meant for a session origination,
and hence stands alone from other MoH option flags
that actually give a metadata (e.g. blob data)
- `mode=reflect` hence contradicts with `mode=sendrecv`
which in its turn serves another purpose
Usage:
- `moh => { mode => 'reflect' }`
Change-Id: I8d0d55f2711c6b47bfca17691582c1ffe66eae3d
Decoding and encoding may have taken some time. Grab an updated "now"
before scheduling a packet to send.
Change-Id: I9380cb01d77519cf082d87f3a6c6cfc18b8213f8
With reuse-codecs, we still need to place the codec from the SDP into
our prefs list, even if it's already present, as the format options may
have changed. Update one affected test case.
Closes#1921
Change-Id: I688c57a8c45ec4c3bf159fe2193a0e00bbceeda2
Protects against double MoH played,
e.g. when inadvertently two rtpengine instances try to trigger MoH.
This gives a clue to the current rtpengine instance,
that another one already started MoH for this call.
By default is set to false.
Change-Id: I7cc36a177b0ce1bdb64ff8b42bf31f13fb1e4c91
Allocate all bufferpool shards of the same size, regardless of
underlying allocator. This way increase memory usage a bit, but we're
already quite heavy on that, so no big deal.
Change-Id: Icbe09cd2f9b33bc58ab1efe7de293dea00236fec
Use allocators that return memory blocks aligned to the requested size,
instead of generic malloc. This makes it easier to play tricks with the
memory blocks.
Change-Id: Iad4b1127c76e48c2e9b4ad8489118d4883a24f6a
Adds a new config section that allows adjusting behaviour for certain
transcoding scenarios. This only adds the initial support for the config
option.
Change-Id: Ia3d43061adc540fab054e5c99ab804dc1ff53b84
Special codec handler to support not forwarding (nor any processing
whatsoever) of particular payload types at all. Support this in the
kernel module as well.
Change-Id: If10227affa54307e1e9b448eadd0bf2bfc5774ba
Only use the codec handler's "kernelize" flag to determine whether a
particular payload type can be handled by the kernel or not. It's
supposed to be a reliable indicator, making checking the other flags
unnecessary.
Change-Id: I5fe58eded55ea973ed555e4376ee8200f112d162
Split function into one part handling the "target" (i.e. ingress)
portion of the forwarding chain, and one function handling just the
outputs.
Change-Id: I3766da3c4bc5caee4eb6bae8978f177a83cc231a
Instead of explicitly triggering an update of subscribers for A and B
during an offer/answer, trigger it only for one side (A) and then
iterate through all subscribers and subsriptions and update them all.
This automatically triggers an update for B, as well as any other
existing subscriptions that might be affected. Use a monotonically
increading update iterator counter to track which medias have been
updated so we don't run into infinite recursion.
Change-Id: Ie2fba8ff9c5a011bbe932559ac06e1634029a091
First step to refactoring the kernelize* functions. Keep all state in a
central struct that is passed to all functions. Requires an auxiliary
bool to facilitate a case distinction in kernelize_one, which can be
removed once refactoring is complete.
Change-Id: I5de8404d55d5b320ef5cb8cd27d5b684802fa7e7
Obsolete the two flavours of packet_encoded_tx and instead distinguish
the two flavour of sequence number handling (passthrough and
self-generated) through a function pointer in the codec SSRC handler,
directly pointing to one of the two existing codec_output_rtp wrappers.
Change-Id: Ib1141413859dab37048be9b04af7a5d235b46d0a
This seems to be an acceptable and reliable way to detect RTCP
multiplexed with RTP, even if `a=rtcp-mux` wasn't advertised in the SDP.
Take the opportunity to clean up __streams_set_sinks() a bit by giving
the variables better names.
Change-Id: I0cdc5e4a544641591fc2aabca12fb11bab3453f7
Use the correct media object (the source media) to obtain media-level i=
lines from. Adapt OSRTP output function to do the same.
Change-Id: I9ba4db286cf9d822b8986a7da2cb4f4aa1c69646
... and allow non-existing HT during lookup. Also reorder cleanup
sequence. This makes managing subscriptions in codec handlers possible.
Change-Id: I9c63fde2001e9dee384872577176fdf7f3bb9699
Separate out the two distinct use cases of requesting a specific port,
and requesting (one or more) random ports.
Change-Id: Ifbe7725d8638d49f620c9f4b9445342d180c8770
Add helper functions wrapping around reserve_port which directly return
a socket_port_link object. This allows us to rework
__get_consecutive_ports and release_reserved_port to eliminate mixing
different port numbers in the same list, which makes for cleaner code.
Change-Id: Ia9808f71c854f6efd0e93ce8df4527c4aea311bd
Empty subscriptions are not supported and would be an internal bug.
Remove expectations that the contents can be NULL.
Change-Id: Ibd7b0d86e7fb147135a93316575954aca546eac2
This flag is relevant to copy the state from A to B during an
offer/answer. It should only be set on one side, not on both.
Change-Id: Ie5c6de58a4ca11b37526b719b1937ffb08ebf512
Have one function to just set flags and init a single media, and another
one to set up sink pointers
Change-Id: I3207ea9f36a0e3575c2149e077e6106fd065fe1b
Directly return the just-created subscription from the respective
function. Saves a hash table lookup.
Change-Id: I42d9c75ebae2cc92619e78badb8ac594397b614b
Turns out that g_ptr_array_new_full or g_ptr_array_new_sized only
preallocates array members, but doesn't set the length.
Change-Id: I722e29a13c415f2a5ff62830dce60205f273b445
Grab source monologue and source media only once, and pass the object
down to the various functions, instead of doing the retrieval several
times in multiple places.
Change-Id: I88d019dbf9493fa0037161390fdb9efda58f5441
We know whether we're printing for monologues or for medias, so there's
no need to have a generic function signature.
Change-Id: I356747686adb34c19ba2ba4c77c2d0a77b85a364
Centralize opts setting, leave it only for
the `media_player_new()`.
Even though it's allowed them to be empty.
Change-Id: Ia347673f891c6c698909f57bdc7126fa5caf42bf
When MoH is triggered with `sendrecv` flag (so that
the recipient, the one who is put on hold, sees
the sendrecv state instead of sendonly/inactive),
we have to correctly process the answer coming back
to the MoH originator.
The originator of MoH must see:
- recvonly to his sendonly
- inactive to his inactive
Hence OA model is kept correct for the originator's leg.
Additionally: accordingly correct MoH tests.
Change-Id: Ida5f074d302c419c1e57e4fd624a55bfddae5587
If MoH originator has inactive stream
allow him to trigger media player.
This ensures that we support two
ways of putting on hold:
- sendonly
- inactive
Change-Id: I81b33184d1f1bcb0ad7c2bb3e7ada96b2c52b1ac
Add a possibility to add opts when actually
creating new media player.
This can be useful for cases with MoH implementation.
Change-Id: Ie7f9d290cd5e46063dd4095d57a521396b58bcfb
Mark the media player as used for MoH (via .opts),
before actually calling the play media
implementation.
This allows to differentiate a default
play media case from those used by MoH.
Change-Id: Ic7a60b6653a505bc856fec767f88988f624bdea0
If the receiver of a previously passthrough T.30 stream gets switched to
a generated PCM stream from a T.38 gateway, continue the sequencing of
the previous SSRC. Technically this is not necessary as the generated
PCM stream gets a new SSRC, but at least Asterisk seems to ignore this
and expect sequencing to continue, and will ignore PCM if the sequence
jump is too large.
Change-Id: Ia4656770db11f5fa1a1e9bf5bd71a0398deb1e00
Add a simple function that acts as an encryption callback to just update
the ext_seq (index) of the egress SSRC context. The kernel module
already does this, but the daemon only did it when SRTP was involved.
This now tracks egress packet indexes in all cases.
Change-Id: I9460744de55ead4b05aceb322fd8482442ff2b41
Some components (the timer thread used by the codec handlers in
particular) may hold references to components owned by the codeclib (the
.so handles in particular). Move codeclib cleanup towards the end.
Change-Id: Ic581588c27b69c025576c14a69e999c9ca5d1597
Fixes a corner case that happens when trying to delete a call created with
ng offer and no-redis-update flag and for which no ng answer was received.
In such cases, one would receive warning messages from Redis
"ERR DB index is out of range".
What happens is that on call creation redis_hosted_db defaults to -1. This
value is changed when writing to Redis, but the writing is not done for a
ng offer with no-redis-update.
Kudos go to Pawel Kuzak.
Closes#1910
Change-Id: Iad19ec8ac69b169e6352662697b17eb23e6970fb