forked from nic-at/httptapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpTapi.h
More file actions
209 lines (175 loc) · 5.72 KB
/
HttpTapi.h
File metadata and controls
209 lines (175 loc) · 5.72 KB
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
/*++
Copyright 2009-2012 IPcom GmbH
Copyright 1995 - 2000 Microsoft Corporation
Module Name: HttpTapi.h
--*/
#pragma once
#include <windows.h>
#include "tapi.h"
#include "tspi.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include "resource.h"
#include "resrc1.h"
#include <initguid.h>
#include <shlwapi.h>
#include <Wincrypt.h>
#include <Windowsx.h>
#include "Config.h"
//
// Line device GUID of MSP
//
// CLSID = s '// 23F7C678- 24E1 -48db- AE AC- 54 A6 F2 A0 10 A0
//DEFINE_GUID(CLSID_SAMPMSP,
//0x23F7C678, 0x24E1, 0x48db, 0xAE, 0xAC, 0x54, 0xA6, 0xF2, 0xA0, 0x10, 0xA0);
// {30A99BF3-079B-4f42-A00C-B7DD25689074}
DEFINE_GUID(CLSID_SAMPMSP,
0x30a99bf3, 0x79b, 0x4f42, 0xa0, 0xc, 0xb7, 0xdd, 0x25, 0x68, 0x90, 0x74);
// DesKeyBlob: A plaintext key BLOB stored in a byte array. The
// byte array must have the following format:
// BLOBHEADER hdr;
// DWORD dwKeySize;
// BYTE rgbKeyData [];
// Our DES Key with Parity
// 6e d3 86 79 94 04 6d c2
BYTE DesKeyBlob[] = {
0x08,0x02,0x00,0x00,0x01,0x66,0x00,0x00, // BLOB header
0x08,0x00,0x00,0x00, // key length, in bytes
0x6e,0xd3,0x86,0x79,0x94,0x04,0x6d,0xc2 // DES key with parity
};
#define MAX_REGKEYNAME_LENGTH 128
#define MAX_REGKEYVAL_LENGTH 1024
#define MAX_LICENSE_LENGTH 2048
#define CACERT_FILENAME "HTTPTAPI_TRUSTED_CAs.pem"
CHAR glpCAFileName[MAX_PATH];
typedef struct _DRVLINE
{
HTAPILINE htLine;
LINEEVENT pfnEventProc;
//
// MSP Variables
DWORD dwMSPHandle;
HTAPIMSPLINE htMSPLineHandle;
//
DWORD dwDeviceID;
char szComm[8];
HTAPICALL htCall;
DWORD dwCallState;
DWORD dwCallStateMode;
DWORD dwMediaMode;
HANDLE hComm;
BOOL bDropInProgress;
OVERLAPPED Overlapped;
} DRVLINE, FAR *PDRVLINE;
typedef struct _DRVLINECONFIG
{
char szPort[8];
char szUri[MAX_REGKEYVAL_LENGTH];
char szCa[MAX_REGKEYVAL_LENGTH];
} DRVLINECONFIG, FAR *PDRVLINECONFIG;
typedef struct _ASYNC_REQUEST
{
DWORD dwRequestID;
DWORD dwCommand;
char szCommand[32];
struct _ASYNC_REQUEST *pNext;
} ASYNC_REQUEST, *PASYNC_REQUEST;
typedef struct _LICENSE {
char *licenseIdentifier;
char *licenseVersion;
int iLicenseVersion;
char *name;
char *company;
char *address;
char *validUntil;
char *numberOfLines;
int iNumberOfLines;
char *additionalData;
} LICENSE, FAR *PLICENSE;
DWORD gdwLineDeviceIDBase;
DWORD gdwPermanentProviderID;
HANDLE ghInst;
HPROVIDER ghProvider;
ASYNC_COMPLETION gpfnCompletionProc;
LINEEVENT gpfnLineCreateProc;
DWORD gdwNumberOfLines; // Licensed lines
int giNumLines; // Configured lines
int giUseWindowsCertStore; // Use Windows Certificate Store
LICENSE gLicense;
char * gLicenseString;
// Location in the Registry to store our settings
char gszHttpTapiKey[] = "HttpTapi";
//char gszHttpTapiKeyBase[] = "Software\\ipcom.at";
//char gszHttpTapiKeyFull[] = "Software\\ipcom.at\\HttpTapi";
char gszHttpTapiKeyBase[] = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Telephony";
char gszHttpTapiKeyFull[] = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Telephony\\HTTPTAPI";
// Registry key to store if Windows certificate store should be used
char gszHttpTapiCertStore[] = "UseWindowsCertStore";
// Registry key to store the number of configured lines
char gszHttpTapiNumLines[] = "NumLines";
// Registry key to store the license string
char gszHttpTapiLicense[] = "License2";
char gszHttpTapiLicenseIdentifier[] = "www.ipcom.at/httptapi";
int gszHttpTapiLicenseVersion = 1;
// Registry key which hold the debug level (0=off, 7=maximum debugging)
char gszHttpTapiDebugLevel[] = "HttpTapiDebugLevel";
// Default (sample) configuration
char gszHttpTapiDefLineConfigParamsName[] = "ext. 123 (SNOM 200)";
char gszHttpTapiDefLineConfigParamsUri[] = "http://1.1.1.1/?NUMBER=%N&DIAL=Dial&active_line=1";
char gszHttpTapiDefLineConfigParamsCa[] = "";
// Default strings
char gszDefaultSnomUri[] = "http://1.1.1.1/?NUMBER=%N&DIAL=Dial&active_line=1";
char gszDefaultAsteriskUri[] = "http://1.1.1.1:8088/asterisk/mxml?action=login&username=YOURUSERNAME&secret=YOURPASSWORD#http://1.1.1.1:8088/asterisk/mxml?action=originate&channel=SIP/YOURPEERNAME&context=YOURCONTEXT&exten=%N&priority=1&callerid=1234567&timeout=5000";
char gszhdLine[] = "hdLine";
char gszhdCall[] = "hdCall";
char gszdwSize[] = "dwSize";
char gszhwndOwner[] = "hwndOwner";
char gszdwDeviceID[] = "dwDeviceID";
char gszdwRequestID[] = "dwRequestID";
char gszlpCallParams[] = "lpCallParams";
char gszdwPermanentProviderID[] = "dwPermanentProviderID";
LPWSTR
PASCAL
My_lstrcpyW(
WCHAR *pString1,
WCHAR *pString2
);
LPVOID
PASCAL
DrvAlloc(
DWORD dwSize
);
VOID
PASCAL
DrvFree(
LPVOID lp
);
void
PASCAL
SetCallState(
PDRVLINE pLine,
DWORD dwCallState,
DWORD dwCallStateMode
);
BOOL
CALLBACK
ConfigDlgProc(
HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam
);
LONG
PASCAL
ProviderInstall(
char *pszProviderName,
BOOL bNoMultipleInstance
);
void
PASCAL
DropActiveCall(
PDRVLINE pLine
);