[server] / trunk / server / src / dialogicchannel.h Repository:
ViewVC logotype

View of /trunk/server/src/dialogicchannel.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 663 - (download) (annotate)
Tue Mar 30 17:12:42 2010 UTC (3 years, 1 month ago) by jtarlton
File size: 7940 byte(s)
    1 /*
    2  * This file is part of Project DiaStar Server.
    3  *
    4  * More information about this project can be found at:
    5  * http://www.projectdiastar.org.
    6  *
    7  * Copyright (C) 2009 Dialogic Corp.
    8  *
    9  * This program is free software; you can redistribute it and/or
   10  * modify it under the terms of the GNU General Public License
   11  * as published by the Free Software Foundation; either version 2
   12  * of the License, or (at your option) any later version.
   13  *
   14  * This program is distributed in the hope that it will be useful,
   15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   17  * GNU General Public License for more details.
   18  *
   19  * You should have received a copy of the GNU General Public License
   20  * along with this program; if not, write to the Free Software
   21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
   22  * 02110-1301, USA.
   23  * Alternatively see <http://www.gnu.org/licenses/>.
   24  * Or see the LICENSE file included within the source tree.
   25  *
   26  */
   27 
   28 /*!
   29  * \file        dialogicchannel.h
   30  * \brief       Channel for Dialogic devices.
   31  * \author      Antony Martin <antony.martin@dialogic.com>
   32  * \author      John Tarlton <john.tarlton@dialogic.com>
   33  * \version     30-MAR-2009
   34  */
   35 
   36 #ifndef _DIALOGICCHANNEL_H
   37 #define _DIALOGICCHANNEL_H
   38 
   39 /*-------------------------------- Dependencies ------------------------------*/
   40 
   41 #include <string>
   42 
   43 #include "channelmanager.h"
   44 #include "ipinfo.h"
   45 
   46 #include "voxdevice.h"
   47 #include "ipmdevice.h"
   48 #include "mmdevice.h"
   49 #include "m3gdevice.h"
   50 #include "gcisdndevice.h"
   51 #include "gciptboard.h"
   52 #include "confdevice.h"
   53 #include "confpartydevice.h"
   54 
   55 /*----------------------------------------------------------------------------*/
   56 
   57 /*!
   58  * \class DialogicChannel
   59  * A channel manages the resources for a single call leg.
   60  */
   61 class DialogicChannel : public Channel
   62 {
   63 public:
   64 
   65   /*!
   66    * ctor. ISDN
   67    */
   68   DialogicChannel( DialogicChannelManager& channelMgr,
   69                    GcIsdnDevice* gc,
   70                    IpmDevice* ipm )
   71     : channelMgr_ (channelMgr),
   72       gcDevice_ (gc),
   73       ipmDevice_ (ipm),
   74       mmDevice_ (0),
   75       protocol_ (gc->getProtocol())  /* ISDN | SS7 */
   76   {;}
   77 
   78   /*!
   79    * ctor. SIP
   80    */
   81   DialogicChannel( DialogicChannelManager& channelMgr,
   82                    GcIptDevice* gc,
   83                    IpmDevice* ipm,
   84                    MmDevice* mm )
   85     : channelMgr_ (channelMgr),
   86       gcDevice_ (gc),
   87       ipmDevice_ (ipm),
   88       mmDevice_ (mm),
   89       protocol_ (PROTOCOL_SIP)
   90   {;}
   91 
   92   /*!
   93    * ctor. CONF
   94    */
   95   DialogicChannel( DialogicChannelManager& channelMgr,
   96                    ConfDevice* confDevice,
   97                    ConfPartyDevice* confParty,
   98                    IpmDevice* ipm,
   99                    MmDevice* mm )
  100     : channelMgr_ (channelMgr),
  101       gcDevice_ (0),
  102       ipmDevice_ (ipm),
  103       mmDevice_ (mm),
  104       confDevice_ (confDevice),
  105       confParty_ (confParty),
  106       protocol_ (PROTOCOL_CONF)
  107   {;}
  108 
  109   /*!
  110    * Get the signalling protocol.
  111    */
  112   virtual Protocol getProtocol() const { return protocol_; }
  113 
  114   /*!
  115    * Get the ipm device associated with this channel.
  116    */
  117   IpmDevice* getIpmDevice() const { return ipmDevice_; }
  118 
  119   /*!
  120    * Get the GC device associated with this channel.
  121    */
  122   GcDevice* getGcDevice() const { return gcDevice_; }
  123 
  124   /*!
  125    * Get the MM device associated with this channel.
  126    */
  127   MmDevice* getMmDevice() const { return mmDevice_; }
  128 
  129   /*!
  130    * Get the conference party device associated with this channel.
  131    */
  132   ConfPartyDevice* getConfPartyDevice() const { return confParty_; }
  133 
  134   /*!
  135    * Get the conference device associated with this channel.
  136    */
  137   ConfDevice* getConfDevice() const { return confDevice_; }
  138 
  139   /*!
  140    * Make an outbound call.
  141    * \param local_number - caller's number
  142    * \param local_name - caller's name
  143    * \param remote_number - callee's number
  144    * \param cpa - set true to enable call progress analysis.
  145    */
  146   virtual bool makeCall( const std::string& local_number,
  147                          const std::string& local_name,
  148                          const std::string& remote_number,
  149                          bool cpa );
  150 
  151   /*!
  152    * Hangup the current call.
  153    * \param cause - reason the call is being cleared
  154    */
  155   virtual bool hangup( int cause );
  156 
  157   /*!
  158    * Accept the current call.
  159    */
  160   virtual bool accept();
  161 
  162   /*!
  163    * Answer the current call.
  164    */
  165   virtual bool answer();
  166 
  167   /*!
  168    * Send dtmf digits inband using the vox device.
  169    */
  170   virtual bool sendDtmf( const std::string& dtmf );
  171 
  172   /*!
  173    * Play media to an established call using the mm device.
  174    * \param audio_uri - audio file.
  175    * \param video_uri - video file.
  176    * \param stop_digits - termination digits.
  177    * \param lang - language
  178    */
  179   virtual bool play( const std::string& audio_uri,
  180                      const std::string& video_uri,
  181                      const std::string& stop_digits,
  182                      const std::string& lang );
  183 
  184   /*!
  185    * Record media from an established call using the mm device.
  186    * \param audio_uri - audio file.
  187    * \param video_uri - video file.
  188    * \param stop_digits - termination digits.
  189    * \param lang - language
  190    * \param beep - if true, play a tone when recording starts.
  191    */
  192   virtual bool record( const std::string& audio_uri,
  193                        const std::string& video_uri,
  194                        const std::string& stop_digits,
  195                        const std::string& lang,
  196                        bool beep );
  197 
  198   /*!
  199    * Stop the current play or record operation.
  200    */
  201   virtual bool stop();
  202 
  203   /*!
  204    * Create a half-duplex media bridge from the external device of this channel
  205    * to the external device of another channel.
  206    * \param other_channel - channel to bridge to.
  207    */
  208   virtual bool bridge( Channel* other_channel );
  209 
  210   /*!
  211    * Test if a dtmf digit is a stop digit for the current play/record operation.
  212    * \param dtmf - digit to test.
  213    */
  214   virtual bool isStopDigit( char dtmf ) const;
  215 
  216   /*!
  217    * Start streaming media to the client.
  218    */
  219   virtual bool startMedia();
  220 
  221   /*!
  222    * Stop streaming media to the client.
  223    */
  224   virtual bool stopMedia();
  225 
  226   /*!
  227    * Test if this is a video call.
  228    */
  229   virtual bool isVideo() const;
  230 
  231   /*!
  232    * Get the local ip-address and port number for the rtp audio media.
  233    */
  234   virtual void getLocalRtpAudioInfo( IpInfo& rtp_audio ) const;
  235 
  236   /*!
  237    * Get the local ip-address and port number for the rtp video media.
  238    */
  239   virtual void getLocalRtpVideoInfo( IpInfo& rtp_video ) const;
  240 
  241   /*!
  242    * Save the ip-address and port of the remote party's rtp audio.
  243    */
  244   virtual void setRemoteRtpAudioInfo( const IpInfo& rtp_audio );
  245 
  246   /*!
  247    * Get the remote ip-address and port number for the rtp audio media.
  248    */
  249   virtual void getRemoteRtpAudioInfo( IpInfo& rtp_audio ) const;
  250 
  251   /*!
  252    * Save the ip-address and port of the remote party's rtp video.
  253    */
  254   virtual void setRemoteRtpVideoInfo( const IpInfo& rtp_video );
  255 
  256   /*!
  257    * Get the remote ip-address and port number for the rtp video media.
  258    */
  259   virtual void getRemoteRtpVideoInfo( IpInfo& rtp_video ) const;
  260 
  261   /*!
  262    * Clear the digit collection buffer.
  263    */
  264   void clearDigits() { collected_digits_.clear(); }
  265 
  266   /*!
  267    * Write a digit to the end of the collection buffer.
  268    * \param dtmf - digit to save.
  269    */
  270   void collectDigit( char dtmf ) { collected_digits_.push_back(dtmf); }
  271 
  272   /*!
  273    * Get the digit collection buffer.
  274    */
  275   const std::string& getDigits() const { return collected_digits_; }
  276 
  277 private:
  278 
  279   DialogicChannel();
  280   DialogicChannel( const DialogicChannel& );
  281   DialogicChannel& operator = ( const DialogicChannel& );
  282 
  283 private:
  284 
  285   DialogicChannelManager& channelMgr_;
  286 
  287   GcDevice*     gcDevice_;         /* dti(dk) or ipt */
  288   IpmDevice*    ipmDevice_;
  289   MmDevice*     mmDevice_;
  290   M3gDevice*    m3gDevice_;
  291   ConfDevice*   confDevice_;
  292   ConfPartyDevice* confParty_;
  293 
  294   Protocol      protocol_;
  295 
  296   std::string   stop_digits_;      /* play/record remination digits */
  297   std::string   collected_digits_; /* digits received during a play */
  298 };
  299 
  300 
  301 #endif // _DIALOGICCHANNEL_H
  302 
  303 /* vim:ts=4:set nu:
  304  * EOF
  305  */

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.8