1

I am developing software for landline phones and full-duplex voice modems using C# and TAPI 3 library. Call answering is working fine but call hangup is throwing an exception. I did a lot of search to find solution but I could not. Following are the errors:

Exception is occurring on calling method ici.ReleaseUserUserInfo(); {"This implementation doesn't take advises (Exception from HRESULT: 0x80040003 (OLE_E_ADVISENOTSUPPORTED))"} System.Exception {System.Runtime.InteropServices.COMException}"

My goal is to save recorded calls. One interesting thing is that if, before call hangup, I close the application, it successfully saves the recorded call.

My code:

private void BtnAnswer_Click(object sender, EventArgs e)
{
    IEnumCall ec = ia[line].EnumerateCalls();
    uint arg = 0;
    ITCallInfo ici;
    ITTerminal recordTerminal;//NY test record
    try
    {
        ec.Next(1, out ici, ref arg);
        ITBasicCallControl2 bc = (TAPI3Lib.ITBasicCallControl2)ici;
        recordTerminal =    bc.RequestTerminal(TapiConstants.CLSID_String_FileRecordingTerminal,
        TapiConstants.TAPIMEDIATYPE_MULTITRACK,
        TAPI3Lib.TERMINAL_DIRECTION.TD_RENDER);
        ITMediaControl mediacontrol = (ITMediaControl)recordTerminal;
        ITMediaRecord mediarecord = (ITMediaRecord)recordTerminal;
        mediarecord.FileName = "a.wav";
        bc.SelectTerminalOnCall(recordTerminal);
        bc.Answer();
        mediacontrol.Start();
    }
    catch (Exception exp)
    {
        MessageBox.Show("There may not be any calls to answer! \n\n" + exp.ToString(), "TAPI3");
    }
}

private void BtnHang_Click(object sender, EventArgs e)
{
    IEnumCall ec = ia[line].EnumerateCalls();
    uint arg = 0;
    ITCallInfo ici;
    try
    {
        ec.Next(1, out ici, ref arg);
        ITBasicCallControl bc = (ITBasicCallControl)ici;
        bc.Disconnect(DISCONNECT_CODE.DC_NORMAL);

        ici.ReleaseUserUserInfo();
    }
    catch (Exception exp)
    {
        MessageBox.Show("No call to disconnect!", "TAPI3");
    }
}
Sabuncu
  • 5,095
  • 5
  • 55
  • 89
Naveed Yousaf
  • 436
  • 4
  • 14
  • 2
    In which line the exception was thrown? –  Jun 19 '14 at 19:18
  • from bottom line no. 07, ici.ReleaseUserUserInfo(); – Naveed Yousaf Jun 20 '14 at 04:22
  • Are you calling the ITCallInfo::GetCallInfoBuffer() method on the ici object anywhere? – Evil Dog Pie Jun 20 '14 at 09:18
  • Just a thought, but be careful when recording voice calls, as many countries require that, under certain circumstances, you notify the caller that the call will be recorded, so they have the opportunity to hang up. For example, in the UK Ofcom has the following advice [here](http://www.ofcom.org.uk/static/archive/oftel/consumer/advice/faqs/prvfaq3.htm) – Evil Dog Pie Jun 20 '14 at 09:23
  • No I am not calling ITCallInfo::GetCallInfoBuffer() anywhere. Please tell me why and where to use? – Naveed Yousaf Jun 20 '14 at 10:28
  • Hi All, i am stuck to answer a call, i am always getting "bc" null value, Please help me guyz. Thanks in advance – Asif Ghanchi May 15 '17 at 10:54

1 Answers1

0

I believe that the error code you're seeing is actually TAPI_E_NOTSUPPORTED!

According to the MSDN documentation for ITCallInfo::ReleaseUserUserInfo:

The ReleaseUserUserInfo method informs the service provider that the application has processed the user-user information obtained from the ITCallInfo::GetCallInfoBuffer method, called with the CIB_USERUSERINFO member of CALLINFO_BUFFER, and subsequently received user-user information can now be written.

Hwoever, User-user information is specific to the ISDN Q.931 standard and not all service providers support it.

Unless you specifically want to exchange this information between your client and the remote end, it is probably sufficient to simply delete the offending line of code, as it is otherwise both unused and unsupported.

Evil Dog Pie
  • 2,300
  • 2
  • 23
  • 46