-
Notifications
You must be signed in to change notification settings - Fork 0
/
call.py
27 lines (25 loc) · 728 Bytes
/
call.py
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
import sys
import win32com.client,time
tapi = win32com.client.Dispatch("TAPI.TAPI")
tapi.Initialize()
# for item in tapi.Addresses: print(item.AddressName)
modemAll = False
modem = "USB"
if len(sys.argv) > 1:
sNumber = sys.argv[1]
else:
exit("Send a phone number to the program")
found = False
modemList = []
for item in tapi.Addresses:
if modemAll or modem in item.AddressName:
found = True
gobjCall = item.CreateCall(sNumber, 1, 0x8)
gobjCall.Connect (False)
if not modemAll:
break
else:
modemList.append(item.AddressName)
if not found:
modemList = str(modemList).strip('[]').replace(',', '\n')
print(f"No modem matched {modem} in\n{modemList}")