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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2981 - (hide annotations) (download)
Sat Jun 12 05:22:52 2004 UTC (15 years, 6 months ago) by derek
Original Path: main/sip/resiprocate/dum/Dialog.cxx
File size: 20934 byte(s)
~Handled is no longer recursive
DumTimeout is cloneable.
~DialogUsageManager cleans up, graceful cleanup not finsihed yet

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

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27