|
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.
|
|
|
|
|
The code does not shows any definition for the following objects:
1) cbAddress.SelectedItem
2) cbDestinationType.SelectedItem
3) playbackTerminal
4) currCall
5) PLAY_FILENAME
I assume they are globaly decleared at some point, and may have been initialized/assigned values at some other point. Could you please show me how they are decleared, and how they may have been previously assigned values if so?
|
|
|
|
|
Hi,
This is the code, I wish it helps, It is working now
<br />
#region TeleVariants<br />
private JulMar.Tapi3.TTapi tapi;<br />
TCall currCall = null;<br />
TTerminal playbackTerminal = null;<br />
TAddress mdmAdress; <br />
bool msg; <br />
int index; <br />
#endregion<br />
<br />
<br />
private void init()<br />
{<br />
<br />
tapi = new JulMar.Tapi3.TTapi();<br />
labelMsg.Text = Message[index];<br />
if (tapi.Initialize() == 0)<br />
{<br />
MessageBox.Show("No TAPI devices available."); <br />
}<br />
foreach (TAddress addr in tapi.Addresses)<br />
{<br />
if (String.Compare(addr.ServiceProviderName, "unimdm.tsp", true) == 0 &&<br />
addr.QueryMediaType(TAPIMEDIATYPES.AUDIO))<br />
{<br />
mdmAdress = addr;<br />
break;<br />
}<br />
}<br />
this.tapi.TE_FILETERMINAL += new System.EventHandler<JulMar.Tapi3.TapiFileTerminalEventArgs>(this.OnFileTerminal);<br />
this.tapi.TE_CALLMEDIA += new System.EventHandler<JulMar.Tapi3.TapiCallMediaEventArgs>(this.OnMediaEvent);<br />
this.tapi.TE_CALLSTATE += new System.EventHandler<JulMar.Tapi3.TapiCallStateEventArgs>(this.OnCallStateChanged);<br />
this.tapi.TE_DIGITEVENT += new System.EventHandler<JulMar.Tapi3.TapiDigitDetectionEventArgs>(this.OnDigitEvent);<br />
}<br />
private void SelectAddress()<br />
{<br />
TAPIMEDIATYPES mediaType = TAPIMEDIATYPES.AUDIO;<br />
if (mdmAdress.QueryMediaType(TAPIMEDIATYPES.VIDEO))<br />
mediaType |= TAPIMEDIATYPES.VIDEO;<br />
<br />
try<br />
{<br />
mdmAdress.Open(mediaType);<br />
}<br />
catch (TapiException ex)<br />
{<br />
if (ex.ErrorCode == unchecked((int)0x80040004))<br />
{<br />
try<br />
{<br />
MessageBox.Show("No voice modem detected!");<br />
mdmAdress.Open(TAPIMEDIATYPES.DATAMODEM);<br />
<br />
}<br />
catch<br />
{ <br />
MessageBox.Show(ex.Message);<br />
}<br />
}<br />
else<br />
{<br />
labelStatus.Text = (ex.Message);<br />
}<br />
}<br />
}<br />
<br />
public void MakeCall()<br />
{<br />
msg = false;<br />
index = 0;<br />
init();<br />
while (index < Num && mystatus[index] == 1)<br />
index++;<br />
if (index < Num)<br />
{<br />
listView_calls.Items[index].Selected = true;<br />
listView_calls.Items[index].EnsureVisible();<br />
SelectAddress();<br />
LINEADDRESSTYPES addrType = LINEADDRESSTYPES.PhoneNumber;<br />
TAPIMEDIATYPES mediaType = TAPIMEDIATYPES.AUDIO;<br />
currCall = mdmAdress.CreateCall(Phones[index], 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 />
string st = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + @"\PreMsg.wav";<br />
playbackTerminal.MediaPlayList = new string[] { st, st, st, st, st, st, st, st };<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 />
try<br />
{<br />
labelStatus.Text = "شماره گیری";<br />
allPicsInvisible();<br />
pictureBox_dialing.Visible = true;<br />
<br />
currCall.Connect(false);<br />
<br />
}<br />
catch (TapiException ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
}<br />
}<br />
else<br />
{<br />
MessageBox.Show("همۀ تماس ها با موفقیت انجام شد.");<br />
Close();<br />
}<br />
}<br />
|
|
|
|
|
Hi, Igot it this is the part of the code that do what I said, but as you said it doesn't wait while the one on the other side of the line answer the phone, it plays it as soon as connecting:
<br />
private void OnMediaEvent(object sender, TapiCallMediaEventArgs e)<br />
{<br />
if (e.Event == CALL_MEDIA_EVENT.CME_STREAM_ACTIVE)<br />
{<br />
TStream stm = e.Stream;<br />
if (stm.Direction == TERMINAL_DIRECTION.TD_RENDER &&<br />
stm.MediaType == TAPIMEDIATYPES.VIDEO)<br />
{<br />
TTerminal t = stm.FindTerminal(stm.MediaType, stm.Direction);<br />
if (t != null)<br />
{<br />
IVideoWindow vw = t.QueryInterface(typeof(IVideoWindow)) as IVideoWindow;<br />
if (vw != null)<br />
{<br />
vw.SetWindowPosition(this.Left + this.Width + 2, this.Top, vw.Width, vw.Height);<br />
vw.Visible = 1;<br />
}<br />
}<br />
}<br />
else if (currCall != null && <br />
stm.Direction == TERMINAL_DIRECTION.TD_CAPTURE &&<br />
stm.MediaType == TAPIMEDIATYPES.AUDIO &&<br />
playbackTerminal != null)<br />
{<br />
try<br />
{<br />
playbackTerminal.Start();<br />
toolStripStatusLabel1.Text = "File Playback Terminal started ";<br />
}<br />
catch (TapiException ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
<br />
}<br />
}<br />
}<br />
what is monitor voice activity? could you help me with a sample code or anything please? thx!!
|
|
|
|
|
I am using the code but I am getting a problem that is I am getting playback terminal as null, I am using a voice modem ZOOM 3095, please if anyone can suggest what can be the problem.
|
|
|
|
|
and by the way what is PLAYBACK TERMINAL, can anyone tell me tht too
|
|
|
|
|
hi i am ayaz and i am working on TAPI releted project using C# for this i need TAPI SDK's I try alot but i could'nt find it, please send me link of TAPI SDK so i can Download it i will be thankful to you my e-mail address is
evolution_ayaz@yahoo.com
|
|
|
|
|
hi, the TAPI SDK is part of windows SDK, you can download it for free from microsoft
"Imagination is more important than knowledge.."
{Albert Einstein}
|
|
|
|
|
Hello,
I am a beginner with C# and would like to receive a call and extract the caller ID with C#. Can I get any help?
Thank you!
pd
|
|
|
|
|
whats wrong with downloading my code and giving it a try ?
Imagination is more important than knowledge...
{Albert Einstein}
|
|
|
|
|
I m new to TAPI i want to receive call using TAPI in C# can u help me.
afshan
|
|
|
|
|
Hi !
I'm using VB.Net Express and show the message when I run the project:
"No symbols are loaded for any call stack frame. The source code cannot be displayed."
What's wrong ?
Thanks
Marcos
|
|
|
|
|
hi,
m facing a problem in disconnecting the call ,although call is disconnected bt it makes d line bzi and no other call could be entertained...
i got idea v have to release the cOM objects bt i don know how to do that
any guidness..
regards
|
|
|
|
|
by calling the shourdown method of the tapi api
|
|
|
|