Unable to set callerID using ARI - asterisk

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.

Related

Asterisk: How to connect called Party to another Destination

I need to connect the called party to another destination on an Asterisk.
Simple situation:
Inbound call is coming in, answered, welcome prompt, gets connected by the DIAL command to destination 1 (agent 1st level support).
Agent 1st level has to consult agent 2nd level, while inbound call is on hold/parked. In some situations the inbound call then has to be connected to the 2nd level agent.
Any idea how I can control the call to the called party (agent 1st level)? Isn't it just a call transfer situation with a conversation between the forwarding and the second destination?
I am using phpagi so I can send all commands from php scripts - but it doesn't make any difference to dialplan commands.
Thank you for your ideas and help
Kim
You can't do that from AGI, becuase it have no control while in Dial command
You can use transfer from softphone or AMI action Redirect.

Asterisk ARI initiating a call

I am trying to initiate a call between two local endpoints, a softphone(PJSIP/100) and a harphone(PJSIP/102). Using ARI I have created two channels, with app parameters and put them both into the same mixing bridge in stasisStart event.
At this moment, both of the channels are in the same bridge, but their state is "Down". If I now dial both of them separately from ARI and then press answer on both endpoints, they can share audio, but is it possible to avoid dialing and answering both of them? I have played around the "originator" and "callerid" parameters, which is passed when creating channels, but that does not help.
Is it possible to "dial" one of them from another via ARI?
It’s not 100% clear what you’re trying to do here, but from what I understand...
Dial PJSIP/100 and put it into bridge_1 in statisStart
Dial PJSIP/102 and put it into bridge_1 in stasisStart
You could dial them using stasis originate or an originate via the dialplan.

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.

Asterisk: Outbound and Inbound call at the same time

I am looking this use case scenario for Asterisk. I am using v 1.8 running a Centos 6.4 Linux distribution.
1.An outbound call is initiated via Asterisk
2.Both the internal extension as well as the outbound call-phone starts to ring.
The first person to pick up (either the internal extension or outbound call-phone) will
hear the a pre recorded message to hold as the call is being connected to the other user
i.e: If outbound call-phone picks up first then he will be asked to hold the line while the call is being connected to internal-phone user.
Any inputs?
My suggestion is almost the same but a little different:
Setup a dynamic meetme room changing the only-person message to "please hold..."
Setup booth calls at same time to destination numbers and set the originate command application parameter as meetme
Create 2 calls
http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out
After connect use bridge command or conference room.
http://www.voip-info.org/wiki/view/Asterisk+cmd+MeetMe

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