avadhut
unread,May 16, 2012, 3:06:53 PM5/16/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hello,
I am getting null refernce exception. in
isc.CreateStream(TapiConstants.TAPIMEDIATYPE_AUDIO,TERMINAL_DIRECTION.TD_CAPTURE);
Please resolve the same
//ANSWER BUTTON
private void answer_Click(object sender, System.EventArgs e)
{
ITAddress i;
i = ia[line];
bool status=false;
IEnumCall ec = ia[line].EnumerateCalls();
uint arg = 0;
ITCallInfo ici;
try
{
ec.Next(1, out ici, ref arg);
ITBasicCallControl m_CallControl = (TAPI3Lib.ITBasicCallControl)ici;
// ITBasicCallControl2 callControl2 = ici as ITBasicCallControl2;
ITStreamControl isc = ici as ITStreamControl;//= (TAPI3Lib.ITStreamControl)ici;
ITStream ist=ici as ITStream;
ITTerminal localTerm = ici as ITTerminal;//(TAPI3Lib.ITTerminal)ici;
if (!reject)
{
// request the terminal using right media type and direction
//localTerm =
callControl2.RequestTerminal(TapiConstants.CLSID_String_FilePlaybackTerminal,
TapiConstants.TAPIMEDIATYPE_AUDIO, TERMINAL_DIRECTION.TD_CAPTURE);
//NULLREFERNCEEXCEPTION
isc.CreateStream(TapiConstants.TAPIMEDIATYPE_AUDIO,TERMINAL_DIRECTION.TD_CAPTURE);
ist.SelectTerminal(localTerm);
ist.StartStream();
ITMediaSupport mediasupport = localTerm as ITMediaSupport;
// prepare to put the file name
ITMediaPlayback mediaPlayback = localTerm as ITMediaPlayback;
if (mediaPlayback != null)
{
try
{
// Set the filename to play
object[] fileList = { @"E:tapi8.2w.wav" };
mediaPlayback.PlayList = fileList;
// Select the terminal
//callControl2.SelectTerminalOnCall(localTerm);
// ist.SelectTerminal(localTerm);
ist.StartStream();
// Answer the call
m_CallControl.Answer();
//callControl2.Answer();
// Start playback.
ITMediaControl mediaControl = localTerm as ITMediaControl;
mediaControl.Start();
// Assign the terminal now terminal
// m_PlayFileTerminal = localTerm;
status = true;
}
catch (Exception ep)
{
MessageBox.Show("here is exception inplaying musicnn" + ep);
//if (Log.IsErrorEnabled)
//{
// Log.ErrorFormat("Call.ReadyPlayTerminal: *** EXCEPTION*** {0}",
e);
//}
}
}
//}*/
}
else
{
MessageBox.Show("All calls are rejected. Please remove 'Reject'
tickmark");
m_CallControl.Disconnect(DISCONNECT_CODE.DC_REJECTED);
//ici.ReleaseUserUserInfo();
tobj.Shutdown();
initializetapi3();
registertoken[line] = tobj.RegisterCallNotifications(ia[line], true, true,
TapiConstants.TAPIMEDIATYPE_DATAMODEM, 2);
MessageBox.Show("Registration token : " + registertoken[line],
"Registration Succeed for line " + line);
}
}
catch (Exception exp)
{
MessageBox.Show("There may not be any calls to answer! nn" + exp,
"TAPI3");
}
}