1 // Copyright (C) 2005 Open Source Telecom Corp.
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 //
17 // As a special exception, you may use this file as part of a free software
18 // library without restriction. Specifically, if other files instantiate
19 // templates or use macros or inline functions from this file, or you compile
20 // this file and link it with other files to produce an executable, this
21 // file does not by itself cause the resulting executable to be covered by
22 // the GNU General Public License. This exception does not however
23 // invalidate any other reasons why the executable file might be covered by
24 // the GNU General Public License.
25 //
26 // This exception applies only to the code released under the name GNU
27 // ccScript. If you copy code from other releases into a copy of GNU
28 // ccScript, as the General Public License permits, the exception does
29 // not apply to the code that you add in this way. To avoid misleading
30 // anyone as to the status of such modified files, you must delete
31 // this exception notice from them.
32 //
33 // If you write modifications of your own for GNU ccScript, it is your choice
34 // whether to permit this exception to apply to your modifications.
35 // If you do not wish that, delete this exception notice.
36 //
37
38 #ifndef CCXX_LIBEXEC_H_
39 #define CCXX_LIBEXEC_H_
40
41 #ifndef CCXX_BAYONNE_H_
43 #endif
44
45 #ifndef CCXX_SLOG_H_
47 #endif
48
49 #ifndef CCXX_PROCESS_H_
51 #endif
52
53 namespace ost {
54
64 {
65 protected:
70
71 public:
77
82
89 const char *getEnv(const char *id);
90
97 const char *getArg(const char *id);
98
107 const char *getPath(const char *filename, char *buffer, unsigned size);
108
115 const char *getFile(const char *filename);
116
123 {voice = voice;};
124
131 {level = level;};
132
136 void hangupSession(void);
137
141 void detachSession(unsigned code);
142
151 result_t sendCommand(const char *text, char *buffer = NULL, unsigned size = 0);
152
159 result_t sendResult(const char *text);
160
166 void sendError(const char *msg);
167
174 result_t xferCall(const char *dest);
175
182 result_t replayFile(const char *file);
183
191 result_t replayOffset(const char *file, const char *offset);
192
202
209 result_t speak(const char *format, ...);
210
219 result_t playTone(
const char *name,
timeout_t duration = 0,
unsigned level = 0);
220 result_t playSingleTone(
short f1,
timeout_t duration,
unsigned level = 0);
221 result_t playDualTone(
short f1,
short f2,
timeout_t duration,
unsigned level = 0);
222
232 result_t recordOffset(
const char *file,
const char *offset,
timeout_t duration,
timeout_t silence = 0);
233
240 result_t eraseFile(const char *file);
241
249 result_t moveFile(const char *file1, const char *file2);
250
254 result_t clearInput(void);
255
262
271 result_t readInput(
char *buffer,
unsigned size,
timeout_t timeout);
272
280
281 result_t sizeSym(const char *id, unsigned size);
282 result_t addSym(const char *id, const char *value);
283 result_t setSym(const char *id, const char *value);
284 result_t getSym(const char *id, char *buf, unsigned size);
285
293 void postSym(const char *id, const char *value);
294 };
295
297 {
298 protected:
300
301 void sysPost(const char *sid, char *id, const char *value);
302 void sysVar(const char *tsid, char *id, const char *value, int size);
303 void sysHeader(const char *tsid);
304 void sysArgs(const char *tsid);
305 void sysStatus(const char *tsid);
306 void sysRecord(const char *tsid, char *token);
307 void sysReplay(const char *tsid, char *token);
308 void sysFlush(const char *tsid);
309 void sysWait(const char *tsid, char *token);
310 void sysTone(const char *tsid, char *token);
311 void sysSTone(const char *tsid, char *token);
312 void sysDTone(const char *tsid, char *token);
313 void sysPrompt(const char *tsid, const char *voice, const char *text);
314 void sysInput(const char *tsid, char *token);
315 void sysHangup(const char *tsid);
316 void sysExit(const char *tsid, char *token);
317 void sysError(const char *tsid, char *token);
318 void sysReturn(const char *tsid, const char *text);
319 void sysXfer(const char *tsid, const char *dest);
320 };
321
329 {
330 private:
332 #ifndef WIN32
333 static int iopair[2];
334 #endif
336
337 static void readline(char *buf, unsigned max);
338
339 void run(void);
340
343
344 public:
346 static void allocate(const char *path, size_t bs = 0, int pri = 0, const char *modpath = NULL);
347 static void cleanup(void);
348 static void startup(void);
349 };
350
351 }; // namespace
352
353 #endif
Generic Bayonne master class to reference various useful data types and core static members used for ...
Core class for any server which impliments libexec functionality.
Keydata objects are used to load and hold "configuration" data for a given application.
Container class for applications implimenting the libexec process method of Bayonne interfacing...
static BayonneSysexec * libexec
The primary session object representing a server timeslot and active communication endpoint in Bayonn...
Every thread of execution in an application is created by instantiating an object of a class derived ...
void setVoice(const char *voice)
Set the effective voice library to use.
System logging facilities abstraction.
void setLevel(Audio::Level level)
Set the effective audio level for tones...