-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a timeout to the example dialplan #47
Comments
@k4ml yes you can set a timeout using the I think that's the way I've normally handled it in the past; if it doesn't work let me know and I'll make a test with a working solution. Actually we should probably document that in the dialplan example stuff. In general I'd like to ship a production grade example dialplan with |
@k4ml btw have you noticed that the socket dies with |
@tgoodlet I haven't try switchio yet but this is what I notice when using park-only dialplan + inbound socket in general. Even the socket didn't die, you must be explicitly hanging up the call somewhere in your app. |
So with park_timeout set, I guess we also need to unpark the call if we manage to handle it in channel_park, otherwise the call will be terminated half the way. Looking here we have to do that with |
No I don't believe this is true. Using any other call mgmt cmd should take the session out of the Actually on top of ^ outbound mode parks calls in the same way before transferring control. |
This is a safeguard in case the ESL connection drops while inbound calls are being received but no longer processed by switchio. Resolves #47
@k4ml if this build passes it should prove my point as there are calls during some of the stress tests in the suite that are kept up longer then 3 seconds (the timeout I added). |
Yep just verified it manually as well. As soon as you do anything else with the session the park timeout is cancelled. I'm going to write a formal test to demonstrate this. |
Verify that when a session is parked but not handled within the timeout period (in this case 3 seconds as set in our CI dialplan) it is cancelled by FS. In the contrary case verify that a simple `session.answer()` within the timeout results in a successful SIPp `uac` client scenario. Resolves #47
This is a safeguard in case the ESL connection drops while inbound calls are being received but no longer processed by switchio. Resolves #47
Verify that when a session is parked but not handled within the timeout period (in this case 3 seconds as set in our CI dialplan) it is cancelled by FS. In the contrary case verify that a simple `session.answer()` within the timeout results in a successful SIPp `uac` client scenario. Resolves #47
Verify that when a session is parked but not handled within the timeout period (in this case 3 seconds as set in our CI dialplan) it is cancelled by FS. In the contrary case verify that a simple `session.answer()` within the timeout results in a successful SIPp `uac` client scenario. Resolves #47
The park_timeout variable is used to calculate an expiration time to be inside the park loop, not necessarily the park state. I think the problem with relying on that is that as soon as your application ends, you're back to the loop and the expiry check will cause the park loop to end and hangup the channel. The park loop only ends when:
I might be missing something, but I don't think that timeout would be cleared by executing applications. However, it won't trigger if you're inside a long-running application (e.g playback, bert, or whatever). It will trigger when that application ends (if it ends after the expiry time). If you execute a never-ending application such as endless_playback or bert, then the timer will appear to never fire. |
Probably the solution you'd be looking for is an activity timeout. E.g, quit if no commands have been received in X amount of time. It'd be basically be the same as the parking timeout, just that it would be reset at the end of executing every command. For outbound sockets it's different because the outbound socket explicitly clears the CF_CONTROLLED flag to exit the park loop when the socket goes down. |
Note all of this would be to work-around a buggy call control server. Any call control server should restart if it dies (e.g via systemd unit restart) and recover control of the sessions or hang up the old sessions (depending on how much state-keeping you preserve after dying). |
@moises-silva thanks for the in depth analysis! Getting the source details is super helpful. In my proposed test it seems simply answering or bridging the session prevents the timeout as well. Maybe I should try un-parking the session and see if it times out? Also the condition in that if (!channel->hangup_cause && channel->state > CS_ROUTING && channel->state < CS_HANGUP && channel->state != CS_RESET &&
!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_NOT_READY) &&
!switch_channel_state_change_pending(channel)) {
ret++;
} Particularly |
Yeah so if I understand this correctly the hangup via
But maybe I'm missing something? |
Yeah agreed, I thought switch_channel_ready() was checking just for hangup and other media io checks, but seems a state change also makes it bail. I'm curious now on what happens then after the last application executes. |
@moises-silva In my test, where I didn't hangup after making a playback, the call still got hangup after the playback end with DESTINATION_OUT_OF_ORDER cause, which I think can verify from the park_timeout in the dialplan. |
So I tested executing playback twice. With park_timeout, the call got hangup after the first playback. |
@k4ml did you answer the call or put it in another state before executing |
@tgoodlet The call was answered and I tested with the same dialplan switchio use:-
Btw I'm not using switchio here but my own esl lib. I'll test with switchio later on. |
@k4ml no I meant what is your ESL app doing after handling the Also if you'd rather get quicker feedback on this join our Riot room to chat. |
@tgoodlet I executed session.answer() first. This is the snippet of the code:-
|
@k4ml hmm I wonder if it matter that you call I'll try the test I have with the |
@tgoodlet You mean I should wait for CHANNEL_EXECUTE_COMPLETE after executing session.answer() before proceed with playback ? |
@k4ml maybe I'm not sure. I know in Let me try what you're doing before going off on a tangent trying to prove my theory correct heh. |
@k4ml ok so I was able to replicate the situation you describe - where after I'm going to investigate a little further. |
Verify that when a session is parked but not handled within the timeout period (in this case 3 seconds as set in our CI dialplan) it is cancelled by FS. In the contrary case verify that a simple `session.answer()` within the timeout results in a successful SIPp `uac` client scenario. Resolves #47
Further progress on this. I found that FS core is exhibiting unreliable @moises-silva I personally think this is incorrect behaviour and FS core should move this |
The behavior I noticed above still similar with this switchio snippet:-
With park_timeout, the call hangup after the first playback with the coded hangup cause. This is in |
This is a safeguard in case the ESL connection drops while inbound calls are being received but no longer processed by switchio. Resolves #47
Verify that when a session is parked but not handled within the timeout period (in this case 3 seconds as set in our CI dialplan) it is cancelled by FS. In the contrary case verify that a simple `session.answer()` within the timeout results in a successful SIPp `uac` client scenario. Resolves #47
@k4ml does the file |
@tgoodlet oh, sorry. media.mp3 is just to mask a real file which is accessed via http. But I can verify the media being played and I can hear it and no errors in freeswitch log as well. |
@k4ml yeah so looking at the core FS code more I think we'll need to propose a patch to core to make this work the way we want. I'm happy to do this - just not sure when i'll get some time next, hopefully this week. |
This is a safeguard in case the ESL connection drops while inbound calls are being received but no longer processed by switchio. Resolves #47
Verify that when a session is parked but not handled within the timeout period (in this case 3 seconds as set in our CI dialplan) it is cancelled by FS. In the contrary case verify that a simple `session.answer()` within the timeout results in a successful SIPp `uac` client scenario. Resolves #47
This is a safeguard in case the ESL connection drops while inbound calls are being received but no longer processed by switchio. Resolves #47
Verify that when a session is parked but not handled within the timeout period (in this case 3 seconds as set in our CI dialplan) it is cancelled by FS. In the contrary case verify that a simple `session.answer()` within the timeout results in a successful SIPp `uac` client scenario. Resolves #47
This is a safeguard in case the ESL connection drops while inbound calls are being received but no longer processed by switchio. Resolves #47
Verify that when a session is parked but not handled within the timeout period (in this case 3 seconds as set in our CI dialplan) it is cancelled by FS. In the contrary case verify that a simple `session.answer()` within the timeout results in a successful SIPp `uac` client scenario. Resolves #47
One issue I noticed with park-only dialplan is that if for some reason the inbound socket process fail or die, then the parked calls will remained in freeswitch db (
show calls
) will list out the calls, filling out freeswitch internal db until it max out and freeswitch not accepting any new calls.Is there something can be done in the dialplan other than just calling
park
, so that if there's no inbound server to process the call, it will just terminate the channel similar to outbound socket ?The text was updated successfully, but these errors were encountered: