QUEUE management with stasis application

Hi,

In my dialplan I have:

[router]
exten => 00*****,1,GotoIf($["${EXTEN}" = "00*****"]?incoming_0033*****,${EXTEN},1)

[incoming_00*****]
exten => 00*****,1,Stasis(externalMedia2)

The STASIS application is opened with ARI NodeJS and when I call 00***** the STASIS application answer and play a sound.

My problem is: If a second person (or 3 or 10) are calling the same number, It will ring indefinitely… I tried to use QUEUE without any success.

Is it possible to play a waiting sound to these people? Even if the SIP number can receive only one call at the same time?

Thanks!

Do the additional calls get to Asterisk? If the answer is no, then there’s nothing you can do in Asterisk. It’s upstream and would be something they would have to do instead.

Hi
Yes the additional call is viewed by ASTERISK:

CALLER 1
- Executing [00*****@router:1] GotoIf("PJSIP/CALLER1-00000003", "1?incoming_00*****,00*****,1") in new stack
    -- Goto (incoming_00*****,00*****,1)
 Executing [00*****@incoming_00*****:1] Stasis("PJSIP/CALLER1-00000003", "externalMedia2") in new stack

and

CALLER 2
- Executing [00*****@router:1] GotoIf("PJSIP/CALLER2-00000004", "1?incoming_00*****,00*****,1") in new stack
    -- Goto (incoming_00*****,00*****,1)
Executing [00*****@incoming_00*****:1] Stasis("PJSIP/CALLER2-00000004", "externalMedia2") in new stack
- Executing [00*****@router:1] GotoIf("PJSIP/CALLER2-00000005", "1?incoming_00*****,00*****,1") in new stack
- Executing [00*****@incoming_00*****:1] Stasis("PJSIP/CALLER1-00000005", "externalMedia2") in new stack
    -- Goto (incoming_00*****,00*****,1)
- Executing [00*****@router:1] GotoIf("PJSIP/CALLER2-00000006", "1?incoming_00*****,00*****,1") in new stack
    -- Goto (incoming_00*****,00*****,1)
Executing [00*****@incoming_00*****:1] Stasis("PJSIP/CALLER1-00000006", "externalMedia2") in new stack

It is expected that an ARI application handle multiple concurrent calls in it. Do you actually really not want this to happen?

Thanks!
My ARI application is connected to AI so I want that the first CALLER goes into the application to use the AI and that the second CALLER (to the same phone number) goes on a queue to wait the end of the first conversation (and to wait, I want to play a music to the CALLER using a queue for the N CALLERS)

What does this mean? Your logs appear to show the SIP number handling multiple calls at the same time. It looks like you problem is that the ARI application hasn’t been structured as an event driven application.

Your options are:

  1. don’t serialise within the stasis application, and handle multiple calls simultaneously.

  2. implement queue logic within the stasis application.

  3. make the stasis application manipulate a pseudo device state, or do that in standard and return busy in the case of races, and using Queue(), with the application on a local channel.

  4. as the previous, except all the state handling is done in normal dialplan, before calling stasis.

Thanks for your help!
At the end I manage to do it:

[router]
exten => 00*****,1,GotoIf($["${EXTEN}" = "00*****"]?incoming_queue_00*****,${EXTEN},1)

[incoming_queue_00*****]
exten => 00*****,1,Answer()
same => n,Queue(incoming_queue_00*****)
same => n,Hangup()

[incoming_00*****]
exten => 00*****,1,Stasis(externalMedia2)

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