/
microsipDlg.h
319 lines (270 loc) · 8.09 KB
/
microsipDlg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
#pragma once
#include "const.h"
#include <pjsua-lib/pjsua.h>
#include <pjsua-lib/pjsua_internal.h>
#include "mmdeviceapi.h"
#pragma comment(lib, "winmm.lib")
#ifdef _GLOBAL_LIB_FILENAME
#pragma comment(lib, _GLOBAL_LIB_FILENAME)
#else
#ifdef NDEBUG
#ifdef _GLOBAL_VIDEO
// Spidy - use the output from pjsua project lib - save renaming the file
//#pragma comment(lib, "libpjproject-i386-Win32-vc8-Release-Static-Video.lib")
#pragma comment(lib, "libpjproject-i386-Win32-vc8-Release-Static.lib")
#else
// Spidy - use the output from pjsua project lib - save renaming the file
//#pragma comment(lib, "libpjproject-i386-Win32-vc8-Release-Static-NoVideo.lib")
#pragma comment(lib, "libpjproject-i386-Win32-vc8-Release-Static.lib")
#endif
#else
#ifdef _GLOBAL_VIDEO
// Spidy - use the output from pjsua project lib - save renaming the file
//#pragma comment(lib, "libpjproject-i386-Win32-vc8-Debug-Static-Video.lib")
#pragma comment(lib, "libpjproject-i386-Win32-vc8-Debug-Static.lib")
#else
// Spidy - use the output from pjsua project lib - save renaming the file
//#pragma comment(lib, "libpjproject-i386-Win32-vc8-Debug-Static-NoVideo.lib")
#pragma comment(lib, "libpjproject-i386-Win32-vc8-Debug-Static.lib")
#endif
#endif
#endif
#include "langpack.h"
#include "BaseDialog.h"
#include "RinginDlg.h"
#ifndef _GLOBAL_NO_ACCOUNT
#include "AccountDlg.h"
#endif
#ifndef _GLOBAL_NO_SETTINGS
#include "SettingsDlg.h"
#endif
#include "MessagesDlg.h"
#include "Dialer.h"
#ifndef _GLOBAL_NO_CONTACTS
#include "Contacts.h"
#endif
#include "Calls.h"
#include "Preview.h"
#include "Transfer.h"
#include "addons.h"
#include "Mmsystem.h"
extern bool PJAccountAndStatusUpdateRunning;
class IMMNotificationClientConcreteClass : public IMMNotificationClient
{
public:
ULONG m_cRef;
IMMNotificationClientConcreteClass::IMMNotificationClientConcreteClass()
{
}
~IMMNotificationClientConcreteClass() {
}
STDMETHODIMP OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState) {
return S_OK;
}
void initialize();
STDMETHODIMP OnDeviceAdded(LPCWSTR pwstrDeviceId);
STDMETHODIMP OnDeviceRemoved(LPCWSTR pwstrDeviceId)
{
return S_OK;
}
STDMETHODIMP OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDefaultDeviceId);
STDMETHODIMP OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key)
{
return S_OK;
}
void OnPFooFinalRelease()
{
}
STDMETHOD(QueryInterface) (REFIID riid,
LPVOID FAR* ppvObj)
{
return S_OK;
}
STDMETHOD_(ULONG,AddRef)()
{
return InterlockedIncrement((LONG *)&m_cRef);
}
STDMETHOD_(ULONG,Release) ()
{
ULONG lRet = InterlockedDecrement((LONG *)&m_cRef);
if (lRet == 0)
{
delete this;
}
return lRet;
}
};
// CmicrosipDlg dialog
class CmicrosipDlg : public CBaseDialog
{
private:
void CreateTrayIcon();
// Construction
public:
CmicrosipDlg(CWnd* pParent = NULL); // standard constructor
~CmicrosipDlg();
BOOL OnDeviceChange(void);
// Dialog Data
enum { IDD = IDD_MICROSIP_DIALOG };
bool m_startMinimized;
#ifndef _GLOBAL_NO_SETTINGS
SettingsDlg* settingsDlg;
#endif
MessagesDlg* messagesDlg;
Transfer* transferDlg;
#ifdef _GLOBAL_ACCOUNT_REG
Reg1* reg1Dlg;
Reg2* reg2Dlg;
Reg3* reg3Dlg;
#endif
#ifdef _GLOBAL_BALANCE_BEE
int regUserId;
#endif
#ifdef _GLOBAL_CONFERENCE_DIALOG
ConferenceDlg* conferenceDlg;
CString lastCallNumber;
#endif
Dialer* pageDialer;
#ifndef _GLOBAL_NO_CONTACTS
Contacts* pageContacts;
#endif
#ifndef _GLOBAL_NO_CALLS
Calls* pageCalls;
#endif
#ifdef _GLOBAL_PAGE_BUTTONS
Buttons* pageButtons;
#endif
BOOL notStopRinging;
CArray <RinginDlg*> ringinDlgs;
CString dialNumberDelayed;
CString balance;
UINT callTimer;
pjsua_acc_config acc_cfg;
pjsua_acc_id account_local;
pjsua_transport_id transport_udp_local;
pjsua_transport_id transport_udp;
pjsua_transport_id transport_tcp;
pjsua_transport_id transport_tls;
pjsua_player_id player_id;
int audio_input;
int audio_output;
int audio_ring;
BOOL disableAutoRegister;
CString callIdImcomingIgnore;
void PJCreate();
void PJDestroy();
void PJAccountAdd();
void PJUpdatePresence();
void PJAccountAndStatusUpdate();
void PJAccountAddLocal();
void PJAccountDelete();
void PJAccountDeleteLocal();
void PJAccountConfig(pjsua_acc_config *acc_cfg);
void PJResetStack ();
void UpdateWindowText(CString = CString(), int icon = IDI_DEFAULT, bool afterRegister = false);
void PublishStatus(bool online = true, bool init=false);
void BaloonPopup(CString title, CString message, DWORD flags = NIIF_WARNING);
void GotoTab(int i, CTabCtrl* tab = NULL);
void DialNumberFromCommandLine(CString number);
void DialNumber(CString params);
void RingIn(CString filename=CString(), BOOL noLoop = FALSE, BOOL inCall = FALSE);
void SetSoundDevice(int outDev);
BOOL CopyStringToClipboard( IN const CString & str );
void OnTimerCall (bool manual = false);
void UsersDirectoryLoad();
#ifndef _GLOBAL_NO_CONTACTS
void OnTimerContactBlink();
#endif
void SetupJumpList();
void RemoveJumpList();
void MainPopupMenu();
void AccountSettingsPendingSave();
void UpdateSoundDevicesIds();
void check_for_device_change();
#ifdef _GLOBAL_VIDEO
Preview* previewWin;
int VideoCaptureDeviceId(CString name=_T(""));
#endif
#ifdef _GLOBAL_BALANCE_GTN
void BalanceGTN();
#endif
#ifdef _GLOBAL_BALANCE_PLAIN
void BalancePlain();
#endif
#ifdef _GLOBAL_BALANCE_OPTIONS
void BalanceOption();
#endif
#ifdef _GLOBAL_BALANCE_BEE
void BalanceBEE();
void LoginBEE();
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
HICON iconSmall;
HICON iconInactive;
NOTIFYICONDATA tnd;
CStatusBar m_bar;
unsigned char m_tabPrev;
POINT m_mousePos;
int m_idleCounter;
BOOL m_isAway;
virtual BOOL OnInitDialog();
virtual void PostNcDestroy();
// Generated message map functions
afx_msg LRESULT onTrayNotify(WPARAM, LPARAM);
afx_msg LRESULT onCreateRingingDlg(WPARAM, LPARAM);
afx_msg LRESULT onDestroyRingingDlg(WPARAM, LPARAM);
afx_msg LRESULT OnAccount(WPARAM wParam,LPARAM lParam);
afx_msg LRESULT onCallMediaState(WPARAM, LPARAM);
#ifndef _GLOBAL_NO_MESSAGING
afx_msg LRESULT onPager(WPARAM, LPARAM);
afx_msg LRESULT onPagerStatus(WPARAM, LPARAM);
#endif
#ifndef _GLOBAL_NO_CONTACTS
afx_msg LRESULT onBuddyState(WPARAM, LPARAM);
#endif
afx_msg LRESULT onShellExecute(WPARAM wParam,LPARAM lParam);
afx_msg LRESULT onDialNumber(WPARAM, LPARAM);
afx_msg LRESULT CreationComplete(WPARAM, LPARAM);
DECLARE_MESSAGE_MAP()
public:
// Spidy - tray icon restore on task bar recreate
// http://www.go4expert.com/articles/display-tray-icon-vcpp-t343/
afx_msg HRESULT OnExplorerCrashTrayRecover( WPARAM wParam_i, LPARAM lParam);
afx_msg LRESULT onPowerBroadcast(WPARAM, LPARAM);
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg BOOL OnQueryEndSession();
afx_msg void OnBnClickedOk();
afx_msg void OnClose();
afx_msg void OnContextMenu(CWnd *pWnd, CPoint point );
afx_msg void OnMove(int x, int y);
afx_msg void OnSize(UINT type, int w, int h);
afx_msg LRESULT onCallAnswer(WPARAM,LPARAM);
afx_msg LRESULT onCallHangup(WPARAM,LPARAM);
afx_msg LRESULT onSetPaneText(WPARAM wParam,LPARAM lParam);
#ifndef _GLOBAL_NO_ACCOUNT
afx_msg void OnMenuAccountAdd();
afx_msg void OnMenuAccountChange(UINT nID);
afx_msg void OnMenuAccountEdit(UINT nID);
#endif
afx_msg void OnMenuSettings();
afx_msg void OnMenuAlwaysOnTop();
#ifndef _GLOBAL_NO_LOG
afx_msg void OnMenuLog();
#endif
afx_msg void OnMenuExit();
afx_msg void OnTimer (UINT TimerVal);
afx_msg void OnTcnSelchangeTab(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnTcnSelchangingTab(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnMenuWebsite();
#if !defined _GLOBAL_CUSTOM || defined _GLOBAL_UPDATES
afx_msg void CheckUpdates();
#endif
#ifdef _GLOBAL_VIDEO
afx_msg void createPreviewWin();
#endif
};
int getRealPort (Account& oAccount);