473,387 Members | 3,821 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,387 software developers and data experts.

TAPI

Hello,
Has anyone got any examples of TAPI code in c#?
Thanks
John
Nov 15 '05 #1
1 15787
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.