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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8848 - (show annotations) (download)
Thu Nov 4 21:31:20 2010 UTC (9 years, 2 months ago) by sgodin
File MIME type: text/plain
File size: 24718 byte(s)
-added x64 project settings for VS2010
-replaced 32-bit pre-compiled popt libraries with source code for VS2010 projects only

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 #include "rutil/WinLeakCheck.hxx"
23
24 #include <sstream>
25 #include <time.h>
26
27 #define RESIPROCATE_SUBSYSTEM Subsystem::TEST
28 #define NO_REGISTRATION 1
29
30 using namespace resip;
31 using namespace std;
32
33 void sleepSeconds(unsigned int seconds)
34 {
35 #ifdef WIN32
36 Sleep(seconds*1000);
37 #else
38 sleep(seconds);
39 #endif
40 }
41
42 /////////////////////////////////////////////////////////////////////////////////
43 //
44 // Classes that provide the mapping between Application Data and DUM
45 // dialogs/dialogsets
46 //
47 // The DUM layer creates an AppDialog/AppDialogSet object for inbound/outbound
48 // SIP Request that results in Dialog creation.
49 //
50 /////////////////////////////////////////////////////////////////////////////////
51 class testAppDialog : public AppDialog
52 {
53 public:
54 testAppDialog(HandleManager& ham, Data &SampleAppData) : AppDialog(ham), mSampleAppData(SampleAppData)
55 {
56 cout << mSampleAppData << ": testAppDialog: created." << endl;
57 }
58 virtual ~testAppDialog()
59 {
60 cout << mSampleAppData << ": testAppDialog: destroyed." << endl;
61 }
62 Data mSampleAppData;
63 };
64
65 class testAppDialogSet : public AppDialogSet
66 {
67 public:
68 testAppDialogSet(DialogUsageManager& dum, Data SampleAppData) : AppDialogSet(dum), mSampleAppData(SampleAppData)
69 {
70 cout << mSampleAppData << ": testAppDialogSet: created." << endl;
71 }
72 virtual ~testAppDialogSet()
73 {
74 cout << mSampleAppData << ": testAppDialogSet: destroyed." << endl;
75 }
76 virtual AppDialog* createAppDialog(const SipMessage& msg)
77 {
78 return new testAppDialog(mDum, mSampleAppData);
79 }
80 virtual SharedPtr<UserProfile> selectUASUserProfile(const SipMessage& msg)
81 {
82 cout << mSampleAppData << ": testAppDialogSet: UAS UserProfile requested for msg: " << msg.brief() << endl;
83 return mDum.getMasterUserProfile();
84 }
85 Data mSampleAppData;
86 };
87
88 class testAppDialogSetFactory : public AppDialogSetFactory
89 {
90 public:
91 virtual AppDialogSet* createAppDialogSet(DialogUsageManager& dum, const SipMessage& msg)
92 { return new testAppDialogSet(dum, Data("UAS") + Data("(") + getMethodName(msg.header(h_RequestLine).getMethod()) + Data(")")); }
93 // For a UAS the testAppDialogSet will be created by DUM using this function. If you want to set
94 // Application Data, then one approach is to wait for onNewSession(ServerInviteSessionHandle ...)
95 // to be called, then use the ServerInviteSessionHandle to get at the AppDialogSet or AppDialog,
96 // then cast to your derived class and set the desired application data.
97 };
98
99
100 // Generic InviteSessionHandler
101 class TestInviteSessionHandler : public InviteSessionHandler, public ClientRegistrationHandler, public OutOfDialogHandler
102 {
103 public:
104 Data name;
105 bool registered;
106 ClientRegistrationHandle registerHandle;
107
108 TestInviteSessionHandler(const Data& n) : name(n), registered(false)
109 {
110 }
111
112 virtual ~TestInviteSessionHandler()
113 {
114 }
115
116 virtual void onSuccess(ClientRegistrationHandle h, const SipMessage& response)
117 {
118 registerHandle = h;
119 assert(registerHandle.isValid());
120 cout << name << ": ClientRegistration-onSuccess - " << response.brief() << endl;
121 registered = true;
122 }
123
124 virtual void onFailure(ClientRegistrationHandle, const SipMessage& msg)
125 {
126 cout << name << ": ClientRegistration-onFailure - " << msg.brief() << endl;
127 throw; // Ungracefully end
128 }
129
130 virtual void onRemoved(ClientRegistrationHandle, const SipMessage& response)
131 {
132 cout << name << ": ClientRegistration-onRemoved" << endl;
133 }
134
135 virtual int onRequestRetry(ClientRegistrationHandle, int retrySeconds, const SipMessage& response)
136 {
137 cout << name << ": ClientRegistration-onRequestRetry (" << retrySeconds << ") - " << response.brief() << endl;
138 return -1;
139 }
140
141 virtual void onNewSession(ClientInviteSessionHandle, InviteSession::OfferAnswerType oat, const SipMessage& msg)
142 {
143 cout << name << ": ClientInviteSession-onNewSession - " << msg.brief() << endl;
144 }
145
146 virtual void onNewSession(ServerInviteSessionHandle, InviteSession::OfferAnswerType oat, const SipMessage& msg)
147 {
148 cout << name << ": ServerInviteSession-onNewSession - " << msg.brief() << endl;
149 }
150
151 virtual void onFailure(ClientInviteSessionHandle, const SipMessage& msg)
152 {
153 cout << name << ": ClientInviteSession-onFailure - " << msg.brief() << endl;
154 }
155
156 virtual void onProvisional(ClientInviteSessionHandle, const SipMessage& msg)
157 {
158 cout << name << ": ClientInviteSession-onProvisional - " << msg.brief() << endl;
159 }
160
161 virtual void onConnected(ClientInviteSessionHandle, const SipMessage& msg)
162 {
163 cout << name << ": ClientInviteSession-onConnected - " << msg.brief() << endl;
164 }
165
166 virtual void onStaleCallTimeout(ClientInviteSessionHandle handle)
167 {
168 cout << name << ": ClientInviteSession-onStaleCallTimeout" << endl;
169 }
170
171 virtual void onConnected(InviteSessionHandle, const SipMessage& msg)
172 {
173 cout << name << ": InviteSession-onConnected - " << msg.brief() << endl;
174 }
175
176 virtual void onRedirected(ClientInviteSessionHandle, const SipMessage& msg)
177 {
178 cout << name << ": ClientInviteSession-onRedirected - " << msg.brief() << endl;
179 }
180
181 virtual void onTerminated(InviteSessionHandle, InviteSessionHandler::TerminatedReason reason, const SipMessage* msg)
182 {
183 cout << name << ": InviteSession-onTerminated - " << msg->brief() << endl;
184 assert(0); // This is overrideen in UAS and UAC specific handlers
185 }
186
187 virtual void onAnswer(InviteSessionHandle, const SipMessage& msg, const SdpContents& sdp)
188 {
189 cout << name << ": InviteSession-onAnswer(SDP)" << endl;
190 //sdp->encode(cout);
191 }
192
193 virtual void onOffer(InviteSessionHandle is, const SipMessage& msg, const SdpContents& sdp)
194 {
195 cout << name << ": InviteSession-onOffer(SDP)" << endl;
196 //sdp->encode(cout);
197 }
198
199 virtual void onEarlyMedia(ClientInviteSessionHandle, const SipMessage& msg, const SdpContents& sdp)
200 {
201 cout << name << ": InviteSession-onEarlyMedia(SDP)" << endl;
202 //sdp->encode(cout);
203 }
204
205 virtual void onOfferRequired(InviteSessionHandle, const SipMessage& msg)
206 {
207 cout << name << ": InviteSession-onOfferRequired - " << msg.brief() << endl;
208 }
209
210 virtual void onOfferRejected(InviteSessionHandle, const SipMessage* msg)
211 {
212 cout << name << ": InviteSession-onOfferRejected" << endl;
213 }
214
215 virtual void onRefer(InviteSessionHandle, ServerSubscriptionHandle, const SipMessage& msg)
216 {
217 cout << name << ": InviteSession-onRefer - " << msg.brief() << endl;
218 }
219
220 virtual void onReferAccepted(InviteSessionHandle, ClientSubscriptionHandle, const SipMessage& msg)
221 {
222 cout << name << ": InviteSession-onReferAccepted - " << msg.brief() << endl;
223 }
224
225 virtual void onReferRejected(InviteSessionHandle, const SipMessage& msg)
226 {
227 cout << name << ": InviteSession-onReferRejected - " << msg.brief() << endl;
228 }
229
230 virtual void onReferNoSub(InviteSessionHandle, const SipMessage& msg)
231 {
232 cout << name << ": InviteSession-onReferNoSub - " << msg.brief() << endl;
233 }
234
235 virtual void onInfo(InviteSessionHandle, const SipMessage& msg)
236 {
237 cout << name << ": InviteSession-onInfo - " << msg.brief() << endl;
238 }
239
240 virtual void onInfoSuccess(InviteSessionHandle, const SipMessage& msg)
241 {
242 cout << name << ": InviteSession-onInfoSuccess - " << msg.brief() << endl;
243 }
244
245 virtual void onInfoFailure(InviteSessionHandle, const SipMessage& msg)
246 {
247 cout << name << ": InviteSession-onInfoFailure - " << msg.brief() << endl;
248 }
249
250 virtual void onMessage(InviteSessionHandle, const SipMessage& msg)
251 {
252 cout << name << ": InviteSession-onMessage - " << msg.brief() << endl;
253 }
254
255 virtual void onMessageSuccess(InviteSessionHandle, const SipMessage& msg)
256 {
257 cout << name << ": InviteSession-onMessageSuccess - " << msg.brief() << endl;
258 }
259
260 virtual void onMessageFailure(InviteSessionHandle, const SipMessage& msg)
261 {
262 cout << name << ": InviteSession-onMessageFailure - " << msg.brief() << endl;
263 }
264
265 virtual void onForkDestroyed(ClientInviteSessionHandle)
266 {
267 cout << name << ": ClientInviteSession-onForkDestroyed" << endl;
268 }
269
270 // Out-of-Dialog Callbacks
271 virtual void onSuccess(ClientOutOfDialogReqHandle, const SipMessage& successResponse)
272 {
273 cout << name << ": ClientOutOfDialogReq-onSuccess - " << successResponse.brief() << endl;
274 }
275 virtual void onFailure(ClientOutOfDialogReqHandle, const SipMessage& errorResponse)
276 {
277 cout << name << ": ClientOutOfDialogReq-onFailure - " << errorResponse.brief() << endl;
278 }
279 virtual void onReceivedRequest(ServerOutOfDialogReqHandle ood, const SipMessage& request)
280 {
281 cout << name << ": ServerOutOfDialogReq-onReceivedRequest - " << request.brief() << endl;
282 // Add SDP to response here if required
283 cout << name << ": Sending 200 response to OPTIONS." << endl;
284 ood->send(ood->answerOptions());
285 }
286 };
287
288 class TestUac : public TestInviteSessionHandler
289 {
290 public:
291 bool done;
292 SdpContents* mSdp;
293 HeaderFieldValue* hfv;
294 Data* txt;
295
296 TestUac()
297 : TestInviteSessionHandler("UAC"),
298 done(false),
299 mSdp(0),
300 hfv(0),
301 txt(0)
302 {
303 txt = new Data("v=0\r\n"
304 "o=1900 369696545 369696545 IN IP4 192.168.2.15\r\n"
305 "s=X-Lite\r\n"
306 "c=IN IP4 192.168.2.15\r\n"
307 "t=0 0\r\n"
308 "m=audio 8000 RTP/AVP 8 3 98 97 101\r\n"
309 "a=rtpmap:8 pcma/8000\r\n"
310 "a=rtpmap:3 gsm/8000\r\n"
311 "a=rtpmap:98 iLBC\r\n"
312 "a=rtpmap:97 speex/8000\r\n"
313 "a=rtpmap:101 telephone-event/8000\r\n"
314 "a=fmtp:101 0-15\r\n");
315
316 hfv = new HeaderFieldValue(txt->data(), (unsigned int)txt->size());
317 Mime type("application", "sdp");
318 mSdp = new SdpContents(hfv, type);
319 }
320
321 virtual ~TestUac()
322 {
323 delete mSdp;
324 delete txt;
325 delete hfv;
326 }
327
328 virtual void onOffer(InviteSessionHandle is, const SipMessage& msg, const SdpContents& sdp)
329 {
330 cout << name << ": InviteSession-onOffer(SDP)" << endl;
331 //sdp->encode(cout);
332 is->provideAnswer(sdp);
333 }
334
335 using TestInviteSessionHandler::onConnected;
336 virtual void onConnected(ClientInviteSessionHandle is, const SipMessage& msg)
337 {
338 cout << name << ": ClientInviteSession-onConnected - " << msg.brief() << endl;
339 cout << "Connected now - requestingOffer from UAS" << endl;
340 is->requestOffer();
341 }
342
343 virtual void onTerminated(InviteSessionHandle, InviteSessionHandler::TerminatedReason reason, const SipMessage* msg)
344 {
345 if(msg)
346 {
347 cout << name << ": InviteSession-onTerminated - " << msg->brief() << endl;
348 }
349 else
350 {
351 cout << name << ": InviteSession-onTerminated" << endl;
352 }
353 done = true;
354 }
355 };
356
357 class TestUas : public TestInviteSessionHandler
358 {
359
360 public:
361 bool done;
362 bool requestedOffer;
363 time_t* pHangupAt;
364
365 SdpContents* mSdp;
366 HeaderFieldValue* hfv;
367 Data* txt;
368
369 TestUas(time_t* pH)
370 : TestInviteSessionHandler("UAS"),
371 done(false),
372 requestedOffer(false),
373 pHangupAt(pH),
374 hfv(0)
375 {
376 txt = new Data("v=0\r\n"
377 "o=1900 369696545 369696545 IN IP4 192.168.2.15\r\n"
378 "s=X-Lite\r\n"
379 "c=IN IP4 192.168.2.15\r\n"
380 "t=0 0\r\n"
381 "m=audio 8001 RTP/AVP 8 3 98 97 101\r\n"
382 "a=rtpmap:8 pcma/8000\r\n"
383 "a=rtpmap:3 gsm/8000\r\n"
384 "a=rtpmap:98 iLBC\r\n"
385 "a=rtpmap:97 speex/8000\r\n"
386 "a=rtpmap:101 telephone-event/8000\r\n"
387 "a=fmtp:101 0-15\r\n");
388
389 hfv = new HeaderFieldValue(txt->data(), (unsigned int)txt->size());
390 Mime type("application", "sdp");
391 mSdp = new SdpContents(hfv, type);
392 }
393
394 ~TestUas()
395 {
396 delete mSdp;
397 delete txt;
398 delete hfv;
399 }
400
401 using TestInviteSessionHandler::onNewSession;
402 virtual void
403 onNewSession(ServerInviteSessionHandle sis, InviteSession::OfferAnswerType oat, const SipMessage& msg)
404 {
405 cout << name << ": ServerInviteSession-onNewSession - " << msg.brief() << endl;
406 cout << name << ": Sending 180 response." << endl;
407 mSis = sis;
408 sis->provisional(180);
409 }
410
411 virtual void onTerminated(InviteSessionHandle, InviteSessionHandler::TerminatedReason reason, const SipMessage* msg)
412 {
413 cout << name << ": InviteSession-onTerminated - " << endl;
414 done = true;
415 }
416
417 virtual void onOffer(InviteSessionHandle is, const SipMessage& msg, const SdpContents& sdp)
418 {
419 cout << name << ": InviteSession-onOffer(SDP)" << endl;
420 //sdp->encode(cout);
421 cout << name << ": Sending 200 response with SDP answer." << endl;
422 is->provideAnswer(sdp);
423 mSis->accept();
424 }
425
426 virtual void onOfferRequired(InviteSessionHandle is, const SipMessage& msg)
427 {
428 cout << name << ": InviteSession-onOfferRequired - " << msg.brief() << endl;
429 is->provideOffer(*mSdp);
430 }
431
432 virtual void onAnswer(InviteSessionHandle is, const SipMessage& msg, const SdpContents& sdp)
433 {
434 cout << name << ": InviteSession-onAnswer(SDP)" << endl;
435 if(*pHangupAt == 0)
436 {
437 is->provideOffer(sdp);
438 *pHangupAt = time(NULL) + 5;
439 }
440 }
441
442 // Normal people wouldn't put this functionality in the handler
443 // it's a kludge for this test for right now
444 void hangup()
445 {
446 if (mSis.isValid())
447 {
448 cout << name << ": Sending BYE." << endl;
449 mSis->end();
450 done = true;
451 }
452 }
453 private:
454 ServerInviteSessionHandle mSis;
455 };
456
457 class TestShutdownHandler : public DumShutdownHandler
458 {
459 public:
460 TestShutdownHandler(const Data& n) : name(n), dumShutDown(false) { }
461 virtual ~TestShutdownHandler(){}
462
463 Data name;
464 bool dumShutDown;
465 virtual void onDumCanBeDeleted()
466 {
467 cout << name << ": onDumCanBeDeleted." << endl;
468 dumShutDown = true;
469 }
470 };
471
472
473 int
474 main (int argc, char** argv)
475 {
476 Log::initialize(Log::Cout, resip::Log::Warning, argv[0]);
477 //Log::initialize(Log::Cout, resip::Log::Debug, argv[0]);
478 //Log::initialize(Log::Cout, resip::Log::Info, argv[0]);
479 //Log::initialize(Log::Cout, resip::Log::Debug, argv[0]);
480
481 #if defined(WIN32) && defined(_DEBUG) && defined(LEAK_CHECK)
482 FindMemoryLeaks fml;
483 {
484 #endif
485
486 #if !defined(NO_REGISTRATION)
487 if ( argc < 5 ) {
488 cout << "usage: " << argv[0] << " sip:user1 passwd1 sip:user2 passwd2" << endl;
489 return 0;
490 }
491 NameAddr uacAor(argv[1]);
492 Data uacPasswd(argv[2]);
493 NameAddr uasAor(argv[3]);
494 Data uasPasswd(argv[4]);
495 #else
496 NameAddr uacAor;
497 NameAddr uasAor;
498 #endif
499
500 //set up UAC
501 SipStack stackUac;
502 DialogUsageManager* dumUac = new DialogUsageManager(stackUac);
503 dumUac->addTransport(UDP, 12005);
504
505 SharedPtr<MasterProfile> uacMasterProfile(new MasterProfile);
506 auto_ptr<ClientAuthManager> uacAuth(new ClientAuthManager);
507 dumUac->setMasterProfile(uacMasterProfile);
508 dumUac->setClientAuthManager(uacAuth);
509
510 TestUac uac;
511 dumUac->setInviteSessionHandler(&uac);
512 dumUac->setClientRegistrationHandler(&uac);
513 dumUac->addOutOfDialogHandler(OPTIONS, &uac);
514
515 auto_ptr<AppDialogSetFactory> uac_dsf(new testAppDialogSetFactory);
516 dumUac->setAppDialogSetFactory(uac_dsf);
517
518 #if !defined(NO_REGISTRATION)
519 //your aor, credentials, etc here
520 dumUac->getMasterProfile()->setDigestCredential(uacAor.uri().host(), uacAor.uri().user(), uacPasswd);
521 //dumUac->getMasterProfile()->setOutboundProxy(Uri("sip:209.134.58.33:9090"));
522 #else
523 uacAor = NameAddr("sip:UAC@127.0.0.1:12005");
524 #endif
525
526 dumUac->getMasterProfile()->setDefaultFrom(uacAor);
527 dumUac->getMasterProfile()->setDefaultRegistrationTime(70);
528
529 //set up UAS
530 SipStack stackUas;
531 DialogUsageManager* dumUas = new DialogUsageManager(stackUas);
532 dumUas->addTransport(UDP, 12010);
533
534 SharedPtr<MasterProfile> uasMasterProfile(new MasterProfile);
535 std::auto_ptr<ClientAuthManager> uasAuth(new ClientAuthManager);
536 dumUas->setMasterProfile(uasMasterProfile);
537 dumUas->setClientAuthManager(uasAuth);
538
539 #if !defined(NO_REGISTRATION)
540 dumUas->getMasterProfile()->setDigestCredential(uasAor.uri().host(), uasAor.uri().user(), uasPasswd);
541 //dumUas->getMasterProfile()->setOutboundProxy(Uri("sip:209.134.58.33:9090"));
542 #else
543 uasAor = NameAddr("sip:UAS@127.0.0.1:12010");
544 #endif
545
546 dumUas->getMasterProfile()->setDefaultFrom(uasAor);
547 dumUas->getMasterProfile()->setDefaultRegistrationTime(70);
548
549 time_t bHangupAt = 0;
550 TestUas uas(&bHangupAt);
551 dumUas->setClientRegistrationHandler(&uas);
552 dumUas->setInviteSessionHandler(&uas);
553 dumUas->addOutOfDialogHandler(OPTIONS, &uas);
554
555 auto_ptr<AppDialogSetFactory> uas_dsf(new testAppDialogSetFactory);
556 dumUas->setAppDialogSetFactory(uas_dsf);
557
558 #if !defined(NO_REGISTRATION)
559 {
560 SharedPtr<SipMessage> regMessage = dumUas->makeRegistration(uasAor, new testAppDialogSet(*dumUac, "UAS(Registration)"));
561 cout << "Sending register for Uas: " << endl << regMessage << endl;
562 dumUas->send(regMessage);
563 }
564 {
565 SharedPtr<SipMessage> regMessage = dumUac->makeRegistration(uacAor, new testAppDialogSet(*dumUac, "UAC(Registration)"));
566 cout << "Sending register for Uac: " << endl << regMessage << endl;
567 dumUac->send(regMessage);
568 }
569 #else
570 uac.registered = true;
571 uas.registered = true;
572 #endif
573
574 bool finishedTest = false;
575 bool stoppedRegistering = false;
576 bool startedCallFlow = false;
577 bool hungup = false;
578 TestShutdownHandler uasShutdownHandler("UAS");
579 TestShutdownHandler uacShutdownHandler("UAC");
580
581 while (!(uasShutdownHandler.dumShutDown && uacShutdownHandler.dumShutDown))
582 {
583 if (!uacShutdownHandler.dumShutDown)
584 {
585 FdSet fdset;
586 stackUac.buildFdSet(fdset);
587 int err = fdset.selectMilliSeconds(resipMin((int)stackUac.getTimeTillNextProcessMS(), 50));
588 assert ( err != -1 );
589 stackUac.process(fdset);
590 while(dumUac->process());
591 }
592 if (!uasShutdownHandler.dumShutDown)
593 {
594 FdSet fdset;
595 stackUas.buildFdSet(fdset);
596 int err = fdset.selectMilliSeconds(resipMin((int)stackUas.getTimeTillNextProcessMS(), 50));
597 assert ( err != -1 );
598 stackUas.process(fdset);
599 while(dumUas->process());
600 }
601
602 if (!(uas.done && uac.done))
603 {
604 if (uas.registered && uac.registered && !startedCallFlow)
605 {
606 if (!startedCallFlow)
607 {
608 startedCallFlow = true;
609 #if !defined(NO_REGISTRATION)
610 cout << "!!!!!!!!!!!!!!!! Registered !!!!!!!!!!!!!!!! " << endl;
611 #endif
612
613 // Kick off call flow by sending an OPTIONS request then an INVITE request from the UAC to the UAS
614 cout << "UAC: Sending Options Request to UAS." << endl;
615 dumUac->send(dumUac->makeOutOfDialogRequest(uasAor, OPTIONS, new testAppDialogSet(*dumUac, "UAC(OPTIONS)"))); // Should probably add Allow, Accept, Accept-Encoding, Accept-Language and Supported headers - but this is fine for testing/demonstration
616
617 cout << "UAC: Sending Invite Request to UAS." << endl;
618 dumUac->send(dumUac->makeInviteSession(uasAor, uac.mSdp, new testAppDialogSet(*dumUac, "UAC(INVITE)")));
619 }
620 }
621
622 // Check if we should hangup yet
623 if (bHangupAt!=0)
624 {
625 if (time(NULL)>bHangupAt && !hungup)
626 {
627 hungup = true;
628 uas.hangup();
629 }
630 }
631 }
632 else
633 {
634 if (!stoppedRegistering)
635 {
636 finishedTest = true;
637 stoppedRegistering = true;
638 dumUas->shutdown(&uasShutdownHandler);
639 dumUac->shutdown(&uacShutdownHandler);
640 #if !defined(NO_REGISTRATION)
641 uas.registerHandle->stopRegistering();
642 uac.registerHandle->stopRegistering();
643 #endif
644 }
645 }
646 }
647
648 // OK to delete DUM objects now
649 delete dumUac;
650 delete dumUas;
651
652 cout << "!!!!!!!!!!!!!!!!!! Successful !!!!!!!!!! " << endl;
653 #if defined(WIN32) && defined(_DEBUG) && defined(LEAK_CHECK)
654 }
655 #endif
656
657 }
658
659 /* ====================================================================
660 * The Vovida Software License, Version 1.0
661 *
662 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
663 *
664 * Redistribution and use in source and binary forms, with or without
665 * modification, are permitted provided that the following conditions
666 * are met:
667 *
668 * 1. Redistributions of source code must retain the above copyright
669 * notice, this list of conditions and the following disclaimer.
670 *
671 * 2. Redistributions in binary form must reproduce the above copyright
672 * notice, this list of conditions and the following disclaimer in
673 * the documentation and/or other materials provided with the
674 * distribution.
675 *
676 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
677 * and "Vovida Open Communication Application Library (VOCAL)" must
678 * not be used to endorse or promote products derived from this
679 * software without prior written permission. For written
680 * permission, please contact vocal@vovida.org.
681 *
682 * 4. Products derived from this software may not be called "VOCAL", nor
683 * may "VOCAL" appear in their name, without prior written
684 * permission of Vovida Networks, Inc.
685 *
686 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
687 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
688 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
689 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
690 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
691 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
692 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
693 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
694 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
695 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
696 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
697 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
698 * DAMAGE.
699 *
700 * ====================================================================
701 *
702 * This software consists of voluntary contributions made by Vovida
703 * Networks, Inc. and many individuals on behalf of Vovida Networks,
704 * Inc. For more information on Vovida Networks, Inc., please see
705 * <http://www.vovida.org/>.
706 *
707 */

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