Channel originate , how to simulate a sip trunk


I want to start a call from Asterisk CLI with “channel originate” command.
But I’d like to simulate a call to a specific SIP trunk. How can I do that ?
Without any additional parameters, the following cli command just makes a call with “anonymous” CLI.

channel originate SIP/istanbul/423874671 extension 20018090850@DialplanContext
1 Like

Not quite sure about your request, but if you want to specify the CallerID when using Originate command, you will need to use local channel

thanks for your reply. But my version of Asterisk (Asterisk 10.12.4) does not have “local channel” command on CLI :

 router*CLI> local channel
No such command 'local channel' (type 'core show help local channel' for other possible commands)


When dialing a Local Channel you are dialing within Asterisk into the Asterisk dialplan.
I was meaning somthing like this mabye, where 447589975480 is the caller ID on the outbound call, so you can replace it. NOTE THIS IS NOT AN STEP BY STEP GUIDE, just an example in order you get the logic of what I mean

asterisk -x “originate Local/423874671@myoutbound extension 20018090850@DialplanContext”

exten=>_x.,1,verbose( calling to ${EXTEN})

1 Like

should I use “channel originate” as in below example ? Because without “channel” keyword, I get “no such command”

With the “channel” keyword , nothing outputs as seen below.
What are the parameters after keyword “Local/” ?
I guess "myoutbound " is the trunk name. But what are the 2 numbers ?

router*CLI> channel originate Local/05421213121@istanbul extension 121@DialplanContext

Hopefully this example would help

1) asterisk -x "originate Local/18097143420@myoutbound extension s@moh"

2) asterisk -x "originate Local/103@home extension s@moh"

exten=>_x.,1,verbose( calling to ${EXTEN})
same=>n,Set(CALLERID(num)=${calleridnumber}) ;callerid to use
same=>n,Dial(SIP/${EXTEN}@trunk,25) ;trunk to use

exten=>_xxx,1,verbose( calling to ${EXTEN})
same=>n,Set(CALLERID(num)=${calleridnumber}) ;callerid to use

1 Like


but I still can not understand what is “moh” in the first example.
If “myoutbount” is the trunk name, then what is “moh” ?

myoutbound is not the trunk name; it is the context in the dialplan used for outbound calls. You should use whatever name you would already use for this purpose for simple, directly dialled outbound calls.

moh is a dialplan context that is being created to isolate the special extension used to isolate the special extension used for generating music on hold. It can have any, otherwise used, name, as long as you use the same name in the originate. It looks as though it is simply being used to provide a complete demonstration configuration, and you should really be using a context that can dial the call you actually want.

1 Like

how can I find my context name ?

You presumably chose the context name in the first place! Otherwise, if the person who did write the dialplan cannot be contacted, you will need to look at how the dialplan works.

actually I am not an Asterisk expert , I did not write my dialplan myself. I had used a GUI version named Trixbox.
So I know nothing about dialplan or context names. is there a quick way to find out ?

Trixbox is abandonware.

Unfortunately, once you use a GUI, you tend to lose the ability to use the full power of Asterisk, and this may be one of those cases. The people who marketed Trixbox have cut off their users so fully that they haven’t even left their peer support forums open.

ok. I understood that.
But at the end it is using a dialplan and I should be able to locate my context and find the name.
How can I track that ?

GUIs tend to write dialplans dynamically, and also have very complex libraries of dialplan code.

The former means that the relevant parts of the dialplan may only exist in memory. The latter means you need expertise on the specific GUI to understand how to safely modify any dialplan that you can access.

@mrmrmrmr In order you be able to use local channels and write customized codes on GUI system, you should at least have basic asterisk knowledges, but this is one of the biggest problem with newbies, they are always trying to achieve advanced and intermediate stuff, and they dont take time at least to understand the basic concepts of Asterisk .

At the end you will have 3 options :

  1. Start learning Asterisk by the basic
  2. Hire a consultant
  3. abandoning your project

If you decide to take the hard way , but at the end your best option. the path to your success

well , actually I am not an Asterisk expert and I do not intend to be.
I am using Asterisk at home for a very basic home IP PBX purpose.
I had thought that starting a call from CLI should be very easy, so I thought of a basic integration with my Amazon Alexa - SamsungSmartthings environment.
I would just call “Alexa ask Asterisk to call some_number” , and it would call.
The Alexa side of this setup is ready.

I just thought that making a call over Asterisk from CLI would be very very simple.
I did not thought that I should learn deep Asterisk dialplan structure etc.

I am very sorry for the disturbance caused to you all Asterisk experts.
I can not afford to hire a consultant for just a “nice to have” functionality.
Only one option left : abandone project

(but it would be very easy if I figured out what context and dialplan to use when calling from CLI)

Have you thought about creating a call file instead? You can specify caller ID in call files.

1 Like


Checking that, I also found my context name as "access"
Following call file solved my issue. It also connects the extension with the called number.
Now I will work on the Amazon Alexa side.

Channel: SIP/993
MaxRetries: 1
RetryTime: 60
WaitTime: 30
Context: access
Extension: 128505424611
Priority: 1


Please share back what you make with Alexa, I’m eager to see it.

Great post, help me a lot, thank you.
Call file is write place to orginate call from command promt with CLID what we want.