Hallo,
ich habe mit ein freun kleiner program geschrieben mit C# das program ist mit ein usb isdn adabter an telefon verbunden capi und tapi ist instalier unsere problem ist das wir ein klein code für program geschriben haben die angekommende anrufe kennen soll aber es zeigt nur einmal die nummer wenn ich zweite mal anrufe wird nicht gezeigt und wir kommen nicht weiter ich bitte um hilfe.
Hier ist das code wir geschrien haben.
ich habe mit ein freun kleiner program geschrieben mit C# das program ist mit ein usb isdn adabter an telefon verbunden capi und tapi ist instalier unsere problem ist das wir ein klein code für program geschriben haben die angekommende anrufe kennen soll aber es zeigt nur einmal die nummer wenn ich zweite mal anrufe wird nicht gezeigt und wir kommen nicht weiter ich bitte um hilfe.
Hier ist das code wir geschrien haben.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TAPI3Lib;
namespace incommingCallTest
{
public partial class Form1 : Form
{
List<string> cbLines = new List<string>();
private void initializeTapi()
{
tapi = new TAPIClass();
tapi.Initialize();
foreach (ITAddress ad in (tapi.Addresses as ITCollection))
{
cbLines.Add(ad.AddressName);
}
tapi.EventFilter = (int)(TAPI3Lib.TAPI_EVENT.TE_CALLNOTIFICATION |
TAPI_EVENT.TE_CALLINFOCHANGE |
TAPI_EVENT.TE_DIGITEVENT |
TAPI_EVENT.TE_PHONEEVENT |
TAPI_EVENT.TE_CALLSTATE |
TAPI_EVENT.TE_GENERATEEVENT |
TAPI_EVENT.TE_GATHERDIGITS |
TAPI_EVENT.TE_REQUEST |
TAPI_EVENT.TE_ADDRESS);
tapi.ITTAPIEventNotification_Event_Event += new ITTAPIEventNotification_EventEventHandler(tapi_ITTAPIEventNotification_Event_Event);
}
public Form1()
{
InitializeComponent();
initializeTapi();
}
TAPIClass tapi = null;
//TAPI_EVENT tapievent=TAPI_EVENT.TE_CALLINFOCHANGE;
ITAddress line = null;
int cn = 0;
//object pEvent=null;
private void lineTapi()
{
foreach (ITAddress ad in (tapi.Addresses as ITCollection))
{
if (ad.AddressName.IndexOf("FRITZ") != -1)
{
line = ad;
break;
}
}
cn = tapi.RegisterCallNotifications(line, true, true, TapiConstants.TAPIMEDIATYPE_AUDIO, 2);
}
private void resetTapi()
{
line = null;
cn = 0;
}
private void Form1_Load(object sender, EventArgs e)
{
lineTapi();
}
string c = "0";
delegate void AddToCallLblDelegate(Control callControll, Control callInfoControll, string callNum, string callInfo);
private void AddToCallLbl(Control callControll, Control callInfoControll, string callNum, string callInfo)
{
if (this.InvokeRequired)
{
this.Invoke(new AddToCallLblDelegate(AddToCallLbl), new object[] { callControll, callInfoControll, callNum, callInfo });
}
callControll.Text = callNum;
callInfoControll.Text = callInfo;
}
private void tapi_ITTAPIEventNotification_Event_Event(TAPI_EVENT TapiEvent, object pEvent)
{
try
{
switch (TapiEvent)
{
case TAPI3Lib.TAPI_EVENT.TE_CALLNOTIFICATION:
TAPI3Lib.ITCallNotificationEvent cn = pEvent as TAPI3Lib.ITCallNotificationEvent;
if (cn.Call.CallState == TAPI3Lib.CALL_STATE.CS_OFFERING)
{
c = cn.Call.get_CallInfoString(TAPI3Lib.CALLINFO_STRING.CIS_CALLERIDNUMBER);
if (string.IsNullOrEmpty(call1Lbl.Text))
{
AddToCallLbl(call1Lbl, call1InfoLbl, c, cn.Call.Address.DialableAddress);
//tapi.Shutdown();
//resetTapi();
//initializeTapi();
//lineTapi();
return;
}
else if (string.IsNullOrEmpty(call2Lbl.Text))
{
AddToCallLbl(call2Lbl, call2InfoLbl, c, cn.Call.Address.DialableAddress);
//tapi.Shutdown();
//resetTapi();
//initializeTapi();
//lineTapi();
return;
}
else if (string.IsNullOrEmpty(call3Lbl.Text))
{
AddToCallLbl(call3Lbl, call3InfoLbl, c, cn.Call.Address.DialableAddress);
//tapi.Shutdown();
//resetTapi();
//initializeTapi();
//lineTapi();
return;
}
else if (string.IsNullOrEmpty(call4Lbl.Text))
{
AddToCallLbl(call4Lbl, call4InfoLbl, c, cn.Call.Address.DialableAddress);
//tapi.Shutdown();
//resetTapi();
//initializeTapi();
//lineTapi();
return;
}
else
{
AddToCallLbl(call1Lbl, call1InfoLbl, c, cn.Call.Address.DialableAddress);
//tapi.Shutdown();
//resetTapi();
//initializeTapi();
//lineTapi();
return;
}
}
break;
}
}
catch (Exception ex)
{
MessageBox.Show("Error " + ex);
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TAPI3Lib;
namespace incommingCallTest
{
public partial class Form1 : Form
{
List<string> cbLines = new List<string>();
private void initializeTapi()
{
tapi = new TAPIClass();
tapi.Initialize();
foreach (ITAddress ad in (tapi.Addresses as ITCollection))
{
cbLines.Add(ad.AddressName);
}
tapi.EventFilter = (int)(TAPI3Lib.TAPI_EVENT.TE_CALLNOTIFICATION |
TAPI_EVENT.TE_CALLINFOCHANGE |
TAPI_EVENT.TE_DIGITEVENT |
TAPI_EVENT.TE_PHONEEVENT |
TAPI_EVENT.TE_CALLSTATE |
TAPI_EVENT.TE_GENERATEEVENT |
TAPI_EVENT.TE_GATHERDIGITS |
TAPI_EVENT.TE_REQUEST |
TAPI_EVENT.TE_ADDRESS);
tapi.ITTAPIEventNotification_Event_Event += new ITTAPIEventNotification_EventEventHandler(tapi_ITTAPIEventNotification_Event_Event);
}
public Form1()
{
InitializeComponent();
initializeTapi();
}
TAPIClass tapi = null;
//TAPI_EVENT tapievent=TAPI_EVENT.TE_CALLINFOCHANGE;
ITAddress line = null;
int cn = 0;
//object pEvent=null;
private void lineTapi()
{
foreach (ITAddress ad in (tapi.Addresses as ITCollection))
{
if (ad.AddressName.IndexOf("FRITZ") != -1)
{
line = ad;
break;
}
}
cn = tapi.RegisterCallNotifications(line, true, true, TapiConstants.TAPIMEDIATYPE_AUDIO, 2);
}
private void resetTapi()
{
line = null;
cn = 0;
}
private void Form1_Load(object sender, EventArgs e)
{
lineTapi();
}
string c = "0";
delegate void AddToCallLblDelegate(Control callControll, Control callInfoControll, string callNum, string callInfo);
private void AddToCallLbl(Control callControll, Control callInfoControll, string callNum, string callInfo)
{
if (this.InvokeRequired)
{
this.Invoke(new AddToCallLblDelegate(AddToCallLbl), new object[] { callControll, callInfoControll, callNum, callInfo });
}
callControll.Text = callNum;
callInfoControll.Text = callInfo;
}
private void tapi_ITTAPIEventNotification_Event_Event(TAPI_EVENT TapiEvent, object pEvent)
{
try
{
switch (TapiEvent)
{
case TAPI3Lib.TAPI_EVENT.TE_CALLNOTIFICATION:
TAPI3Lib.ITCallNotificationEvent cn = pEvent as TAPI3Lib.ITCallNotificationEvent;
if (cn.Call.CallState == TAPI3Lib.CALL_STATE.CS_OFFERING)
{
c = cn.Call.get_CallInfoString(TAPI3Lib.CALLINFO_STRING.CIS_CALLERIDNUMBER);
if (string.IsNullOrEmpty(call1Lbl.Text))
{
AddToCallLbl(call1Lbl, call1InfoLbl, c, cn.Call.Address.DialableAddress);
//tapi.Shutdown();
//resetTapi();
//initializeTapi();
//lineTapi();
return;
}
else if (string.IsNullOrEmpty(call2Lbl.Text))
{
AddToCallLbl(call2Lbl, call2InfoLbl, c, cn.Call.Address.DialableAddress);
//tapi.Shutdown();
//resetTapi();
//initializeTapi();
//lineTapi();
return;
}
else if (string.IsNullOrEmpty(call3Lbl.Text))
{
AddToCallLbl(call3Lbl, call3InfoLbl, c, cn.Call.Address.DialableAddress);
//tapi.Shutdown();
//resetTapi();
//initializeTapi();
//lineTapi();
return;
}
else if (string.IsNullOrEmpty(call4Lbl.Text))
{
AddToCallLbl(call4Lbl, call4InfoLbl, c, cn.Call.Address.DialableAddress);
//tapi.Shutdown();
//resetTapi();
//initializeTapi();
//lineTapi();
return;
}
else
{
AddToCallLbl(call1Lbl, call1InfoLbl, c, cn.Call.Address.DialableAddress);
//tapi.Shutdown();
//resetTapi();
//initializeTapi();
//lineTapi();
return;
}
}
break;
}
}
catch (Exception ex)
{
MessageBox.Show("Error " + ex);
}
}
}
}
Du musst angemeldet sein, um Bilder zu sehen.
Zuletzt bearbeitet von einem Moderator: