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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27