|
hello, i am really sorry as i will not be able to directly help you but if you face specific troubles with TAPI please post them and i will try to solve them for you.
"Imagination is more important than knowledge.."
{Albert Einstein}
|
|
|
|
|
Does anyone know why my playback terminal remains nothing after an assignment? Below is my code:
Private Sub OnDial(ByVal sender As Object, ByVal e As EventArgs)
Dim tapi As TTapi = New TTapi()
Dim addr As TAddress = Nothing
Dim CurrCall As TCall
tapi.Initialize()
For Each add As TAddress In tapi.Addresses
If (String.Compare(add.ServiceProviderName, "unimdm.tsp", True) = 0 And add.QueryMediaType(TAPIMEDIATYPES.AUDIO)) Then
addr = add
End If
Next
If addr IsNot Nothing Then
addr.Monitor(TAPIMEDIATYPES.AUDIO)
End If
Dim playbackTerminal As TTerminal
Dim Play_FileName As String = Server.MapPath(".\voices\test.wav")
' Create a call -- this should always succeed
CurrCall = addr.CreateCall("5551213", LINEADDRESSTYPES.PhoneNumber, TAPIMEDIATYPES.DATAMODEM)
If CurrCall IsNot Nothing Then
' Get the playback terminal from the call
Try
'THIS IS WHERE PLAYBACK IS UPDATED
playbackTerminal = CurrCall.RequestTerminal(TTerminal.FilePlaybackTerminal, TAPIMEDIATYPES.AUDIO, JulMar.Tapi3.TERMINAL_DIRECTION.TD_RENDER)
'BUT IT IS STILL NOTHING: Playback=Nothing
If playbackTerminal IsNot Nothing Then
playbackTerminal.MediaPlayList = New String() {Play_FileName}
CurrCall.SelectTerminalOnCall(playbackTerminal)
Else
MsgBox("Failed to retrieve playback terminal.")
CurrCall.Disconnect(JulMar.Tapi3.DISCONNECT_CODE.DC_REJECTED)
End If
Catch ex As TapiException
MsgBox(ex.Message)
End Try
|
|
|
|
|
What type is your modem? Make sure that you use VOICE modem.
>> CurrCall = addr.CreateCall("5551213", LINEADDRESSTYPES.PhoneNumber, TAPIMEDIATYPES.DATAMODEM)
it seems like you trying to create a call on DATAMODEM and run playback terminal as TAPIMEDIATYPES.AUDIO.
If you are trying to play a wav file it is supposes to be a playbackTerminal. But if you record voice, use recordingTerminal.
The initialization for playback would look like
ITBasicCallControl2 bc = (TAPI3Lib.ITBasicCallControl2)activeCall;
filePlayBackTerminal = bc.RequestTerminal(TapiConstants.CLSID_String_FilePlaybackTerminal, TapiConstants.TAPIMEDIATYPE_AUDIO, TERMINAL_DIRECTION.TD_CAPTURE);
|
|
|
|
|
TAddress addr = tapi.Addresses[0] ;
LINEADDRESSTYPES addrType = LINEADDRESSTYPES.PhoneNumber ;
TAPIMEDIATYPES mediaType = TAPIMEDIATYPES.AUDIO;
if (addr.QueryMediaType(TAPIMEDIATYPES.VIDEO))
mediaType |= TAPIMEDIATYPES.VIDEO;
try
{
addr.Open(mediaType);
}
catch (TapiException ex)
{
if (ex.ErrorCode == unchecked((int)0x80040004))
{
try
{
addr.Open(TAPIMEDIATYPES.DATAMODEM);
}
catch
{
toolStripStatusLabel1.Text = ex.Message;
}
}
else
{
toolStripStatusLabel1.Text = ex.Message;
}
}
// Create a call -- this should always succeed
currCall = addr.CreateCall(phoneNumber, addrType, mediaType);
if (currCall != null)
{
// Get the playback terminal from the call
try
{
playbackTerminal = currCall.RequestTerminal(
TTerminal.FilePlaybackTerminal,
TAPIMEDIATYPES.AUDIO, TERMINAL_DIRECTION.TD_CAPTURE );
if (playbackTerminal != null)
{
playbackTerminal.MediaPlayList = new string[] { PLAY_FILENAME };
//string[] names = playbackTerminal.MediaPlayList;
//playbackTerminal.Name;
currCall.SelectTerminalOnCall(playbackTerminal);
}
else
{
MessageBox.Show("Failed to retrieve playback terminal.");
}
}
catch (TapiException ex)
{
MessageBox.Show(ex.Message);
}
try
{
// Connect the call
currCall.Connect(false);
toolStripStatusLabel1.Text = "Placing call...";
}
catch (TapiException ex)
{
//toolStripStatusLabel1.Text = ex.Message;
}
}
this is my code, I am aiming to play a wav file as soon as call is connected but my playbackterminal remains null and I get an error Failed to retrieve playback terminal., I am using a voice modem ZOOM 3095, Please can anybody help me its really urgent for me. The same code if I use while connecting to data modem I can dial a call. please help me around waiting for reply. Thanks !!
|
|
|
|
|
Hi, I'm coding a simple answering machine service for Vista. I'm using Mark Smith's TAPIwrapper (TAPI 3.1) for .NET (in Visual Basic Express Edition 2008). The code looks very much like your example - same basic event handling structure - but with additional code to playback a welcome message when a call is answered and to record the caller's message after the welcome message finishes. Everything works nicely with one exception: when a remote caller hangs up, no event fires and the caller's message just keeps on recording. Eventually (after about a full minute), QWEST detects the line is idle and starts their "If you'd like to make a call, please hang up and dial again..." message. Eventually (after 2 minutes or so) QWEST kills the call and the code then finally gets the DISCONNECTED message and resets for another call. I've found several sources on the web that state this is a known issue with Unimodem drivers and voice modems - i.e. the driver does not detect remote hang-up. Many commercial PC answering machine programs apparently use some kind of line monitoring algorithm to work around the problem. If the line is "silent" for a set period of time, they force a disconnect.
My question: are there TAPI API's or other .NET methods that you know of for detecting a "silent" line. I've searched high and low and found nothing so far.
Thanks,
Clayton Gautier
|
|
|
|
|
Please find my code below. The problem is i need to initialize the bcc (basic call control) and ts (terminal support)
ERROR MESSAGE: OBJECT REFERENCE SET TO INSTANCE OF AN OBJECT.
'CODE STARTS HERE
Sub SendTapi(ByVal WavFileName As String)
Dim bcc As TAPI3Lib.ITBasicCallControl2=Nothing
Dim ts As ITTerminalSupport = Nothing
Dim fpbt As ITTerminal = ts.CreateTerminal
(TAPI3Lib.TapiConstants.CLSID_String_FilePlaybackTerminal,
TAPI3Lib.TapiConstants.TAPIMEDIATYPE_MULTITRACK,
TAPI3Lib.TERMINAL_DIRECTION.TD_BIDIRECTIONAL)
Dim mp As ITMediaPlayback = fpbt
Dim audiofile(1) As Object
audiofile(0) = Server.MapPath(WavFileName)
mp.PlayList = audiofile
bcc.unselectterminaloncall(fpbt)
bcc.selectterminaloncall(fpbt)
Dim mc As ITMediaControl = fpbt
mc.Start()
End Sub
PLEASE HELP.
ATOGWE
|
|
|
|
|
Hello,
i am a newbies in TAPI, and would like to know about setting up hardwares require for phone call(computer to phone call).i can do a IP call, but don't know how to do that. please kindly reply me the way to do that.
Thanks in advances,:->
John
|
|
|
|
|
I make an outgoing call, play a wav msg, and disconnect onFileTerminal(when the wave msg finished),everything is ok until then.then I make another outgoing call onDiscoonect event, to do the same things above, but I got the Ecxeption "No call appearance available." on the line "m_call.Cennect(false)", what does it mean?
|
|
|
|
|
I checked the status of curcall and I got that when the line "curcall.Connect(false)" runs, the status of curcall becomes "CALL_STATE.CS_DISCONNECTED". and that's why it makes that Ecxeption,but why does such a thing happen? why it should become disconnected?
|
|
|
|
|
you are probaply handling the wrong reference to the call object, maybe you are disconnecting the call twice or disconnecting the old call, not the new one.
give it a check.
"Imagination is more important than knowledge.."
{Albert Einstein}
|
|
|
|
|
Hi,
I changed my code so that I shutdown tapi and renew it everytime I want to dial the new number, and now I can dial a list of numbers consecutively, without any problem. Thank you for all your patience and being with me till the end.
|
|
|
|
|
Hi,
My goal is to make a phone call and when the user answers the call I
want to play a message.Now this is my code:
<br />
private TAPI3Lib.TAPIClass m_tapi=null;<br />
<br />
private TAPI3Lib.ITAddress m_address=null;<br />
<br />
private TAPI3Lib.ITBasicCallControl m_call=null;<br />
<br />
ITMediaPlayback pMediaPlayback;<br />
<br />
<br />
private bool SelectTerminal()<br />
<br />
{<br />
<br />
try<br />
<br />
{<br />
<br />
ITTerminal pFileTerm=null;<br />
<br />
ITTerminalSupport pTermSup=null;<br />
<br />
pTermSup=(ITTerminalSupport)m_address;<br />
<br />
pFileTerm=pTermSup.CreateTerminal(TapiConstants.CLSID_String_FilePlaybackTerminal, TapiConstants.TAPIMEDIATYPE_AUDIO,TERMINAL_DIRECTION.TD_CAPTURE);<br />
<br />
if(pFileTerm==null)<br />
<br />
MessageBox.Show("terminal is null");<br />
<br />
pMediaPlayback=null;<br />
<br />
pMediaPlayback=(ITMediaPlayback)pFileTerm;<br />
<br />
object[] s=new object[1]; <br />
s[0]="c:\\2.wav";<br />
<br />
pMediaPlayback.PlayList=s;<br />
<br />
ITCallInfo ci=(ITCallInfo)m_call;<br />
<br />
ITBasicCallControl2 cc2=(ITBasicCallControl2)ci;<br />
<br />
cc2.SelectTerminalOnCall(pFileTerm);<br />
<br />
m_control=(ITMediaControl)pFileTerm;<br />
<br />
}<br />
<br />
catch(Exception ex)<br />
<br />
{<br />
<br />
MessageBox.Show(ex.Message);<br />
<br />
}<br />
<br />
return true;<br />
<br />
}<br />
<br />
<br />
private void OnConnect()<br />
<br />
{<br />
<br />
m_control.Start();<br />
<br />
}<br />
when the call is making,an event of Call_Media happens,that is :
CALL_MEDIA_EVENT.CME_STREAM_FAIL
also I think I must use TD_RENDER for playing the wav sound, but when I use that I get this Exception:
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
What's wrong with my code? PLZ help, It's urgent...Thx
|
|
|
|
|
maybe its the wave file encoding, try recording it with 8 bit mono @ 11 kHz using windows recorder and tell me if it worked.
"Imagination is more important than knowledge.."
{Albert Einstein}
|
|
|
|
|
Yes, That was the problem, I did it and it worked.Thank you so much...
|
|
|
|
|
Hi,
This is my code:
<br />
<br />
private TAPI3Lib.TAPIClass m_tapi=null;<br />
<br />
private TAPI3Lib.ITAddress m_address=null;<br />
<br />
private TAPI3Lib.ITBasicCallControl m_call=null;<br />
<br />
ITMediaPlayback pMediaPlayback;<br />
<br />
<br />
private bool SelectTerminal()<br />
<br />
{<br />
<br />
try<br />
<br />
{<br />
<br />
ITTerminal pFileTerm=null;<br />
<br />
ITTerminalSupport pTermSup=null;<br />
<br />
pTermSup=(ITTerminalSupport)m_address;<br />
<br />
pFileTerm=pTermSup.CreateTerminal(TapiConstants.CLSID_String_FilePlaybackTerminal, TapiConstants.TAPIMEDIATYPE_AUDIO,TERMINAL_DIRECTION.TD_CAPTURE);<br />
<br />
if(pFileTerm==null)<br />
<br />
MessageBox.Show("terminal is null");<br />
<br />
pMediaPlayback=null;<br />
<br />
pMediaPlayback=(ITMediaPlayback)pFileTerm;<br />
<br />
object[] s=null;<br />
<br />
if(m_strFileName.Length<1)<br />
<br />
s=new string[]{"c:\\2.wav"};<br />
<br />
else<br />
<br />
s=new string[]{m_strFileName};<br />
<br />
pMediaPlayback.PlayList=s; <br />
<br />
ITCallInfo ci=(ITCallInfo)m_call;<br />
<br />
ITBasicCallControl2 cc2=(ITBasicCallControl2)ci; <br />
<br />
cc2.SelectTerminalOnCall(pFileTerm);<br />
<br />
m_control=(ITMediaControl)pFileTerm; <br />
<br />
}<br />
<br />
catch(Exception ex)<br />
<br />
{<br />
<br />
MessageBox.Show(ex.Message);<br />
<br />
}<br />
<br />
return true;<br />
<br />
}<br />
<br />
<br />
private void OnConnect()<br />
<br />
{ <br />
<br />
m_control.Start(); <br />
<br />
}<br />
<br />
<\code><br />
<br />
Why I don't hear anything when I pick up the phone?<br />
<br />
I'm a beginner, can anyone help me on this please? Thx in advance ;)
|
|
|
|
|
Andisheh_K wrote: pFileTerm=pTermSup.CreateTerminal(TapiConstants.CLSID_String_FilePlaybackTerminal, TapiConstants.TAPIMEDIATYPE_AUDIO,TERMINAL_DIRECTION.TD_CAPTURE);
TERMINAL_DIRECTION.TD_CAPTURE is used to record conversation, use playback instead
"Imagination is more important than knowledge.."
{Albert Einstein}
|
|
|
|
|
Hi,
Thx for your reply
The code gives me an Exception on this line:
pMediaPlayback.PlayList = s;
the exception is: Value does not fall within the expected range
I don't know whyI ignored that befor.What does it mean?
|
|
|
|
|
Hi Andisheh and others,
I encountered the same problem when I tried to construct a simple IVR machine for evaluation purpose that can play and record sound over the phone but now is stuck by the same problem. I am using VB.Net 2005. The method defined for C#.net 2005 is as the follows:
==============================================================
HRESULT put_PlayList(
[in] VARIANTARG PlayListVariant
);
Parameters
PlayListVariant
Variant of type VT_ARRAY, which contains variants of type VT_BSTR and VT_STORAGE.
The VT_BSTR elements of the array contain the names of the files to play. The file extension is used to determine the type of file. Currently, the supported file extensions are .avi and .wav.
===============================================================
Exception was encountered when I tried to assign a object value to the method objMediaPlayBack.PlayList.
Would Anyone know how to set the corresponding value in VB (objMediaPlayBack.PlayList) which is of a object type ?
Andisheh, any finding?
Thanks!
|
|
|
|
|
I want to play a message in an outgoing call when the one on the other side of the line pick up the phone, but I have found out that as voice modems can't detect when an outgoing line has been answered, thus the best way to do that is after CS_CONNECTED,I should start playing a mesage like "Press 1 ..." repeatedly and then if 1 is pressed I understand that the phone is answered by a human, and I can play my message.I'm a beginner and I need a sample code for the last part.I don't know how to detect the digit that was pressed.I will appreciate if anyone can help.Thx;)
|
|
|
|
|
Hi,
My goal is to make a phone call and when the user answers the call I
want to play a message.I'm a beginer in tapi programing, I have been able to dial a number and manage some of its events.Now I want to recognise if the call is answered so I can play the message. and also I want to know if the phone line was busy, or not answered or..., I will appreciate if anyone can help me with a sample code.(It's urgent, Plz help)
Thx
|
|
|
|
|
hi, Hmm.. to play a wave file is easy but to know when the other party on the phone picked up the call or not is very hard because modem does not provide such feature. so you will have to monitor voice activity
"Imagination is more important than knowledge.."
{Albert Einstein}
|
|
|
|
|
Thank you for your attention I have made a lot of search and I found a code using Julmar.tapi3 dll to do that, I just run the applicatio and it started playing a message axectly when I answered the phone.I don't know much about what the code does but this is the code:
<br />
private void OnDial(object sender, EventArgs e)<br />
{<br />
TAddress addr = (TAddress)cbAddress.SelectedItem;<br />
LINEADDRESSTYPES addrType = (LINEADDRESSTYPES) cbDestinationType.SelectedItem;<br />
<br />
TAPIMEDIATYPES mediaType = TAPIMEDIATYPES.AUDIO;<br />
if (addr.QueryMediaType(TAPIMEDIATYPES.VIDEO))<br />
mediaType |= TAPIMEDIATYPES.VIDEO;<br />
<br />
try<br />
{<br />
addr.Open(mediaType);<br />
}<br />
catch (TapiException ex)<br />
{<br />
if (ex.ErrorCode == unchecked((int)0x80040004))<br />
{<br />
try <br />
{ <br />
addr.Open(TAPIMEDIATYPES.DATAMODEM); <br />
}<br />
catch<br />
{<br />
toolStripStatusLabel1.Text = ex.Message;<br />
}<br />
}<br />
else<br />
{<br />
toolStripStatusLabel1.Text = ex.Message;<br />
}<br />
}<br />
<br />
currCall = addr.CreateCall(textDestination.Text, addrType, mediaType);<br />
if (currCall != null)<br />
{<br />
try<br />
{<br />
playbackTerminal = currCall.RequestTerminal(<br />
TTerminal.FilePlaybackTerminal,<br />
TAPIMEDIATYPES.AUDIO, TERMINAL_DIRECTION.TD_CAPTURE);<br />
if (playbackTerminal != null)<br />
{<br />
playbackTerminal.MediaPlayList = new string[] { PLAY_FILENAME };<br />
currCall.SelectTerminalOnCall(playbackTerminal);<br />
}<br />
else<br />
{<br />
MessageBox.Show("Failed to retrieve playback terminal.");<br />
}<br />
}<br />
catch (TapiException ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
<br />
<br />
<br />
try<br />
{<br />
currCall.Connect(false);<br />
toolStripStatusLabel1.Text = "Placing call...";<br />
}<br />
catch (TapiException ex)<br />
{<br />
toolStripStatusLabel1.Text = ex.Message;<br />
}<br />
}<br />
}<br />
but I havn't found any sample code for this with windows tapi3 dll. Now I don't know wich dll is better to work with. I have only 2 weeks left to finish the application, it's so important to me.
|
|
|
|
|
i would suggest you start a new article and share you code and idea, and i will post its link within the article here if you want to.
"Imagination is more important than knowledge.."
{Albert Einstein}
|
|
|
|
|
OK, Thx.
|
|
|
|
|
I am trying to do the same using TAPI 3x. I have created the necessary reference. Now looking at the solution that worked for you, I can not seem to make the same object declearation as you did. the resources are not available in the MS version of the tapi I have. Are you using a different dll reference or am I missing something.
|
|
|
|