Issue a call hangup while playback sound for called party

I want to call multiple numbers and then hangup and then playback sound for the called numbers. I have the code below but the sound is not playing for the called party/s, any help please?

While( condition){ //loop through all numbers to be called
$agi→exec(‘Dial’,“SIP/Trunk/phone”,"",“A”);
$agi→exec(‘Hangup’);
$agi->exec(‘Playback’,"/path/soundfile");
}

Dial does a lot more than dial. It supervises the whole call, so doesn’t exit until the outgoing call ends.

If you want the playback to be asynchronous with respect to the initiator, you probably want to use Originate. However, I would strongly suggest studying the example configurations and getting familiar with simple calls, first.

Note your A option is incomplete, although even a complete one would be synchronous and would leave the call up, after the announcement.

Also, agi exec only seems to have two arguments.

Why are you using AGI?

Thanks for the reply.
I was using php fsockopen() to connect and issue AMI commands with code below but i don’t know how to detect who answered the call. Perhaps if i can know how to detect and record who answered a call?

Action: Originate
Channel: SIP/trunk/phone
Data: $sounfile

You are missing a mandatory parameter.

For anything complex, use the extension variant.

Is it possible with code above that after playing the soundfile which is working fine, and then send the call to dialplan and save the ${DIALSTATUS} on DB?

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