Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here i have how i accept the call but when someon is calling to me it is rejecting here is what i have tried but still don't works outgoing calls are working but incoming not
C#
static void call_CallStateChanged(object sender, CallStateChangedArgs e)
     {
         Console.WriteLine("Call state: {0}.", e.State);

         if (e.State == CallState.Answered)
            SetupDevices();
     }


C#
static void RegisterAccount(SIPAccount account)
      {
          try
          {
              phoneLine = softphone.CreatePhoneLine(account);
              phoneLine.RegistrationStateChanged += line_RegStateChanged;
              softphone.IncomingCall += softphone_IncomingCall;
              softphone.RegisterPhoneLine(phoneLine);


          }
          catch (Exception ex)
          {
              MessageBox.Show("Error during SIP registration: " + ex);
          }


C#
static void softphone_IncomingCall(object sender, VoIPEventArgs<iphonecall> e)
        {
            call = e.Item;
            call.CallStateChanged += call_CallStateChanged;
            call.Answer();
        }</iphonecall>


[Update]
on debug there is no call received that the problem i tried to download Ozeki nudget on C# consol application i regestered my phone then i run the program always State is Busy i don't know why on my Windows Forms there is Nothing showed up and when i trie too call form other phone it is coming to PBX and goin on My C# form Phone but receiving busy but on Debug it is showing nothing
Posted
Updated 21-Mar-16 7:21am
v2

1 solution

You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.

The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html[^]
https://www.jetbrains.com/idea/help/debugging-your-first-java-application.html[^]

Use the debugger to see what your code is doing when a call is received, there is an error or something unexpected.
You can also add check points in the code in order to ensure what the code is doing.

[update]
Quote:
on debug there is no call receved that the problem
This mean that it is not a problem in the code you showed.
Quote:
always State is Busy
This is probably the reason of the problem.
You have to find why your phone is always busy.
 
Share this answer
 
v3
Comments
GTR0123 21-Mar-16 11:37am    
on debug there is no call receved that the problem i tried to download Ozeki nudget on C# consol application i regesterd my phone then i run the program always State is Busy i don't know why on my Windows Forms there is Nothing showed up and when i trie too call form other phone it is coming to PBX and goin on My C# form Phone but reciving busy but on Debug it is showing nothing

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900