We’re tweaking our custom Find Me dialplan and are using the U option to handle a simple “Press 1 to accept this call” for the called party.
I’m trying to figure out how to detect if the original channel still exists so as to play a friendly prompt after the called party presses 1 in cases where the caller has hungup.
I got excited when I saw the CHANNEL_EXISTS() function in the docs but it doesn’t appear to actually be in Asterisk any longer.
Any thoughts how to check for the status of another channel from within the dialplan?
I think the incoming channel will only have a soft hangup, so it will still exist. You’d have to check something about the state. Only the thread that currently owns the channel can actually remove it, and that is busy running your subroutine.
llinkedid won’t work in the general case, if the identity isn’t set by Dial, in a special variable, you would need have it copied into an inheritable variable before the Dial. Strictly speaking you should use the unique ID not the channel name, as transfers could change the latter.
Actually, I’m not certain that there is even a soft hangup at that stage. I think there may just be an AST_CONTROL_HANGUP frame stuck in the channel’s incoming queue. In which case you would have to try and identify the technology specific channel information. However there doesn’t seem to be access to the state of that.
I got excited when I saw the CHANNEL_EXISTS() function in the docs but it doesn’t appear to actually be in Asterisk any longer.
What do you mean by this exactly? It was only recently added to Asterisk. You need to be more specific than “Asterisk 18.x”. This function only exists in the last couple minor versions of 16, 18, and 19.
Yes, don’t do this either. Use the IMPORT function, not ImportVar. ImportVar has long been deprecated and will probably be removed soon (hopefully next year).
It’s 18.7, 18.8 and 18.9 had a bug with queues that caused us some grief so we rolled back and haven’t updated to latest.
That bug has long been fixed (I believe I know which one you’re referring to).
CHANNEL_EXISTS appeared in 18.8, so I recommend you upgrade to the latest LTS, 18.13, which has that queue issue fixed and has the CHANNEL_EXISTS function.
What do you mean by this exactly? It was only recently added to Asterisk. You need to be more specific than “Asterisk 18.x”. This function only exists in the last couple minor versions of 16, 18, and 19.
It’s 18.7, 18.8 and 18.9 had a bug with queues that caused us some grief so we rolled back and haven’t updated to latest.
Agree and big thanks for the recommendations! I wish it was this easy, we have north of 60 high density asterisk servers and I’m not sure this would be a compelling enough reason but I’ve already started the internal political process to make that happen.
If you can’t risk a big change, you could always apply the patch from Gerrit manually.
Otherwise, I guess you’d have to wait until the next upgrade cycle before being able to use it.
I wrote CHANNEL_EXISTS to make it easier to explicitly see if a specific channel exists or not. Before that, the poor man’s hacky way of doing it was using the CHANNELS function with some convoluted regex that never worked perfectly (I think there was a \b in it), but that might work well enough in the meantime.
The way you’re doing it now works just as well though.
Thanks for all your hard work, it’s very much appreciated
I have 18.latest on our test servers now, I’m going to build out this update using both IMPORT and CHANNEL_EXISTS and see if I can get us over the hump while we argue endlessly.
I say that half joking, this is a wonderful place to work and everybody is awesome but a little gun shy to stack changes as things have been really stable for a long time.