AMI 2nd channel CID

Simple click2dial script:
Action: login
Events: off
Username: userxxx
Secret: passxxx
Action: originate
Channel: sip/123 ( local extension )
WaitTime: 30 (sec)
CallerId: 2225551212 (to be shown at local channel)
Exten: 2225551212 (number to be dialed)
Context: from-whatever
Priority: 1
Action: Logoff

Simple right?
In fact the Originate command calls Channel first and when answered it originate the call to Exten.
CallerId: only apply to Channel.
How do I set/control CallerID that is being sent with second dial/originate action to Exten.
I did attempt to do so with
Variable: CALLERID(all)=5555551212 but this was a no go.
The CID is set by PBX at extension and/or Trunk and/or outbound route but not by the carrier.
How do I override the default CALLERID(all) or CALLERID(num) other then dialing the Exten first?

Any help will help :slight_smile

This is about Originate, not AMI.

Originate originates to the first channel, then runs dialplan on that channel. That dialplan can do anything that dialplan can do on that channel, including setting the CALLERID() function, as you would do if the first channel had been an incoming channel who’s caller ID you wanted to modify or replace.

Note that Exten is the Asterisk extension to run. It is up to the dialplan whether the extension number is actually dialled.

OK, Would I be able to accomplish what I need by creating unique context in which I can set var CALLERID() and then include that unique context in from-whatever (a default outbound context)?

OR , perhaps there is an other/better way?

Exten is a number to be dialed it is not a local extension.
Channel is a local extension,
At least in this scenario.
I would like the website visitor phone number to be dialed after Channel ( local extension ) picks up/answers the call.

Goto, rather than include,

Also, although include would probably not help, I think you had the include back to front.

Yes, you are right, goto.

What about creating a static context with var and then setting this var using Variable: from originate command in AMI?
Would this work?

There are many ways of doing it. The best one for you is likely to depend on information that you haven’t provided.

I end up using
Variable: foo=3335551212 (outbound CID)

and dialplan:

Thank you for your help