Click here to Skip to main content
15,885,855 members
Articles / Programming Languages / C#

Examples to create your Conferencing System in .NET, C# VOIP & Video Conferencing Systems using H.323 and TAPI 3

Rate me:
Please Sign up or sign in to vote.
4.85/5 (108 votes)
31 Jan 2007CPOL3 min read 895.9K   86.6K   431  
Four examples to create your Conferencing System in .NET using H.323 and TAPI 3
using System;

using TAPI3Lib;
using System.Windows.Forms;
using System.Threading;
using System.Runtime.InteropServices;


namespace complete
{
	class callnotification:TAPI3Lib.ITTAPIEventNotification
	{
		public delegate void listshow(string str);
		public listshow addtolist;
		

		public void Event(TAPI3Lib.TAPI_EVENT te,object eobj)
		{
			switch(te)
			{
				case TAPI3Lib.TAPI_EVENT.TE_CALLNOTIFICATION:
					addtolist("call notification event has occured");
					ITCallNotificationEvent notify;
					notify=(ITCallNotificationEvent)eobj;
					ITCallInfo newcall;
					newcall=notify.Call;
					ITBasicCallControl call_control;//=f1.call_control;
					call_control=(ITBasicCallControl)newcall;
					string callerid=newcall.get_CallInfoString(CALLINFO_STRING.CIS_CALLERIDNUMBER);					if(MessageBox.Show("calling from "+callerid+"\n\n Press Ok to Attend Call    /   Cancel to Reject the Call\n","Answer",MessageBoxButtons.OKCancel)==DialogResult.OK)
					{	
						IEnumStream enum_stream;
						ITStreamControl pstream_control;
						pstream_control=(ITStreamControl)call_control;
						pstream_control.EnumerateStreams(out enum_stream);
						ITStream p_stream;
						uint a11=0;
						enum_stream.Next(1,out p_stream,ref a11);
						int imedia;
						imedia=p_stream.MediaType;
						TERMINAL_DIRECTION dir;
						dir=p_stream.Direction;
						ITTerminal termi,termi1;
				
						ITTerminalSupport term_support=(ITTerminalSupport)Form1.call_address;
						termi=term_support.GetDefaultStaticTerminal(imedia,dir);

						p_stream.SelectTerminal(termi);

						enum_stream.Next(1,out p_stream,ref a11);
						termi1=term_support.GetDefaultStaticTerminal(imedia,TERMINAL_DIRECTION.TD_CAPTURE);

						p_stream.SelectTerminal(termi1);

						call_control.Answer();
					}

					else
					{
						call_control.Disconnect(DISCONNECT_CODE.DC_REJECTED);
					}
					///////
					break;
				case TAPI3Lib.TAPI_EVENT.TE_DIGITEVENT:
					TAPI3Lib.ITDigitDetectionEvent dd=(TAPI3Lib.ITDigitDetectionEvent)eobj;
					addtolist("Dialed digit"+dd.ToString());
					break;
				case TAPI3Lib.TAPI_EVENT.TE_GENERATEEVENT:
					TAPI3Lib.ITDigitGenerationEvent dg=(TAPI3Lib.ITDigitGenerationEvent)eobj;
					addtolist("Dialed digit"+dg.ToString());
					break;
				case TAPI3Lib.TAPI_EVENT.TE_PHONEEVENT:
					addtolist("A phone event!");
					break;
				case TAPI3Lib.TAPI_EVENT.TE_GATHERDIGITS:
					addtolist("Gather digit event!");
					break;
				case TAPI3Lib.TAPI_EVENT.TE_CALLSTATE:
					TAPI3Lib.ITCallStateEvent a=(TAPI3Lib.ITCallStateEvent)eobj;
					TAPI3Lib.ITCallInfo b=a.Call;
				switch(b.CallState)
				{
					case TAPI3Lib.CALL_STATE.CS_INPROGRESS:
						addtolist("dialing");
						break;
					case TAPI3Lib.CALL_STATE.CS_CONNECTED:
						addtolist("Connected");
						break;
					case TAPI3Lib.CALL_STATE.CS_DISCONNECTED:
						addtolist("Disconnected");
						break;
					case TAPI3Lib.CALL_STATE.CS_OFFERING:
						addtolist("A party wants to communicate with you!");
						break;
					case TAPI3Lib.CALL_STATE.CS_IDLE:
						addtolist("Call is created!");
						break;
				}
					break;
			}
		}
	}


}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Systems Engineer SocketCoder.Com
Jordan Jordan
Fadi Abdelqader
WebSite: http://www.SocketCoder.com
Facebook Group: http://www.facebook.com/groups/socketcoder/
Facebook Page: http://www.facebook.com/socketcoders/

Last Published Book:
-Professional Network, Distributed Systems & TCP/IP Programming In .NET Framework 1.1 & 2.0 (2006 Release)

Last Published eBook:
- The SocketCoder e-Reference For Network, Distributed Systems And TCP/IP Programming In .NET, Arabic (SocketCoder.Com 2010)

Last Projects:
- Silverlight Based Projects For Web Video Conferencing (WCS,WMS,WCS Plus..)
-(SocketCoder) RTP Multicasting VOIP Library
-(SocketCoder) Remote Controlling Systems

Last SocketCoder RSS: http://www.socketcoder.com/feed/

http://www.socketcoder.com

Comments and Discussions