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

Annotation of /main/sip/resiprocate/dum/Dialog.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2535 - (hide annotations) (download)
Sun Apr 4 04:50:33 2004 UTC (15 years, 9 months ago) by jason
File size: 2901 byte(s)
*** empty log message ***

1 ken 2520 #include "resiprocate/sam/nnDialog.hxx"
2    
3     using namespace resip;
4     using namespace std;
5    
6     DialogId Dialog;:getId() const
7     {
8     return mId;
9     }
10    
11     BaseUsage&
12     Dialog::findInvSession()
13     {
14 ken 2521 std::list<BaseUsage*>::iterator it = mUsages.begin();
15 ken 2520 BaseUsage *usage;
16     while (it != mUsages.end())
17     {
18     usage = it.next();
19 ken 2521 if ((dynamic_cast<ClientInviteSession*>(usage) != null) ||
20     (dynamic_cast<ServerInviteSession*>(usage) != null))
21 ken 2520 {
22     return *usage;
23     }
24     }
25 ken 2521 return BaseUsage::empty();
26 ken 2520 }
27    
28     UsageSet
29     Dialog::findSubscriptions()
30     {
31 ken 2521 std::list<BaseUsage*>::iterator it = mUsages.begin();
32 ken 2520 BaseUsage *usage;
33     UsageSet usageSet;
34     while (it != mUsages.end())
35     {
36     usage = it.next();
37 ken 2521 if ((dynamic_cast<ClientSubscription*>(usage) != null) ||
38     (dynamic_cast<ServerSubscription*>(usage) != null))
39 ken 2520 {
40     usageSet.push_back(*usage);
41     }
42     }
43     return usageSet:
44     }
45    
46     BaseUsage&
47     Dialog::findRegistration()
48     {
49 ken 2521 std::list<BaseUsage*>::iterator it = mUsages.begin();
50 ken 2520 BaseUsage *usage;
51     while (it != mUsages.end())
52     {
53     usage = it.next();
54 ken 2521 if ((dynamic_cast<CientRegistration*>(usage) != null) ||
55     (dynamic_cast<ServerRegistration*>(usage) != null))
56 ken 2520 {
57     return *usage;
58     }
59     }
60 ken 2521 return BaseUsage::empty();
61 ken 2520 }
62    
63    
64     BaseUsage&
65     Dialog::findPublication()
66     {
67 ken 2521 std::list<BaseUsage*>::iterator it = mUsages.begin();
68 ken 2520 BaseUsage *usage;
69     while (it != mUsages.end())
70     {
71     usage = it.next();
72 ken 2521 if ((dynamic_cast<CientPublication*>(usage) != null) ||
73     (dynamic_cast<ServerPublication*>(usage) != null))
74 ken 2520 {
75 ken 2521 return *usage;
76 ken 2520 }
77     }
78 ken 2521 return BaseUsage::empty();
79 ken 2520 }
80    
81     UsageSet
82     Dialog::findOutOfDialogs()
83     {
84 ken 2521 std::list<BaseUsage*>::iterator it = mUsages.begin();
85 ken 2520 BaseUsage *usage;
86     UsageSet usageSet;
87     while (it != mUsages.end())
88     {
89     usage = it.next();
90 ken 2521 if ((dynamic_cast<ClientOutOfDialogReq*>(usage) != null) ||
91     (dynamic_cast<ServerOutOfDialogReq*>(usage) != null))
92 ken 2520 {
93     usageSet.push_back(*usage);
94     }
95     }
96     return usageSet:
97     }
98 jason 2535
99     void
100     Dialog::processNotify(const SipMessage& notify)
101     {
102     if (notify.isRequest())
103     {
104     if (findSubscriptions().empty())
105     {
106     SubscriptionCreator* creator = dynamic_cast<SubscriptionCreator*>(DialogSetId(notify).getCreator());
107     if (creator)
108     {
109     creator->makeNewSubscription(notify);
110     }
111     }
112     else
113     {
114     for (std::list<BaseUsage*>::iterator i=mUsages.begin(); i!=mUsages.end(); i++)
115     {
116     ClientSubscription* sub = dynamic_cast<ClientSubscription*>(*i);
117     if (sub && sub->matches(notify))
118     {
119     sub->process(notify);
120     break;
121     }
122     }
123     }
124     }
125     }

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27