How to make a background music when run the php agi scripts

Hello everyone
I like to play the music when run the agi.
For example I run ping ip address 127.0.0.1 for 10 seconds and I like same the ping address play the music.

I try this ones

$agi->exec(‘Background’,‘custom/1’);
$agi->verbose(’-------------------------------------------------’);

$agi->exec(‘Playback’,‘custom/1’);
$agi->verbose(’-------------------------------------------------’);

$agi->exec(MusicOnHold);
$agi->verbose(’-------------------------------------------------’);

All this line are play the music but at the same time is not run the script.
When run the music file verbose is not on the asterisk console

Please advise me how to solve this
Thank You

Do you mean play background music while pinging a host, all done in the same AGI script ?

Yes
beacuse ping the destination ip need a 10 second and I like to play music in this time

Use music on hold, rather than background?

You can use local channel and chanspy to inject the background music