1 |
#if defined(HAVE_CONFIG_HXX) |
2 |
#include "resip/stack/config.hxx" |
3 |
#endif |
4 |
|
5 |
#include <cstring> |
6 |
#include <cassert> |
7 |
|
8 |
#ifndef __APPLE__ |
9 |
bool TRUE=true; |
10 |
bool FALSE=false; |
11 |
#endif |
12 |
|
13 |
#include "UserAgent.hxx" |
14 |
#include "resip/stack/SipStack.hxx" |
15 |
#include "resip/stack/Uri.hxx" |
16 |
#include "rutil/Logger.hxx" |
17 |
|
18 |
#ifdef USE_SSL |
19 |
#include "resip/stack/ssl/Security.hxx" |
20 |
#endif |
21 |
|
22 |
#include <signal.h> |
23 |
|
24 |
using namespace resip; |
25 |
using namespace std; |
26 |
|
27 |
#define RESIPROCATE_SUBSYSTEM Subsystem::SIP |
28 |
|
29 |
static bool finished = false; |
30 |
|
31 |
static void |
32 |
signalHandler(int signo) |
33 |
{ |
34 |
std::cerr << "Shutting down" << endl; |
35 |
finished = true; |
36 |
} |
37 |
|
38 |
int |
39 |
main(int argc, char* argv[]) |
40 |
{ |
41 |
#ifndef _WIN32 |
42 |
if ( signal( SIGPIPE, SIG_IGN) == SIG_ERR) |
43 |
{ |
44 |
cerr << "Couldn't install signal handler for SIGPIPE" << endl; |
45 |
exit(-1); |
46 |
} |
47 |
#endif |
48 |
|
49 |
if ( signal( SIGINT, signalHandler ) == SIG_ERR ) |
50 |
{ |
51 |
cerr << "Couldn't install signal handler for SIGINT" << endl; |
52 |
exit( -1 ); |
53 |
} |
54 |
|
55 |
if ( signal( SIGTERM, signalHandler ) == SIG_ERR ) |
56 |
{ |
57 |
cerr << "Couldn't install signal handler for SIGTERM" << endl; |
58 |
exit( -1 ); |
59 |
} |
60 |
|
61 |
try |
62 |
{ |
63 |
UserAgent ua(argc, argv); |
64 |
ua.startup(); |
65 |
|
66 |
InfoLog(<< argv[0] << " starting"); |
67 |
while(!finished) |
68 |
{ |
69 |
ua.process(); |
70 |
} |
71 |
} |
72 |
catch (BaseSecurity::Exception& e) |
73 |
{ |
74 |
WarningLog (<< "Couldn't set up security object"); |
75 |
exit(-1); |
76 |
} |
77 |
catch (BaseException& e) |
78 |
{ |
79 |
ErrLog (<< "Caught: " << e); |
80 |
exit(-1); |
81 |
} |
82 |
catch( ... ) |
83 |
{ |
84 |
ErrLog( << "Caught non-resip exception" ); |
85 |
exit(-1); |
86 |
} |
87 |
|
88 |
return 0; |
89 |
} |
90 |
|
91 |
/* ==================================================================== |
92 |
* The Vovida Software License, Version 1.0 |
93 |
* |
94 |
* Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. |
95 |
* |
96 |
* Redistribution and use in source and binary forms, with or without |
97 |
* modification, are permitted provided that the following conditions |
98 |
* are met: |
99 |
* |
100 |
* 1. Redistributions of source code must retain the above copyright |
101 |
* notice, this list of conditions and the following disclaimer. |
102 |
* |
103 |
* 2. Redistributions in binary form must reproduce the above copyright |
104 |
* notice, this list of conditions and the following disclaimer in |
105 |
* the documentation and/or other materials provided with the |
106 |
* distribution. |
107 |
* |
108 |
* 3. The names "VOCAL", "Vovida Open Communication Application Library", |
109 |
* and "Vovida Open Communication Application Library (VOCAL)" must |
110 |
* not be used to endorse or promote products derived from this |
111 |
* software without prior written permission. For written |
112 |
* permission, please contact vocal@vovida.org. |
113 |
* |
114 |
* 4. Products derived from this software may not be called "VOCAL", nor |
115 |
* may "VOCAL" appear in their name, without prior written |
116 |
* permission of Vovida Networks, Inc. |
117 |
* |
118 |
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED |
119 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
120 |
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND |
121 |
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA |
122 |
* NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES |
123 |
* IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, |
124 |
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
125 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
126 |
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
127 |
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
128 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
129 |
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
130 |
* DAMAGE. |
131 |
* |
132 |
* ==================================================================== |
133 |
* |
134 |
* This software consists of voluntary contributions made by Vovida |
135 |
* Networks, Inc. and many individuals on behalf of Vovida Networks, |
136 |
* Inc. For more information on Vovida Networks, Inc., please see |
137 |
* <http://www.vovida.org/>. |
138 |
* |
139 |
*/ |