|
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 "mcestateterminating.h" |
|
23 #include "mcesipsession.h" |
|
24 #include "mceactionset.h" |
|
25 #include "mcefcactionset.h" |
|
26 #include "mceclientserver.h" |
|
27 |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CMceStateTerminating::CMceStateTerminating |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CMceStateTerminating::CMceStateTerminating () |
|
34 : CMceState( KMceStateTerminating ) |
|
35 { |
|
36 } |
|
37 |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CMceStateTerminating::~CMceStateTerminating |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CMceStateTerminating::~CMceStateTerminating() |
|
44 { |
|
45 } |
|
46 |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CMceStateTerminating::DoAcceptL |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 TBool CMceStateTerminating::DoAcceptL( TMceStateTransitionEvent& aEvent ) |
|
53 { |
|
54 // EMceBye event can be received in terminating state |
|
55 // when both MO and MT side terminate the session at the same time |
|
56 User::LeaveIfError( |
|
57 aEvent.Code() == EMceAck || |
|
58 aEvent.Code() == EMceResponse || |
|
59 aEvent.Code() == EMceErrorResponse || |
|
60 aEvent.Code() == EMceProvisionalResponse || |
|
61 aEvent.Code() == EMceMediaSessionStopped || |
|
62 aEvent.Code() == EMceBye || |
|
63 IsExtensionRequestEvent( aEvent ) |
|
64 |
|
65 ? KErrNone : KErrTotalLossOfPrecision ); |
|
66 |
|
67 //ignore EMceMediaSessionStopped |
|
68 //and final responses other than response to BYE |
|
69 TBool ignore = aEvent.Code() == EMceMediaSessionStopped || |
|
70 aEvent.Code() == EMceAck || |
|
71 ( aEvent.Code() != EMceBye && |
|
72 !MceSip::IsResponseTo( aEvent.Session().Response(), |
|
73 SIPStrings::StringF( SipStrConsts::EBye )) ); |
|
74 |
|
75 return !ignore; |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CMceStateTerminating::EntryL |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void CMceStateTerminating::EntryL( TMceStateTransitionEvent& aEvent ) |
|
83 { |
|
84 if ( IsExtensionRequestEvent( aEvent )) |
|
85 { |
|
86 HandleExtensionRequestEventL( aEvent ); |
|
87 } |
|
88 |
|
89 |
|
90 // when bye event is received, send the 200 ok for bye. |
|
91 else if ( aEvent.Code() == EMceBye ) |
|
92 { |
|
93 EntryByeL( aEvent ); |
|
94 } |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CMceStateTerminating::EntryByeL |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 void CMceStateTerminating::EntryByeL( TMceStateTransitionEvent& aEvent ) |
|
102 { |
|
103 CMceSipSession& session = aEvent.Session(); |
|
104 |
|
105 //send 200OK and stop media and FC |
|
106 session.Actions().Send200OKL( session.Request() ); |
|
107 session.Actions().StopMedia(); |
|
108 session.FCActions().ReleaseFC(); |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CMceStateTerminating::ExitL |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 void CMceStateTerminating::ExitL( TMceStateTransitionEvent& aEvent ) |
|
116 { |
|
117 |
|
118 if ( IsExtensionRequestEvent( aEvent )) |
|
119 { |
|
120 //Do Nothing; |
|
121 } |
|
122 |
|
123 else |
|
124 { |
|
125 CMceSipSession& session = aEvent.Session(); |
|
126 |
|
127 session.Actions().StateChanged( KMceStateTerminated ); |
|
128 |
|
129 if ( aEvent.Code() == EMceBye ) |
|
130 { |
|
131 session.Actions().ClientStateChangedL( CMceSession::ETerminated, session.Request() ); |
|
132 } |
|
133 else |
|
134 { |
|
135 session.Actions().ClientStateChangedL( CMceSession::ETerminated, session.Response() ); |
|
136 } |
|
137 } |
|
138 } |
|
139 |
|
140 |
|
141 |
|
142 // End of File |
|
143 |