Call with different ID

I think that probably i understand something wrong or maybe im doing something wrong :slight_smile:

here is a sample of my extensions.conf file

[incoming and outgoin calls]
exten=>_25021001,1,NoOp(Incoming call to public number 25021001)
 same=> n,GoTo(outer,1001,1)
 same=> n,Hangup()
exten=>_1001,1,NoOp(Transfered from public context to local extension 1001)
 same=> n,Dial(PJSIP/${EXTEN},20)
;function added for voimail
 same=> n,VoiceMail(1001@default,u)
 same=> n,Hangup()
exten=>_2501002,1,NoOp(Incoming call to public number 25021002)
 same=> n,GoTo(outer,1002,1)
 same=> n,Hangup()
exten=>_1002,1,NoOp(Transfered from public context to local extension 1002)
 same=> n,Dial(PJSIP/${EXTEN},180)
 same=> n,Hangup()

exten=> _X.,1,Verbose(1, "Didn't match any restricted numbers, proceeding with outbound dial.")
 same=> n,Set(CALLERID(num)=2502${CALLERID(num)})
 same=> n,Dial(PJSIP/${EXTEN}@trunk-prime-endpoint-25021001)
 same=> n,Hangup()

What i need to do now is when the extensions 1001 or 1002 they must be able to call with their extension number meaning 25021001 or 25021002 but once i create the extension 1003 i wish to display a totally different number which i already own. for example 25323211 is it possible to achieve it with my current setup or so i need to do something different? or… di i got it all wrong?

please note that the numbers which i posted are not real.

Repeat the set caller ID line, using s (or n-1) in the priority with an ex-girlfriend logic match on the caller ID (_X./<caller ID>). Alternatively use ExecIF.

1 Like

can you please write at least 2 lines to get the idea of (_X/. )?

Sorry, forgot to mark it as pre-formatted; now done. Also missed a “,”,

I try it but it doesnt working. Here is what ive done:

exten => _X./1001,1,Set(CALLERID(num)=25021001)
exten => _X./1002,1,Set(CALLERID(num)=25021002)
exten => _X./1005,1,Set(CALLERID(num)=25021001)
exten => _X.,n,Dial(PJSIP/${EXTEN}@trunk-prime-endpoint-25021001)

and the error is:

srvname asterisk[9658]: [Jan 16 ] #033[1;33mNOTICE#033[0m[9703]: #033[1;37mres_pjsip_session.c#033[0m:#033[1;37m2132#033[0m #033[1;37
mnew_invite#033[0m: Call from '1001' (UDP: to extension 'XXXXXX87' rejected because extension not found in context 'outer'.

Just to check, You are defining your _X extension in the ‘outer’ context correct?

If you do a 'dialplan show 5551212@outer' what does the console show?

I made it but im not 100% sure that it suppose to be like that

exten => _X./${CALLERID(num)},1,Verbose(1, "Didn't match any restricted numbers, proceeding with outbound dial.")
exten => _X./1001,1,Set(CALLERID(all)="Jane A" <25021001>)
exten => _X./1002,1,Set(CALLERID(all)="John P" <25021002>)
exten => _X./1004,1,Set(CALLERID(num)=25021007)
exten => _X.,n,Dial(PJSIP/${EXTEN}@trunk-prime-endpoint-25021001)
exten => _X.,n,Hangup()

Up to the point that everything is starting ${CALLERID(num)} is equal with the extension number for some reason… is that normal?
But in this way im able to make calls.

The first line should only contain _X and no /.