Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

mmssip.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider,             *
00003  *                           Matthias Hardt, Guido Madaus                  *
00004  *                                                                         *
00005  *   Copyright (C) 2007-2008 BerLinux Solutions GbR                        *
00006  *                           Stefan Schwarzer & Guido Madaus               *
00007  *                                                                         *
00008  *   Copyright (C) 2009-2013 BerLinux Solutions GmbH                       *
00009  *                                                                         *
00010  *   Authors:                                                              *
00011  *      Stefan Schwarzer   <stefan.schwarzer@diskohq.org>,                 *
00012  *      Matthias Hardt     <matthias.hardt@diskohq.org>,                   *
00013  *      Jens Schneider     <jens.schneider@diskohq.org>,                   *
00014  *      Guido Madaus       <guido.madaus@diskohq.org>,                     *
00015  *      Patrick Helterhoff <patrick.helterhoff@diskohq.org>,               *
00016  *      René Bählkow       <rene.baehlkow@diskohq.org>                     *
00017  *                                                                         *
00018  *   This library is free software; you can redistribute it and/or         *
00019  *   modify it under the terms of the GNU Lesser General Public            *
00020  *   License version 2.1 as published by the Free Software Foundation.     *
00021  *                                                                         *
00022  *   This library is distributed in the hope that it will be useful,       *
00023  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00024  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00025  *   Lesser General Public License for more details.                       *
00026  *                                                                         *
00027  *   You should have received a copy of the GNU Lesser General Public      *
00028  *   License along with this library; if not, write to the                 *
00029  *   Free Software Foundation, Inc.,                                       *
00030  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
00031  **************************************************************************/
00032 
00033 #ifdef __HAVE_MMSSIP__
00034 
00035 #ifndef MMSSIP_H_
00036 #define MMSSIP_H_
00037 
00038 #include <pjsua-lib/pjsua.h>
00039 #include <iostream>
00040 #include <sigc++/sigc++.h>
00041 #include <map>
00042 
00043 using namespace std;
00044 
00045 typedef struct {
00046     string user;
00047     string passwd;
00048     string registrar;
00049     string realm;
00050     bool   autoanswer;
00051 } MMSSipAccount;
00052 
00053 typedef enum {
00054     BUDDY_ONLINE        = PJSUA_BUDDY_STATUS_ONLINE,
00055     BUDDY_OFFLINE       = PJSUA_BUDDY_STATUS_OFFLINE,
00056     BUDDY_UNKNOWN       = PJSUA_BUDDY_STATUS_UNKNOWN
00057 } MMSSipBuddyStatus;
00058 
00059 typedef struct {
00060     string              name;
00061     string              uri;
00062     MMSSipBuddyStatus   status;
00063 } MMSSipBuddy;
00064 
00065 typedef struct {
00066     pj_thread_desc  desc;
00067     pj_thread_t     *thread;
00068 } MMSSipThread;
00069 
00070 class MMSSip {
00071     private:
00072         string       stunserver,
00073                      nameserver;
00074         short int    localPort;
00075 
00076         vector<MMSSipThread>    threadInfo;
00077 
00078         map<int, MMSSipAccount> accounts;
00079         int                     defaultAccount;
00080         map<int, MMSSipBuddy>   buddies;
00081 
00082     public:
00083         MMSSip(const string    &user,
00084                const string    &passwd,
00085                const string    &registrar,
00086                const string    &realm = "",
00087                const string    &stunserver = "",
00088                const string    &nameserver = "",
00089                const short int &localPort = 5060);
00090 
00091         ~MMSSip();
00092 
00093         const bool registerAccount(const string &user,
00094                                    const string &passwd,
00095                                    const string &registrar,
00096                                    const string &realm,
00097                                    const bool defaultAccount = false,
00098                                    const bool autoanswer = false);
00099         const int call(const string &user, const string &domain = "");
00100         void hangup(int id = PJSUA_INVALID_ID);
00101         void answer(int id);
00102         void addBuddy(const string &name, const string &uri);
00103         MMSSipBuddy getBuddy(const int &id);
00104         bool setSpeakerVolume(const unsigned int percent);
00105         int  getSpeakerVolume();
00106         bool getAutoAnswer(const int accountId);
00107         void setAutoAnswer(const int accountId, const bool value = true);
00108         bool registerRingtone(const string &filename);
00109         bool registerBusytone(const string &filename);
00110         bool registerCallingtone(const string &filename);
00111 
00112         /**
00113          * sigc++-connector that will be emitted if a call is
00114          * successfull connected.
00115          *
00116          * Parameters are callid and call state.
00117          */
00118         sigc::signal<void, int, int>               *onCallSuccessfull;
00119 
00120         /**
00121          * sigc++-connector that will be emitted if a call is
00122          * incoming.
00123          *
00124          * Parameters are callid, calling user and call state.
00125          */
00126         sigc::signal<void, int, string, int>       *onCallIncoming;
00127 
00128         /**
00129          * sigc++-connector that will be emitted if a call is
00130          * disconnected.
00131          *
00132          * Parameters are callid and call state.
00133          */
00134         sigc::signal<void, int, int>               *onCallDisconnected;
00135 
00136         /**
00137          * sigc++-connector that will be emitted if you are trying
00138          * to call.
00139          *
00140          * Parameters are callid and call state.
00141          */
00142         sigc::signal<void, int, int>               *onCalling;
00143 
00144         /**
00145          * sigc++-connector that will be emitted if the status of
00146          * one of your buddies changed.
00147          *
00148          * Parameter is MMSSipBuddy structure.
00149          */
00150         sigc::signal<void, MMSSipBuddy>            *onBuddyStatus;
00151 };
00152 
00153 #endif /* MMSSIP_H_ */
00154 #endif /* __HAVE_MMSSIP__ */

Generated by doxygen