From wiki
Jump to: navigation, search

Cheating at dial-up competitions

So, you and several million other people are all trying to ring the same number to enter a competition or call your doctor's surgery. The line's always busy, so how do you get through?

CHEAT, of course.

The following code uses Asterisk queues to repeatedly try dialing a number. Essentially you drop yourself into a queue and the queue member(s) is/are the number you are trying to dial. You could just put the channel definition of the callee into the queue (e.g. "member => SIP/number@provider") but this has the disadvantage that you can only put one such member definition in (Asterisk removes duplicates).

Instead, this scheme uses the Local channel to dial back into the dialplan which can then dial out. Using pattern matching allows multiple channels to be used. This also allows you to play with your caller ID (assuming your carrier permits this) to make it look like the calls are coming from different places!


announce-holdtime = no

member => Local/dial01@multidial/n
member => Local/dial02@multidial/n
; Repeat for every simultaneous call required.


; ----------------------------------------------------------
;               MULTIDIAL
; ----------------------------------------------------------
; Nick Barnes, Vitell, 2010 or so!
; Licence: CC Attribution-Share Alike 3.0 Unported
; ----------------------------------------------------------
; Vitell - Asterisk, Linux and RouterOS consultants.
; No job too complex! Call us on:
; SIP:
; PSTN: +44-1676530540
; or e-mail
; ----------------------------------------------------------


exten => s,1,NoOp()
exten => s,n,Queue(multidial)
exten => s,n,Goto(1)

exten => _dialXX,1,NoOp()
exten => _dialXX,n(dowait),Wait(${RAND(0,2)}.${RAND(1,9)})
exten => _dialXX,n,Set(CALLERID(num)=01${RAND(100000000,999999999)})
exten => _dialXX,n,Dial(SIP/number@provider,,g)
exten => _dialXX,n,Goto(dowait)

Then, to use it, just Goto(multidial,s,1) from somewhere in your dialplan.

Note that at the moment, the number must be hard-coded in. I will change this at some point! The queue is used as a method of generating n simultaneous calls. Each of these loops around dialing and dialing until one of them gets through (or you give up and hang up). The Wait() command inserts a delay of between 0.1 and 2.9 seconds before each dial to try to ensure an even spread of calls.

For the record, this has been proven to work - Seems that BBC Radio 2 have 30 inbound lines which the code above managed to fill with ringing calls!