OriginateResponse event returns wrong reason

Hello everybody
I am using AMI originate command in order to make outgoing calls.
so the action i am sending is as follows :

action : originate
actionid : 13449851233
channel : SIP/Trunkname/094561321657    => the number that am calling to
application : Playback
data : custom/whatever
async : true

i intend to originate a call and when the user answers the call then i playback a sound for user.
i got doubt how to accomplish this task .
Questions :

  1. am i doing it in a correct way ? if not what is the correct way to accomplish this task ?
  2. how to get current status of a call in a real-time application ?

my major problem is when asterisk sends “OriginateResponse” event , i either get Success or Failed.
let me explain more,
if user answers the call i get Success response
if user does not answer the call i get Failed response
but if user reject the call then i get Success response too.
what is wrong ?
what is happening to other reasons like no answer, busy ?
I need a straightforward way to manage my call status and it is really important to get the status in real-time.
i don’t know how to get current status of a call such as no answer,answered and busy . these three statuses are really important for my application.
for the record if you would like to suggest me CDR for getting call status , I believe it does not fit in real-time applications.
i am looking forward to hearing from you.
thank you in advance !

According to the Asterisk documentation OriginateRespons just return Failure or Success, such information it is on the CDR but CDR is only written once the channel has been hangup, maybe using local channels you could access to the {DIALSTATUS} variable

Originate to a local channel and generate a user event from the local channel.

1 Like

How can i implement such a thing ?
specially user event ?