Search code examples
asterisk

Asterisk: rewrite set Caller id if number is "number" and multiple conditions


I need to rewrite a Caller id: this code seems to work but I want to set it for a multiple condition(for example, if number is 1005 rewrite to 383838, if number is 1006 then rewrite to 848481, etc) Anyone know how to do?

exten => _X.,1,Gotoif($[${CALLERID(num)}=1004]?2)
exten => _X.,2,SET(CALLERID(all)=My company<1234489>)

Solution

  • Use callerid matching in dialplan.

    exten => _X./_1005,1,SET(CALLERID(all)=My company<1234489>)
    exten => _X./_1006,1,SET(CALLERID(all)=My company<848481>)
    
    exten => _X.,2,Noop(doing something for all)
    

    See end of page: https://wiki.asterisk.org/wiki/display/AST/Pattern+Matching