Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

yatephone.h

00001 /*
00002  * yatephone.h
00003  * This file is part of the YATE Project http://YATE.null.ro
00004  *
00005  * Drivers, channels and telephony related classes
00006  *
00007  * Yet Another Telephony Engine - a fully featured software PBX and IVR
00008  * Copyright (C) 2004-2006 Null Team
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
00023  */
00024 
00025 #ifndef __YATEPHONE_H
00026 #define __YATEPHONE_H
00027 
00028 #ifndef __cplusplus
00029 #error C++ is required
00030 #endif
00031 
00032 #include <yatengine.h>
00033         
00037 namespace TelEngine {
00038 
00042 struct YATE_API ImageInfo {
00046     int width;
00047 
00051     int height;
00052 
00056     int depth;
00057 };
00058 
00062 struct YATE_API FormatInfo {
00066     const char* name;
00067 
00071     const char* type;
00072 
00076     int frameSize;
00077 
00081     int frameTime;
00082 
00086     int sampleRate;
00087 
00091     int numChannels;
00092 
00096     bool converter;
00097 
00103     int guessSamples(int len) const;
00104 
00109     int dataRate() const;
00110 
00114     inline FormatInfo()
00115         : name(0), type("audio"),
00116           frameSize(0), frameTime(0),
00117           sampleRate(8000), numChannels(1),
00118           converter(false)
00119         { }
00120 
00124     inline FormatInfo(const char* _name, int fsize = 0, int ftime = 10000,
00125         const char* _type = "audio", int srate = 8000, int nchan = 1, bool convert = false)
00126         : name(_name), type(_type),
00127           frameSize(fsize), frameTime(ftime),
00128           sampleRate(srate), numChannels(nchan),
00129           converter(convert)
00130         { }
00131 };
00132 
00133 class CallEndpoint;
00134 class Driver;
00135 
00140 struct YATE_API TranslatorCaps {
00142     const FormatInfo* src;
00144     const FormatInfo* dest;
00146     int cost;
00147 };
00148 
00153 class YATE_API FormatRepository
00154 {
00155 private:
00156     FormatRepository();
00157     FormatRepository& operator=(const FormatRepository&);
00158 public:
00164     static const FormatInfo* getFormat(const String& name);
00165 
00177     static const FormatInfo* addFormat(const String& name, int fsize, int ftime, const String& type = "audio", int srate = 8000, int nchan = 1);
00178 };
00179 
00184 class YATE_API DataFormat : public String
00185 {
00186 public:
00190     inline DataFormat()
00191         : m_parsed(0)
00192         { }
00193 
00198     inline DataFormat(const char* value)
00199         : String(value), m_parsed(0)
00200         { }
00201 
00206     inline DataFormat(const DataFormat& value)
00207         : String(value), m_parsed(value.getInfo())
00208         { }
00209 
00214     inline DataFormat(const String& value)
00215         : String(value), m_parsed(0)
00216         { }
00217 
00222     inline DataFormat(const String* value)
00223         : String(value), m_parsed(0)
00224         { }
00225 
00230     inline DataFormat(const FormatInfo* format)
00231         : String(format ? format->name : (const char*)0), m_parsed(format)
00232         { }
00233 
00237     inline DataFormat& operator=(const DataFormat& value)
00238         { String::operator=(value); return *this; }
00239 
00244     const FormatInfo* getInfo() const;
00245 
00251     inline int frameSize(int defValue = 0) const
00252         { return getInfo() ? getInfo()->frameSize : defValue; }
00253 
00259     inline int frameTime(int defValue = 0) const
00260         { return getInfo() ? getInfo()->frameTime : defValue; }
00261 
00268     inline int sampleRate(int defValue = 0) const
00269         { return getInfo() ? getInfo()->sampleRate : defValue; }
00270 
00276     inline int numChannels(int defValue = 1) const
00277         { return getInfo() ? getInfo()->numChannels : defValue; }
00278 
00279 protected:
00283     virtual void changed();
00284 
00285 private:
00286     mutable const FormatInfo* m_parsed;
00287 };
00288 
00292 class YATE_API DataNode : public RefObject
00293 {
00294 public:
00299     inline DataNode(const char* format = 0)
00300         : m_format(format), m_timestamp(0)
00301         { }
00302 
00308     virtual int costFormat(const DataFormat& format)
00309         { return -1; }
00310 
00316     virtual bool setFormat(const DataFormat& format)
00317         { return false; }
00318 
00323     inline const DataFormat& getFormat() const
00324         { return m_format; }
00325 
00330     inline unsigned long timeStamp() const
00331         { return m_timestamp; }
00332 
00337     inline static unsigned long invalidStamp()
00338         { return (unsigned long)-1; }
00339 
00340 protected:
00341     DataFormat m_format;
00342     unsigned long m_timestamp;
00343 };
00344 
00345 class DataSource;
00346 class DataTranslator;
00347 class TranslatorFactory;
00348 class ThreadedSourcePrivate;
00349 
00353 class YATE_API DataConsumer : public DataNode
00354 {
00355     friend class DataSource;
00356 
00357 public:
00362     inline DataConsumer(const char* format = "slin")
00363         : DataNode(format),
00364           m_source(0), m_override(0),
00365           m_regularTsDelta(0), m_overrideTsDelta(0), m_lastTsTime(0)
00366         { }
00367 
00371     virtual ~DataConsumer();
00372 
00378     virtual void* getObject(const String& name) const;
00379 
00385     virtual void Consume(const DataBlock& data, unsigned long tStamp) = 0;
00386 
00391     inline DataSource* getConnSource() const
00392         { return m_source; }
00393 
00398     inline DataSource* getOverSource() const
00399         { return m_override; }
00400 
00405     virtual DataSource* getTransSource() const
00406         { return 0; }
00407 
00408 protected:
00414     virtual bool synchronize(DataSource* source);
00415 
00416 private:
00417     void Consume(const DataBlock& data, unsigned long tStamp, DataSource* source);
00418     DataSource* m_source;
00419     DataSource* m_override;
00420     long m_regularTsDelta;
00421     long m_overrideTsDelta;
00422     u_int64_t m_lastTsTime;
00423 };
00424 
00428 class YATE_API DataSource : public DataNode
00429 {
00430     friend class DataTranslator;
00431 
00432 public:
00437     inline DataSource(const char* format = "slin")
00438         : DataNode(format), m_nextStamp(invalidStamp()), m_translator(0) { }
00439 
00443     virtual ~DataSource();
00444 
00450     virtual void* getObject(const String& name) const;
00451     
00457     void Forward(const DataBlock& data, unsigned long tStamp = invalidStamp());
00458 
00465     bool attach(DataConsumer* consumer, bool override = false);
00466 
00472     bool detach(DataConsumer* consumer);
00473 
00477     void clear();
00478 
00483     inline Mutex* mutex()
00484         { return &m_mutex; }
00485 
00490     inline DataTranslator* getTranslator() const
00491         { return m_translator; }
00492 
00497     void synchronize(unsigned long tStamp);
00498 
00503     inline unsigned long nextStamp() const
00504         { return m_nextStamp; }
00505 
00506 protected:
00507     unsigned long m_nextStamp;
00508     DataTranslator* m_translator;
00509     ObjList m_consumers;
00510     Mutex m_mutex;
00511 private:
00512     inline void setTranslator(DataTranslator* translator)
00513         { m_translator = translator; }
00514     bool detachInternal(DataConsumer* consumer);
00515 };
00516 
00520 class YATE_API ThreadedSource : public DataSource
00521 {
00522     friend class ThreadedSourcePrivate;
00523 public:
00527     virtual ~ThreadedSource();
00528 
00535     bool start(const char* name = "ThreadedSource", Thread::Priority prio = Thread::Normal);
00536 
00540     void stop();
00541 
00546     Thread* thread() const;
00547 
00548 protected:
00553     inline ThreadedSource(const char* format = "slin")
00554         : DataSource(format), m_thread(0) { }
00555 
00559     virtual void run() = 0;
00560 
00564     virtual void cleanup();
00565 
00566 private:
00567     ThreadedSourcePrivate* m_thread;
00568 };
00569 
00575 class YATE_API DataTranslator : public DataConsumer
00576 {
00577     friend class TranslatorFactory;
00578 public:
00584     DataTranslator(const char* sFormat, const char* dFormat);
00585 
00592     DataTranslator(const char* sFormat, DataSource* source = 0);
00593 
00597     ~DataTranslator();
00598 
00604     virtual void* getObject(const String& name) const;
00605 
00610     virtual DataSource* getTransSource() const
00611         { return m_tsource; }
00612 
00617     DataTranslator* getFirstTranslator();
00618 
00623     const DataTranslator* getFirstTranslator() const;
00624 
00633     static ObjList* srcFormats(const DataFormat& dFormat = "slin", int maxCost = -1, unsigned int maxLen = 0, ObjList* lst = 0);
00634 
00643     static ObjList* destFormats(const DataFormat& sFormat = "slin", int maxCost = -1, unsigned int maxLen = 0, ObjList* lst = 0);
00644 
00651     static bool canConvert(const DataFormat& fmt1, const DataFormat& fmt2 = "slin");
00652 
00659     static int cost(const DataFormat& sFormat, const DataFormat& dFormat);
00660 
00667     static DataTranslator* create(const DataFormat& sFormat, const DataFormat& dFormat);
00668 
00676     static bool attachChain(DataSource* source, DataConsumer* consumer, bool override = false);
00677 
00684     static bool detachChain(DataSource* source, DataConsumer* consumer);
00685 
00690     static void setMaxChain(unsigned int maxChain);
00691 
00692 protected:
00698     virtual bool synchronize(DataSource* source);
00699 
00704     static void install(TranslatorFactory* factory);
00705 
00710     static void uninstall(TranslatorFactory* factory);
00711 
00712 private:
00713     DataTranslator(); // No default constructor please
00714     static void compose();
00715     static void compose(TranslatorFactory* factory);
00716     static bool canConvert(const FormatInfo* fmt1, const FormatInfo* fmt2);
00717     DataSource* m_tsource;
00718     static Mutex s_mutex;
00719     static ObjList s_factories;
00720     static unsigned int s_maxChain;
00721 };
00722 
00728 class YATE_API TranslatorFactory : public GenObject
00729 {
00730 protected:
00734     inline TranslatorFactory()
00735         { DataTranslator::install(this); }
00736 
00737 public:
00741     virtual ~TranslatorFactory();
00742 
00747     virtual void removed(const TranslatorFactory* factory);
00748 
00755     virtual DataTranslator* create(const DataFormat& sFormat, const DataFormat& dFormat) = 0;
00756 
00761     virtual const TranslatorCaps* getCapabilities() const = 0;
00762 
00769     virtual bool converts(const DataFormat& sFormat, const DataFormat& dFormat) const;
00770 
00775     virtual unsigned int length() const;
00776 
00782     virtual bool intermediate(const FormatInfo* info) const;
00783 
00788     virtual const FormatInfo* intermediate() const;
00789 };
00790 
00796 class YATE_API DataEndpoint : public RefObject
00797 {
00798 public:
00799 
00803     DataEndpoint(CallEndpoint* call = 0, const char* name = "audio");
00804 
00808     ~DataEndpoint();
00809 
00815     virtual void* getObject(const String& name) const;
00816 
00821     virtual const String& toString() const;
00822 
00827     Mutex* mutex() const;
00828 
00833     static Mutex& commonMutex();
00834 
00840     bool connect(DataEndpoint* peer);
00841 
00846     bool disconnect();
00847 
00852     void setSource(DataSource* source = 0);
00853 
00858     inline DataSource* getSource() const
00859         { return m_source; }
00860 
00865     void setConsumer(DataConsumer* consumer = 0);
00866 
00871     inline DataConsumer* getConsumer() const
00872         { return m_consumer; }
00873 
00879     void setPeerRecord(DataConsumer* consumer = 0);
00880 
00885     inline DataConsumer* getPeerRecord() const
00886         { return m_peerRecord; }
00887 
00893     void setCallRecord(DataConsumer* consumer = 0);
00894 
00899     inline DataConsumer* getCallRecord() const
00900         { return m_callRecord; }
00901 
00907     bool addSniffer(DataConsumer* sniffer);
00908 
00914     bool delSniffer(DataConsumer* sniffer);
00915 
00921     inline DataConsumer* getSniffer(const String& name)
00922         { return static_cast<DataConsumer*>(m_sniffers[name]); }
00923 
00927     void clearSniffers();
00928 
00933     inline DataEndpoint* getPeer() const
00934         { return m_peer; }
00935 
00940     inline CallEndpoint* getCall() const
00941         { return m_call; }
00942 
00947     inline const String& name() const
00948         { return m_name; }
00949 
00950 protected:
00956     virtual bool nativeConnect(DataEndpoint* peer)
00957         { return false; }
00958 
00959 private:
00960     String m_name;
00961     DataSource* m_source;
00962     DataConsumer* m_consumer;
00963     DataEndpoint* m_peer;
00964     CallEndpoint* m_call;
00965     DataConsumer* m_peerRecord;
00966     DataConsumer* m_callRecord;
00967     ObjList m_sniffers;
00968 };
00969 
00974 class YATE_API CallEndpoint : public RefObject
00975 {
00976     friend class DataEndpoint;
00977 
00978 private:
00979     CallEndpoint* m_peer;
00980     String m_id;
00981 
00982 protected:
00983     ObjList m_data;
00984     Mutex* m_mutex;
00985 
00986 public:
00990     virtual ~CallEndpoint();
00991 
00997     virtual void* getObject(const String& name) const;
00998 
01003     virtual const String& toString() const
01004         { return m_id; }
01005 
01010     inline const String& id() const
01011         { return m_id; }
01012 
01017     inline CallEndpoint* getPeer() const
01018         { return m_peer; }
01019 
01024     inline const String& getPeerId() const
01025         { return m_peer ? m_peer->id() : String::empty(); }
01026 
01031     inline Mutex* mutex() const
01032         { return m_mutex; }
01033 
01038     static Mutex& commonMutex();
01039 
01047     bool connect(CallEndpoint* peer, const char* reason = 0, bool notify = true);
01048 
01055     inline bool disconnect(const char* reason = 0, bool notify = true)
01056         { return disconnect(false,reason,notify); }
01057 
01063     DataEndpoint* getEndpoint(const char* type = "audio") const;
01064 
01070     DataEndpoint* setEndpoint(const char* type = "audio");
01071 
01076     void clearEndpoint(const char* type = 0);
01077 
01083     void setSource(DataSource* source = 0, const char* type = "audio");
01084 
01090     DataSource* getSource(const char* type = "audio") const;
01091 
01097     void setConsumer(DataConsumer* consumer = 0, const char* type = "audio");
01098 
01104     DataConsumer* getConsumer(const char* type = "audio") const;
01105 
01106 protected:
01110     CallEndpoint(const char* id = 0);
01111 
01116     virtual void connected(const char* reason) { }
01117 
01123     virtual void disconnected(bool final, const char* reason) { }
01124 
01131     void setPeer(CallEndpoint* peer, const char* reason = 0, bool notify = true);
01132 
01137     virtual void setId(const char* newId);
01138 
01139 private:
01140     bool disconnect(bool final, const char* reason, bool notify);
01141 };
01142 
01147 class YATE_API Module : public Plugin, public Mutex, public MessageReceiver, public DebugEnabler
01148 {
01149 private:
01150     bool m_init;
01151     int m_relays;
01152     String m_name;
01153     String m_type;
01154     Regexp m_filter;
01155     u_int64_t m_changed;
01156     static unsigned int s_delay;
01157 
01158 public:
01164     virtual void* getObject(const String& name) const;
01165 
01170     inline const String& name() const
01171         { return m_name; }
01172 
01177     inline const String& type() const
01178         { return m_type; }
01179 
01184     void changed();
01185 
01190     inline static unsigned int updateDelay()
01191         { return s_delay; }
01192 
01197     inline static void updateDelay(unsigned int delay)
01198         { s_delay = delay; }
01199 
01204     inline bool filterInstalled() const
01205         { return !m_filter.null(); }
01206 
01212     bool filterDebug(const String& item) const;
01213 
01214 protected:
01218     enum {
01219         // Module messages
01220         Status     = 0x00000001,
01221         Timer      = 0x00000002,
01222         Level      = 0x00000004,
01223         Command    = 0x00000008,
01224         Help       = 0x00000010,
01225         Halt       = 0x00000020,
01226         Route      = 0x00000040,
01227         // Driver messages
01228         Execute    = 0x00000100,
01229         Drop       = 0x00000200,
01230         // Channel messages
01231         Locate     = 0x00000400,
01232         Masquerade = 0x00000800,
01233         Ringing    = 0x00001000,
01234         Answered   = 0x00002000,
01235         Tone       = 0x00004000,
01236         Text       = 0x00008000,
01237         Progress   = 0x00010000,
01238         Update     = 0x00020000,
01239         Transfer   = 0x00040000,
01240         // Last possible public ID
01241         PubLast    = 0x0fffffff,
01242         // Private messages base ID
01243         Private    = 0x10000000
01244     } RelayID;
01245 
01251     static const char* messageName(int id);
01252 
01258     Module(const char* name, const char* type = 0);
01259 
01263     virtual ~Module();
01264 
01268     virtual void initialize();
01269 
01273     void setup();
01274 
01281     bool installRelay(int id, unsigned priority = 100);
01282 
01289     bool installRelay(const char* name, unsigned priority = 100);
01290 
01297     virtual bool received(Message &msg, int id);
01298 
01303     virtual void genUpdate(Message& msg);
01304 
01309     virtual void msgTimer(Message& msg);
01310 
01315     virtual void msgStatus(Message& msg);
01316 
01321     virtual bool msgRoute(Message& msg);
01322 
01327     virtual void statusModule(String& str);
01328 
01333     virtual void statusParams(String& str);
01334 
01340     virtual bool setDebug(Message& msg, const String& target);
01341 
01342 private:
01343     Module(); // no default constructor please
01344     static TokenDict s_messages[];
01345     bool installRelay(const char* name, int id, unsigned priority);
01346 };
01347 
01352 class YATE_API Channel : public CallEndpoint, public DebugEnabler
01353 {
01354     friend class Driver;
01355     friend class Router;
01356 
01357 private:
01358     Driver* m_driver;
01359     bool m_outgoing;
01360     u_int64_t m_timeout;
01361     u_int64_t m_maxcall;
01362 
01363 protected:
01364     String m_status;
01365     String m_address;
01366     String m_targetid;
01367     String m_billid;
01368     bool m_answered;
01369 
01370 public:
01374     virtual ~Channel();
01375 
01381     virtual void* getObject(const String& name) const;
01382 
01388     virtual void complete(Message& msg, bool minimal = false) const;
01389 
01397     Message* message(const char* name, bool minimal = false, bool data = false);
01398 
01404     virtual bool msgProgress(Message& msg);
01405 
01411     virtual bool msgRinging(Message& msg);
01412 
01418     virtual bool msgAnswered(Message& msg);
01419 
01426     virtual bool msgTone(Message& msg, const char* tone);
01427 
01434     virtual bool msgText(Message& msg, const char* text);
01435 
01442     virtual bool msgDrop(Message& msg, const char* reason);
01443 
01449     virtual bool msgTransfer(Message& msg);
01450 
01456     virtual bool msgUpdate(Message& msg);
01457 
01462     virtual void msgStatus(Message& msg);
01463 
01469     virtual void checkTimers(Message& msg, const Time& tmr);
01470 
01477     virtual bool callPrerouted(Message& msg, bool handled);
01478 
01484     virtual bool callRouted(Message& msg);
01485 
01490     virtual void callAccept(Message& msg);
01491 
01498     virtual void callRejected(const char* error, const char* reason = 0, const Message* msg = 0);
01499 
01505     virtual void callConnect(Message& msg);
01506 
01511     virtual bool setDebug(Message& msg);
01512 
01517     inline const String& status() const
01518         { return m_status; }
01519 
01524     inline const String& address() const
01525         { return m_address; }
01526 
01531     inline bool isOutgoing() const
01532         { return m_outgoing; }
01533 
01538     inline bool isIncoming() const
01539         { return !m_outgoing; }
01540 
01545     inline bool isAnswered() const
01546         { return m_answered; }
01547 
01552     const char* direction() const;
01553 
01558     inline Driver* driver() const
01559         { return m_driver; }
01560 
01565     inline u_int64_t timeout() const
01566         { return m_timeout; }
01567 
01572     inline void timeout(u_int64_t tout)
01573         { m_timeout = tout; }
01574 
01579     inline u_int64_t maxcall() const
01580         { return m_maxcall; }
01581 
01586     inline void maxcall(u_int64_t tout)
01587         { m_maxcall = tout; }
01588 
01593     inline void setMaxcall(const Message& msg)
01594         { setMaxcall(&msg); }
01595 
01600     void setMaxcall(const Message* msg);
01601 
01607     inline const String& targetid() const
01608         { return m_targetid; }
01609 
01615     inline const String& billid() const
01616         { return m_billid; }
01617 
01624     bool startRouter(Message* msg);
01625 
01630     static unsigned int allocId();
01631 
01636     void filterDebug(const String& item);
01637 
01638 protected:
01642     Channel(Driver* driver, const char* id = 0, bool outgoing = false);
01643 
01647     Channel(Driver& driver, const char* id = 0, bool outgoing = false);
01648 
01653     void cleanup();
01654 
01658     void dropChan();
01659 
01664     virtual void zeroRefs();
01665 
01670     virtual void connected(const char* reason);
01671 
01677     virtual void disconnected(bool final, const char* reason);
01678 
01683     virtual void setId(const char* newId);
01684 
01690     void status(const char* newstat);
01691 
01696     virtual void statusParams(String& str);
01697 
01702     inline void setOutgoing(bool outgoing = true)
01703         { m_outgoing = outgoing; }
01704 
01711     bool dtmfInband(const char* tone);
01712 
01719     bool toneDetect(const char* sniffer = "tone/*");
01720 
01721 private:
01722     void init();
01723     Channel(); // no default constructor please
01724 };
01725 
01730 class YATE_API Driver : public Module
01731 {
01732     friend class Router;
01733     friend class Channel;
01734 
01735 private:
01736     bool m_init;
01737     bool m_varchan;
01738     String m_prefix;
01739     ObjList m_chans;
01740     int m_routing;
01741     int m_routed;
01742     int m_total;
01743     unsigned int m_nextid;
01744     int m_timeout;
01745     int m_maxroute;
01746     int m_maxchans;
01747 
01748 public:
01754     virtual void* getObject(const String& name) const;
01755 
01760     inline const String& prefix() const
01761         { return m_prefix; }
01762 
01767     inline bool varchan() const
01768         { return m_varchan; }
01769 
01774     inline ObjList& channels()
01775         { return m_chans; }
01776 
01782     virtual Channel* find(const String& id) const;
01783 
01788     virtual bool isBusy() const;
01789 
01794     virtual void dropAll(Message &msg);
01795 
01801     virtual bool canAccept(bool routers = true);
01802 
01807     virtual bool canRoute();
01808 
01813     unsigned int nextid();
01814 
01819     inline unsigned int lastid() const
01820         { return m_nextid; }
01821 
01826     inline int timeout() const
01827         { return m_timeout; }
01828 
01833     inline int routing() const
01834         { return m_routing; }
01835 
01840     inline int routed() const
01841         { return m_routed; }
01842 
01847     inline int total() const
01848         { return m_total; }
01849 
01850 protected:
01856     Driver(const char* name, const char* type = 0);
01857 
01861     virtual void initialize();
01862 
01868     void setup(const char* prefix = 0, bool minimal = false);
01869 
01876     virtual bool received(Message &msg, int id);
01877 
01882     virtual void genUpdate(Message& msg);
01883 
01890     virtual bool msgExecute(Message& msg, String& dest) = 0;
01891 
01896     virtual void msgStatus(Message& msg);
01897 
01902     virtual void statusModule(String& str);
01903 
01908     virtual void statusParams(String& str);
01909 
01914     virtual void statusChannels(String& str);
01915 
01921     virtual bool setDebug(Message& msg, const String& target);
01922 
01926     virtual void loadLimits();
01927 
01932     inline void varchan(bool variable)
01933         { m_varchan = variable; }
01934 
01939     inline void timeout(int tout)
01940         { m_timeout = tout; }
01941 
01946     inline void maxRoute(int ncalls)
01947         { m_maxroute = ncalls; }
01948 
01953     inline void maxChans(int ncalls)
01954         { m_maxchans = ncalls; }
01955 
01956 private:
01957     Driver(); // no default constructor please
01958 };
01959 
01964 class YATE_API Router : public Thread
01965 {
01966 private:
01967     Driver* m_driver;
01968     String m_id;
01969     Message* m_msg;
01970 
01971 public:
01978     Router(Driver* driver, const char* id, Message* msg);
01979 
01983     virtual void run();
01984 
01989     virtual bool route();
01990 
01994     virtual void cleanup();
01995 
01996 protected:
02001     const String& id() const
02002         { return m_id; }
02003 };
02004 
02010 YATE_API bool isE164(const char* str);
02011 
02012 }; // namespace TelEngine
02013 
02014 #endif /* __YATEPHONE_H */
02015 
02016 /* vi: set ts=8 sw=4 sts=4 noet: */

Generated on Mon Sep 18 20:56:12 2006 for Yate by  doxygen 1.4.4