|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include "mcestateanswering.h" |
|
23 #include "mcesipsession.h" |
|
24 #include "mceactionset.h" |
|
25 #include "mcefcactionset.h" |
|
26 #include "mceclientserver.h" |
|
27 |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CMceStateAnswering::CMceStateAnswering |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CMceStateAnswering::CMceStateAnswering () |
|
34 : CMceState( KMceStateAnswering) |
|
35 { |
|
36 } |
|
37 |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CMceStateAnswering::~CMceStateAnswering |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CMceStateAnswering::~CMceStateAnswering() |
|
44 { |
|
45 } |
|
46 |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CMceStateAnswering::DoAcceptL |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 TBool CMceStateAnswering::DoAcceptL( TMceStateTransitionEvent& aEvent ) |
|
53 { |
|
54 |
|
55 User::LeaveIfError( |
|
56 aEvent.Code() == EMceItcEnable || |
|
57 aEvent.Code() == EMceItcDisable || |
|
58 aEvent.Code() == EMceAck || |
|
59 aEvent.Code() == EMceBye || |
|
60 IsExtensionRequestEvent( aEvent ) |
|
61 |
|
62 ? KErrNone : KErrTotalLossOfPrecision ); |
|
63 |
|
64 return ETrue; |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CMceStateAnswering::EntryL |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 void CMceStateAnswering::EntryL( TMceStateTransitionEvent& aEvent ) |
|
72 { |
|
73 if ( IsExtensionRequestEvent( aEvent )) |
|
74 { |
|
75 HandleExtensionRequestEventL( aEvent ); |
|
76 } |
|
77 |
|
78 else |
|
79 { |
|
80 CMceSipSession& session = aEvent.Session(); |
|
81 |
|
82 switch ( aEvent.Code() ) |
|
83 { |
|
84 case EMceBye: |
|
85 { |
|
86 EntryByeL( aEvent ); |
|
87 break; |
|
88 } |
|
89 case EMceItcEnable: |
|
90 case EMceItcDisable: |
|
91 { |
|
92 session.Actions().ControlMediaL( aEvent.ParamIDs(), |
|
93 (TMceItcFunctions)aEvent.Code() ); |
|
94 break; |
|
95 } |
|
96 default: |
|
97 { |
|
98 } |
|
99 } |
|
100 } |
|
101 } |
|
102 |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CMceStateAnswering::StateEntry |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 void CMceStateAnswering::StateEntry( TMceStateTransitionEvent& aEvent ) |
|
109 { |
|
110 CMceState::StateEntry( aEvent ); |
|
111 |
|
112 CMceSipSession& session = aEvent.Session(); |
|
113 |
|
114 session.Actions().StopPendingTimer(); |
|
115 |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CMceStateAnswering::EntryByeL |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 void CMceStateAnswering::EntryByeL( TMceStateTransitionEvent& aEvent ) |
|
123 { |
|
124 CMceSipSession& session = aEvent.Session(); |
|
125 |
|
126 //send 200OK and stop media and FC |
|
127 session.Actions().Send200OKL( session.Request() ); |
|
128 session.Actions().StopMedia(); |
|
129 session.FCActions().ReleaseFC(); |
|
130 |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CMceStateAnswering::ExitL |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 void CMceStateAnswering::ExitL( TMceStateTransitionEvent& aEvent ) |
|
138 { |
|
139 |
|
140 if ( IsExtensionRequestEvent( aEvent )) |
|
141 { |
|
142 //Do Nothing; |
|
143 } |
|
144 |
|
145 else |
|
146 { |
|
147 CMceSipSession& session = aEvent.Session(); |
|
148 |
|
149 switch ( aEvent.Code() ) |
|
150 { |
|
151 //received BYE causes server & client to terminated state |
|
152 case EMceBye: |
|
153 { |
|
154 session.Actions().StateChanged( KMceStateTerminated ); |
|
155 session.Actions().ClientStateChangedL( |
|
156 CMceSession::ETerminated, session.Request() ); |
|
157 break; |
|
158 } |
|
159 case EMceItcEnable: |
|
160 case EMceItcDisable: |
|
161 { |
|
162 //NOP |
|
163 break; |
|
164 } |
|
165 default: |
|
166 { |
|
167 session.Actions().StateChanged( KMceStateEstablished ); |
|
168 session.Actions().ClientStateChangedL( CMceSession::EEstablished, session.Request() ); |
|
169 } |
|
170 } |
|
171 } |
|
172 } |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 // End of File |
|
178 |