Set callerID using Asterisk CLI channel originate command - asterisk

I am trying to automate calls in Asterisk. For its first step, i am trying to make a call via Asterisk CLI. Then I will automate via bash script. I want to set callerID and make a call via SIP Trunk. I can make a call with following command. How can i set callerID in this command.
channel originate SIP/commpeak/${callingNumber}
I tried the given command but it is not setting callerID however call is placed
channel originate SIP/commpeak/yyyyy Application Set(CALLERID(number)=xxxx

You can call via Local channels(call via dialplan, not sip) or use context,extension,priority as destination for command(second leg).
https://wiki.asterisk.org/wiki/display/AST/Local+Channel

Related

Unable to set callerID using ARI

I have a java stasis application on Asterisk 14 using ari4java. It mostly works great. I am now trying to receive an external call and relay it back out. I do following
Incoming call enters Stasis
Create bridge
Add first call(channel) to bridge
Create channel
Add second channel to bridge
Dial( secondChID, "Local/2601", 30)
No matter what I try, the second outbound call gets the callerID of the first inbound call. That is actually OK for many calls, but in this case I want to set another callerId.
Before Dial() I have tried to setChannelVar(CALLERID(num)) and this value I can see in all events coming from Asterisk. But once the SIP call is placed, no sign of my callerID.
I doubt it is the ari4java doing anything wrong as I see the callerID in all the "dial" events. I thought I could force a callerID in sip.conf, but unable to do that too.

Accept user input while two calls are patched with dial extension

I have an executive and incoming caller. I patched their call in Asterisk using the dial command, but how can I to receive the inputi.e DTMF from the caller?
You should look at features.conf. It contains examples for:
dynamic features
These dynamic features can be triggered by in-call DTMF.

In Asterisk how can I use originate command to send a fax with Elastix virtual fax

I want to send a fax with my application via Asterisk. I need to execute Originate command to send a fax and use Elastix virtual fax.
My Elastix virtual fax is defined IAX and 999 extension number.
Commandline:
asterisk -rx "channel originate Local/1234567890#from-internal extension 999#from-internal"
pro-sip*CLI> channel originate (tab pressed)
There are two ways to use this
command. A call can be originated between a channel and a specific
application, or between a channel and an extension in the dialplan.
This is similar to call files or the manager originate action. Calls
originated with this command are given a timeout of 30 seconds.
Usage1: channel originate application [appdata]
This will originate a call between the specified channel tech/data and
the given application. Arguments to the application are optional. If
the given arguments to the application include spaces, all of the
arguments to the application need to be placed in quotation marks.
Usage2: channel originate extension [exten#][context]
This will originate a call between the specified channel tech/data and
the given extension. If no context is specified, the 'default' context
will be used. If no extension is given, the 's' extension will be
used.
Sure this example not check anything like channel not availible or busy etc.
You can do same using AMI action originate
http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Originate
Correct application should also check dialling state, redial etc.

Asterisk invalid Hangup cause

I am using Adhearsion on top of Asterisk (version 11.9.0).
To make outbound calls Adhearsion uses AMI originate command. Problem is Asterisk doesn't say why the call got hung up.
If the callee is busy or did not pick up the call or hung up the call or switched off i am getting the same reason code ( 0 ).
Is there a way to get different Hung up reasons?
You can do originate to channel like Local/number#some_context/n
After that you can write some_context to dialout and handle in that context usual way any dial cause.

Where can I see executed "Originate" command from Asterisk AMI

I'm adjusting simple application that among other things should be able to call another party using Asterisk AMI Originate command.
I'm stuck and I believe that my originate command is wrong.
Where/how can I see log of Originate commands that Asterisk creates when I use regular phone so I can compare it to my hand crafted one?
Use a network sniffer, such as tcpdump or wireshark, and capture the packets that come and go to/from asterisk. By default, it uses 5038/tcp. Check your manager.conf file, and look for the bindaddr and port options to be sure you capture the right traffic.
If you are using ssl (sslenable=yes), then you will have to configure wireshark with your ssl keys, so it can decrypt the traffic or just use normal tcp (without ssl) for debugging and then switch to ssl.
You should see the Action: Originate coming in to asterisk, and the asterisk response and the associated events. Look for the ActionID parameter of the action so you can trace which responses and events correspond to each issued action.
Take into account that an async originate (async: true) will return a response as soon as the action is received by asterisk, but it will then send asynchronous events to inform the call status (once finished). On the other hand, when using async: false, the call will be placed and the response will have the status.
A few more resources on the originate action:
http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Originate
https://wiki.asterisk.org/wiki/display/AST/ManagerAction_Originate
Another question related to the async parameter:
Asterisk originate response says successfully queued but nothing more
Hope it helps!
EDIT: Asterisk does not create the originate command, but will dial a target (a channel) based on an incoming originate action, or call file, so your application (the ami client) will issue an originate action and then asterisk will react to it by doing the call. If your call is originating from a phone, it's more probable that the call is being originated by a dial() command in your dialplan.

Resources