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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2535 - (show 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 #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 std::list<BaseUsage*>::iterator it = mUsages.begin();
15 BaseUsage *usage;
16 while (it != mUsages.end())
17 {
18 usage = it.next();
19 if ((dynamic_cast<ClientInviteSession*>(usage) != null) ||
20 (dynamic_cast<ServerInviteSession*>(usage) != null))
21 {
22 return *usage;
23 }
24 }
25 return BaseUsage::empty();
26 }
27
28 UsageSet
29 Dialog::findSubscriptions()
30 {
31 std::list<BaseUsage*>::iterator it = mUsages.begin();
32 BaseUsage *usage;
33 UsageSet usageSet;
34 while (it != mUsages.end())
35 {
36 usage = it.next();
37 if ((dynamic_cast<ClientSubscription*>(usage) != null) ||
38 (dynamic_cast<ServerSubscription*>(usage) != null))
39 {
40 usageSet.push_back(*usage);
41 }
42 }
43 return usageSet:
44 }
45
46 BaseUsage&
47 Dialog::findRegistration()
48 {
49 std::list<BaseUsage*>::iterator it = mUsages.begin();
50 BaseUsage *usage;
51 while (it != mUsages.end())
52 {
53 usage = it.next();
54 if ((dynamic_cast<CientRegistration*>(usage) != null) ||
55 (dynamic_cast<ServerRegistration*>(usage) != null))
56 {
57 return *usage;
58 }
59 }
60 return BaseUsage::empty();
61 }
62
63
64 BaseUsage&
65 Dialog::findPublication()
66 {
67 std::list<BaseUsage*>::iterator it = mUsages.begin();
68 BaseUsage *usage;
69 while (it != mUsages.end())
70 {
71 usage = it.next();
72 if ((dynamic_cast<CientPublication*>(usage) != null) ||
73 (dynamic_cast<ServerPublication*>(usage) != null))
74 {
75 return *usage;
76 }
77 }
78 return BaseUsage::empty();
79 }
80
81 UsageSet
82 Dialog::findOutOfDialogs()
83 {
84 std::list<BaseUsage*>::iterator it = mUsages.begin();
85 BaseUsage *usage;
86 UsageSet usageSet;
87 while (it != mUsages.end())
88 {
89 usage = it.next();
90 if ((dynamic_cast<ClientOutOfDialogReq*>(usage) != null) ||
91 (dynamic_cast<ServerOutOfDialogReq*>(usage) != null))
92 {
93 usageSet.push_back(*usage);
94 }
95 }
96 return usageSet:
97 }
98
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