473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

TAPI

Hello,
Has anyone got any examples of TAPI code in c#?
Thanks
John
Nov 15 '05 #1
1 15798
I hope this helps. I haven't figured out how to hangup AND how to capture events (dialed a busy line or fax) from the modem yet. If you do please let me know.

This works if the modem is hooked up to the server. I am having problems writing this into .NET 2.0 web page as a javascript so the modem on the client machine will dial instead.

// you must referrence C:\windows\system32\tapi3.dll in your project

<asp:Label ID="lblModem" runat="server" Text="Label">
THIS DISPLAYS ALL YOU AVAILABLE MODEMS
</asp:Label>
<asp:TextBox ID="txtModem" runat="server">
CHANGE YOUR MODEM NAME YOU ARE GOING TO USE HERE
</asp:TextBox>
<asp:TextBox ID="txtPhoneNumber" runat="server">
CHANGE THE PHONE NUMBER YOU WANT TO DIAL
</asp:TextBox>



<%--TAPI_Phone.aspx--------------------------------------------------------------------%>



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TAPI_Phone.aspx.cs" Inherits="TAPI_Phone" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<script runat="server">
</script>
<title>TAPI_Phone Test Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="lblModem" runat="server" Text="Label"></asp:Label>
<asp:TextBox ID="txtModem" runat="server">BCM V.92 56K Modem</asp:TextBox>
<asp:TextBox ID="txtPhoneNumber" runat="server">5551212</asp:TextBox>
</form>
</body>
</html>




//TAPI_Phone.aspx.cs-------------------------------------------------------------------------


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;
// you must referrence C:\windows\system32\tapi3.dll in your project
using TAPI3Lib;

public partial class TAPI_Phone : System.Web.UI.Page
{
uint ui;
string sModemName = "";
TAPI3Lib.TAPIClass pTAPI = new TAPI3Lib.TAPIClass();
//ITAddressPtr pAddress;
TAPI3Lib.ITAddress pAddress;
//IEnumAddressPtr pEnumAddress;
TAPI3Lib.IEnumAddress pEnumAddress;
//ITBasicCallControlPtr pCall;
TAPI3Lib.ITBasicCallControl pCall;
const int LINEADDRESSTYPE_PHONENUMBER = 1;
const int TAPIMEDIATYPE_AUDIO = 8;

protected void Page_Load(object sender, EventArgs e)
{
pTAPI.Initialize();
pEnumAddress = pTAPI.EnumerateAddresses();
lblModem.Text = "";
while (txtModem.Text != sModemName)
{
pEnumAddress.Next(1, out pAddress, ref ui);
sModemName = pAddress.AddressName.ToString();
lblModem.Text = lblModem.Text + "<li>" + sModemName;
}
If the line was found, then make a call
pCall = pAddress.CreateCall(txtPhoneNumber.Text,
LINEADDRESSTYPE_PHONENUMBER,
TAPIMEDIATYPE_AUDIO);
// Make the call
pCall.Connect(true);
// Wait a while - do something here while the call is ongoing
//Thread.Sleep(5000); // wait 5 seconds
// Hangup
pCall.Disconnect(DISCONNECT_CODE.DC_NORMAL);
// Shutdown TAPI
pTAPI.Shutdown();
}
}
Jul 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: futureofphp | last post by:
Hi, Just out of curiosity, Can I use TAPI (Telephone API) in PHP. Create an answering machine that can answer calls and respond, also detect DTMF tones using TAPI? I havent heard of such a...
0
by: Damon | last post by:
I am using the following code (primarily wizard created) to dial a phone number on an access form via the on double click event. Application.Run "utility.wlib_AutoDial", stDialStr I want to...
5
by: David | last post by:
Hello. Where can I find some examples of using TAPI in C#? And is there any site or newsgroup for TAPI?
11
by: BizTalk Architect | last post by:
Hello, I am days into this problem and I cant make heads or tails of it. Please post suggestions, I dont care how crazy they sound. Scenario: I have a TAPI C# application. (TAPI 3.0)
1
by: ahmed fat-hi | last post by:
hi every body to make a call using TAPI i do the following: 1- initiate connectiion 2- Select an Address 3- make a call when i make a call i execute the function ITAddress::CreateCall the...
3
by: perspolis | last post by:
Hi all thanks in advance to read my post. I created a TAPI application and in this application I monitor the digits that user enter by phone.. it works well when I call from a phone but it...
7
by: StevenVibert | last post by:
I'm rewriting a C++ TAPI app I wrote a while ago in C#. Everything works fine for the first call. Unfortunately, all subsequent calls are completely ignored by TAPI until I restart the app again....
1
by: Dr.Sameh Ali | last post by:
I am trying to build IVR system using c# . i know that .net wrapper for tapi does not work well. but it seems that many made it work. So my question: Is there any hope to find a working code that...
0
jackb
by: jackb | last post by:
Hi there. Is there any solution such that I could connect to some TAPI access number using TAPI in .NET, and then could send messages? E.g. consider SprintPCS; I could send message to any...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.