Return to LanScape's home page Go back a page...       Active TopicsActive Topics   Display List of Forum MembersMember List   Knowledge Base SearchSearch   HelpHelp  RegisterRegister  LoginLogin

LanScape VOIP Media Engine™ - Technical Support
 LanScape Support Forum -> LanScape VOIP Media Engine™ - Technical Support
Subject Topic: How can I make a phone line go to OnHook state? Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
ajdiaz
Junior
Junior


Joined: December 10 2007
Location: United States
Posts: 76
Posted: June 12 2009 at 4:41pm | IP Logged Quote ajdiaz

Support,

We have a piece of code like this:

Code:

VoipMediaEngine.LINE_STATE InitialCallInfo = new VoipMediaEn gine.LINE_STATE();

//get the line status
status = MediaEngine.GetLineStatus(iPhoneLine, InitialCallIn fo);

//save the line status in a string
stringStatus += "{" + Convert.ToString(InitialCallInfo.State ) + "}";

//change the caller ID
MediaEngine.SetFromHeaderUserName(iPhoneLine, "8005551234");

//make call
status = this._MediaEngine.MakeCall(
 PhoneNumber,
 SipProxy,
 SipProxyPort,
 iPhoneLine,
 true, 
 60000 
 );

//append the status in the same string
stringStatus += status.ToString() + ";";

//if success, exit loop
if (status == VoipMediaEngine.TELEPHONY_RETURN_VALUE.SipSucc ess)
{
   //exit loop
   break;
}
else
{
  // Terminate phone call
  MediaEngine.TerminateCall(iPhoneLine, true, 3000);

  //sleep for 30 seconds, then try again, up to 4 times.
  Thread.Sleep(1000 * 30);
}



And many times even after 4 attempts we cannot connect to the phone number.

We are getting results like this:

1st try: {SipOnHook}SipFarEndIsBusy;
2nd try; {SipOnHook}SipFarEndIsBusy;
3rd try: {SipWaitForInviteOk}SipCallAlreadyInProgress;
4th try: {SipOnHook}SipCallAlreadyInProgress;

*why would the line go from {SipOnHook}SipFarEndIsBusy to {SipWaitForInviteOk}?

*And why would on the 4th try when the line was in SipOnHook and we immediately afterwards call MakeCall() get a SipCallAlreadyInProgress code.

Another example:
1st try: {SipOnHook}SipCallTimeOut;
2nd try; {SipInCall}SipCallAlreadyInProgress;
3rd try: {SipWaitForInviteOk}SipCallAlreadyInProgress;
4th try: {SipStartOutgoingRing}SipCallAlreadyInProgress;

*why would the line go from {SipOnHook}SipCallTimeOut to {SipInCall}SipCallAlreadyInProgress;?

Anyways, we are using MediaEngine.TerminateCall() whenever the call does not connect in the hopes that we get the phone line back to the OnHook state, but obviously unsuccesfully.

Is there anything wrong with what we are trying to do here? How can we get the line back to the OnHook state after an unsuccessful attempt to connect?

Thanks.

-AJD

Back to Top View ajdiaz's Profile Search for other posts by ajdiaz
 
support
Administrator
Administrator


Joined: January 26 2005
Location: United States
Posts: 1666
Posted: June 15 2009 at 8:52am | IP Logged Quote support

Hi Aj,

Is this occurring as the result of using the latest v6.0.0.14 engineering release image?

We will work with you today to get this resolved.


Randal

Back to Top View support's Profile Search for other posts by support Visit support's Homepage
 
ajdiaz
Junior
Junior


Joined: December 10 2007
Location: United States
Posts: 76
Posted: June 15 2009 at 11:03am | IP Logged Quote ajdiaz

Hi Randal,

This issue is happening with our release v6.0.0.11 and for quite a while now. We are posting this now in the forum after adding more logging and finding a somewhat of a pattern.

Another pattern is that it happens more frequently in the first 30-40 phone calls our application makes. For instance, say the app is running and it suddenly receives 200 calls to make. As it makes one call after another, we see this issue with the retries and the unavailable lines and states more frequently in the first 40 calls (maybe in 80% of them), then in calls towards the very end we rarely see it happenning (maybe 5% or even less).

Hope this helps.

-AJD
Back to Top View ajdiaz's Profile Search for other posts by ajdiaz
 
support
Administrator
Administrator


Joined: January 26 2005
Location: United States
Posts: 1666
Posted: June 15 2009 at 4:42pm | IP Logged Quote support

Hi Aj,

We should probably take the first call scenario and figure out why you are getting the results you are seeing.

In your description:

1st try: {SipOnHook}SipFarEndIsBusy;
2nd try; {SipOnHook}SipFarEndIsBusy;
3rd try: {SipWaitForInviteOk}SipCallAlreadyInProgress;
4th try: {SipOnHook}SipCallAlreadyInProgress;

Possible reasons why call #3 would start with the SipWaitForInviteOk state is if:

1)
There is a bug in the media engine. This is possible but all of our QA call tests are passing. Strange…

2)
TerminateCall() failed for some reason. We need to get the status value returned from this procedure call to understand the failure.

3)
Another thread took the phone line specified by iPhoneLine OFF hook. Is this possible?

If I had your code, I would first try to determine if the TerminateCall() proc is returning something other than SipSuccess. For example:

Code:

     
     
     VoipMediaEngine.LINE_STATE InitialCallInfo = new VoipMediaEn gine.LINE_STATE();
     
     //get the line status
     status = MediaEngine.GetLineStatus(iPhoneLine, InitialCallIn fo);
     
     //save the line status in a string
     stringStatus += "{" + Convert.ToString(InitialCallInfo.State ) + "}";
     
     //change the caller ID
     MediaEngine.SetFromHeaderUserName(iPhoneLine, "8005551234");
     
     //make call
     status = this._MediaEngine.MakeCall(
     PhoneNumber,
     SipProxy,
     SipProxyPort,
     iPhoneLine,
     true,
     60000
     );
     
     //append the status in the same string
     stringStatus += status.ToString() + ";";
     
     //if success, exit loop
     if (status == VoipMediaEngine.TELEPHONY_RETURN_VALUE.SipSuccess)
     {
          //exit loop
          break;
     }
     else
     {
          // Terminate phone call
          //MediaEngine.TerminateCall(iPhoneLine, true, 3000);
          status = MediaEngine.TerminateCall(iPhoneLine, true, 3000);
          
          //////////////////////////////////////////////////////////
          /////// Add this code ////////////////////////////////////
          //////////////////////////////////////////////////////////
          if (status == VoipMediaEngine.TELEPHONY_RETURN_VALUE.SipSuccess)
          {
               // OK.
               //
          }
          else
          {
               // what is this error? If terminate call fails, the line may
               // not be on hook!
               //
               
               // get the phone line state and add it to the status string
               //
               status = MediaEngine.GetLineStatus(iPhoneLine, InitialCallIn fo);
               
               //save the line status in a string
               stringStatus += "{" + Convert.ToString(InitialCallInfo.State ) + "}";
          }
          //////////////////////////////////////////////////////////
          //////////////////////////////////////////////////////////
          //////////////////////////////////////////////////////////
     
          //sleep for 30 seconds, then try again, up to 4 times.
          Thread.Sleep(1000 * 30);
     }
     
     
     



If TerminateCall() never returns an error code, then some other thread must be trying to use the same phone line or there is a media engine bug.

Note: I did not try to compile the code changes above.


Randal


Back to Top View support's Profile Search for other posts by support Visit support's Homepage
 
ajdiaz
Junior
Junior


Joined: December 10 2007
Location: United States
Posts: 76
Posted: June 17 2009 at 8:22pm | IP Logged Quote ajdiaz

Randal,

Thanks for your suggestion.

After implementing it and adding even more logging, we discovered that indeed there were a few scenarios in which two threads were accessing the same phone line.

The MediaEngine.TerminateCall() was returning SipAlreadyOnHook. Therefore something else was making it go Off Hook.

We need to do more testing, but we are pretty sure that this is the issue.

Thanks again.

-AJD
Back to Top View ajdiaz's Profile Search for other posts by ajdiaz
 
support
Administrator
Administrator


Joined: January 26 2005
Location: United States
Posts: 1666
Posted: June 18 2009 at 8:08am | IP Logged Quote support

Hi Alex,

It sounds like you are making progress. That is good.

Whatever you eventually find, please post your final results to this thread. This way we will know that we do not have some strange issue with the call states and the media engine. Having a bug in the media engine where phone line call states are being handled improperly would be a very bad situation.


Thank you,


Randal

Back to Top View support's Profile Search for other posts by support Visit support's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum






Contact LanScape Hear what the Lawyers have to say How youm may use this site Read your privacy rights