1 /*
2  * Copyright 2008-2014 Arsen Chaloyan
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Id: dtmfsession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17  */
18 
19 #ifndef DTMF_SESSION_H
20 #define DTMF_SESSION_H
21 
22 /**
23  * @file dtmfsession.h
24  * @brief DTMF Recognition Session
25  */
26 
27 #include "umcsession.h"
28 
29 class DtmfScenario;
30 struct RecogChannel;
31 
32 class DtmfSession : public UmcSession
33 {
34 public:
35 /* ============================ CREATORS =================================== */
36 	DtmfSession(const DtmfScenario* pScenario);
37 	virtual ~DtmfSession();
38 
39 protected:
40 /* ============================ MANIPULATORS =============================== */
41 	virtual bool Start();
42 
43 	RecogChannel* CreateRecogChannel();
44 	bool StartRecognition(mrcp_channel_t* pMrcpChannel);
45 
46 	mrcp_message_t* CreateRecognizeRequest(mrcp_channel_t* pMrcpChannel);
47 
48 	static bool ParseNLSMLResult(mrcp_message_t* pMrcpMessage);
49 
50 /* ============================ HANDLERS =================================== */
51 	virtual bool OnSessionTerminate(mrcp_sig_status_code_e status);
52 	virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status);
53 	virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message);
54 
55 /* ============================ ACCESSORS ================================== */
56 	const DtmfScenario* GetScenario() const;
57 
58 private:
59 /* ============================ DATA ======================================= */
60 	RecogChannel*         m_pRecogChannel;
61 };
62 
63 
64 /* ============================ INLINE METHODS ============================= */
GetScenario()65 inline const DtmfScenario* DtmfSession::GetScenario() const
66 {
67 	return (DtmfScenario*)m_pScenario;
68 }
69 
70 #endif /* DTMF_SESSION_H */
71