How to add prifex no. to incoming call

How to add prifex no. to incoming call?

Set(${CALLERIDNUM}=prefix${CALLERIDNUM}) should work


That mean all incoming call would be added the prefix. If I can defind some special incoming call be added prefix and the other not be added?

I think you mistake my meaning. I want to add prefix to called number not callerid. Maybe i have to provide moere infos. Following is my extensions.conf.

exten => 5000513511,1,Answer()
exten => 5000513511,2,Dial(IAX2/qing|30|m)
exten => 5000513511,3,Hangup()

Normally, I have to dial 5000513511 to call to IAX user qing. Now i want to know if i can dial 13511 for calling ‘qing’ and the asterisk system add the prefix 50005 automaticlly.

qing is a IAX ‘firend’

exten => 13511,1,answer
exten => 13511,2,Dial(IAX2/quing|30|m)
exten => 13511,3,hangup

should be enough.

if You have multiple users then
exten => _XXXXX,1,Set(gotouser=50005${EXTEN})
exten => _XXXXX,2,goto(${gotouser})
should accept 5 digit number, add 5005 and jump to extension 50005[5digitnumber] in the same context