1 /*
2  * Copyright (C) 2002-2003 Fhg Fokus
3  * Copyright (C) 2006 iptego GmbH
4  *
5  * This file is part of SEMS, a free SIP media server.
6  *
7  * SEMS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * For a license to use the sems software under conditions
13  * other than those described here, or to purchase support for this
14  * software, please contact iptel.org by e-mail at the following addresses:
15  *    info@iptel.org
16  *
17  * SEMS is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25  */
26 
27 #ifndef _ANNOUNCETRANSFER_H_
28 #define _ANNOUNCETRANSFER_H_
29 
30 #include "AmSession.h"
31 #include "AmAudioFile.h"
32 #include "AmConfigReader.h"
33 
34 #include <string>
35 using std::string;
36 
37 /** \brief session factory for announce_transfer sessions */
38 class AnnounceTransferFactory: public AmSessionFactory
39 {
40 public:
41   static string AnnouncePath;
42   static string AnnounceFile;
43 
44   AnnounceTransferFactory(const string& _app_name);
45 
46   int onLoad();
47   AmSession* onInvite(const AmSipRequest& req, const string& app_name,
48 		      const map<string,string>& app_params);
49 };
50 
51 /** \brief session logic implementation for announce_transfer sessions */
52 class AnnounceTransferDialog : public AmSession
53 {
54   string callee_uri;
55 
56   AmAudioFile wav_file;
57   string filename;
58 
59   unsigned int status;
60 
61   enum  { Disconnected = 0,
62 	  Announcing,
63 	  Transfering,
64 	  Hangup        // remote hangup
65   } AnnounceStatus;
66 public:
67   AnnounceTransferDialog(const string& filename);
68   ~AnnounceTransferDialog();
69 
70   void onInvite(const AmSipRequest& req);
71   void onSessionStart();
72   void startSession();
73   void onBye(const AmSipRequest& req);
74   void onSipRequest(const AmSipRequest& req);
75   void onSipReply(const AmSipRequest& req, const AmSipReply& rep,
76 		  AmBasicSipDialog::Status old_dlg_status);
onDtmf(int event,int duration_msec)77   void onDtmf(int event, int duration_msec) {}
78 
79   void process(AmEvent* event);
80 };
81 
82 #endif
83 // Local Variables:
84 // mode:C++
85 // End:
86 
87