Raw SIP RESPONSES

I’m trying to originate calls using asterisk AMI originate action ,
everything is working properly ,
but ,
i’m not receiving the failure reasons properly .
It’s always 0 or 3 .
Is there a way to enable receiving failure reasons in OriginateResponse event .
or is there any better approach to achieve that ?
I also tried ARI with no luck .

Using Asterisk 18.12.1 with pjsip

There’s no access to the direct SIP responses there. It’s an extremely simplified reason.

Use a Local channel in your Originate action, and read the failure value from the HANGUPCAUSE or DIALSTATUS variable. Then, use an AMI user event to generate a custom event with that information.

@ambiorixg12 Thanks for your reply , i have tried both variables , but in all scenariosn i’m getting
NOANSWER in DIALSTATUS
and 16 in HANGUPCAUSE
in all sip responses
that is why i’m asking for the sip response it self.

but is it always the same reason ?
or something is wrong with my configurations

You haven’t shown any detail, so can’t really say. You could show the actual SIP trace, console output, AMI response.

that is my ami response .
it’s always 0 or 3 what ever happens on the other leg (busy , no answer , no route , un available , congestion , wrong number ).

AmiEvent {
variables: {},
event: ‘OriginateResponse’,
privilege: ‘call,all’,
actionid: ‘0.5928193652090825’,
response: ‘Failure’,
channel: ‘PJSIP/number@CON’,
context: ‘CON’,
exten: ‘number’,
reason: ‘0’,
uniqueid: ‘’,
calleridnum: ‘966xxxxxxxx’,
calleridname: ‘’,
incomingData: [
‘Event: OriginateResponse’,
‘Privilege: call,all’,
‘ActionID: 0.5928193652090825’,
‘Response: Failure’,
‘Channel: PJSIP/number@CON’,
‘Context: CON’,
‘Exten: number’,
‘Reason: 0’,
‘Uniqueid: ’,
‘CallerIDNum: 966xxxxxxxx’,
‘CallerIDName: ’
]
}

Failure on OriginateResponse would seem to indicate failure to initiate the call, so something was wrong with the request to Asterisk itself.

For example, for ARI, the hangup cause will be reported in the ChannelDestroyed event. You can see some sample code for picking this up in the track_call_ari_async example here.

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