]>
git.ipfire.org Git - thirdparty/freeswitch.git/blob - fscomm/fshost.h
2 * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3 * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
17 * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
19 * The Initial Developer of the Original Code is
20 * Anthony Minessale II <anthm@freeswitch.org>
21 * Portions created by the Initial Developer are Copyright (C)
22 * the Initial Developer. All Rights Reserved.
26 * Joao Mesquita <jmesquita@freeswitch.org>
35 #include <QSharedPointer>
43 static void eventHandlerCallback(switch_event_t
*);
44 static switch_status_t
loggerHandler(const switch_log_node_t
*, switch_log_level_t
);
46 class FSHost
: public QThread
50 explicit FSHost(QObject
*parent
= 0);
51 switch_status_t
sendCmd(const char *cmd
, const char *args
, QString
*res
);
52 void generalEventHandler(QSharedPointer
<switch_event_t
>event
);
53 void generalLoggerHandler(QSharedPointer
<switch_log_node_t
>node
, switch_log_level_t level
);
54 void printEventHeaders(QSharedPointer
<switch_event_t
>event
);
55 QSharedPointer
<Call
> getCallByUUID(QString uuid
) { return _active_calls
.value(uuid
); }
56 QSharedPointer
<Call
> getCurrentActiveCall();
57 QList
<QSharedPointer
<Account
> > getAccounts() { return _accounts
.values(); }
58 QSharedPointer
<Account
> getAccountByUUID(QString uuid
);
59 QSharedPointer
<Account
> getCurrentDefaultAccount();
60 QSharedPointer
<Account
> getAccountByName(QString accStr
);
61 void accountReloadCmd(QSharedPointer
<Account
> acc
);
62 QBool
isModuleLoaded(QString
);
69 void coreLoadingError(QString
);
70 void loadingModules(QString
, int, QColor
);
71 void loadedModule(QString
, QString
);
76 void eventLog(QSharedPointer
<switch_log_node_t
>, switch_log_level_t
);
77 void newEvent(QSharedPointer
<switch_event_t
>);
80 void ringing(QSharedPointer
<Call
>);
81 void answered(QSharedPointer
<Call
>);
82 void newOutgoingCall(QSharedPointer
<Call
>);
83 void callFailed(QSharedPointer
<Call
>);
84 void hungup(QSharedPointer
<Call
>);
87 void accountStateChange(QSharedPointer
<Account
>);
88 void newAccount(QSharedPointer
<Account
>);
89 void delAccount(QSharedPointer
<Account
>);
92 /* We need to wait for the gateway deletion before reloading it */
93 void accountReloadSlot(QSharedPointer
<Account
>);
94 void minimalModuleLoaded(QString
, QString
);
100 /*FSM State handlers*/
101 /** Channel Related*/
102 void eventChannelCreate(QSharedPointer
<switch_event_t
> event
, QString uuid
);
103 void eventChannelAnswer(QSharedPointer
<switch_event_t
> event
, QString uuid
);
104 void eventChannelState(QSharedPointer
<switch_event_t
>event
, QString uuid
);
105 void eventChannelExecute(QSharedPointer
<switch_event_t
>event
, QString uuid
);
106 void eventChannelExecuteComplete(QSharedPointer
<switch_event_t
>event
, QString uuid
);
107 void eventChannelOutgoing(QSharedPointer
<switch_event_t
>event
, QString uuid
);
108 void eventChannelOriginate(QSharedPointer
<switch_event_t
>event
, QString uuid
);
109 void eventChannelProgress(QSharedPointer
<switch_event_t
>event
, QString uuid
);
110 void eventChannelProgressMedia(QSharedPointer
<switch_event_t
>event
, QString uuid
);
111 void eventChannelBridge(QSharedPointer
<switch_event_t
>event
, QString uuid
);
112 void eventChannelHangup(QSharedPointer
<switch_event_t
>event
, QString uuid
);
113 void eventChannelUnbridge(QSharedPointer
<switch_event_t
>event
, QString uuid
);
114 void eventChannelHangupComplete(QSharedPointer
<switch_event_t
>event
, QString uuid
);
115 void eventChannelDestroy(QSharedPointer
<switch_event_t
>event
, QString uuid
);
118 void eventCodec(QSharedPointer
<switch_event_t
>event
, QString uuid
);
119 void eventCallUpdate(QSharedPointer
<switch_event_t
>event
, QString uuid
);
120 void eventRecvInfo(QSharedPointer
<switch_event_t
>event
, QString uuid
);
122 /* Structures to keep track of things */
123 QHash
<QString
, QSharedPointer
<Call
> > _active_calls
;
124 QHash
<QString
, QSharedPointer
<Account
> > _accounts
;
125 QHash
<QString
, QSharedPointer
<Channel
> > _channels
;
126 QList
<QString
> _reloading_Accounts
;
127 QList
<QString
> _loadedModules
;
130 extern FSHost
*g_FSHost
;