[asterisk-users] How to get ten-digit number?

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri Nov 9 06:56:11 CST 2007


On Friday 09 November 2007 06:07:04 Vincent wrote:
> 	Instead of using PrivacyManager, I'd rather use my own
> dialplan to prompt the user for a ten-digit number if they called
> while blocking CID.
>
> This code does prompt the user, but
> 1) hangs up if the user didn't type the ten digits before the timeout
> 2) if the user did type the right number of digits, it still hangs up
> instead of Returning and then jumping forth to the "cid" extension:

Actually, it DOES return, but because you have no further instructions
and since autofallthrough is set to "yes", it hangs up at that point.

> ========
> exten => 777,1,Set(CALLERIDNUM=${CALLERID(num)})
> exten => 777,n,GosubIf($[${LEN(${CALLERIDNUM})} != 10 ]?nocid,1:cid,1)

exten => 777,n,WaitExten(10)

> ;prompt user for 10-digit #, and Return to GosubIf()
> exten =>
> nocid,1,Read(CALLERIDNUM,/root/asterisk_sound_files/no_cid,10)
> exten => nocid,n,Verbose(User typed ${CALLERIDNUM})
> exten => nocid,n,Return
>
> exten => cid,1,Set(CALLERIDNAME = ${DB(cidname/${CALLERIDNUM})})
> exten => cid,n,Background(/root/asterisk_sound_files/main_menu)
> exten => cid,n,Set(SOFTWARE=${EXTEN})

This won't work, EXTEN is "cid" at this point.  If you want it continuous, use
the Read application again.

> exten => cid,n,Hangup
> ========

-- 
Tilghman



More information about the asterisk-users mailing list