1# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
2# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
3#
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without modification,
7# are permitted provided that the following conditions are met:
8#
9# 1. Redistributions of source code must retain the above copyright notice, this
10# list of conditions and the following disclaimer.
11#
12# 2. Redistributions in binary form must reproduce the above copyright notice,
13# this list of conditions and the following disclaimer in the documentation and/or
14# other materials provided with the distribution.
15#
16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
20# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27from Rtp_proxy_client_stream import Rtp_proxy_client_stream
28
29import socket
30
31class Rtp_proxy_client_local(Rtp_proxy_client_stream):
32    is_local = True
33
34    def __init__(self, global_config, address = '/var/run/rtpproxy.sock', \
35      bind_address = None, nworkers = 1):
36        Rtp_proxy_client_stream.__init__(self, global_config = global_config, \
37          address = address, bind_address = bind_address, nworkers = nworkers, \
38          family == socket.AF_UNIX)
39
40if __name__ == '__main__':
41    from twisted.internet import reactor
42    def display(*args):
43        print args
44        reactor.crash()
45    r = Rtp_proxy_client_local({'_sip_address':'1.2.3.4'})
46    r.send_command('VF 123456', display, 'abcd')
47    reactor.run(installSignalHandlers = 1)
48    r.shutdown()
49