/[resiprocate]/main/resip/dum/Dialog.cxx
ViewVC logotype

Contents of /main/resip/dum/Dialog.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3024 - (show annotations) (download)
Tue Jun 22 22:10:19 2004 UTC (15 years, 5 months ago) by derek
Original Path: main/sip/resiprocate/dum/Dialog.cxx
File size: 25204 byte(s)
improved AUTH behaviour
fixed some bugs in dialog
add missing handler call to serverInviteSession
Logging changes

1 #include "resiprocate/Contents.hxx"
2 #include "resiprocate/Helper.hxx"
3 #include "resiprocate/SipMessage.hxx"
4 #include "resiprocate/dum/AppDialog.hxx"
5 #include "resiprocate/dum/BaseCreator.hxx"
6 #include "resiprocate/dum/ClientAuthManager.hxx"
7 #include "resiprocate/dum/ClientInviteSession.hxx"
8 #include "resiprocate/dum/ClientOutOfDialogReq.hxx"
9 #include "resiprocate/dum/ClientRegistration.hxx"
10 #include "resiprocate/dum/ClientSubscription.hxx"
11 #include "resiprocate/dum/Dialog.hxx"
12 #include "resiprocate/dum/DialogUsageManager.hxx"
13 #include "resiprocate/dum/InviteSessionCreator.hxx"
14 #include "resiprocate/dum/ServerInviteSession.hxx"
15 #include "resiprocate/dum/ServerOutOfDialogReq.hxx"
16 #include "resiprocate/dum/ServerRegistration.hxx"
17 #include "resiprocate/dum/ServerSubscription.hxx"
18 #include "resiprocate/dum/ClientPublication.hxx"
19 #include "resiprocate/dum/ServerPublication.hxx"
20 #include "resiprocate/os/Logger.hxx"
21
22 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM
23
24 using namespace resip;
25 using namespace std;
26
27 Dialog::Dialog(DialogUsageManager& dum, const SipMessage& msg, DialogSet& ds)
28 : mDum(dum),
29 mDialogSet(ds),
30 mClientSubscriptions(),
31 mServerSubscription(0),
32 mInviteSession(0),
33 mClientRegistration(0),
34 mServerRegistration(0),
35 mClientPublication(0),
36 mServerPublication(0),
37 mClientOutOfDialogRequests(),
38 mServerOutOfDialogRequest(0),
39 mType(Fake),
40 mRouteSet(),
41 mLocalContact(),
42 mLocalCSeq(0),
43 mRemoteCSeq(0),
44 mId("INVALID", "INVALID", "INVALID"),
45 mRemoteTarget(),
46 mLocalNameAddr(),
47 mRemoteNameAddr(),
48 mCallId(msg.header(h_CallID)),
49 mDestroying(false)
50 {
51 assert(msg.isExternal());
52
53
54 if (msg.isRequest()) // UAS
55 {
56 const SipMessage& request = msg;
57
58 switch (request.header(h_CSeq).method())
59 {
60 case INVITE:
61 mType = Invitation;
62 break;
63
64 case SUBSCRIBE:
65 case REFER:
66 case NOTIFY:
67 mType = Subscription;
68 break;
69
70 default:
71 mType = Fake;
72 }
73 if (request.exists(h_RecordRoutes))
74 {
75 mRouteSet = request.header(h_RecordRoutes); // !jf! is this right order
76 }
77
78 switch (request.header(h_CSeq).method())
79 {
80 case INVITE:
81 case SUBSCRIBE:
82 case REFER:
83 InfoLog ( << "UAS dialog ID creation, DS: " << ds.getId());
84 mId = DialogId(ds.getId(), request.header(h_From).param(p_tag));
85 mRemoteNameAddr = request.header(h_From);
86 mLocalNameAddr = request.header(h_To);
87 mLocalNameAddr.param(p_tag) = mId.getLocalTag();
88 if (request.exists(h_Contacts) && request.header(h_Contacts).size() == 1)
89 {
90 const NameAddr& contact = request.header(h_Contacts).front();
91 if (isEqualNoCase(contact.uri().scheme(), Symbols::Sips) ||
92 isEqualNoCase(contact.uri().scheme(), Symbols::Sip))
93 {
94 mLocalContact = NameAddr(request.header(h_RequestLine).uri()); // update later when send a request
95 mRemoteTarget = contact;
96 }
97 else
98 {
99 InfoLog(<< "Got an INVITE or SUBSCRIBE with invalid scheme");
100 DebugLog(<< request);
101 throw Exception("Invalid scheme in request", __FILE__, __LINE__);
102 }
103 }
104 else
105 {
106 InfoLog (<< "Got an INVITE or SUBSCRIBE that doesn't have exactly one contact");
107 DebugLog (<< request);
108 throw Exception("Too many (or no contact) contacts in request", __FILE__, __LINE__);
109 }
110 break;
111 default:
112 break;
113 }
114
115 mRemoteCSeq = request.header(h_CSeq).sequence();
116 mLocalCSeq = 1;
117
118 InfoLog ( << "************** Created Dialog as UAS **************" );
119 InfoLog ( << "mRemoteNameAddr: " << mRemoteNameAddr );
120 InfoLog ( << "mLocalNameAddr: " << mLocalNameAddr );
121 InfoLog ( << "mLocalContact: " << mLocalContact );
122 InfoLog ( << "mRemoteTarget: " << mRemoteTarget );
123 }
124 else if (msg.isResponse())
125 {
126 mId = DialogId(msg);
127 const SipMessage& response = msg;
128 mRemoteNameAddr = response.header(h_To);
129 mLocalNameAddr = response.header(h_From);
130
131 switch (msg.header(h_CSeq).method())
132 {
133 case INVITE:
134 mType = Invitation;
135 break;
136
137 case SUBSCRIBE:
138 case REFER:
139 mType = Subscription;
140 break;
141
142 default:
143 mType = Fake;
144 }
145
146 if (response.exists(h_RecordRoutes))
147 {
148 mRouteSet = response.header(h_RecordRoutes).reverse();
149 }
150
151 switch (response.header(h_CSeq).method())
152 {
153 case INVITE:
154 case SUBSCRIBE:
155 case REFER:
156 if (response.header(h_StatusLine).statusCode() > 100 &&
157 response.header(h_StatusLine).statusCode() < 300)
158 {
159
160 if (response.exists(h_Contacts) && response.header(h_Contacts).size() == 1)
161 {
162 const NameAddr& contact = response.header(h_Contacts).front();
163 if (isEqualNoCase(contact.uri().scheme(), Symbols::Sips) ||
164 isEqualNoCase(contact.uri().scheme(), Symbols::Sip))
165 {
166 BaseCreator* creator = mDum.findCreator(mId);
167 assert(creator);// !jf! throw or something here
168
169 mLocalContact = creator->getLastRequest().header(h_Contacts).front();
170 mRemoteTarget = contact;
171 }
172 else
173 {
174 InfoLog (<< "Got an INVITE or SUBSCRIBE with invalid scheme");
175 DebugLog (<< response);
176 throw Exception("Bad scheme in contact in response", __FILE__, __LINE__);
177 }
178 }
179 else
180 {
181 InfoLog (<< "Got an INVITE or SUBSCRIBE that doesn't have exactly one contact");
182 DebugLog (<< response);
183 throw Exception("Too many contacts (or no contact) in response", __FILE__, __LINE__);
184 }
185 break;
186 default:
187 break;
188 }
189 }
190
191 mLocalCSeq = response.header(h_CSeq).sequence();
192 mRemoteCSeq = 0;
193 InfoLog ( << "************** Created Dialog as UAC **************" );
194 InfoLog ( << "mRemoteNameAddr: " << mRemoteNameAddr );
195 InfoLog ( << "mLocalNameAddr: " << mLocalNameAddr );
196 InfoLog ( << "mLocalContact: " << mLocalContact );
197 InfoLog ( << "mRemoteTarget: " << mRemoteTarget );
198
199
200 }
201 mDialogSet.addDialog(this);
202 }
203
204 Dialog::~Dialog()
205 {
206 mDestroying = true;
207 //does removing an elemnt from a list invalidate iterators?
208 for(std::list<ClientSubscription*>::iterator it = mClientSubscriptions.begin();
209 it != mClientSubscriptions.end(); it++)
210 {
211 delete *it;
212 }
213 for(std::list<ClientOutOfDialogReq*>::iterator it = mClientOutOfDialogRequests.begin();
214 it != mClientOutOfDialogRequests.end(); it++)
215 {
216 delete *it;
217 }
218 delete mServerSubscription;
219 delete mInviteSession;
220 delete mClientRegistration;
221 delete mServerRegistration;
222 delete mClientPublication;
223 delete mServerPublication;
224 delete mServerOutOfDialogRequest;
225
226 mDialogSet.mDialogs.erase(this->getId());
227 delete mAppDialog;
228 mDialogSet.possiblyDie();
229 }
230
231 DialogId
232 Dialog::getId() const
233 {
234 return mId;
235 }
236
237 void
238 Dialog::cancel()
239 {
240 if (mInviteSession)
241 {
242 mInviteSession->end();
243 }
244 else
245 {
246 if (mDialogSet.getCreator())
247 {
248 makeRequest(mDialogSet.getCreator()->getLastRequest(), CANCEL);
249 mDum.send(mDialogSet.getCreator()->getLastRequest());
250 delete this;
251 }
252 }
253 }
254
255 void
256 Dialog::dispatch(const SipMessage& msg)
257 {
258 InfoLog ( << "Dialog::dispatch: " << msg.brief());
259 if (msg.isRequest())
260 {
261 const SipMessage& request = msg;
262 switch (request.header(h_CSeq).method())
263 {
264 case INVITE: // new INVITE
265 if (mInviteSession == 0)
266 {
267 InfoLog ( << "Dialog::dispatch -- Created new server invite session" << msg.brief());
268 mInviteSession = makeServerInviteSession(request);
269 }
270 mInviteSession->dispatch(request);
271 break;
272 case BYE:
273 if (mInviteSession == 0)
274 {
275 InfoLog ( << "Spurious BYE" );
276 return;
277 }
278 else
279 {
280 mInviteSession->dispatch(request);
281 }
282 break;
283 case ACK:
284 case CANCEL:
285 if (mInviteSession == 0)
286 {
287 InfoLog (<< "Drop stray ACK or CANCEL in dialog on the floor");
288 DebugLog (<< request);
289 }
290 else
291 {
292 mInviteSession->dispatch(request);
293 }
294 break;
295
296 case SUBSCRIBE:
297 case REFER: //!jf! does this create a server subs?
298 if (mServerSubscription == 0)
299 {
300 mServerSubscription = makeServerSubscription(request);
301 }
302
303 mServerSubscription->dispatch(request);
304 break;
305
306 case NOTIFY:
307 if (request.header(h_To).exists(p_tag))
308 {
309 ClientSubscription* client = findMatchingClientSub(request);
310 if (client)
311 {
312 client->dispatch(request);
313 }
314 else
315 {
316 BaseCreator* creator = mDum.findCreator(mId);
317 if (creator)
318 {
319 ClientSubscription* sub = makeClientSubscription(request);
320 mClientSubscriptions.push_back(sub);
321 sub->dispatch(request);
322 }
323 else
324 {
325 SipMessage failure;
326 makeResponse(failure, request, 481);
327 mDum.sendResponse(failure);
328 return;
329 }
330 }
331 }
332 else // no to tag - unsolicited notify
333 {
334 assert(mServerOutOfDialogRequest == 0);
335 mServerOutOfDialogRequest = makeServerOutOfDialog(request);
336 mServerOutOfDialogRequest->dispatch(request);
337 }
338 break;
339
340 case PUBLISH:
341 if (mServerPublication == 0)
342 {
343 mServerPublication = makeServerPublication(request);
344 }
345 mServerPublication->dispatch(request);
346 break;
347
348 case REGISTER:
349 if (mServerRegistration == 0)
350 {
351 mServerRegistration = makeServerRegistration(request);
352 }
353 mServerRegistration->dispatch(request);
354 break;
355
356 default:
357 InfoLog ( << "In Dialog::dispatch, default(ServerOutOfDialogRequest), msg: " << msg );
358 // only can be one ServerOutOfDialogReq at a time
359 assert(mServerOutOfDialogRequest == 0);
360 mServerOutOfDialogRequest = makeServerOutOfDialog(request);
361 mServerOutOfDialogRequest->dispatch(request);
362 break;
363 }
364 }
365 else if (msg.isResponse())
366 {
367 //Auth related
368 if (mDum.mClientAuthManager && !mDialogSet.mCancelled)
369 {
370 if (mDialogSet.getCreator())
371 {
372 if ( mDum.mClientAuthManager->handle( mDialogSet.getCreator()->getLastRequest(), msg))
373 {
374 InfoLog( << "about to retransmit request with digest credentials" );
375 InfoLog( << mDialogSet.getCreator()->getLastRequest() );
376
377 mDum.send(mDialogSet.getCreator()->getLastRequest());
378 return;
379 }
380 }
381 else
382 {
383 SipMessage* lastRequest = 0;
384 switch (msg.header(h_CSeq).method())
385 {
386 case INVITE:
387 case CANCEL:
388 case REFER:
389 if (mInviteSession == 0)
390 {
391 return;
392 }
393 else
394 {
395 lastRequest = &mInviteSession->mLastRequest;
396 }
397 break;
398 case REGISTER:
399 if (mClientRegistration == 0)
400 {
401 return;
402 }
403 else
404 {
405 lastRequest = &mClientRegistration->mLastRequest;
406 }
407 break;
408 default:
409 break;
410 }
411 if ( lastRequest && mDum.mClientAuthManager->handle( *lastRequest, msg ) )
412 {
413 InfoLog( << "about to retransmit request with digest credentials" );
414 InfoLog( << *lastRequest );
415
416 mDum.send(*lastRequest);
417 return;
418 }
419 }
420 }
421
422 const SipMessage& response = msg;
423 // !jf! should this only be for 2xx responses? !jf! Propose no as an
424 // answer !dcm! what is he on?
425 switch (response.header(h_CSeq).method())
426 {
427 case INVITE:
428 if (mInviteSession == 0)
429 {
430 // #if!jf! don't think creator needs a dispatch
431 //BaseCreator* creator = mDum.findCreator(mId);
432 //assert (creator); // stray responses have been rejected already
433 //creator->dispatch(response);
434 // #endif!jf!
435 InfoLog ( << "Dialog::dispatch -- Created new client invite session" << msg.brief());
436
437 mInviteSession = makeClientInviteSession(response);
438 mInviteSession->dispatch(response);
439 }
440 else
441 {
442 mInviteSession->dispatch(response);
443 }
444 break;
445 case BYE:
446 case ACK:
447 case CANCEL:
448 if (mInviteSession != 0)
449 {
450 mInviteSession->dispatch(response);
451 }
452 // else drop on the floor
453 break;
454
455 case SUBSCRIBE:
456 case REFER:
457 {
458 ClientSubscription* client = findMatchingClientSub(response);
459 if (client)
460 {
461 client->dispatch(response);
462 }
463 else
464 {
465 ClientSubscription* sub = makeClientSubscription(response);
466 mClientSubscriptions.push_back(sub);
467 sub->dispatch(response);
468 }
469 break;
470 }
471
472 case PUBLISH:
473 // !jf! could assert that no other usages exist
474 if (mClientPublication == 0)
475 {
476 mClientPublication = makeClientPublication(response);
477 }
478 mClientPublication->dispatch(response);
479 break;
480
481 case REGISTER:
482 // !jf! could assert that no other usages exist
483 if (mClientRegistration == 0)
484 {
485 mClientRegistration = makeClientRegistration(response);
486 }
487 mClientRegistration->dispatch(response);
488 break;
489
490 // unsolicited - not allowed but commonly implemented
491 // by large companies with a bridge as their logo
492 case NOTIFY:
493 case INFO:
494
495 default:
496 {
497 ClientOutOfDialogReq* req = findMatchingClientOutOfDialogReq(response);
498 if (req == 0)
499 {
500 req = makeClientOutOfDialogReq(response);
501 mClientOutOfDialogRequests.push_back(req);
502 }
503 req->dispatch(response);
504 break;
505 }
506 }
507 }
508 }
509
510
511
512
513 ClientSubscription*
514 Dialog::findMatchingClientSub(const SipMessage& msg)
515 {
516 for (std::list<ClientSubscription*>::iterator i=mClientSubscriptions.begin();
517 i != mClientSubscriptions.end(); ++i)
518 {
519 if ((*i)->matches(msg))
520 {
521 return *i;
522 }
523 }
524 return 0;
525 }
526
527 ClientOutOfDialogReq*
528 Dialog::findMatchingClientOutOfDialogReq(const SipMessage& msg)
529 {
530 for (std::list<ClientOutOfDialogReq*>::iterator i=mClientOutOfDialogRequests.begin();
531 i != mClientOutOfDialogRequests.end(); ++i)
532 {
533 if ((*i)->matches(msg))
534 {
535 return *i;
536 }
537 }
538 return 0;
539 }
540
541
542 InviteSessionHandle
543 Dialog::findInviteSession()
544 {
545 if (mInviteSession)
546 {
547 return mInviteSession->getSessionHandle();
548 }
549 else
550 {
551 throw BaseUsage::Exception("no such invite session",
552 __FILE__, __LINE__);
553 }
554 }
555
556 std::vector<ClientSubscriptionHandle>
557 Dialog::findClientSubscriptions()
558 {
559 std::vector<ClientSubscriptionHandle> handles;
560
561 for (std::list<ClientSubscription*>::const_iterator i = mClientSubscriptions.begin();
562 i != mClientSubscriptions.end(); ++i)
563 {
564 handles.push_back((*i)->getHandle());
565 }
566
567 return handles;
568 }
569
570 ClientRegistrationHandle
571 Dialog::findClientRegistration()
572 {
573 if (mClientRegistration)
574 {
575 return mClientRegistration->getHandle();
576 }
577 else
578 {
579 throw BaseUsage::Exception("no such client registration",
580 __FILE__, __LINE__);
581 }
582 }
583
584 ServerRegistrationHandle
585 Dialog::findServerRegistration()
586 {
587 if (mServerRegistration)
588 {
589 return mServerRegistration->getHandle();
590 }
591 else
592 {
593 throw BaseUsage::Exception("no such server registration",
594 __FILE__, __LINE__);
595 }
596 }
597
598 ClientPublicationHandle
599 Dialog::findClientPublication()
600 {
601 if (mClientPublication)
602 {
603 return mClientPublication->getHandle();
604 }
605 else
606 {
607 throw BaseUsage::Exception("no such client publication",
608 __FILE__, __LINE__);
609 }
610 }
611
612 ServerPublicationHandle
613 Dialog::findServerPublication()
614 {
615 if (mServerPublication)
616 {
617 return mServerPublication->getHandle();
618 }
619 else
620 {
621 throw BaseUsage::Exception("no such server publication",
622 __FILE__, __LINE__);
623 }
624 }
625
626 #if 0
627 ClientOutOfDialogReqHandle
628 Dialog::findClientOutOfDialog()
629 {
630 if (mClientOutOfDialogRequests)
631 {
632 return mClientOutOfDialogReq->getHandle();
633 }
634 else
635 {
636 throw BaseUsage::Exception("no such client out of dialog",
637 __FILE__, __LINE__);
638 }
639 }
640 #endif
641
642 ServerOutOfDialogReqHandle
643 Dialog::findServerOutOfDialog()
644 {
645 if (mServerOutOfDialogRequest)
646 {
647 return mServerOutOfDialogRequest->getHandle();
648 }
649 else
650 {
651 throw BaseUsage::Exception("no such server out of dialog",
652 __FILE__, __LINE__);
653 }
654 }
655
656 #if 0
657 void
658 Dialog::processNotify(const SipMessage& notify)
659 {
660 if (notify.isRequest())
661 {
662 if (findSubscriptions().empty())
663 {
664 SubscriptionCreator* creator = dynamic_cast<SubscriptionCreator*>(DialogSetId(notify).getCreator());
665 if (creator)
666 {
667 creator->makeNewSubscription(notify);
668 }
669 }
670 else
671 {
672 for (std::list<BaseUsage*>::iterator i=mUsages.begin(); i!=mUsages.end(); i++)
673 {
674 ClientSubscription* sub = dynamic_cast<ClientSubscription*>(*i);
675 if (sub && sub->matches(notify))
676 {
677 sub->process(notify);
678 break;
679 }
680 }
681 }
682 }
683 }
684 #endif
685
686
687 void
688 Dialog::makeRequest(SipMessage& request, MethodTypes method)
689 {
690 RequestLine rLine(method);
691
692 rLine.uri() = mRemoteTarget.uri();
693
694 request.header(h_RequestLine) = rLine;
695 request.header(h_To) = mRemoteNameAddr;
696 // request.header(h_To).param(p_tag) = mId.getRemoteTag();
697 request.header(h_From) = mLocalNameAddr;
698 // request.header(h_From).param(p_tag) = mId.getLocalTag();
699
700 request.header(h_CallId) = mCallId;
701
702 request.remove(h_RecordRoutes); //!dcm! -- all of this is rather messy
703
704 request.remove(h_Contacts);
705 request.header(h_Contacts).push_front(mLocalContact);
706 request.header(h_CSeq).method() = method;
707 request.header(h_MaxForwards).value() = 70;
708
709 //must keep old via for cancel
710 if (method != CANCEL)
711 {
712 request.header(h_Routes) = mRouteSet;
713 request.remove(h_Vias);
714 Via via;
715 via.param(p_branch); // will create the branch
716 request.header(h_Vias).push_front(via);
717 }
718 else
719 {
720 assert(request.exists(h_Vias));
721 }
722 //don't increment CSeq for ACK or CANCEL
723 if (method != ACK && method != CANCEL)
724 {
725 request.header(h_CSeq).sequence() = ++mLocalCSeq;
726 }
727 InfoLog ( << "Dialog::makeRequest: " << request );
728 }
729
730 void
731 Dialog::makeCancel(SipMessage& request)
732 {
733 makeRequest(request, CANCEL);
734
735 //not allowed in a CANCEL
736 request.remove(h_Requires);
737 request.remove(h_ProxyRequires);
738 }
739
740 void
741 Dialog::makeResponse(SipMessage& response, const SipMessage& request, int code)
742 {
743 assert( code >= 100 );
744 if (code < 300 && code > 100)
745 {
746 assert(request.isRequest());
747 assert(request.header(h_RequestLine).getMethod() == INVITE ||
748 request.header(h_RequestLine).getMethod() == SUBSCRIBE ||
749 request.header(h_RequestLine).getMethod() == BYE ||
750 request.header(h_RequestLine).getMethod() == CANCEL);
751
752 assert (request.header(h_Contacts).size() == 1);
753 Helper::makeResponse(response, request, code, mLocalContact);
754 response.header(h_To).param(p_tag) = mId.getLocalTag();
755 }
756 else
757 {
758 Helper::makeResponse(response, request, code, mLocalContact);
759 response.header(h_To).param(p_tag) = mId.getLocalTag();
760
761 }
762 InfoLog ( << "Dialog::makeResponse: " << response);
763 }
764
765
766 ClientInviteSession*
767 Dialog::makeClientInviteSession(const SipMessage& response)
768 {
769 InviteSessionCreator* creator = dynamic_cast<InviteSessionCreator*>(mDialogSet.getCreator());
770 assert(creator); // !jf! this maybe can assert by evil UAS
771 //return mDum.createAppClientInviteSession(*this, *creator);
772 return new ClientInviteSession(mDum, *this, creator->getLastRequest(), creator->getInitialOffer());
773 }
774
775 ClientRegistration*
776 Dialog::makeClientRegistration(const SipMessage& response)
777 {
778 BaseCreator* creator = mDialogSet.getCreator();
779 assert(creator);
780 return new ClientRegistration(mDum, *this, creator->getLastRequest());
781 }
782
783 ClientPublication*
784 Dialog::makeClientPublication(const SipMessage& response)
785 {
786 BaseCreator* creator = mDialogSet.getCreator();
787 assert(creator);
788 return new ClientPublication(mDum, *this, creator->getLastRequest());
789 }
790
791 ClientSubscription*
792 Dialog::makeClientSubscription(const SipMessage& response)
793 {
794 BaseCreator* creator = mDialogSet.getCreator();
795 assert(creator);
796 return new ClientSubscription(mDum, *this, creator->getLastRequest());
797 }
798
799 ClientOutOfDialogReq*
800 Dialog::makeClientOutOfDialogReq(const SipMessage& response)
801 {
802 BaseCreator* creator = mDialogSet.getCreator();
803 assert(creator);
804 return new ClientOutOfDialogReq(mDum, *this, creator->getLastRequest());
805 }
806
807 ServerInviteSession*
808 Dialog::makeServerInviteSession(const SipMessage& request)
809 {
810 return new ServerInviteSession(mDum, *this, request);
811 }
812
813 ServerSubscription*
814 Dialog::makeServerSubscription(const SipMessage& request)
815 {
816 return new ServerSubscription(mDum, *this, request);
817 }
818
819 ServerRegistration*
820 Dialog::makeServerRegistration(const SipMessage& request)
821 {
822 return new ServerRegistration(mDum, *this, request);
823 }
824
825 ServerPublication*
826 Dialog::makeServerPublication(const SipMessage& request)
827 {
828 return new ServerPublication(mDum, *this, request);
829 }
830
831 ServerOutOfDialogReq*
832 Dialog::makeServerOutOfDialog(const SipMessage& request)
833 {
834 return new ServerOutOfDialogReq(mDum, *this, request);
835 }
836
837 Dialog::Exception::Exception(const Data& msg, const Data& file, int line)
838 : BaseException(msg, file, line)
839 {
840 }
841
842 void
843 Dialog::update(const SipMessage& msg)
844 {
845 }
846
847 #if 0
848 void
849 Dialog::setLocalContact(const NameAddr& localContact)
850 {
851 mLocalContact = localContact;
852 }
853
854 void
855 Dialog::setRemoteTarget(const NameAddr& remoteTarget)
856 {
857 mRemoteTarget = remoteTarget;
858 }
859 #endif
860
861 void Dialog::possiblyDie()
862 {
863 if (!mDestroying)
864 {
865 if (mClientSubscriptions.empty() &&
866 mClientOutOfDialogRequests.empty() &&
867 !(mServerSubscription ||
868 mInviteSession ||
869 mClientRegistration ||
870 mServerRegistration ||
871 mClientPublication ||
872 mServerPublication ||
873 mServerOutOfDialogRequest))
874 {
875 delete this;
876 }
877 }
878 }
879
880 ostream&
881 resip::operator<<(ostream& strm, const Dialog& dialog)
882 {
883
884 return strm;
885 }
886

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27