Passing every 3rd call to specific number


Is there a way I can pass every 3rd or 2nd call to a specific number?

I tried to use

exten => s,n,Set(Count=0)
exten => s,n,Set(Count=$[${Count} + 1])
exten => s,n,GotoIf($[ ${count} = 3 ]?hold:send)
exten => s,n(send),Dial(SIP/1855******@voxbeam,30,Tt)
exten => s,n(hold),Dial(SIP/1855******@voxbeam,30,Tt)

But issue is if I use this count every time sets to zero

Use Count as Global variable and reset it to 0 when it reaches 3 in your context (or use modulo logic). You may think of using locks in your context if you expect multiple calls at the same time

1 Like

I do receive multiple calls at the same time…can you please guide what locks are?

See these functions LOCK and UNLOCK

Ok, one more thing if I use queues, and want to route overflowing calls to another number? how can I do that?

Concatenate the dialplan to do it after the call to Queue.

1 Like