[asterisk-users] Verification number / code

Steve Edwards asterisk.org at sedwards.com
Sat Nov 21 18:20:03 CST 2009


On Sat, 21 Nov 2009, Thomas Perron wrote:

> I want to distribute a random number to each of the first 100 callers to 
> my IVR. This random number will be matched to their telephone number. 
> Where in Asterisk can I do this?  And, how?
>
> Logic.
>
> Call arrives.
> Context for announcement begins.
> You will receive a authentication code at the end of the message.
> Then, if they press a certain digit to confirm then I simply pass a code to
> them.
> These codes are distributed to the first 100.
> The 101st call does not get a code.

I'm guessing you really don't want a random number since a random number 
generator can generate duplicates.

"Matching" the number to their ANI also has issues. What if my ANI is 
blocked? What if I spoof my ANI? What if I call from a SIP phone?

I would "pre-compute" the random numbers and store them in a database.

When a call arrives, I would invoke an AGI that would lock the table, read 
the first value with a null ANI, update the row with the caller's ANI, and 
unlock the table.

You could do it in dialplan, but I find database access in dialplan ugly.

Alternatively, you could mung UNIQUEID (<number of seconds since 
Epoch>.<number of channels created by this instance of Asterisk>) to 
appear to the caller as random and then store that and their ANI in a 
database.

What happens if Asterisk is restarted in the middle of your campaign?

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list