Showing randome cli on customer phone

My telecom allow to show any DID which is in range of PRI number and I can show random pri number from this pri but how can I show random number between 10 PRIs?

Contact your service provider.

Even if you have multiple providers, you may be able to prove to them that the you control all the numbers.

Basically this is a commercial issue with your provider, not a technical issue with Asterisk.

1 Like

If you could set CLID from dialplan then you could put your numbers into database and choose random number before each call.

You can easily set the number in the dialplan using Set() and CALLERID(), but this will not help if your service provider doesn’t allow you to fake caller IDs. You don’t even have to do this just to pas through the incoming ID, as Asterisk will do this automatically unless the device configuration overrides it, or the dialplan explicitly sets it.

Really, the ability to fake a general caller ID should be reserved to some sort of licensed network operator, but, from the number of faked ones I see, there are network operators that do allow you to forge caller IDs.

This is what I have written in my dialplan

Set(CALLERID(num)=${RAND(1246477003,1246477032)})
and same work fine…but when I tried Set(CALLERID(num)=${RAND(1246411111,1246499999)}) this did not work because random number was coming which was out of the PRI DIDs…
cant I define list of random number in RAND function if yes then my job will be.

Random functions don’t work that way. You would need to use the random number to select from a list of acceptable numbers.

Incidentally I assumed that random was bad English for arbitrary, but seems the OP really meant random.

you mean I need to put available DIDs in database and dynamically I can pull any random DID from there then need to set callerid before placing call?

Whilst you obviously have to set the caller ID before making the call, there are many way of implementing the fine details, e.g. you could put them in a long string, if not too many, and use substring selectors.

got it but I think this also will not solve the problem…What I want actually I have 6 PRI for call.

I want to find out which pri is being used for call and then will change the cli of that particular on dynamic way I also tried to do this through pre dail hander but I could not set the caller id through pre dial hander.

If you can use the same DID range on any PRI line:

[PRI-GROUP]
exten => _X.,1,NoOp(Select Random PRI Line w/ Random CLID)
  // CLID = 123-1250 ~ 123-1269
  same => 2,Set(CALLERID(num)=12312${RAND(5,6)}${RAND(0,9)})
  same => 3,Goto(${RAND(4,6)})
  same => 4,Dial(SIP/PRI1/${EXTEN})
  same => 5,Dial(SIP/PRI2/${EXTEN})
  same => 6,Dial(SIP/PRI3/${EXTEN})

If you need to set the DID range on each PRI line:

[PRI-INDVIDUAL]
exten => _X.,1,NoOp(Select Random PRI Line)
  same => 2,Goto(${RAND(3,5)})
  same => 3,Goto(PRI1,${EXTEN},1)
  same => 4,Goto(PRI2,${EXTEN},1)
  same => 5,Goto(PRI3,${EXTEN},1)

[PRI1]
exten => _X.,1,NoOp(Random CLID on PRI Line)
  // CLID = 111-1110 ~ 111-1119
  same => n,Set(CALLERID(num)=111111${RAND(0,9)})
  same => n,Dial(SIP/PRI1/${EXTEN})

[PRI2]
exten => _X.,1,NoOp(Random CLID on PRI Line)
  // CLID = 222-2220 ~ 222-2229
  same => n,Set(CALLERID(num)=222222${RAND(0,9)})
  same => n,Dial(SIP/PRI2/${EXTEN})

[PRI3]
exten => _X.,1,NoOp(Random CLID on PRI Line)
  // CLID = 333-3330 ~ 333-3339
  same => n,Set(CALLERID(num)=333333${RAND(0,9)})
  same => n,Dial(SIP/PRI3/${EXTEN})