Checking if extension is in any queue call

Hello everybody,

is there a way of a clean, non-hacky check if extension is in queue call using diaplan vars / functions?

(i am trying to flag an outbound call while doing sip attended transfer to external party-- but can’t differentiate it from normal, standalone calls. To my understanding, an outbound call while doing attended transfer begins just as any other regular, stand-alone outbound call and I can’t distinguish between them. One way would be to check if this same extension that is making an outbound call is already in queue call).

Thanks in advance.

Best regards,
Andrej

Not that I can think of. Someone else may be able to think of some clever way, but it may be at best guessing.

Thank you for your thoughts.

I am afraid of words guessing and billing in the same sentence. :slight_smile:

One way of doing it is using different prefix for outbound calls and distinguish attended XFR calls from standalone calls by that.

Any other ideas much appreciated.

one way is to set a var before you add the call to a queue and use this to set an extra sip headder
just remember to remove it after the queue if not answered by it

This has also been asked at Determine if extension is in queue call - General Help - FreePBX Community Forums which means they are using FreePBX, which may significantly reduce their options. Their reference to extensions when they meant endpoints, is a clue to this.

Thank you for your idea. I don’t think this will help in my particular situation where I am trying to figure out if the outbound call is standalone or part of attended transfer (of a queue call).

But it might help with other issue where I loose channel variables after attended transfer is done.

We do use Freepbx and I don’t think this is something bad or dirty. :slight_smile:

I’ve asked in asterisk forum because solution might be pure asterisk related (using system vars and/or functions).

Thanks for your help, as always.

I got a brilliant idea (i know :man_facepalming:) that challenge could be solved by use of shared variable where endopoint would share a variable with itself, not with full channel name, but with prefix only.

Theory:

Endpoint SIP/XXXX answers a queue call on channel SIP/XXXX-YYYYYYYY and has a variable FROMQ=true. Based on that, in Dial U subroutine, it creates a shared variable SHARED(FROMQ, SIP/XXXX)=true.

so… when the same endpoint puts existing incoming queue call on hold and tries to do an attended transfer, I wait for that new, fresh, parallel call from same endpoint in Dial B subroutine, channel SIP/XXXX-ZZZZZZZZ, where I check for presence of SHARED(FROMQ, SIP/XXXX)=true. If it’s present, then do __FROMQ=true for that new channel so the var will be inhertied to the new channel.

Real life:

It doesn’t work in 90% of cases and I don’t understand why (bear with me, I am just a padawan). My first thought was that shared variable gets destroyed before used on outbound call (part of attended transfer), but first call is still there (on hold), which is also seen in call log.

Maybe I am using the shared function with prefixes wrong? Or misunderstand how it’s supposed to work?

Dialplan part of Dial U subroutine:

exten => s,n,ExecIf($[“${CHANNEL:0:3}” = “SIP” & “${FROMQ}” = “true”]?Set(SHARED(ECHOFROMQ,${CUT(CHANNEL,-,1)})=true))

Call log part of Dial U subroutine:

-- Executing [s@UDIAL:9] ExecIf("SIP/1002-00000144", "1?Set(SHARED(ECHOFROMQ,SIP/1002)=true)") in new stack
-- Executing [s@UDIAL:10] NoOp("SIP/1002-00000144", "SHAREDECHOFROMQ is true") in new stack

Dialplan part of dial B subroutine:

exten => s,n,NoOp(CUT CHANNEL is ${CUT(CHANNEL,-,1)})
exten => s,n,NoOp(SHAREDFROMQ is ${SHARED(ECHOFROMQ,${CUT(CHANNEL,-,1)})})
exten => s,n,DumpChan()
exten => s,n,ExecIf($[“${CHANNEL:0:3}” = “SIP” & “${SHARED(ECHOFROMQ,${CUT(CHANNEL,-,1)})}” = “true”]?Set(__FROMQ=true))

Call log part of Dial B subroutine:

– Executing [s@BDIAL:1] NoOp(“SIP/1002-00000145”, “BDIAL”) in new stack
– Executing [s@BDIAL:2] NoOp(“SIP/1002-00000145”, “CHANNEL is SIP/1002-00000145”) in new stack
– Executing [s@BDIAL:3] NoOp(“SIP/1002-00000145”, “MASTER CHANNEL is SIP/1002-00000145”) in new stack
– Executing [s@BDIAL:4] NoOp(“SIP/1002-00000145”, "FROMQ is ") in new stack
– Executing [s@BDIAL:5] NoOp(“SIP/1002-00000145”, “CUT CHANNEL is SIP/1002”) in new stack
– Executing [s@BDIAL:6] NoOp(“SIP/1002-00000145”, "SHAREDFROMQ is ") in new stack
– Executing [s@BDIAL:7] DumpChan(“SIP/1002-00000145”, “”) in new stack
– Executing [s@BDIAL:8] ExecIf(“SIP/1002-00000145”, “0?Set(__FROMQ=true)”) in new stack

Can anyone shed some light on that?

(I hope I used endpoint and extension expressions right this time. :wink: )

Big thanks in advance.
Andrej

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.