Asterisk AMI Originate Response When User Not Pick Call or Not Answered

Hello Team,

Hope you are doing well.

I’m using Asterisk AMI to generate outbound call on User phone. My requirement is to hit specific API when user not pick incoming call / number seems to busy and Phone number is switched off.
I have below sample code
fputs($socket, “Action: Login\r\n”);
fputs($socket, “UserName: $user\r\n”);
fputs($socket, “Secret: $pass\r\n\r\n”);
//echo $wrets;
fputs($socket, “Action: Originate\r\n” );
fputs($socket, “Channel: SIP/$calling_number$channel\r\n” );
fputs($socket, “Exten: $calling_number\r\n” );
fputs($socket, “Context: text-context\r\n” );
fputs($socket, “Priority: 1\r\n” );
fputs($socket, “Callerid: 1234567\r\n\r\n” );
fputs($socket, “WaitTime: 15\r\n” );
fputs($socket, “Variable: api=\r\n\r\n”);
fputs($socket, “Async: true\r\n” );

Need your help on this .

Use a local channel.

1 Like

Many thanks David,

Can you please share sample code for Local Channel to communicate with AMI
Awaiting your warm response

No. I don’t do paid consultancy at the moment.

          fputs($socket, "Channel: Local/$numbertodialoutl@from-internal\r\n" );

exten=>_x.,1,Noop( Use DIALSTATUS variable and curl function to complete the rest)

Dear Ambiorixg12

Thanks for your support and sample code
But I need one more query about cdr entry in this case twice cdr entry for a single call
If i disconnect the call it’s save two time the same number variables
Please help on this

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