27 #include "muslogger.h" |
27 #include "muslogger.h" |
28 #include "musavacalleventmonitor.h" |
28 #include "musavacalleventmonitor.h" |
29 |
29 |
30 #include <e32base.h> |
30 #include <e32base.h> |
31 |
31 |
32 const TInt KSipUriArrayGranularity = 1; |
|
33 |
32 |
34 CMusAvaNetworkAvailability* CMusAvaNetworkAvailability::NewL( |
33 CMusAvaNetworkAvailability* CMusAvaNetworkAvailability::NewL( |
35 MMusAvaAvailabilityObserver& aObserver, |
34 MMusAvaAvailabilityObserver& aObserver, |
36 CMusAvaSettingsImp& aSettings ) |
35 CMusAvaSettingsImp& aSettings ) |
37 { |
36 { |
73 |
72 |
74 CMusAvaNetworkAvailability::CMusAvaNetworkAvailability( |
73 CMusAvaNetworkAvailability::CMusAvaNetworkAvailability( |
75 MMusAvaAvailabilityObserver& aObserver, |
74 MMusAvaAvailabilityObserver& aObserver, |
76 CMusAvaSettingsImp& aSettings ) |
75 CMusAvaSettingsImp& aSettings ) |
77 :CMusAvaAvailability( aObserver ), |
76 :CMusAvaAvailability( aObserver ), |
78 iSettings( aSettings ) |
77 iSettings( aSettings ), |
|
78 iConfcall( EFalse ) |
79 { |
79 { |
80 } |
80 } |
81 |
81 |
82 |
82 |
83 void CMusAvaNetworkAvailability::ConstructL() |
83 void CMusAvaNetworkAvailability::ConstructL() |
99 // that's done in RunL |
99 // that's done in RunL |
100 switch (iPhoneStatus->CallStatusL()) |
100 switch (iPhoneStatus->CallStatusL()) |
101 { |
101 { |
102 case NMusSessionInformationApi::ECallConnected: |
102 case NMusSessionInformationApi::ECallConnected: |
103 { |
103 { |
104 TBuf<CMusAvaCallEventMonitor::KMusTelNumberMaxLength> telNumber; |
104 TBuf<CMusAvaCallEventMonitor::KMusTelNumberMaxLength> telNumber; |
105 TBool isSipUri( EFalse ); |
105 iPhoneStatus->GetTelNumberL( telNumber ); |
106 iPhoneStatus->GetTelNumberL( telNumber, isSipUri ); |
106 iSettings.SetTelNumberL( telNumber ); |
107 SetRemoteHostL( telNumber, isSipUri ); |
107 iSettings.SetCallDirection( iPhoneStatus->CallDirectionL() ); |
108 iSettings.SetCallDirection( iPhoneStatus->CallDirectionL() ); |
108 iSettings.SetCallPrivacy( iPhoneStatus->CallPrivacyL() ); |
109 SetState( MMusAvaObserver::EMusAvaStatusAvailable ); |
109 |
110 break; |
110 SetState( MMusAvaObserver::EMusAvaStatusAvailable ); |
|
111 break; |
111 } |
112 } |
112 case NMusSessionInformationApi::ECallHold: |
113 case NMusSessionInformationApi::ECallHold: |
113 SetState( MMusAvaObserver::EMusAvaStatusCallOnHold ); |
114 SetState( MMusAvaObserver::EMusAvaStatusCallOnHold ); |
114 break; |
115 break; |
115 case NMusSessionInformationApi::EConferenceCall: |
116 case NMusSessionInformationApi::EConferenceCall: |
145 |
146 |
146 // ------------------------------------------------------------------------- |
147 // ------------------------------------------------------------------------- |
147 // This function is called when a cs call is connected. |
148 // This function is called when a cs call is connected. |
148 // ------------------------------------------------------------------------- |
149 // ------------------------------------------------------------------------- |
149 // |
150 // |
150 void CMusAvaNetworkAvailability::CallConnectedL( const TDesC& aTelNumber, |
151 void CMusAvaNetworkAvailability::CallConnectedL( const TDesC& aTelNumber ) |
151 TBool aIsSipUri) |
|
152 { |
152 { |
153 MUS_LOG( "mus: [MUSAVA] \ |
153 MUS_LOG( "mus: [MUSAVA] \ |
154 -> CMusAvaNetworkAvailability::CallConnectedL()" ) |
154 -> CMusAvaNetworkAvailability::CallConnectedL()" ) |
155 // try to resolve to contact information of the remote host |
155 |
156 SetRemoteHostL( aTelNumber, aIsSipUri ); |
156 // try to resolve to contact information of the remote host |
157 iSettings.SetCallDirection( iPhoneStatus->CallDirectionL() ); |
157 iSettings.SetTelNumberL( aTelNumber ); |
158 SetState( MMusAvaObserver::EMusAvaStatusAvailable ); |
158 iSettings.SetCallDirection( iPhoneStatus->CallDirectionL() ); |
|
159 iSettings.SetCallPrivacy( iPhoneStatus->CallPrivacyL() ); |
|
160 |
|
161 //isn't the phone sent option successfully |
|
162 if ( ( aTelNumber != iSettings.OptionSentTelNumber() |
|
163 || iSettings.OptionSentTelNumber() == KNullDesC() ) |
|
164 && iConfcall ) |
|
165 { |
|
166 MUS_LOG("CMusAvaNetworkAvailability::CallConnectedL EMusAvaStatusInProgress"); |
|
167 iSettings.ReleaseOptionSentNumber(); |
|
168 SetState( MMusAvaObserver::EMusAvaStatusInProgress ); |
|
169 } |
|
170 else |
|
171 { |
|
172 SetState( MMusAvaObserver::EMusAvaStatusAvailable ); |
|
173 MUS_LOG("CMusAvaNetworkAvailability::CallConnectedL EMusAvaStatusAvailable"); |
|
174 |
|
175 } |
159 |
176 |
160 MUS_LOG( "mus: [MUSAVA] \ |
177 MUS_LOG( "mus: [MUSAVA] \ |
161 <- CMusAvaNetworkAvailability::CallConnectedL()" ) |
178 <- CMusAvaNetworkAvailability::CallConnectedL()" ) |
162 } |
179 } |
163 |
180 |
170 void CMusAvaNetworkAvailability::ConferenceCallL() |
187 void CMusAvaNetworkAvailability::ConferenceCallL() |
171 { |
188 { |
172 MUS_LOG( "mus: [MUSAVA] \ |
189 MUS_LOG( "mus: [MUSAVA] \ |
173 -> CMusAvaNetworkAvailability::ConferenceCallL()" ) |
190 -> CMusAvaNetworkAvailability::ConferenceCallL()" ) |
174 //Report line status |
191 //Report line status |
|
192 iConfcall = ETrue; |
175 SetState( MMusAvaObserver::EMusAvaStatusConferenceCall ); |
193 SetState( MMusAvaObserver::EMusAvaStatusConferenceCall ); |
176 MUS_LOG( "mus: [MUSAVA] \ |
194 MUS_LOG( "mus: [MUSAVA] \ |
177 <- CMusAvaNetworkAvailability::ConferenceCallL()" ) |
195 <- CMusAvaNetworkAvailability::ConferenceCallL()" ) |
178 } |
196 } |
179 |
197 |
180 |
198 |
181 // ------------------------------------------------------------------------- |
199 // ------------------------------------------------------------------------- |
182 // This function is called when a cs call goes hold |
200 // This function is called when a cs call goes hold |
183 // ------------------------------------------------------------------------- |
201 // ------------------------------------------------------------------------- |
184 // |
202 // |
185 void CMusAvaNetworkAvailability::CallHoldL( const TDesC& aTelNumber, |
203 void CMusAvaNetworkAvailability::CallHoldL( const TDesC& aTelNumber ) |
186 TBool aIsSipUri) |
|
187 { |
204 { |
188 MUS_LOG( "mus: [MUSAVA] -> CMusAvaNetworkAvailability::CallHoldL()" ) |
205 MUS_LOG( "mus: [MUSAVA] -> CMusAvaNetworkAvailability::CallHoldL()" ) |
189 //Report line status |
206 //Report line status |
190 SetRemoteHostL( aTelNumber, aIsSipUri ); |
207 iSettings.SetTelNumberL( aTelNumber ); |
191 iSettings.SetCallDirection( iPhoneStatus->CallDirectionL() ); |
208 iSettings.SetCallDirection( iPhoneStatus->CallDirectionL() ); |
|
209 iSettings.SetCallPrivacy( iPhoneStatus->CallPrivacyL() ); |
192 SetState( MMusAvaObserver::EMusAvaStatusCallOnHold ); |
210 SetState( MMusAvaObserver::EMusAvaStatusCallOnHold ); |
193 MUS_LOG( "mus: [MUSAVA] <- CMusAvaNetworkAvailability::CallHoldL()" ) |
211 MUS_LOG( "mus: [MUSAVA] <- CMusAvaNetworkAvailability::CallHoldL()" ) |
194 } |
212 } |
195 |
213 |
196 |
214 |
202 void CMusAvaNetworkAvailability::NoActiveCallL() |
220 void CMusAvaNetworkAvailability::NoActiveCallL() |
203 { |
221 { |
204 MUS_LOG( "mus: [MUSAVA] -> CMusAvaNetworkAvailability::NoActiveCallL()" ) |
222 MUS_LOG( "mus: [MUSAVA] -> CMusAvaNetworkAvailability::NoActiveCallL()" ) |
205 |
223 |
206 iSettings.SetTelNumberL( KNullDesC() ); |
224 iSettings.SetTelNumberL( KNullDesC() ); |
207 CDesCArrayFlat* sipUris = |
|
208 new ( ELeave ) CDesCArrayFlat( KSipUriArrayGranularity ); |
|
209 CleanupStack::PushL( sipUris ); |
|
210 iSettings.SetSipAddressesL( sipUris ); |
|
211 CleanupStack::Pop( sipUris ); |
|
212 |
225 |
213 //Report line status |
226 //Report line status |
214 //Availability status |
227 //Availability status |
215 SetState( MMusAvaObserver::EMusAvaStatusNoCall ); |
228 SetState( MMusAvaObserver::EMusAvaStatusNoCall ); |
216 |
229 |
217 MUS_LOG( "mus: [MUSAVA] <- CMusAvaNetworkAvailability::NoActiveCallL()" ) |
230 MUS_LOG( "mus: [MUSAVA] <- CMusAvaNetworkAvailability::NoActiveCallL()" ) |
218 } |
231 } |
219 |
232 |
220 |
233 // ------------------------------------------------------------------------- |
221 void CMusAvaNetworkAvailability::SetRemoteHostL( const TDesC& aTelNumber, |
234 //This function is called when conference call terminted |
222 TBool aIsSipUri ) |
235 // |
|
236 // ------------------------------------------------------------------------- |
|
237 // |
|
238 void CMusAvaNetworkAvailability::ConferenceCallLTerminated() |
223 { |
239 { |
224 MUS_LOG1( "mus: [MUSAVA] -> CMusAvaNetworkAvailability::SetRemoteHostL(%d)", |
240 MUS_LOG( "mus: [MUSAVA] -> CMusAvaNetworkAvailability::ConferenceCallLTerminated()" ) |
225 aIsSipUri ) |
241 if ( iConfcall ) |
226 |
242 { |
227 if ( aIsSipUri ) |
243 iConfcall = EFalse; |
228 { |
244 } |
229 CDesCArrayFlat* sipUris = |
245 AvailabilitiesAbleToShowIndicator(); |
230 new ( ELeave ) CDesCArrayFlat( KSipUriArrayGranularity ); |
246 |
231 CleanupStack::PushL( sipUris ); |
247 MUS_LOG( "mus: [MUSAVA] <- CMusAvaNetworkAvailability::ConferenceCallLTerminated()" ) |
232 sipUris->AppendL( aTelNumber ); |
|
233 iSettings.SetSipAddressesL( sipUris ); |
|
234 CleanupStack::Pop( sipUris ); |
|
235 |
|
236 iSettings.SetUriForContactResolvingL( aTelNumber ); |
|
237 } |
|
238 else |
|
239 { |
|
240 iSettings.SetTelNumberL( aTelNumber ); |
|
241 } |
|
242 |
|
243 MUS_LOG( "mus: [MUSAVA] <- CMusAvaNetworkAvailability::SetRemoteHostL()" ) |
|
244 } |
248 } |