943,752 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 3458
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Aug 19th, 2008
0

TAPI

Expand Post »
Hi, I was wondering how to use TAPI in C++ to communicate with my modem. How would I accomplish this? I'm not using Visual C++. I'm using dev-c++ 4.9.9.2.
Similar Threads
Reputation Points: 79
Solved Threads: 6
Posting Whiz in Training
TheBeast32 is offline Offline
236 posts
since Dec 2007
Aug 20th, 2008
0

Re: TAPI

Anyone?
Reputation Points: 79
Solved Threads: 6
Posting Whiz in Training
TheBeast32 is offline Offline
236 posts
since Dec 2007
Aug 20th, 2008
0

Re: TAPI

What do you mean "how"?

How I would do it would be
- STW for tutorials and examples
- Read the manual pages
- Try some examples
- Do some design work on the system I want to implement
- Write some code, then test it.
And so on.

Same as any other software problem really. The "TAPI" and "C++" isn't special in that respect.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 20th, 2008
0

Re: TAPI

By "How", I mean I looked for like an hour finding only stuff about .Net, and was wondering what the code would be, what libraries I might have to get, and so on. Like I said before, I'm using Dev-C++ 4.9.9.2, so anything that could be compiled with that IDE would help me a lot.
Last edited by TheBeast32; Aug 20th, 2008 at 2:09 am.
Reputation Points: 79
Solved Threads: 6
Posting Whiz in Training
TheBeast32 is offline Offline
236 posts
since Dec 2007
Aug 20th, 2008
0

Re: TAPI

C++ doesn't care whether your IDE is "Visual" or "Dev".
Again, if you've already found some C++ code, you're already like 95%+ of the way there.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 20th, 2008
0

Re: TAPI

How would you compile this in Dev?

C++ Syntax (Toggle Plain Text)
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using JulMar.Tapi3;
  5.  
  6. namespace TestTapi
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. TTapi tapi = new TTapi();
  13. TCall call = null; TAddress modemAddr = null;
  14.  
  15. tapi.Initialize();
  16. tapi.TE_CALLNOTIFICATION += delegate(object sender, TapiCallNotificationEventArgs e)
  17. {
  18. Console.WriteLine("New call {0} detected from {1}", e.Call.ToString(), e.Event);
  19. };
  20. tapi.TE_CALLSTATE += delegate(object sender, TapiCallStateEventArgs e)
  21. {
  22. Console.WriteLine("{0}:{4} has changed state to {1} due to {2} - current={3}:{5}",
  23. e.Call, e.State, e.Cause, e.Call == call, e.Call.GetHashCode(), (call != null) ? call.GetHashCode() : 0);
  24. if (e.State == CALL_STATE.CS_INPROGRESS && e.Call == call)
  25. {
  26. Console.WriteLine("Dropping call");
  27. e.Call.Disconnect(DISCONNECT_CODE.DC_NORMAL);
  28. }
  29. };
  30.  
  31. foreach (TAddress addr in tapi.Addresses)
  32. {
  33. if (String.Compare(addr.ServiceProviderName, "unimdm.tsp", true) == 0 &&
  34. addr.QueryMediaType(TAPIMEDIATYPES.AUDIO))
  35. modemAddr = addr;
  36. }
  37.  
  38. if (modemAddr != null)
  39. {
  40. Console.WriteLine("{0} = {1} ({3}) [{2}]", modemAddr.AddressName, modemAddr.State, modemAddr.ServiceProviderName, modemAddr.DialableAddress);
  41. modemAddr.Monitor(TAPIMEDIATYPES.AUDIO);
  42. ConsoleKey ki = ConsoleKey.A;
  43.  
  44. while (ki != ConsoleKey.Q)
  45. {
  46. // Flip the auto-destroy flag
  47. if (ki == ConsoleKey.D)
  48. {
  49. tapi.AutoDestroyCalls = !tapi.AutoDestroyCalls;
  50. Console.WriteLine("Set AutoDestroy to {0}", tapi.AutoDestroyCalls);
  51. }
  52. // List existing calls
  53. else if (ki == ConsoleKey.L)
  54. {
  55. foreach (TCall _call in modemAddr.EnumerateCalls())
  56. {
  57. Console.WriteLine("Existing call found: {0}:{1}", _call, _call.GetHashCode());
  58. _call.Dispose(); // Go ahead and dump it
  59. }
  60. }
  61. // Create a new call
  62. else
  63. {
  64. call = modemAddr.CreateCall("5551213", LINEADDRESSTYPES.PhoneNumber, TAPIMEDIATYPES.DATAMODEM);
  65. Console.WriteLine("Created new call {0}:{1}", call, call.GetHashCode());
  66. try
  67. {
  68. // This will fail if existing call interface is still around (i.e. not disposed)
  69. call.Connect(false);
  70. }
  71. catch (TapiException ex)
  72. {
  73. Console.WriteLine(ex.Message);
  74. }
  75. }
  76. Console.WriteLine("Press a key to try another call.. Q to quit");
  77. ki = Console.ReadKey().Key;
  78. }
  79. }
  80.  
  81. // This will destroy any outstanding interfaces
  82. tapi.Shutdown();
  83.  
  84. // Call should be disposed here.. state will be CS_UNKNOWN
  85. if (call != null)
  86. Console.WriteLine("{0} {1}", call, call.CallState);
  87. }
  88. }
Reputation Points: 79
Solved Threads: 6
Posting Whiz in Training
TheBeast32 is offline Offline
236 posts
since Dec 2007
Aug 20th, 2008
0

Re: TAPI

I thought you have C++ examples as well as .net examples.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 20th, 2008
0

Re: TAPI

OOOOOOOPSSSSSSSSSSS, I'm StUPID. No i didn't. I don't know why I put that........
I'm an idiot.......................
Last edited by TheBeast32; Aug 20th, 2008 at 2:10 am.
Reputation Points: 79
Solved Threads: 6
Posting Whiz in Training
TheBeast32 is offline Offline
236 posts
since Dec 2007
Aug 20th, 2008
0

Re: TAPI

After a brief search, some source code in C++
http://www.julmar.com/tapi/
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 20th, 2008
0

Re: TAPI

Where can I get the SDK for the samples here http://www.tapi.info/default.aspx/TAPI/PSDKSamples.html
Last edited by TheBeast32; Aug 20th, 2008 at 4:33 pm.
Reputation Points: 79
Solved Threads: 6
Posting Whiz in Training
TheBeast32 is offline Offline
236 posts
since Dec 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: String Concatetation
Next Thread in C++ Forum Timeline: help implementing singly linked list





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC