reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
PyRouteMessageHandler.cxx
Go to the documentation of this file.
1
3#include "PyRouteWorker.hxx"
4
5#define RESIPROCATE_SUBSYSTEM resip::Subsystem::REPRO
6
7using namespace resip;
8using namespace repro;
9
11 mDispatcher(dispatcher)
12{
13}
14
18
19void
20PyRouteMessageHandler::outboundMessage(const Tuple &source, const Tuple &destination, const SipMessage &msg)
21{
22 onMessage(true, source, destination, msg);
23}
24
25void
26PyRouteMessageHandler::inboundMessage(const Tuple& source, const Tuple& destination, const SipMessage &msg)
27{
28 onMessage(false, source, destination, msg);
29}
30
31void
32PyRouteMessageHandler::onMessage(bool outbound, const Tuple &source, const Tuple &destination, const SipMessage &msg)
33{
34 DebugLog(<< "onMessage: PyRoute");
35
36 auto work = new PyRouteMessageHandlerWork(msg);
37 std::unique_ptr<ApplicationMessage> app(work);
38 if(mDispatcher.post(app))
39 {
40 return;
41 }
42 else
43 {
44 ErrLog(<<"mDispatcher.post failed, maybe not accepting work");
45 return;
46 }
47}
48
49/* ====================================================================
50 *
51 * Copyright (c) 2022, Software Freedom Institute https://softwarefreedom.institute
52 * Copyright (c) 2022, Daniel Pocock https://danielpocock.com
53 *
54 * Redistribution and use in source and binary forms, with or without
55 * modification, are permitted provided that the following conditions
56 * are met:
57 *
58 * 1. Redistributions of source code must retain the above copyright
59 * notice, this list of conditions and the following disclaimer.
60 *
61 * 2. Redistributions in binary form must reproduce the above copyright
62 * notice, this list of conditions and the following disclaimer in
63 * the documentation and/or other materials provided with the
64 * distribution.
65 *
66 * 3. Neither the name of the author(s) nor the names of any contributors
67 * may be used to endorse or promote products derived from this software
68 * without specific prior written permission.
69 *
70 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
71 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
72 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
73 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
74 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
75 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
76 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
77 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
78 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
79 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
80 * SUCH DAMAGE.
81 *
82 * ====================================================================
83 *
84 *
85 */
86
#define DebugLog(args_)
Definition Logger.hxx:128
#define ErrLog(args_)
Definition Logger.hxx:137
static Token outbound(Symbols::Outbound)
virtual void onMessage(bool outbound, const resip::Tuple &source, const resip::Tuple &destination, const resip::SipMessage &msg)
virtual void outboundMessage(const resip::Tuple &source, const resip::Tuple &destination, const resip::SipMessage &msg)
PyRouteMessageHandler(resip::Dispatcher &dispatcher)
virtual void inboundMessage(const resip::Tuple &source, const resip::Tuple &destination, const resip::SipMessage &msg)
A generic thread-bank class.
virtual bool post(std::unique_ptr< resip::ApplicationMessage > &work)
Posts a message to this thread bank.
Represents a SIP message.
Represents a network address.
Definition Tuple.hxx:59
This Class is used to implement a primitive form of RPC using loose XML formatting.
dcm! – add UnusedChecking(_enum) below;