Author |
|
mfitzgerald Vetran
Joined: June 14 2006 Location: United States Posts: 142
|
Posted: February 27 2008 at 3:42pm | IP Logged
|
|
|
I’m trying to figure out a solution to dynamically request a port without having to restart the application or requiring the user enter different Telephony parameters.
I’m would like to see if there a graceful way to do one of the following:
1) check to see if the port I’m attempting to start the Telephony Engine on is available or
2) on a SipSocketBindError result from StartSipTelephony() to automatically increment the port and re-try StartSipTelephony()
It would seem the second solution would be the simpler approach.
Simulated Code
Code:
for(;(StartupParams.NumPhoneLinesRequested > 0)&& !pCPhoneBase->Terminating && StartupParams.SipPort < 5070;)
{
// start the telephony engine.
status = StartSipTelephony(&StartupParams,&(pCPhoneBase->hSipEngine));
// see if the number of phone lines we requested is supported.
if(status == SipSuccess)
{
pCPhoneBase->NumPhoneLinesCreated = StartupParams.NumPhoneLinesRequested;
break;
}
.
.
.
else if(status == SipSocketBindError && )
{
Sleep(2000);
StartupParams.SipPort++;
}
.
.
.
}
|
|
|
A Sleep() was added as noticed in the SipBadNumberOfPhoneLines case:
Code:
else if(status == SipBadNumberOfPhoneLines)
{
tmp.Format("Your telephony engine does not support %d phone lines.",StartupParams.NumPhoneLinesRequested);
pCPhoneBase->UpdateProgressBar(CSPTR(tmp));
Sleep(2000);
// reduce the number of lines requested.
StartupParams.NumPhoneLinesRequested--;
tmp.Format("Starting %d line telephony engine...",StartupParams.NumPhoneLinesRequested);
pCPhoneBase->UpdateProgressBar(CSPTR(tmp));
}
|
|
|
Initial attempts have proven unsuccessful. I would be grateful for any suggestions or examples that might guide me in the right direction.
As always thanks for your prompt responses.
|
Back to Top |
|
|
mfitzgerald Vetran
Joined: June 14 2006 Location: United States Posts: 142
|
Posted: February 28 2008 at 9:52am | IP Logged
|
|
|
BTW... this is with LS Engine v. 5.12.3.30
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: February 28 2008 at 6:37pm | IP Logged
|
|
|
Hi Fitz,
Glad to see you back. Its been a while. :)
Your solution #2 above should work ok. If you try to start the media engine on say SIP port 5060 and it return with the SipSocketBindError, increment the port value in the startup parameters and try again. Are you saying this does not work???
As an alternative:
If we understand you correctly, can’t you (using your own code fragment) just try to open and then bind to the SIP port the media engine wants to use. In other words, before you start the media engine, perform your own UDP socket open and try to bind to the port (this would basically check to see if the media engine will be able to bind to port 5060 (or whatever) when it boots).
We understand your group is opening a support agreement with us. That is good. As soon as you do, we will update you with latest software. You will really want to start using the latest version for your VOIP application development (v5.12.8.1 as of 2-28-08).
Thanks Fitz,
Support
|
Back to Top |
|
|
mfitzgerald Vetran
Joined: June 14 2006 Location: United States Posts: 142
|
Posted: February 29 2008 at 9:17am | IP Logged
|
|
|
Solution #2 was the first I tried, however it results in StartSipTelephony() returning SipInvalidInstance.
I was hoping the solution might be as simple as incrementing the port. Hopefully with only a few modifications it is still a viable solution. Though the fallback solution #1 should work, it would just take a bit more coding.
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: February 29 2008 at 10:34am | IP Logged
|
|
|
Fitz,
You are correct, Solution #2 should work – and it does in the latest v5.12.8.1 version we tried it with. We looked back at the bug fixes since your media engine version and we found this:
Single instance media engine could not be restarted when experiencing an error.
Date: 8-1-07
Version: v5.12.4.5
If a single instance media engine is started and it gets an error, application software could not restart the media engine because its instance locking mechanism would report that an instance was already running. The only way to clear this situation would be to restart the VOIP application. This bug has been fixed.
Greg told us your group will be starting a support agreement with LanScape this year. When you guys decide to budget for that, let us know and we will invoice you for the enhanced support. When the support agreement gets activated we will be able to update you with all the latest media engine versions as they are made available.
Because of the bug in your version, you will have to use solution #1 until we get you upgraded.
Bugs suck.
Support
|
Back to Top |
|
|
mfitzgerald Vetran
Joined: June 14 2006 Location: United States Posts: 142
|
Posted: February 29 2008 at 10:57am | IP Logged
|
|
|
I don't know many of the details regarding the support agreement, but I look forward to a newer version of LS to work with.
I thank you for your help in finding out what was going on.
Bugs do suck... work-arounds can be fun though...
|
Back to Top |
|
|