Yate: yatephone.h Source File

Yate

yatephone.h
1
21
22#ifndef __YATEPHONE_H
23#define __YATEPHONE_H
24
25#ifndef __cplusplus
26#error C++ is required
27#endif
28
29#include <yatengine.h>
30
34namespace TelEngine {
35
39 struct YATE_API ImageInfo {
43 int width;
44
48 int height;
49
53 int depth;
54};
55
59 struct YATE_API FormatInfo {
63 const char* name;
64
68 const char* type;
69
73 int frameSize;
74
78 int frameTime;
79
83 int sampleRate;
84
88 int numChannels;
89
93 bool converter;
94
100 int guessSamples(int len) const;
101
106 int dataRate() const;
107
111 inline FormatInfo()
112 : name(0), type("audio"),
113 frameSize(0), frameTime(0),
114 sampleRate(8000), numChannels(1),
115 converter(false)
116 { }
117
121 inline explicit FormatInfo(const char* _name, int fsize = 0, int ftime = 10000,
122 const char* _type = "audio", int srate = 8000, int nchan = 1, bool convert = false)
123 : name(_name), type(_type),
124 frameSize(fsize), frameTime(ftime),
125 sampleRate(srate), numChannels(nchan),
126 converter(convert)
127 { }
128};
129
130class DataEndpoint;
131class CallEndpoint;
132class Driver;
133
138 struct YATE_API TranslatorCaps {
140 const FormatInfo* src;
142 const FormatInfo* dest;
144 int cost;
145};
146
151 class YATE_API FormatRepository
152{
153 YNOCOPY(FormatRepository); // no automatic copies please
154private:
155 FormatRepository();
156public:
162 static const FormatInfo* getFormat(const String& name);
163
175 static const FormatInfo* addFormat(const String& name, int fsize, int ftime, const String& type = "audio", int srate = 8000, int nchan = 1);
176};
177
182 class YATE_API DataFormat : public NamedList
183{
184public:
188 inline DataFormat()
189 : NamedList((const char*)0), m_parsed(0)
190 { }
191
196 inline DataFormat(const char* value)
197 : NamedList(value), m_parsed(0)
198 { }
199
204 inline DataFormat(const DataFormat& value)
205 : NamedList(value), m_parsed(value.getInfo())
206 { }
207
212 inline DataFormat(const String& value)
213 : NamedList(value), m_parsed(0)
214 { }
215
220 inline DataFormat(const NamedList& value)
221 : NamedList(value), m_parsed(0)
222 { }
223
228 inline DataFormat(const String* value)
229 : NamedList(value ? value->c_str() : (const char*)0), m_parsed(0)
230 { }
231
236 inline explicit DataFormat(const FormatInfo* format)
237 : NamedList(format ? format->name : (const char*)0), m_parsed(format)
238 { }
239
243 inline DataFormat& operator=(const DataFormat& value)
244 { NamedList::operator=(value); m_parsed = value.getInfo(); return *this; }
245
250 const FormatInfo* getInfo() const;
251
257 inline int frameSize(int defValue = 0) const
258 { return getInfo() ? getInfo()->frameSize : defValue; }
259
265 inline int frameTime(int defValue = 0) const
266 { return getInfo() ? getInfo()->frameTime : defValue; }
267
274 inline int sampleRate(int defValue = 0) const
275 { return getInfo() ? getInfo()->sampleRate : defValue; }
276
282 inline int numChannels(int defValue = 1) const
283 { return getInfo() ? getInfo()->numChannels : defValue; }
284
285protected:
289 virtual void changed();
290
291private:
292 mutable const FormatInfo* m_parsed;
293};
294
298 class YATE_API DataNode : public RefObject
299{
300 friend class DataEndpoint;
301 YNOCOPY(DataNode); // no automatic copies please
302public:
306 enum DataFlags {
307 DataStart = 0x0001,
308 DataEnd = 0x0002,
309 DataMark = 0x0004,
310 DataSilent = 0x0008,
311 DataMissed = 0x0010,
312 DataError = 0x0020,
313 DataPrivate = 0x0100
314 };
315
320 inline explicit DataNode(const char* format = 0)
321 : m_format(format), m_timestamp(0)
322 { }
323
329 virtual int costFormat(const DataFormat& format)
330 { return -1; }
331
337 virtual bool setFormat(const DataFormat& format)
338 { return false; }
339
344 inline const DataFormat& getFormat() const
345 { return m_format; }
346
351 inline unsigned long timeStamp() const
352 { return m_timestamp; }
353
358 virtual bool valid() const
359 { return true; }
360
366 virtual bool control(NamedList& params)
367 { return false; }
368
373 inline static unsigned long invalidStamp()
374 { return (unsigned long)-1; }
375
381 virtual void attached(bool added)
382 { }
383
384protected:
385 DataFormat m_format;
386 unsigned long m_timestamp;
387};
388
389class DataSource;
390class DataTranslator;
391class TranslatorFactory;
392class ThreadedSourcePrivate;
393
397 class YATE_API DataConsumer : public DataNode
398{
399 friend class DataSource;
400
401public:
406 inline explicit DataConsumer(const char* format = "slin")
407 : DataNode(format),
408 m_source(0), m_override(0),
409 m_regularTsDelta(0), m_overrideTsDelta(0), m_lastTsTime(0)
410 { }
411
415 virtual void destroyed();
416
422 virtual void* getObject(const String& name) const;
423
433 virtual unsigned long Consume(const DataBlock& data, unsigned long tStamp, unsigned long flags) = 0;
434
439 inline DataSource* getConnSource() const
440 { return m_source; }
441
446 inline DataSource* getOverSource() const
447 { return m_override; }
448
453 virtual DataSource* getTransSource() const
454 { return 0; }
455
456protected:
462 virtual bool synchronize(DataSource* source);
463
464private:
465 unsigned long Consume(const DataBlock& data, unsigned long tStamp,
466 unsigned long flags, DataSource* source);
467 DataSource* m_source;
468 DataSource* m_override;
469 long m_regularTsDelta;
470 long m_overrideTsDelta;
471 u_int64_t m_lastTsTime;
472};
473
477 class YATE_API DataSource : public DataNode, public Mutex
478{
479 friend class DataTranslator;
480 YNOCOPY(DataSource); // no automatic copies please
481public:
486 inline explicit DataSource(const char* format = "slin")
487 : DataNode(format), Mutex(false,"DataSource"),
488 m_nextStamp(invalidStamp()), m_translator(0) { }
489
493 virtual void destroyed();
494
500 virtual void* getObject(const String& name) const;
501
506 virtual bool valid() const;
507
513 virtual bool control(NamedList& params);
514
522 unsigned long Forward(const DataBlock& data, unsigned long tStamp = invalidStamp(),
523 unsigned long flags = 0);
524
531 bool attach(DataConsumer* consumer, bool override = false);
532
538 bool detach(DataConsumer* consumer);
539
543 void clear();
544
549 inline DataTranslator* getTranslator() const
550 { return m_translator; }
551
556 void synchronize(unsigned long tStamp);
557
562 inline unsigned long nextStamp() const
563 { return m_nextStamp; }
564
565protected:
566 unsigned long m_nextStamp;
567 ObjList m_consumers;
568private:
569 inline void setTranslator(DataTranslator* translator) {
570 Lock mylock(this);
571 m_translator = translator;
572 }
573 bool detachInternal(DataConsumer* consumer);
574 DataTranslator* m_translator;
575};
576
581 class YATE_API ThreadedSource : public DataSource
582{
583 friend class ThreadedSourcePrivate;
584public:
588 virtual void destroyed();
589
596 bool start(const char* name = "ThreadedSource", Thread::Priority prio = Thread::Normal);
597
601 void stop();
602
607 Thread* thread() const;
608
613 bool running() const;
614
615protected:
620 inline explicit ThreadedSource(const char* format = "slin")
621 : DataSource(format), m_thread(0)
622 { }
623
627 virtual void run() = 0;
628
633 virtual void cleanup();
634
640 bool looping(bool runConsumers = false) const;
641
642private:
643 ThreadedSourcePrivate* m_thread;
644};
645
651 class YATE_API DataTranslator : public DataConsumer
652{
653 friend class TranslatorFactory;
654public:
660 DataTranslator(const char* sFormat, const char* dFormat);
661
668 explicit DataTranslator(const char* sFormat, DataSource* source = 0);
669
673 ~DataTranslator();
674
680 virtual void* getObject(const String& name) const;
681
686 virtual bool valid() const
687 { return m_tsource && m_tsource->valid(); }
688
693 virtual DataSource* getTransSource() const
694 { return m_tsource; }
695
700 DataTranslator* getFirstTranslator();
701
706 const DataTranslator* getFirstTranslator() const;
707
716 static ObjList* srcFormats(const DataFormat& dFormat = "slin", int maxCost = -1, unsigned int maxLen = 0, ObjList* lst = 0);
717
726 static ObjList* destFormats(const DataFormat& sFormat = "slin", int maxCost = -1, unsigned int maxLen = 0, ObjList* lst = 0);
727
736 static ObjList* allFormats(const ObjList* formats, bool existing = true, bool sameRate = true, bool sameChans = true);
737
746 static ObjList* allFormats(const String& formats, bool existing = true, bool sameRate = true, bool sameChans = true);
747
754 static bool canConvert(const DataFormat& fmt1, const DataFormat& fmt2 = "slin");
755
762 static int cost(const DataFormat& sFormat, const DataFormat& dFormat);
763
770 static DataTranslator* create(const DataFormat& sFormat, const DataFormat& dFormat);
771
779 static bool attachChain(DataSource* source, DataConsumer* consumer, bool override = false);
780
787 static bool detachChain(DataSource* source, DataConsumer* consumer);
788
793 static void setMaxChain(unsigned int maxChain);
794
795protected:
800 inline ObjList* getConsumers() const
801 { return m_tsource ? m_tsource->m_consumers.skipNull() : 0; }
802
808 virtual bool synchronize(DataSource* source);
809
814 static void install(TranslatorFactory* factory);
815
820 static void uninstall(TranslatorFactory* factory);
821
822private:
823 DataTranslator(); // No default constructor please
824 static void compose();
825 static void compose(TranslatorFactory* factory);
826 static bool canConvert(const FormatInfo* fmt1, const FormatInfo* fmt2);
827 DataSource* m_tsource;
828 static Mutex s_mutex;
829 static ObjList s_factories;
830 static unsigned int s_maxChain;
831};
832
838 class YATE_API TranslatorFactory : public GenObject
839{
840 YNOCOPY(TranslatorFactory); // no automatic copies please
841protected:
846 inline explicit TranslatorFactory(const char* name = 0)
847 : m_name(name ? name : "?")
848 { m_counter = Thread::getCurrentObjCounter(true); DataTranslator::install(this); }
849
850public:
854 virtual ~TranslatorFactory();
855
860 virtual void removed(const TranslatorFactory* factory);
861
868 virtual DataTranslator* create(const DataFormat& sFormat, const DataFormat& dFormat) = 0;
869
874 virtual const TranslatorCaps* getCapabilities() const = 0;
875
882 virtual bool converts(const DataFormat& sFormat, const DataFormat& dFormat) const;
883
888 virtual unsigned int length() const;
889
895 virtual bool intermediate(const FormatInfo* info) const;
896
901 virtual const FormatInfo* intermediate() const;
902
907 virtual const char* name() const
908 { return m_name; }
909
914 inline NamedCounter* objectsCounter() const
915 { return m_counter; }
916
917private:
918 const char* m_name;
919 NamedCounter* m_counter;
920};
921
927 class YATE_API DataEndpoint : public RefObject
928{
929 YNOCOPY(DataEndpoint); // no automatic copies please
930public:
934 explicit DataEndpoint(CallEndpoint* call = 0, const char* name = "audio");
935
939 virtual void destroyed();
940
946 virtual void* getObject(const String& name) const;
947
952 virtual const String& toString() const;
953
958 Mutex* mutex() const;
959
964 static Mutex& commonMutex();
965
971 bool connect(DataEndpoint* peer);
972
977 bool disconnect();
978
983 void setSource(DataSource* source = 0);
984
989 inline DataSource* getSource() const
990 { return m_source; }
991
996 void setConsumer(DataConsumer* consumer = 0);
997
1002 inline DataConsumer* getConsumer() const
1003 { return m_consumer; }
1004
1010 void setPeerRecord(DataConsumer* consumer = 0);
1011
1016 inline DataConsumer* getPeerRecord() const
1017 { return m_peerRecord; }
1018
1024 void setCallRecord(DataConsumer* consumer = 0);
1025
1030 inline DataConsumer* getCallRecord() const
1031 { return m_callRecord; }
1032
1038 bool clearData(DataNode* node);
1039
1045 bool addSniffer(DataConsumer* sniffer);
1046
1052 bool delSniffer(DataConsumer* sniffer);
1053
1060 DataConsumer* getSniffer(const String& name, bool ref = false);
1061
1065 void clearSniffers();
1066
1071 inline DataEndpoint* getPeer() const
1072 { return m_peer; }
1073
1078 inline CallEndpoint* getCall() const
1079 { return m_call; }
1080
1085 inline const String& name() const
1086 { return m_name; }
1087
1093 inline void clearCall(const CallEndpoint* call)
1094 { if (call == m_call) m_call = 0; }
1095
1101 virtual bool control(NamedList& params);
1102
1103protected:
1109 virtual bool nativeConnect(DataEndpoint* peer)
1110 { return false; }
1111
1112private:
1113 String m_name;
1114 DataSource* m_source;
1115 DataConsumer* m_consumer;
1116 DataEndpoint* m_peer;
1117 CallEndpoint* m_call;
1118 DataConsumer* m_peerRecord;
1119 DataConsumer* m_callRecord;
1120 ObjList m_sniffers;
1121};
1122
1127 class YATE_API CallEndpoint : public RefObject
1128{
1129 friend class DataEndpoint;
1130 YNOCOPY(CallEndpoint); // no automatic copies please
1131private:
1132 CallEndpoint* m_peer;
1133 const void* m_lastPeer;
1134 String m_id;
1135 String m_lastPeerId;
1136
1137protected:
1138 ObjList m_data;
1139 Mutex* m_mutex;
1140
1141public:
1145 virtual void destroyed();
1146
1152 virtual void* getObject(const String& name) const;
1153
1158 virtual const String& toString() const
1159 { return m_id; }
1160
1165 inline const String& id() const
1166 { return m_id; }
1167
1172 inline CallEndpoint* getPeer() const
1173 { return m_peer; }
1174
1180 bool getPeerId(String& id) const;
1181
1186 String getPeerId() const;
1187
1193 bool getLastPeerId(String& id) const;
1194
1198 void setLastPeerId();
1199
1204 inline Mutex* mutex() const
1205 { return m_mutex; }
1206
1211 static Mutex& commonMutex();
1212
1220 bool connect(CallEndpoint* peer, const char* reason = 0, bool notify = true);
1221
1229 inline bool disconnect(const char* reason = 0, bool notify = true, const NamedList* params = 0)
1230 { return disconnect(false,reason,notify,params); }
1231
1238 inline bool disconnect(const char* reason, const NamedList& params)
1239 { return disconnect(false,reason,true,&params); }
1240
1246 DataEndpoint* getEndpoint(const String& type = CallEndpoint::audioType()) const;
1247
1253 DataEndpoint* setEndpoint(const String& type = CallEndpoint::audioType());
1254
1259 void clearEndpoint(const String& type = String::empty());
1260
1266 void setSource(DataSource* source = 0, const String& type = CallEndpoint::audioType());
1267
1273 DataSource* getSource(const String& type = CallEndpoint::audioType()) const;
1274
1280 void setConsumer(DataConsumer* consumer = 0, const String& type = CallEndpoint::audioType());
1281
1287 DataConsumer* getConsumer(const String& type = CallEndpoint::audioType()) const;
1288
1295 bool clearData(DataNode* node, const String& type = CallEndpoint::audioType());
1296
1301 static const String& audioType();
1302
1303protected:
1307 CallEndpoint(const char* id = 0);
1308
1313 virtual void connected(const char* reason) { }
1314
1320 virtual void disconnected(bool final, const char* reason) { }
1321
1326 virtual void setDisconnect(const NamedList* params) { }
1327
1335 void setPeer(CallEndpoint* peer, const char* reason = 0, bool notify = true, const NamedList* params = 0);
1336
1341 void setEndpoint(DataEndpoint* endPoint);
1342
1347 virtual void setId(const char* newId);
1348
1349private:
1350 bool disconnect(bool final, const char* reason, bool notify, const NamedList* params);
1351};
1352
1357 class YATE_API Module : public Plugin, public Mutex, public MessageReceiver
1358{
1359 YNOCOPY(Module); // no automatic copies please
1360private:
1361 bool m_init;
1362 int m_relays;
1363 String m_type;
1364 Regexp m_filter;
1365 u_int64_t m_changed;
1366 static unsigned int s_delay;
1367
1368public:
1374 virtual void* getObject(const String& name) const;
1375
1380 inline const String& type() const
1381 { return m_type; }
1382
1387 void changed();
1388
1393 inline static unsigned int updateDelay()
1394 { return s_delay; }
1395
1400 inline static void updateDelay(unsigned int delay)
1401 { s_delay = delay; }
1402
1407 inline bool filterInstalled() const
1408 { return !m_filter.null(); }
1409
1415 bool filterDebug(const String& item) const;
1416
1424 static bool itemComplete(String& itemList, const String& item, const String& partWord);
1425
1433 static inline bool itemComplete(String& itemList, const ObjList& list, const String& partWord) {
1434 bool ok = false;
1435 for (ObjList* o = list.skipNull(); o; o = o->skipNext())
1436 ok = itemComplete(itemList,o->get()->toString(),partWord) || ok;
1437 return ok;
1438 }
1439
1447 static inline bool itemComplete(String& itemList, const TokenDict* dict, const String& partWord) {
1448 if (!dict)
1449 return false;
1450 bool ok = false;
1451 for (; dict->token; ++dict)
1452 ok = itemComplete(itemList,dict->token,partWord) || ok;
1453 return ok;
1454 }
1455
1463 static inline bool itemComplete(String& itemList, const TokenDict64* dict, const String& partWord) {
1464 if (!dict)
1465 return false;
1466 bool ok = false;
1467 for (; dict->token; ++dict)
1468 ok = itemComplete(itemList,dict->token,partWord) || ok;
1469 return ok;
1470 }
1471
1472protected:
1476 enum {
1477 // Module messages
1478 Status = 0x00000001,
1479 Timer = 0x00000002,
1480 Level = 0x00000004,
1481 Command = 0x00000008,
1482 Help = 0x00000010,
1483 Halt = 0x00000020,
1484 Route = 0x00000040,
1485 Stop = 0x00000080,
1486 // Driver messages
1487 Execute = 0x00000100,
1488 Drop = 0x00000200,
1489 // Channel messages
1490 Locate = 0x00000400,
1491 Masquerade = 0x00000800,
1492 Ringing = 0x00001000,
1493 Answered = 0x00002000,
1494 Tone = 0x00004000,
1495 Text = 0x00008000,
1496 Progress = 0x00010000,
1497 Update = 0x00020000,
1498 Transfer = 0x00040000,
1499 Control = 0x00080000,
1500 // Instant messaging related
1501 MsgExecute = 0x00100000,
1502 // Last possible public ID
1503 PubLast = 0x00ffffff,
1504 // Private messages base ID
1505 Private = 0x01000000
1506 } RelayID;
1507
1513 static const char* messageName(int id);
1514
1520 static inline int relayId(const char* name)
1521 { return lookup(name,s_messages); }
1522
1529 Module(const char* name, const char* type = 0, bool earlyInit = false);
1530
1534 virtual ~Module();
1535
1539 virtual void initialize();
1540
1544 void setup();
1545
1551 inline bool relayInstalled(int id) const
1552 { return (id & m_relays) != 0; }
1553
1561 bool installRelay(int id, unsigned priority = 100, NamedString* filter = 0);
1562
1570 bool installRelay(const char* name, unsigned priority = 100, NamedString* filter = 0);
1571
1580 bool installRelay(int id, const char* name, unsigned priority = 100, NamedString* filter = 0);
1581
1587 bool installRelay(MessageRelay* relay);
1588
1595 bool uninstallRelay(MessageRelay* relay, bool delRelay = true);
1596
1603 bool uninstallRelay(int id, bool delRelay = true);
1604
1609 bool uninstallRelays();
1610
1617 virtual bool received(Message &msg, int id);
1618
1623 virtual void genUpdate(Message& msg);
1624
1629 virtual void msgTimer(Message& msg);
1630
1635 virtual void msgStatus(Message& msg);
1636
1642 virtual bool msgRoute(Message& msg);
1643
1650 virtual bool msgCommand(Message& msg);
1651
1656 virtual void statusModule(String& str);
1657
1662 virtual void statusParams(String& str);
1663
1668 virtual void statusDetail(String& str);
1669
1676 virtual bool commandExecute(String& retVal, const String& line);
1677
1685 virtual bool commandComplete(Message& msg, const String& partLine, const String& partWord);
1686
1692 virtual bool setDebug(Message& msg, const String& target);
1693
1694private:
1695 Module(); // no default constructor please
1696 static TokenDict s_messages[];
1697 ObjList m_relayList;
1698};
1699
1704 class YATE_API Channel : public CallEndpoint, public DebugEnabler, public MessageNotifier
1705{
1706 friend class Driver;
1707 friend class Router;
1708 YNOCOPY(Channel); // no automatic copies please
1709private:
1710 NamedList m_parameters;
1711 NamedList* m_chanParams; // Channel parameters to be set in all messages
1712 Driver* m_driver;
1713 bool m_outgoing;
1714 u_int64_t m_timeout;
1715 u_int64_t m_maxcall;
1716 u_int64_t m_maxPDD; // Timeout while waiting for some progress on outgoing calls
1717 u_int64_t m_dtmfTime;
1718 unsigned int m_toutAns;
1719 unsigned int m_dtmfSeq;
1720 String m_dtmfText;
1721 String m_dtmfDetected;
1722
1723protected:
1724 String m_status;
1725 String m_address;
1726 String m_targetid;
1727 String m_billid;
1728 bool m_answered;
1729
1730public:
1734 virtual ~Channel();
1735
1741 virtual void* getObject(const String& name) const;
1742
1747 static Mutex& paramMutex();
1748
1754 virtual void complete(Message& msg, bool minimal = false) const;
1755
1763 Message* message(const char* name, bool minimal = false, bool data = false);
1764
1775 Message* message(const char* name, const NamedList* original, const char* params = 0, bool minimal = false, bool data = false);
1776
1787 inline Message* message(const char* name, const NamedList& original, const char* params = 0, bool minimal = false, bool data = false)
1788 { return message(name,&original,params,minimal,data); }
1789
1795 virtual bool msgProgress(Message& msg);
1796
1802 virtual bool msgRinging(Message& msg);
1803
1809 virtual bool msgAnswered(Message& msg);
1810
1817 virtual bool msgTone(Message& msg, const char* tone);
1818
1825 virtual bool msgText(Message& msg, const char* text);
1826
1833 virtual bool msgDrop(Message& msg, const char* reason);
1834
1840 virtual bool msgTransfer(Message& msg);
1841
1847 virtual bool msgUpdate(Message& msg);
1848
1854 virtual bool msgMasquerade(Message& msg);
1855
1860 virtual void msgStatus(Message& msg);
1861
1867 virtual bool msgControl(Message& msg);
1868
1874 virtual void checkTimers(Message& msg, const Time& tmr);
1875
1882 virtual bool callPrerouted(Message& msg, bool handled);
1883
1889 virtual bool callRouted(Message& msg);
1890
1895 virtual void callAccept(Message& msg);
1896
1903 virtual void callRejected(const char* error, const char* reason = 0, const Message* msg = 0);
1904
1910 virtual void callConnect(Message& msg);
1911
1916 virtual bool setDebug(Message& msg);
1917
1925 inline String& getStatus(String& buf, bool append = true) const {
1926 Lock lck(chanDataMutex());
1927 if (append)
1928 buf += m_status;
1929 else
1930 buf = m_status;
1931 return buf;
1932 }
1933
1941 inline void putStatus(NamedList& list, const char* param = "status", bool append = true) const {
1942 NamedString* ns = new NamedString(param);
1943 getStatus(*ns);
1944 if (append)
1945 list.addParam(ns);
1946 else
1947 list.setParam(ns);
1948 }
1949
1954 inline const String& address() const
1955 { return m_address; }
1956
1961 inline bool isOutgoing() const
1962 { return m_outgoing; }
1963
1968 inline bool isIncoming() const
1969 { return !m_outgoing; }
1970
1975 inline bool isAnswered() const
1976 { return m_answered; }
1977
1982 const char* direction() const;
1983
1988 inline Driver* driver() const
1989 { return m_driver; }
1990
1995 inline u_int64_t timeout() const
1996 { return m_timeout; }
1997
2002 inline void timeout(u_int64_t tout)
2003 { m_timeout = tout; }
2004
2009 inline u_int64_t maxcall() const
2010 { return m_maxcall; }
2011
2016 inline void maxcall(u_int64_t tout)
2017 { m_maxcall = tout; }
2018
2024 inline void setMaxcall(const Message& msg, int defTout = -1)
2025 { setMaxcall(&msg,defTout); }
2026
2032 void setMaxcall(const Message* msg, int defTout = -1);
2033
2039 inline u_int64_t maxPDD() const
2040 { return m_maxPDD; }
2041
2047 inline void maxPDD(u_int64_t tout)
2048 { m_maxPDD = tout; }
2049
2055 void setMaxPDD(const Message& msg);
2056
2062 inline const String& targetid() const
2063 { return m_targetid; }
2064
2070 inline const String& billid() const
2071 { return m_billid; }
2072
2077 void initChan();
2078
2085 bool startRouter(Message* msg);
2086
2091 static unsigned int allocId();
2092
2097 void filterDebug(const String& item);
2098
2103 inline const NamedList& parameters() const
2104 { return m_parameters; }
2105
2111 inline void setChanParams(const NamedList& list, bool in = false) {
2112 const String& pref = in ? list[YSTRING("ichanparams-prefix")] : list[YSTRING("chanparams-prefix")];
2113 if (!pref)
2114 return;
2115 Lock lck(paramMutex());
2116 if (!m_chanParams)
2117 m_chanParams = new NamedList("");
2118 m_chanParams->copySubParams(list,pref,true,true);
2119 }
2120
2125 inline void copyChanParams(NamedList& list) const {
2126 if (!m_chanParams)
2127 return;
2128 Lock lck(paramMutex());
2129 list.copyParams(*m_chanParams);
2130 }
2131
2137 virtual void dispatched(const Message& msg, bool handled);
2138
2139protected:
2143 Channel(Driver* driver, const char* id = 0, bool outgoing = false);
2144
2148 Channel(Driver& driver, const char* id = 0, bool outgoing = false);
2149
2154 void cleanup();
2155
2159 void dropChan();
2160
2165 virtual void zeroRefs();
2166
2171 virtual void connected(const char* reason);
2172
2178 virtual void disconnected(bool final, const char* reason);
2179
2184 virtual void setDisconnect(const NamedList* params);
2185
2191 virtual void endDisconnect(const Message& msg, bool handled);
2192
2197 virtual void setId(const char* newId);
2198
2204 virtual Message* getDisconnect(const char* reason);
2205
2211 void status(const char* newstat);
2212
2218 inline const String& getStatus() const
2219 { return m_status; }
2220
2225 virtual void statusParams(String& str);
2226
2231 inline void setOutgoing(bool outgoing = true)
2232 { m_outgoing = outgoing; }
2233
2239 bool dtmfSequence(Message& msg);
2240
2246 bool dtmfEnqueue(Message* msg);
2247
2254 bool dtmfInband(const char* tone);
2255
2262 bool toneDetect(const char* sniffer = 0);
2263
2268 inline NamedList& parameters()
2269 { return m_parameters; }
2270
2271private:
2272 void init();
2273 Channel(); // no default constructor please
2274 static Mutex s_chanDataMutex;
2275 // Just in case we are going to (re)move the channel data mutex!
2276 static inline Mutex* chanDataMutex()
2277 { return &s_chanDataMutex; }
2278};
2279
2284 class YATE_API Driver : public Module
2285{
2286 friend class Router;
2287 friend class Channel;
2288
2289private:
2290 bool m_init;
2291 bool m_varchan;
2292 String m_prefix;
2293 ObjList m_chans;
2294 int m_routing;
2295 int m_routed;
2296 int m_total;
2297 unsigned int m_nextid;
2298 int m_timeout;
2299 int m_maxroute;
2300 int m_maxchans;
2301 int m_chanCount;
2302 bool m_dtmfDups;
2303 volatile bool m_doExpire;
2304
2305public:
2311 virtual void* getObject(const String& name) const;
2312
2317 inline const String& prefix() const
2318 { return m_prefix; }
2319
2324 inline bool varchan() const
2325 { return m_varchan; }
2326
2331 inline ObjList& channels()
2332 { return m_chans; }
2333
2339 virtual Channel* find(const String& id) const;
2340
2345 virtual bool isBusy() const;
2346
2351 virtual void dropAll(Message &msg);
2352
2358 virtual bool canAccept(bool routers = true);
2359
2364 virtual bool canRoute();
2365
2370 unsigned int nextid();
2371
2376 inline unsigned int lastid() const
2377 { return m_nextid; }
2378
2383 inline int timeout() const
2384 { return m_timeout; }
2385
2390 inline int routing() const
2391 { return m_routing; }
2392
2397 inline int routed() const
2398 { return m_routed; }
2399
2404 inline int total() const
2405 { return m_total; }
2406
2411 inline int chanCount() const
2412 { return m_chanCount; }
2413
2418 inline int maxChans() const
2419 { return m_maxchans; }
2420
2421protected:
2427 Driver(const char* name, const char* type = 0);
2428
2432 virtual void initialize();
2433
2439 void setup(const char* prefix = 0, bool minimal = false);
2440
2447 virtual bool received(Message &msg, int id);
2448
2453 virtual void genUpdate(Message& msg);
2454
2461 virtual bool hasLine(const String& line) const;
2462
2469 virtual bool msgRoute(Message& msg);
2470
2477 virtual bool msgExecute(Message& msg, String& dest) = 0;
2478
2486 virtual bool commandComplete(Message& msg, const String& partLine, const String& partWord);
2487
2492 virtual void statusModule(String& str);
2493
2498 virtual void statusParams(String& str);
2499
2504 virtual void statusDetail(String& str);
2505
2511 virtual bool setDebug(Message& msg, const String& target);
2512
2516 virtual void loadLimits();
2517
2522 virtual bool canStopCall() const
2523 { return false; }
2524
2529 inline void varchan(bool variable)
2530 { m_varchan = variable; }
2531
2536 inline void timeout(int tout)
2537 { m_timeout = tout; }
2538
2543 inline void maxRoute(int ncalls)
2544 { m_maxroute = ncalls; }
2545
2550 inline void maxChans(int ncalls)
2551 { m_maxchans = ncalls; }
2552
2557 inline void dtmfDups(bool duplicates)
2558 { m_dtmfDups = duplicates; }
2559
2560private:
2561 Driver(); // no default constructor please
2562};
2563
2568 class YATE_API Router : public Thread
2569{
2570 YNOCOPY(Router); // no automatic copies please
2571private:
2572 Driver* m_driver;
2573 String m_id;
2574 Message* m_msg;
2575
2576public:
2583 Router(Driver* driver, const char* id, Message* msg);
2584
2588 virtual void run();
2589
2594 virtual bool route();
2595
2599 virtual void cleanup();
2600
2601protected:
2606 const String& id() const
2607 { return m_id; }
2608};
2609
2614 class YATE_API CallAccount
2615{
2616 YNOCOPY(CallAccount);
2617private:
2618 Mutex* m_mutex;
2619 NamedList m_inbParams;
2620 NamedList m_outParams;
2621 NamedList m_regParams;
2622
2623public:
2628 void pickAccountParams(const NamedList& params);
2629
2630
2635 void setInboundParams(NamedList& params);
2636
2641 void setOutboundParams(NamedList& params);
2642
2647 void setRegisterParams(NamedList& params);
2648
2653 inline const NamedList& inboundParams() const
2654 { return m_inbParams; }
2655
2660 inline const NamedList& outboundParams() const
2661 { return m_outParams; }
2662
2667 inline const NamedList& registerParams() const
2668 { return m_regParams; }
2669
2670protected:
2675 inline CallAccount(Mutex* mutex)
2676 : m_mutex(mutex), m_inbParams(""), m_outParams(""), m_regParams("")
2677 { }
2678};
2679
2685YATE_API bool isE164(const char* str);
2686
2687}; // namespace TelEngine
2688
2689#endif /* __YATEPHONE_H */
2690
2691/* vi: set ts=8 sw=4 sts=4 noet: */
DataBlock
A class that holds just a block of raw data.
Definition yateclass.h:6074
DebugEnabler::DebugEnabler
DebugEnabler(int level=TelEngine::debugLevel(), bool enabled=true)
Definition yateclass.h:336
GenObject::GenObject
GenObject()
Lock
Ephemeral mutex, semaphore or rw-lock locking object.
Definition yateclass.h:10000
Mutex
Mutex support.
Definition yateclass.h:9403
Mutex::Mutex
Mutex(bool recursive=false, const char *name=0)
NamedCounter
Atomic counter with name.
Definition yateclass.h:5428
NamedList
A named string container class.
Definition yateclass.h:7690
NamedList::NamedList
NamedList(const char *name)
NamedList::operator=
NamedList & operator=(const NamedList &value)
NamedList::setParam
NamedList & setParam(NamedString *param)
NamedList::addParam
NamedList & addParam(NamedString *param)
NamedList::copyParams
NamedList & copyParams(bool replace, const NamedList &original, bool copyUserData=false)
NamedString
A named string class.
Definition yateclass.h:5304
ObjList
An object list class.
Definition yateclass.h:2032
ObjList::skipNull
ObjList * skipNull() const
ObjList::skipNext
ObjList * skipNext() const
RefObject::RefObject
RefObject()
RefObject::ref
bool ref()
Regexp
A regexp matching class.
Definition yateclass.h:5094
String
A C-style string handling class.
Definition yateclass.h:3055
String::c_str
const char * c_str() const
Definition yateclass.h:3160
String::String
String()
String::toString
virtual const String & toString() const
String::empty
static const String & empty()
TelEngine::CallAccount::setInboundParams
void setInboundParams(NamedList &params)
TelEngine::CallAccount::setRegisterParams
void setRegisterParams(NamedList &params)
TelEngine::CallAccount::pickAccountParams
void pickAccountParams(const NamedList &params)
TelEngine::CallAccount::inboundParams
const NamedList & inboundParams() const
Definition yatephone.h:2653
TelEngine::CallAccount::CallAccount
CallAccount(Mutex *mutex)
Definition yatephone.h:2675
TelEngine::CallAccount::outboundParams
const NamedList & outboundParams() const
Definition yatephone.h:2660
TelEngine::CallAccount::registerParams
const NamedList & registerParams() const
Definition yatephone.h:2667
TelEngine::CallAccount::setOutboundParams
void setOutboundParams(NamedList &params)
TelEngine::CallEndpoint
An abstract call endpoint.
Definition yatephone.h:1128
TelEngine::CallEndpoint::setConsumer
void setConsumer(DataConsumer *consumer=0, const String &type=CallEndpoint::audioType())
TelEngine::CallEndpoint::getObject
virtual void * getObject(const String &name) const
TelEngine::CallEndpoint::destroyed
virtual void destroyed()
TelEngine::CallEndpoint::getEndpoint
DataEndpoint * getEndpoint(const String &type=CallEndpoint::audioType()) const
TelEngine::CallEndpoint::getSource
DataSource * getSource(const String &type=CallEndpoint::audioType()) const
TelEngine::CallEndpoint::clearData
bool clearData(DataNode *node, const String &type=CallEndpoint::audioType())
TelEngine::CallEndpoint::getPeerId
bool getPeerId(String &id) const
TelEngine::CallEndpoint::connected
virtual void connected(const char *reason)
Definition yatephone.h:1313
TelEngine::CallEndpoint::id
const String & id() const
Definition yatephone.h:1165
TelEngine::CallEndpoint::mutex
Mutex * mutex() const
Definition yatephone.h:1204
TelEngine::CallEndpoint::connect
bool connect(CallEndpoint *peer, const char *reason=0, bool notify=true)
TelEngine::CallEndpoint::setEndpoint
void setEndpoint(DataEndpoint *endPoint)
TelEngine::CallEndpoint::CallEndpoint
CallEndpoint(const char *id=0)
TelEngine::CallEndpoint::clearEndpoint
void clearEndpoint(const String &type=String::empty())
TelEngine::CallEndpoint::setSource
void setSource(DataSource *source=0, const String &type=CallEndpoint::audioType())
TelEngine::CallEndpoint::audioType
static const String & audioType()
TelEngine::CallEndpoint::toString
virtual const String & toString() const
Definition yatephone.h:1158
TelEngine::CallEndpoint::disconnect
bool disconnect(const char *reason, const NamedList &params)
Definition yatephone.h:1238
TelEngine::CallEndpoint::getConsumer
DataConsumer * getConsumer(const String &type=CallEndpoint::audioType()) const
TelEngine::CallEndpoint::getPeer
CallEndpoint * getPeer() const
Definition yatephone.h:1172
TelEngine::CallEndpoint::setDisconnect
virtual void setDisconnect(const NamedList *params)
Definition yatephone.h:1326
TelEngine::CallEndpoint::setLastPeerId
void setLastPeerId()
TelEngine::CallEndpoint::setId
virtual void setId(const char *newId)
TelEngine::CallEndpoint::setEndpoint
DataEndpoint * setEndpoint(const String &type=CallEndpoint::audioType())
TelEngine::CallEndpoint::disconnect
bool disconnect(const char *reason=0, bool notify=true, const NamedList *params=0)
Definition yatephone.h:1229
TelEngine::CallEndpoint::getPeerId
String getPeerId() const
TelEngine::CallEndpoint::commonMutex
static Mutex & commonMutex()
TelEngine::CallEndpoint::getLastPeerId
bool getLastPeerId(String &id) const
TelEngine::CallEndpoint::disconnected
virtual void disconnected(bool final, const char *reason)
Definition yatephone.h:1320
TelEngine::CallEndpoint::setPeer
void setPeer(CallEndpoint *peer, const char *reason=0, bool notify=true, const NamedList *params=0)
TelEngine::Channel
An abstract communication channel.
Definition yatephone.h:1705
TelEngine::Channel::dropChan
void dropChan()
TelEngine::Channel::msgRinging
virtual bool msgRinging(Message &msg)
TelEngine::Channel::zeroRefs
virtual void zeroRefs()
TelEngine::Channel::statusParams
virtual void statusParams(String &str)
TelEngine::Channel::msgMasquerade
virtual bool msgMasquerade(Message &msg)
TelEngine::Channel::getObject
virtual void * getObject(const String &name) const
TelEngine::Channel::setMaxPDD
void setMaxPDD(const Message &msg)
TelEngine::Channel::msgTransfer
virtual bool msgTransfer(Message &msg)
TelEngine::Channel::parameters
NamedList & parameters()
Definition yatephone.h:2268
TelEngine::Channel::setMaxcall
void setMaxcall(const Message *msg, int defTout=-1)
TelEngine::Channel::callRouted
virtual bool callRouted(Message &msg)
TelEngine::Channel::dtmfInband
bool dtmfInband(const char *tone)
TelEngine::Channel::msgProgress
virtual bool msgProgress(Message &msg)
TelEngine::Channel::callConnect
virtual void callConnect(Message &msg)
TelEngine::Channel::putStatus
void putStatus(NamedList &list, const char *param="status", bool append=true) const
Definition yatephone.h:1941
TelEngine::Channel::message
Message * message(const char *name, bool minimal=false, bool data=false)
TelEngine::Channel::timeout
void timeout(u_int64_t tout)
Definition yatephone.h:2002
TelEngine::Channel::timeout
u_int64_t timeout() const
Definition yatephone.h:1995
TelEngine::Channel::setMaxcall
void setMaxcall(const Message &msg, int defTout=-1)
Definition yatephone.h:2024
TelEngine::Channel::allocId
static unsigned int allocId()
TelEngine::Channel::dtmfEnqueue
bool dtmfEnqueue(Message *msg)
TelEngine::Channel::message
Message * message(const char *name, const NamedList &original, const char *params=0, bool minimal=false, bool data=false)
Definition yatephone.h:1787
TelEngine::Channel::direction
const char * direction() const
TelEngine::Channel::cleanup
void cleanup()
TelEngine::Channel::setDebug
virtual bool setDebug(Message &msg)
TelEngine::Channel::msgDrop
virtual bool msgDrop(Message &msg, const char *reason)
TelEngine::Channel::connected
virtual void connected(const char *reason)
TelEngine::Channel::setOutgoing
void setOutgoing(bool outgoing=true)
Definition yatephone.h:2231
TelEngine::Channel::getStatus
String & getStatus(String &buf, bool append=true) const
Definition yatephone.h:1925
TelEngine::Channel::maxPDD
void maxPDD(u_int64_t tout)
Definition yatephone.h:2047
TelEngine::Channel::msgAnswered
virtual bool msgAnswered(Message &msg)
TelEngine::Channel::msgTone
virtual bool msgTone(Message &msg, const char *tone)
TelEngine::Channel::endDisconnect
virtual void endDisconnect(const Message &msg, bool handled)
TelEngine::Channel::getDisconnect
virtual Message * getDisconnect(const char *reason)
TelEngine::Channel::maxcall
u_int64_t maxcall() const
Definition yatephone.h:2009
TelEngine::Channel::dtmfSequence
bool dtmfSequence(Message &msg)
TelEngine::Channel::initChan
void initChan()
TelEngine::Channel::driver
Driver * driver() const
Definition yatephone.h:1988
TelEngine::Channel::getStatus
const String & getStatus() const
Definition yatephone.h:2218
TelEngine::Channel::dispatched
virtual void dispatched(const Message &msg, bool handled)
TelEngine::Channel::Channel
Channel(Driver &driver, const char *id=0, bool outgoing=false)
TelEngine::Channel::isIncoming
bool isIncoming() const
Definition yatephone.h:1968
TelEngine::Channel::isOutgoing
bool isOutgoing() const
Definition yatephone.h:1961
TelEngine::Channel::maxcall
void maxcall(u_int64_t tout)
Definition yatephone.h:2016
TelEngine::Channel::isAnswered
bool isAnswered() const
Definition yatephone.h:1975
TelEngine::Channel::callRejected
virtual void callRejected(const char *error, const char *reason=0, const Message *msg=0)
TelEngine::Channel::message
Message * message(const char *name, const NamedList *original, const char *params=0, bool minimal=false, bool data=false)
TelEngine::Channel::startRouter
bool startRouter(Message *msg)
TelEngine::Channel::msgStatus
virtual void msgStatus(Message &msg)
TelEngine::Channel::callPrerouted
virtual bool callPrerouted(Message &msg, bool handled)
TelEngine::Channel::toneDetect
bool toneDetect(const char *sniffer=0)
TelEngine::Channel::msgControl
virtual bool msgControl(Message &msg)
TelEngine::Channel::billid
const String & billid() const
Definition yatephone.h:2070
TelEngine::Channel::callAccept
virtual void callAccept(Message &msg)
TelEngine::Channel::setDisconnect
virtual void setDisconnect(const NamedList *params)
TelEngine::Channel::filterDebug
void filterDebug(const String &item)
TelEngine::Channel::setId
virtual void setId(const char *newId)
TelEngine::Channel::msgUpdate
virtual bool msgUpdate(Message &msg)
TelEngine::Channel::~Channel
virtual ~Channel()
TelEngine::Channel::address
const String & address() const
Definition yatephone.h:1954
TelEngine::Channel::complete
virtual void complete(Message &msg, bool minimal=false) const
TelEngine::Channel::maxPDD
u_int64_t maxPDD() const
Definition yatephone.h:2039
TelEngine::Channel::copyChanParams
void copyChanParams(NamedList &list) const
Definition yatephone.h:2125
TelEngine::Channel::Channel
Channel(Driver *driver, const char *id=0, bool outgoing=false)
TelEngine::Channel::setChanParams
void setChanParams(const NamedList &list, bool in=false)
Definition yatephone.h:2111
TelEngine::Channel::parameters
const NamedList & parameters() const
Definition yatephone.h:2103
TelEngine::Channel::msgText
virtual bool msgText(Message &msg, const char *text)
TelEngine::Channel::targetid
const String & targetid() const
Definition yatephone.h:2062
TelEngine::Channel::paramMutex
static Mutex & paramMutex()
TelEngine::Channel::disconnected
virtual void disconnected(bool final, const char *reason)
TelEngine::Channel::status
void status(const char *newstat)
TelEngine::Channel::checkTimers
virtual void checkTimers(Message &msg, const Time &tmr)
TelEngine::DataConsumer
Definition yatephone.h:398
TelEngine::DataConsumer::getObject
virtual void * getObject(const String &name) const
TelEngine::DataConsumer::DataConsumer
DataConsumer(const char *format="slin")
Definition yatephone.h:406
TelEngine::DataConsumer::destroyed
virtual void destroyed()
TelEngine::DataConsumer::getOverSource
DataSource * getOverSource() const
Definition yatephone.h:446
TelEngine::DataConsumer::getTransSource
virtual DataSource * getTransSource() const
Definition yatephone.h:453
TelEngine::DataConsumer::synchronize
virtual bool synchronize(DataSource *source)
TelEngine::DataConsumer::getConnSource
DataSource * getConnSource() const
Definition yatephone.h:439
TelEngine::DataConsumer::Consume
virtual unsigned long Consume(const DataBlock &data, unsigned long tStamp, unsigned long flags)=0
TelEngine::DataEndpoint
A data transfer endpoint capable of sending and/or receiving data.
Definition yatephone.h:928
TelEngine::DataEndpoint::delSniffer
bool delSniffer(DataConsumer *sniffer)
TelEngine::DataEndpoint::disconnect
bool disconnect()
TelEngine::DataEndpoint::getObject
virtual void * getObject(const String &name) const
TelEngine::DataEndpoint::addSniffer
bool addSniffer(DataConsumer *sniffer)
TelEngine::DataEndpoint::destroyed
virtual void destroyed()
TelEngine::DataEndpoint::clearCall
void clearCall(const CallEndpoint *call)
Definition yatephone.h:1093
TelEngine::DataEndpoint::setConsumer
void setConsumer(DataConsumer *consumer=0)
TelEngine::DataEndpoint::getCallRecord
DataConsumer * getCallRecord() const
Definition yatephone.h:1030
TelEngine::DataEndpoint::nativeConnect
virtual bool nativeConnect(DataEndpoint *peer)
Definition yatephone.h:1109
TelEngine::DataEndpoint::clearData
bool clearData(DataNode *node)
TelEngine::DataEndpoint::setCallRecord
void setCallRecord(DataConsumer *consumer=0)
TelEngine::DataEndpoint::getConsumer
DataConsumer * getConsumer() const
Definition yatephone.h:1002
TelEngine::DataEndpoint::clearSniffers
void clearSniffers()
TelEngine::DataEndpoint::mutex
Mutex * mutex() const
TelEngine::DataEndpoint::getPeer
DataEndpoint * getPeer() const
Definition yatephone.h:1071
TelEngine::DataEndpoint::getPeerRecord
DataConsumer * getPeerRecord() const
Definition yatephone.h:1016
TelEngine::DataEndpoint::getSource
DataSource * getSource() const
Definition yatephone.h:989
TelEngine::DataEndpoint::getCall
CallEndpoint * getCall() const
Definition yatephone.h:1078
TelEngine::DataEndpoint::toString
virtual const String & toString() const
TelEngine::DataEndpoint::setSource
void setSource(DataSource *source=0)
TelEngine::DataEndpoint::getSniffer
DataConsumer * getSniffer(const String &name, bool ref=false)
TelEngine::DataEndpoint::DataEndpoint
DataEndpoint(CallEndpoint *call=0, const char *name="audio")
TelEngine::DataEndpoint::name
const String & name() const
Definition yatephone.h:1085
TelEngine::DataEndpoint::setPeerRecord
void setPeerRecord(DataConsumer *consumer=0)
TelEngine::DataEndpoint::commonMutex
static Mutex & commonMutex()
TelEngine::DataEndpoint::control
virtual bool control(NamedList &params)
TelEngine::DataEndpoint::connect
bool connect(DataEndpoint *peer)
TelEngine::DataFormat
A Data format.
Definition yatephone.h:183
TelEngine::DataFormat::DataFormat
DataFormat()
Definition yatephone.h:188
TelEngine::DataFormat::DataFormat
DataFormat(const String *value)
Definition yatephone.h:228
TelEngine::DataFormat::DataFormat
DataFormat(const FormatInfo *format)
Definition yatephone.h:236
TelEngine::DataFormat::changed
virtual void changed()
TelEngine::DataFormat::frameSize
int frameSize(int defValue=0) const
Definition yatephone.h:257
TelEngine::DataFormat::frameTime
int frameTime(int defValue=0) const
Definition yatephone.h:265
TelEngine::DataFormat::DataFormat
DataFormat(const String &value)
Definition yatephone.h:212
TelEngine::DataFormat::getInfo
const FormatInfo * getInfo() const
TelEngine::DataFormat::DataFormat
DataFormat(const DataFormat &value)
Definition yatephone.h:204
TelEngine::DataFormat::operator=
DataFormat & operator=(const DataFormat &value)
Definition yatephone.h:243
TelEngine::DataFormat::numChannels
int numChannels(int defValue=1) const
Definition yatephone.h:282
TelEngine::DataFormat::DataFormat
DataFormat(const char *value)
Definition yatephone.h:196
TelEngine::DataFormat::DataFormat
DataFormat(const NamedList &value)
Definition yatephone.h:220
TelEngine::DataFormat::sampleRate
int sampleRate(int defValue=0) const
Definition yatephone.h:274
TelEngine::DataNode
Definition yatephone.h:299
TelEngine::DataNode::attached
virtual void attached(bool added)
Definition yatephone.h:381
TelEngine::DataNode::valid
virtual bool valid() const
Definition yatephone.h:358
TelEngine::DataNode::timeStamp
unsigned long timeStamp() const
Definition yatephone.h:351
TelEngine::DataNode::costFormat
virtual int costFormat(const DataFormat &format)
Definition yatephone.h:329
TelEngine::DataNode::DataNode
DataNode(const char *format=0)
Definition yatephone.h:320
TelEngine::DataNode::invalidStamp
static unsigned long invalidStamp()
Definition yatephone.h:373
TelEngine::DataNode::setFormat
virtual bool setFormat(const DataFormat &format)
Definition yatephone.h:337
TelEngine::DataNode::DataFlags
DataFlags
Definition yatephone.h:306
TelEngine::DataNode::getFormat
const DataFormat & getFormat() const
Definition yatephone.h:344
TelEngine::DataNode::control
virtual bool control(NamedList &params)
Definition yatephone.h:366
TelEngine::DataSource
Definition yatephone.h:478
TelEngine::DataSource::synchronize
void synchronize(unsigned long tStamp)
TelEngine::DataSource::getObject
virtual void * getObject(const String &name) const
TelEngine::DataSource::destroyed
virtual void destroyed()
TelEngine::DataSource::Forward
unsigned long Forward(const DataBlock &data, unsigned long tStamp=invalidStamp(), unsigned long flags=0)
TelEngine::DataSource::nextStamp
unsigned long nextStamp() const
Definition yatephone.h:562
TelEngine::DataSource::valid
virtual bool valid() const
TelEngine::DataSource::attach
bool attach(DataConsumer *consumer, bool override=false)
TelEngine::DataSource::detach
bool detach(DataConsumer *consumer)
TelEngine::DataSource::getTranslator
DataTranslator * getTranslator() const
Definition yatephone.h:549
TelEngine::DataSource::clear
void clear()
TelEngine::DataSource::DataSource
DataSource(const char *format="slin")
Definition yatephone.h:486
TelEngine::DataSource::control
virtual bool control(NamedList &params)
TelEngine::DataTranslator
An unidirectional data translator (codec).
Definition yatephone.h:652
TelEngine::DataTranslator::allFormats
static ObjList * allFormats(const String &formats, bool existing=true, bool sameRate=true, bool sameChans=true)
TelEngine::DataTranslator::attachChain
static bool attachChain(DataSource *source, DataConsumer *consumer, bool override=false)
TelEngine::DataTranslator::getObject
virtual void * getObject(const String &name) const
TelEngine::DataTranslator::destFormats
static ObjList * destFormats(const DataFormat &sFormat="slin", int maxCost=-1, unsigned int maxLen=0, ObjList *lst=0)
TelEngine::DataTranslator::canConvert
static bool canConvert(const DataFormat &fmt1, const DataFormat &fmt2="slin")
TelEngine::DataTranslator::DataTranslator
DataTranslator(const char *sFormat, const char *dFormat)
TelEngine::DataTranslator::valid
virtual bool valid() const
Definition yatephone.h:686
TelEngine::DataTranslator::getFirstTranslator
const DataTranslator * getFirstTranslator() const
TelEngine::DataTranslator::uninstall
static void uninstall(TranslatorFactory *factory)
TelEngine::DataTranslator::allFormats
static ObjList * allFormats(const ObjList *formats, bool existing=true, bool sameRate=true, bool sameChans=true)
TelEngine::DataTranslator::getConsumers
ObjList * getConsumers() const
Definition yatephone.h:800
TelEngine::DataTranslator::~DataTranslator
~DataTranslator()
TelEngine::DataTranslator::srcFormats
static ObjList * srcFormats(const DataFormat &dFormat="slin", int maxCost=-1, unsigned int maxLen=0, ObjList *lst=0)
TelEngine::DataTranslator::install
static void install(TranslatorFactory *factory)
TelEngine::DataTranslator::create
static DataTranslator * create(const DataFormat &sFormat, const DataFormat &dFormat)
TelEngine::DataTranslator::getTransSource
virtual DataSource * getTransSource() const
Definition yatephone.h:693
TelEngine::DataTranslator::setMaxChain
static void setMaxChain(unsigned int maxChain)
TelEngine::DataTranslator::cost
static int cost(const DataFormat &sFormat, const DataFormat &dFormat)
TelEngine::DataTranslator::getFirstTranslator
DataTranslator * getFirstTranslator()
TelEngine::DataTranslator::synchronize
virtual bool synchronize(DataSource *source)
TelEngine::DataTranslator::DataTranslator
DataTranslator(const char *sFormat, DataSource *source=0)
TelEngine::DataTranslator::detachChain
static bool detachChain(DataSource *source, DataConsumer *consumer)
TelEngine::Driver
A Channel driver module.
Definition yatephone.h:2285
TelEngine::Driver::setup
void setup(const char *prefix=0, bool minimal=false)
TelEngine::Driver::msgExecute
virtual bool msgExecute(Message &msg, String &dest)=0
TelEngine::Driver::Driver
Driver(const char *name, const char *type=0)
TelEngine::Driver::statusParams
virtual void statusParams(String &str)
TelEngine::Driver::timeout
void timeout(int tout)
Definition yatephone.h:2536
TelEngine::Driver::setDebug
virtual bool setDebug(Message &msg, const String &target)
TelEngine::Driver::statusModule
virtual void statusModule(String &str)
TelEngine::Driver::getObject
virtual void * getObject(const String &name) const
TelEngine::Driver::chanCount
int chanCount() const
Definition yatephone.h:2411
TelEngine::Driver::nextid
unsigned int nextid()
TelEngine::Driver::canRoute
virtual bool canRoute()
TelEngine::Driver::dropAll
virtual void dropAll(Message &msg)
TelEngine::Driver::genUpdate
virtual void genUpdate(Message &msg)
TelEngine::Driver::statusDetail
virtual void statusDetail(String &str)
TelEngine::Driver::timeout
int timeout() const
Definition yatephone.h:2383
TelEngine::Driver::varchan
bool varchan() const
Definition yatephone.h:2324
TelEngine::Driver::loadLimits
virtual void loadLimits()
TelEngine::Driver::initialize
virtual void initialize()
TelEngine::Driver::maxRoute
void maxRoute(int ncalls)
Definition yatephone.h:2543
TelEngine::Driver::lastid
unsigned int lastid() const
Definition yatephone.h:2376
TelEngine::Driver::prefix
const String & prefix() const
Definition yatephone.h:2317
TelEngine::Driver::received
virtual bool received(Message &msg, int id)
TelEngine::Driver::maxChans
int maxChans() const
Definition yatephone.h:2418
TelEngine::Driver::routing
int routing() const
Definition yatephone.h:2390
TelEngine::Driver::routed
int routed() const
Definition yatephone.h:2397
TelEngine::Driver::hasLine
virtual bool hasLine(const String &line) const
TelEngine::Driver::channels
ObjList & channels()
Definition yatephone.h:2331
TelEngine::Driver::canAccept
virtual bool canAccept(bool routers=true)
TelEngine::Driver::varchan
void varchan(bool variable)
Definition yatephone.h:2529
TelEngine::Driver::dtmfDups
void dtmfDups(bool duplicates)
Definition yatephone.h:2557
TelEngine::Driver::canStopCall
virtual bool canStopCall() const
Definition yatephone.h:2522
TelEngine::Driver::msgRoute
virtual bool msgRoute(Message &msg)
TelEngine::Driver::isBusy
virtual bool isBusy() const
TelEngine::Driver::maxChans
void maxChans(int ncalls)
Definition yatephone.h:2550
TelEngine::Driver::find
virtual Channel * find(const String &id) const
TelEngine::Driver::commandComplete
virtual bool commandComplete(Message &msg, const String &partLine, const String &partWord)
TelEngine::Driver::total
int total() const
Definition yatephone.h:2404
TelEngine::FormatRepository::getFormat
static const FormatInfo * getFormat(const String &name)
TelEngine::FormatRepository::addFormat
static const FormatInfo * addFormat(const String &name, int fsize, int ftime, const String &type="audio", int srate=8000, int nchan=1)
TelEngine::MessageNotifier
Post-dispatching message hook.
Definition yatengine.h:875
TelEngine::MessageReceiver
A multiple message receiver.
Definition yatengine.h:806
TelEngine::MessageRelay
A message handler relay.
Definition yatengine.h:822
TelEngine::Message
A message container class.
Definition yatengine.h:380
TelEngine::Module::statusParams
virtual void statusParams(String &str)
TelEngine::Module::msgTimer
virtual void msgTimer(Message &msg)
TelEngine::Module::setDebug
virtual bool setDebug(Message &msg, const String &target)
TelEngine::Module::filterInstalled
bool filterInstalled() const
Definition yatephone.h:1407
TelEngine::Module::statusModule
virtual void statusModule(String &str)
TelEngine::Module::messageName
static const char * messageName(int id)
TelEngine::Module::getObject
virtual void * getObject(const String &name) const
TelEngine::Module::itemComplete
static bool itemComplete(String &itemList, const TokenDict64 *dict, const String &partWord)
Definition yatephone.h:1463
TelEngine::Module::filterDebug
bool filterDebug(const String &item) const
TelEngine::Module::commandExecute
virtual bool commandExecute(String &retVal, const String &line)
TelEngine::Module::uninstallRelay
bool uninstallRelay(int id, bool delRelay=true)
TelEngine::Module::relayInstalled
bool relayInstalled(int id) const
Definition yatephone.h:1551
TelEngine::Module::~Module
virtual ~Module()
TelEngine::Module::installRelay
bool installRelay(int id, const char *name, unsigned priority=100, NamedString *filter=0)
TelEngine::Module::genUpdate
virtual void genUpdate(Message &msg)
TelEngine::Module::itemComplete
static bool itemComplete(String &itemList, const TokenDict *dict, const String &partWord)
Definition yatephone.h:1447
TelEngine::Module::statusDetail
virtual void statusDetail(String &str)
TelEngine::Module::installRelay
bool installRelay(MessageRelay *relay)
TelEngine::Module::setup
void setup()
TelEngine::Module::changed
void changed()
TelEngine::Module::itemComplete
static bool itemComplete(String &itemList, const ObjList &list, const String &partWord)
Definition yatephone.h:1433
TelEngine::Module::initialize
virtual void initialize()
TelEngine::Module::uninstallRelays
bool uninstallRelays()
TelEngine::Module::itemComplete
static bool itemComplete(String &itemList, const String &item, const String &partWord)
TelEngine::Module::uninstallRelay
bool uninstallRelay(MessageRelay *relay, bool delRelay=true)
TelEngine::Module::received
virtual bool received(Message &msg, int id)
TelEngine::Module::updateDelay
static unsigned int updateDelay()
Definition yatephone.h:1393
TelEngine::Module::relayId
static int relayId(const char *name)
Definition yatephone.h:1520
TelEngine::Module::type
const String & type() const
Definition yatephone.h:1380
TelEngine::Module::msgStatus
virtual void msgStatus(Message &msg)
TelEngine::Module::Module
Module(const char *name, const char *type=0, bool earlyInit=false)
TelEngine::Module::installRelay
bool installRelay(int id, unsigned priority=100, NamedString *filter=0)
TelEngine::Module::installRelay
bool installRelay(const char *name, unsigned priority=100, NamedString *filter=0)
TelEngine::Module::RelayID
enum TelEngine::Module::@116044232121152234227125177133322337324012073137 RelayID
TelEngine::Module::msgRoute
virtual bool msgRoute(Message &msg)
TelEngine::Module::msgCommand
virtual bool msgCommand(Message &msg)
TelEngine::Module::commandComplete
virtual bool commandComplete(Message &msg, const String &partLine, const String &partWord)
TelEngine::Module::updateDelay
static void updateDelay(unsigned int delay)
Definition yatephone.h:1400
TelEngine::Plugin::earlyInit
bool earlyInit() const
Definition yatengine.h:1339
TelEngine::Plugin::name
const String & name() const
Definition yatengine.h:1325
TelEngine::Plugin::Plugin
Plugin(const char *name, bool earlyInit=false)
TelEngine::Router::route
virtual bool route()
TelEngine::Router::cleanup
virtual void cleanup()
TelEngine::Router::id
const String & id() const
Definition yatephone.h:2606
TelEngine::Router::run
virtual void run()
TelEngine::Router::Router
Router(Driver *driver, const char *id, Message *msg)
TelEngine::ThreadedSource::cleanup
virtual void cleanup()
TelEngine::ThreadedSource::run
virtual void run()=0
TelEngine::ThreadedSource::destroyed
virtual void destroyed()
TelEngine::ThreadedSource::start
bool start(const char *name="ThreadedSource", Thread::Priority prio=Thread::Normal)
TelEngine::ThreadedSource::stop
void stop()
TelEngine::ThreadedSource::running
bool running() const
TelEngine::ThreadedSource::looping
bool looping(bool runConsumers=false) const
TelEngine::ThreadedSource::thread
Thread * thread() const
TelEngine::ThreadedSource::ThreadedSource
ThreadedSource(const char *format="slin")
Definition yatephone.h:620
TelEngine::TranslatorFactory::getCapabilities
virtual const TranslatorCaps * getCapabilities() const =0
TelEngine::TranslatorFactory::name
virtual const char * name() const
Definition yatephone.h:907
TelEngine::TranslatorFactory::TranslatorFactory
TranslatorFactory(const char *name=0)
Definition yatephone.h:846
TelEngine::TranslatorFactory::intermediate
virtual const FormatInfo * intermediate() const
TelEngine::TranslatorFactory::converts
virtual bool converts(const DataFormat &sFormat, const DataFormat &dFormat) const
TelEngine::TranslatorFactory::~TranslatorFactory
virtual ~TranslatorFactory()
TelEngine::TranslatorFactory::length
virtual unsigned int length() const
TelEngine::TranslatorFactory::removed
virtual void removed(const TranslatorFactory *factory)
TelEngine::TranslatorFactory::create
virtual DataTranslator * create(const DataFormat &sFormat, const DataFormat &dFormat)=0
TelEngine::TranslatorFactory::intermediate
virtual bool intermediate(const FormatInfo *info) const
TelEngine::TranslatorFactory::objectsCounter
NamedCounter * objectsCounter() const
Definition yatephone.h:914
Thread
Thread support class.
Definition yateclass.h:10192
Thread::Priority
Priority
Definition yateclass.h:10202
Thread::getCurrentObjCounter
static NamedCounter * getCurrentObjCounter(bool always=false)
Thread::Thread
Thread(const char *name=0, Priority prio=Normal)
Time
A time holding class.
Definition yateclass.h:5764
TelEngine
Definition yatemime.h:34
TelEngine::isE164
bool isE164(const char *str)
TelEngine::FormatInfo
Definition yatephone.h:59
TelEngine::FormatInfo::dataRate
int dataRate() const
TelEngine::FormatInfo::FormatInfo
FormatInfo(const char *_name, int fsize=0, int ftime=10000, const char *_type="audio", int srate=8000, int nchan=1, bool convert=false)
Definition yatephone.h:121
TelEngine::FormatInfo::FormatInfo
FormatInfo()
Definition yatephone.h:111
TelEngine::FormatInfo::frameTime
int frameTime
Definition yatephone.h:78
TelEngine::FormatInfo::type
const char * type
Definition yatephone.h:68
TelEngine::FormatInfo::numChannels
int numChannels
Definition yatephone.h:88
TelEngine::FormatInfo::name
const char * name
Definition yatephone.h:63
TelEngine::FormatInfo::frameSize
int frameSize
Definition yatephone.h:73
TelEngine::FormatInfo::converter
bool converter
Definition yatephone.h:93
TelEngine::FormatInfo::guessSamples
int guessSamples(int len) const
TelEngine::FormatInfo::sampleRate
int sampleRate
Definition yatephone.h:83
TelEngine::ImageInfo
Definition yatephone.h:39
TelEngine::ImageInfo::width
int width
Definition yatephone.h:43
TelEngine::ImageInfo::depth
int depth
Definition yatephone.h:53
TelEngine::ImageInfo::height
int height
Definition yatephone.h:48
TelEngine::TranslatorCaps
Definition yatephone.h:138
TelEngine::TranslatorCaps::dest
const FormatInfo * dest
Definition yatephone.h:142
TelEngine::TranslatorCaps::cost
int cost
Definition yatephone.h:144
TelEngine::TranslatorCaps::src
const FormatInfo * src
Definition yatephone.h:140
TokenDict64
Definition yateclass.h:908
TokenDict64::token
const char * token
Definition yateclass.h:912
TokenDict
Definition yateclass.h:891
TokenDict::token
const char * token
Definition yateclass.h:895