Set the port in fake SDP answer (to the other side)
coming from the leg, which now replaces the previously
existing one, to the port gotten from the replace INVITE.
Otherwise, if to use the port from the pending transaction
(towards pick-up'er) it confuses rtpengine with a case
when same port talks to himself, and then can later be
used to update the pick-uper's leg once again.
Change-Id: I4c001f7956a005b64285c05586839f01216cfd91
Don't re-exploit the connection information and port
(taken from the coming SDP offer) for creation of faked
SDP answer (200OK). This is confusing and can break things
in rtpengine monologues handling.
Better to create fake SDP answer based on already learned
local SDP port and entirely connection information.
Change-Id: Id71453022fd6c93f6743f1046588447b52c38c07
Make the AmOfferAnswer model actual and introduce
according class API updates.
Accordingly update CallLeg, SBCCallLeg and AmSipDialog.
Change-Id: Iab26f4a7577af56df68ffe693859eaac08913b7f
In case of INVITE pending UAC transactions for the other leg,
and new coming in (like 200OK send to this leg, and just right
after that re-INVITE), just provide a fake SDP answer (200OK)
in the meanwhile.
And expect that a finished UAC transaction on the other side,
must trigger a consequent update for this leg, what will finish
these media negotiations.
Change-Id: I190dfcd5467c728e2192940dfac8454f708cecaf
Add class wrapping around a void* and make it call dlclose in its dtor.
Use a shared_ptr-based container to keep all dlhandles until end of
lifetime.
This way we get automatic dlclose when all references are gone.
Change-Id: I4bf94fc9825a9d20e68e8a6fbd4a96e8fd442a1a
Apps registered through registerFactory4App or registerApplication get
put into the same name2app map as apps registered from loadAppPlugIn.
For consistent references, refcount these as well.
Change-Id: I9b616257555533a8ea5847a95b4fa5c0f2e91877
Increase refcount also for DI plugins and log plugins, as they also have
their refcount decreased for unloading.
Change-Id: I0b9d2f671a2a1acda4e5210855aafd47f8cb62c3
New class inheriting from AmEventQueueBase to be used in threads that
run in a loop processing events until thread shutdown is requested.
Change-Id: Ib63837997659a944fc217712ff2472c7900e7525
Rename most of it to AmEventQueueBase. Remove the integrated mutex and
condition variable.
Add refactored AmEventQueue, which now inherits from AmEventQueueBase
and includes the previously existing mutex and condition variable.
No behavioural or usage difference, other than that now AmEventQueueBase
must be used as base class where previously AmEventQueue was used.
Remove pointless locking in dtor.
Use lock guards where appropriate.
Introduce virtual ::shouldSleep() to determine whether a looping thread
should sleep and wait for an event, or go to process pending events.
Change-Id: Ib90ff47e0c9c279e54f23cd33bf31042fdf08015
AmThread already inherits atomic_ref_cnt virtually. For cases of child
classes inheriting both AmThread and AmEventQueue, make sure only one
instance of atomic_ref_cnt is present.
Change-Id: I611db51f0b36e7cca2bcdfe8befa20bce975030b
Use AmMutex facilities to protect members dictating whether to run or
not. Replaces `runcond`, `process_sessions_mut`, and ::on_stop().
Remove redundant wake-up.
Change-Id: I75c5c4ff2be2b66b36c7354c1e127bc4f5d9993c
This module initialises and starts the StatsUDPServer. Stop its worker
when the module is destroyed.
Change-Id: I265d7ee103866a5946b066e4e7d42376e3510cac
Use the new AmThread facilities to get notified about shutdown. Use the
new `run_mut` in place of the existing mutex to protect `thread_list`
Stop watcher thread from main thread on shutdown.
Change-Id: I4214a5d2324dd7d7d5a424e425d3e2d0ef20aa14
Add a central mutex and condition variable to AmThread, which can be
used by subclasses in their ::run() to determine whether they should
sleep, run, or shut down. This will replace identical mechanism in
subclasses that have this implemented on their own.
Subclasses which don't need this are not affected.
Add `_state` to the list of members protected by this mutex, obsoleting
the need for atomic ops.
Refactor `_joined` as an enum state, also protected by run_mutex,
replacing the separate mutex. Use run_cond as signal to wake up thread
waiting on the join to the complete.
Notify this cond on shutdown, after setting the state to "stopping."
Add ::stop_requested_unlocked() for threads which use `run_mut`.
Change-Id: I0b640b54c9f601e86cbb25413cacb67e31fbe913
In the following funcs:
- AmB2BSession::acceptPendingInviteB2B()
- AmB2BSession::acceptPendingInvite()
That ensures we do not interfere into SDP
when creating fictitious replies.
Change-Id: Ic2e6ccc273cd6079c4b21839cfee38455e60ebc2
The parsing code expect a null-terminated string. Make sure the string
is.
Use correct ssize_t as return value.
Change-Id: I2590dead0db5ca839ebe5fe7506b4edfe524d164
Expose the queue_mut for external users.
Supposed to only be used with a snapshot mechanism,
because it is partially a data incapsulation violation.
The container itself and lock mechanism is meant
to be reworked in the future, to not expose locks anymore.
Change-Id: I4f8b90ab60f3ab564e2b858c588a94eb78da6acf
A a mechanism to get the AmSession object
stored polymorphically on the EvQueueMap.
Follow the classes hierarchy:
AmEventQueueInterface -> AmEventQueue -> AmSession
to retrieve AmSession by down casting it from base class.
When retrieved, acquire the snapshot dedicated lock
to prevent other thread destroying this gotten AmSession.
As soon as AmSessionSnapshot is ready,
release the lock and let other (real owner) thread do anything with it.
Left corner cases:
- by the time the AmEventQueueInterface is retrieved and down-casted
into the AmSession, returned to the user and the snapshot lock
is acquired, this thread can simply destroy the AmSession object
- this is an undefined behavior
Change-Id: Ia62b5cb27618e2c077ae5a247bb914be74e17fa9
This makes sure we use the system library, with any updates coming from
upstream, including security fixes.
Change-Id: I3bc01b99fa4c5f107d28a819dc0e1c1eac155e91
Use static_cast for the up-cast of AmSession.
Static cast is equivalent to the C-style implicit cast,
when doing an up-cast, but C-style cast is less clear.
So just use static_cast here.
Change-Id: I7a41f2ee389a4bd48734a75a0d736d8d5a75ed28