Call originate from command line

I was fiddling with the command line and hoping to initiate (or originate) a call from the command line from an internal extension to an external phone number. The following works:

channel originate local/<external number>@from-internal extension <internal extension>@from-internal

While this does work, CEL does not show the extension in its logs and the phone shows the IP address of the server as CID. I was wondering if the following were possible:

  • show the internal extension in the CEL log
  • show the external number as CID when the internal extension rings
  • ring internal extension first, then the external number

This is possible; just switch the two local channels.

The CLI version of originate doesn’t support caller ID or the setting of variables. If using it you need to use local channels that do these for you. An alternative would, for example, be to use AMI, which has more powerful originate support, or call files.

If you are doing click to call, note that many people do this, so I expect there to be many worked examples.

Is this what you mean? This doesn’t seem to work.

channel originate extension <internal extension>@from-internal local/<external number>@from-internal

Could you please explain this?

If using it you need to use local channels that do these for you.

The keyword “extension” is in the wrong place. (Further hint: both internal extension and external number are extensions in Asterisk terminology.)

You are currently using local channels which run standard FreePBX dialplan. You would need to replace them with ones that ran customised dialplan, although it is conceivable that you could assemble that from FreePBX modules.

Thanks, this is a working example:

channel originate local/<internal extension>@from-internal extension <external number>@from-internal

No sure how to go about the other thing though. I’m pretty vanilla at the command line/FreePBX thing.

The second example is basically what I posted, isn’t it? AMI Examples - Asterisk Project - Asterisk Project Wiki

In Asterisk 19 you can set variables when running Originate.

1 Like

Mind sharing a few examples?

I upgraded to Asterisk 19, but unfortunately, I cannot find any documentation on how to add a variable… Sorry.

It isn’t in the source code for 19.1:

(definitely not in the self documentation, but I cannot see anything with a skim of the code, either).

AMI, call files, dialplan and, possibly ARI, versions tend to support more options.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.