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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27