|
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 "mcestatecanceled.h" |
|
23 #include "mcesipsession.h" |
|
24 #include "mceactionset.h" |
|
25 #include "mcefcactionset.h" |
|
26 #include "mceclientserver.h" |
|
27 |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CMceStateCanceled::CMceStateCanceled |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CMceStateCanceled::CMceStateCanceled () |
|
34 : CMceState( KMceStateCanceled ) |
|
35 { |
|
36 } |
|
37 |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CMceStateCanceled::~CMceStateCanceled |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CMceStateCanceled::~CMceStateCanceled() |
|
44 { |
|
45 } |
|
46 |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CMceStateCanceled::AcceptL |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 TBool CMceStateCanceled::AcceptL( TMceStateTransitionEvent& aEvent ) |
|
53 { |
|
54 TBool accept = CMceState::AcceptL( aEvent ); |
|
55 |
|
56 if ( !accept && aEvent.Code() == EMceProvisionalResponse )//100 Trying |
|
57 { |
|
58 accept = ETrue; |
|
59 } |
|
60 |
|
61 return accept; |
|
62 |
|
63 } |
|
64 |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CMceStateCanceled::DoAcceptL |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 TBool CMceStateCanceled::DoAcceptL( TMceStateTransitionEvent& aEvent ) |
|
71 { |
|
72 |
|
73 //not accepted |
|
74 User::LeaveIfError( aEvent.EventSource() == EMceClient ? |
|
75 KErrTotalLossOfPrecision : |
|
76 KErrNone ); |
|
77 |
|
78 |
|
79 if ( aEvent.EventSource() == EMceMedia || |
|
80 aEvent.Code() == EMceRedirectionResponse ) |
|
81 { |
|
82 //ignore |
|
83 return EFalse; |
|
84 } |
|
85 else |
|
86 { |
|
87 return ETrue; |
|
88 } |
|
89 |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CMceStateCanceled::EntryL |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 void CMceStateCanceled::EntryL( TMceStateTransitionEvent& aEvent ) |
|
97 { |
|
98 |
|
99 CMceSipSession& session = aEvent.Session(); |
|
100 RStringF invite = SIPStrings::StringF( SipStrConsts::EInvite ); |
|
101 |
|
102 switch ( aEvent.Code() ) |
|
103 { |
|
104 case EMceResponse: |
|
105 { |
|
106 if ( MceSip::IsResponseTo( session.Response(), invite ) ) |
|
107 { |
|
108 session.Actions().SendACKL( session.Response() ); |
|
109 if ( session.SubState() == CMceSipSession::EOffering ) |
|
110 { |
|
111 session.Actions().SendBYEL(); |
|
112 } |
|
113 } |
|
114 else//200OK to CANCEL |
|
115 { |
|
116 //NOP |
|
117 } |
|
118 break; |
|
119 } |
|
120 case EMceProvisionalResponse: |
|
121 { |
|
122 //if CANCEL is not send yet |
|
123 if ( !session.PendingTransaction( SIPStrings::StringF( SipStrConsts::ECancel ) ) ) |
|
124 { |
|
125 session.Actions().SendCancelL(); |
|
126 } |
|
127 break; |
|
128 } |
|
129 case EMceErrorResponse://487 |
|
130 default: |
|
131 { |
|
132 } |
|
133 } |
|
134 |
|
135 |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CMceStateCanceled::ExitL |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 void CMceStateCanceled::ExitL( TMceStateTransitionEvent& aEvent) |
|
143 { |
|
144 |
|
145 CMceSipSession& session = aEvent.Session(); |
|
146 RStringF invite = SIPStrings::StringF( SipStrConsts::EInvite ); |
|
147 |
|
148 if ( aEvent.Code() != EMceProvisionalResponse ) |
|
149 { |
|
150 if ( session.SubState() == CMceSipSession::EOffering ) |
|
151 { |
|
152 if ( aEvent.Code() == EMceResponse && |
|
153 MceSip::IsResponseTo( session.Response(), invite ) ) |
|
154 { |
|
155 session.Actions().StateChanged( KMceStateTerminating ); |
|
156 session.Actions().ClientStateChangedL( CMceSession::ETerminating, |
|
157 session.Response() ); |
|
158 } |
|
159 else |
|
160 { |
|
161 session.Actions().StateChanged( KMceStateTerminated ); |
|
162 session.Actions().ClientStateChangedL( CMceSession::ETerminated, |
|
163 session.Response() ); |
|
164 } |
|
165 } |
|
166 else |
|
167 { |
|
168 session.Actions().StateChanged( KMceStateEstablished ); |
|
169 session.Actions().ClientStateChangedL( CMceSession::EEstablished, |
|
170 *session.Body(), |
|
171 session.Response() ); |
|
172 } |
|
173 } |
|
174 |
|
175 } |
|
176 |