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”);
$wrets=fgets($socket,128);
//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=http://www.google.com\r\n\r\n”);
fputs($socket, “Async: true\r\n” );
$wrets=fgets($socket,128);

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" );

[from-internal]
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.