/[resiprocate]/main/resip/dum/test/test3pcc.cxx
ViewVC logotype

Contents of /main/resip/dum/test/test3pcc.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5948 - (show annotations) (download)
Fri Feb 17 15:30:16 2006 UTC (13 years, 9 months ago) by dworley
File MIME type: text/plain
File size: 7387 byte(s)
Setting more svn: properties, and adding EOLs to the ends of files
that need it.

1 #include "resip/stack/SdpContents.hxx"
2 #include "resip/stack/SipMessage.hxx"
3 #include "resip/stack/ShutdownMessage.hxx"
4 #include "resip/stack/SipStack.hxx"
5 #include "resip/dum/ClientAuthManager.hxx"
6 #include "resip/dum/ClientInviteSession.hxx"
7 #include "resip/dum/ClientRegistration.hxx"
8 #include "resip/dum/DialogUsageManager.hxx"
9 #include "resip/dum/DumShutdownHandler.hxx"
10 #include "resip/dum/InviteSessionHandler.hxx"
11 #include "resip/dum/MasterProfile.hxx"
12 #include "resip/dum/RegistrationHandler.hxx"
13 #include "resip/dum/ServerInviteSession.hxx"
14 #include "resip/dum/ServerOutOfDialogReq.hxx"
15 #include "resip/dum/OutOfDialogHandler.hxx"
16 #include "resip/dum/AppDialog.hxx"
17 #include "resip/dum/AppDialogSet.hxx"
18 #include "resip/dum/AppDialogSetFactory.hxx"
19 #include "rutil/Log.hxx"
20 #include "rutil/Logger.hxx"
21 #include "rutil/Random.hxx"
22
23 #include <sstream>
24 #include <time.h>
25
26 #define RESIPROCATE_SUBSYSTEM Subsystem::TEST
27
28 using namespace resip;
29 using namespace std;
30
31 class Controller : public InviteSessionHandler
32 {
33 public:
34 virtual void onNewSession(ClientInviteSessionHandle, InviteSession::OfferAnswerType oat,
35 const SipMessage& msg)
36 {
37 }
38
39 virtual void onNewSession(ServerInviteSessionHandle, InviteSession::OfferAnswerType oat,
40 const SipMessage& msg)
41 {
42 }
43
44 virtual void onFailure(ClientInviteSessionHandle, const SipMessage& msg)
45 {
46 }
47
48 virtual void onProvisional(ClientInviteSessionHandle h, const SipMessage& msg)
49 {
50 }
51
52 virtual void onConnected(ClientInviteSessionHandle, const SipMessage& msg)
53 {
54 }
55
56 virtual void onStaleCallTimeout(ClientInviteSessionHandle)
57 {
58 }
59
60 virtual void onConnected(InviteSessionHandle, const SipMessage& msg)
61 {
62 }
63
64 virtual void onRedirected(ClientInviteSessionHandle, const SipMessage& msg)
65 {
66 }
67
68 virtual void onTerminated(InviteSessionHandle, InviteSessionHandler::TerminatedReason reason,
69 const SipMessage* msg)
70 {
71 }
72
73 virtual void onAnswer(InviteSessionHandle h, const SipMessage& msg, const SdpContents& sdp)
74 {
75 h->end();
76 }
77
78 virtual void onOffer(InviteSessionHandle is, const SipMessage& msg, const SdpContents& sdp)
79 {
80 }
81
82 virtual void onEarlyMedia(ClientInviteSessionHandle, const SipMessage& msg, const SdpContents& sdp)
83 {
84 }
85
86 virtual void onOfferRequired(InviteSessionHandle, const SipMessage& msg)
87 {
88 }
89
90 virtual void onOfferRejected(InviteSessionHandle, const SipMessage& msg)
91 {
92 }
93
94 virtual void onDialogModified(InviteSessionHandle, InviteSession::OfferAnswerType oat,
95 const SipMessage& msg)
96 {
97 }
98
99 virtual void onInfo(InviteSessionHandle, const SipMessage& msg)
100 {
101 }
102
103 virtual void onRefer(InviteSessionHandle, ServerSubscriptionHandle, const SipMessage& msg)
104 {
105 }
106
107 virtual void onReferAccepted(InviteSessionHandle, ClientSubscriptionHandle, const SipMessage& msg)
108 {
109 }
110
111 virtual void onReferRejected(InviteSessionHandle, const SipMessage& msg)
112 {
113 }
114
115 virtual void onInfoSuccess(InviteSessionHandle, const SipMessage& msg)
116 {
117 }
118
119 virtual void onInfoFailure(InviteSessionHandle, const SipMessage& msg)
120 {
121 }
122
123 virtual void onForkDestroyed(ClientInviteSessionHandle)
124 {
125 }
126 };
127
128
129 int
130 main (int argc, char** argv)
131 {
132 Log::initialize(Log::Cout, resip::Log::Warning, argv[0]);
133
134 DialogUsageManager controller;
135 controller.addTransport(UDP, 12005);
136
137 SharedPtr<MasterProfile> uacMasterProfile(new MasterProfile);
138 auto_ptr<ClientAuthManager> uacAuth(new ClientAuthManager);
139 controller.setMasterProfile(uacMasterProfile);
140 controller.setClientAuthManager(uacAuth);
141
142 Controller invSessionHandler;
143 controller.setInviteSessionHandler(&invSessionHandler);
144
145 NameAddr controllerAor("sip:controller@internal.xten.net");
146 controller.getMasterProfile()->setDefaultFrom(controllerAor);
147 NameAddr target("sip:rohan@internal.xten.net");
148
149 Data txt("v=0\r\n"
150 "o=- 327064655 327074279 IN IP4 192.168.0.129\r\n"
151 "s=3pcc test\r\n"
152 "c=IN IP4 0.0.0.0\r\n"
153 "t=0 0\r\n"
154 // "m=audio 7154 RTP/AVP 0\r\n"
155 // "a=sendrecv\r\n"
156 );
157
158 HeaderFieldValue hfv(txt.data(), txt.size());
159 Mime type("application", "sdp");
160 SdpContents sdp(&hfv, type);
161
162 controller.send(controller.makeInviteSession(target, &sdp));
163
164
165 int n = 0;
166 while (true)
167 {
168 FdSet fdset;
169 // Should these be buildFdSet on the DUM?
170 controller.buildFdSet(fdset);
171 int err = fdset.selectMilliSeconds(100);
172 assert ( err != -1 );
173 controller.process(fdset);
174 if (!(n++ % 10)) cerr << "|/-\\"[(n/10)%4] << '\b';
175 }
176 return 0;
177 }
178
179 /* ====================================================================
180 * The Vovida Software License, Version 1.0
181 *
182 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
183 *
184 * Redistribution and use in source and binary forms, with or without
185 * modification, are permitted provided that the following conditions
186 * are met:
187 *
188 * 1. Redistributions of source code must retain the above copyright
189 * notice, this list of conditions and the following disclaimer.
190 *
191 * 2. Redistributions in binary form must reproduce the above copyright
192 * notice, this list of conditions and the following disclaimer in
193 * the documentation and/or other materials provided with the
194 * distribution.
195 *
196 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
197 * and "Vovida Open Communication Application Library (VOCAL)" must
198 * not be used to endorse or promote products derived from this
199 * software without prior written permission. For written
200 * permission, please contact vocal@vovida.org.
201 *
202 * 4. Products derived from this software may not be called "VOCAL", nor
203 * may "VOCAL" appear in their name, without prior written
204 * permission of Vovida Networks, Inc.
205 *
206 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
207 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
208 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
209 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
210 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
211 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
212 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
213 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
214 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
215 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
216 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
217 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
218 * DAMAGE.
219 *
220 * ====================================================================
221 *
222 * This software consists of voluntary contributions made by Vovida
223 * Networks, Inc. and many individuals on behalf of Vovida Networks,
224 * Inc. For more information on Vovida Networks, Inc., please see
225 * <http://www.vovida.org/>.
226 *
227 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27