How can play audio files when calling

Hello I am new in freepbx and asterisk. a little know


$call_trunk = ‘IDT’;

$src = preg_replace(’/\s+/’, ‘’, $fromcall);
$dst = preg_replace(’/\s+/’, ‘’, $tocall);
$trunk = preg_replace(’/\s+/’, ‘’, $call_trunk);
$cid = preg_replace(’/\s+/’, ‘’, $callerid);
$id = preg_replace(’/\s+/’, ‘’, $_POST[id]);
$pitch = preg_replace(’/\s+/’, ‘’, $call_pitch);

$ext=$src ;
$audio_path = ‘/var/www/html/b007a9c12395c9c842bad59d900d88f2.mp3’
$socket = fsockopen("$host",$port,$errno, $errstr, $timeout);
fputs($socket, “Action: Login\r\n”);
fputs($socket, “UserName: *********\r\n”); //
fputs($socket, “Secret: ***********\r\n\r\n”); // //

          fputs($socket, "Action: Originate\r\n" );
           fputs($socket, "Channel: Local/$src@out1/n\r\n" );
           fputs($socket, "Exten: $dst\r\n" );
           fputs($socket, "Context: $context\r\n" );
           fputs($socket, "Priority: 1\r\n" );
           fputs($socket, "CallerID: $cid\r\n" );
           fputs($socket, "Variable: __trunk=$trunk\r\n" );
           fputs($socket, "Variable: __dst=$dst\r\n" );
           fputs($socket, "Variable: __src=$src\r\n" );

           fputs($socket, "Variable: __cid=$cid\r\n" );
           fputs($socket, "Variable: __id=$id\r\n" );
           fputs($socket, "Variable: __pitch=$pitch\r\n" );
           fputs($socket, "Variable: __audio_path=$audio_path\r\n" );               

         fputs($socket, "Async: yes\r\n\r\n" );
          fputs($socket, "Action: Logoff\r\n\r\n");

sleep (1);
echo $wrets;

this is php code in freepbx server.
after this, I dont know how to play audio files when calling.
where is ?
please help me

I guess this is supposed to be an AMI script. At first you need to get the Originate command right. This is something you can do from the console. You could call the Playback application, but not with an mp3 file as the source. For simplicity I’d write an extension to answer the call.

You can play audio with early media, but I would stay away from this.

thanks for your reply.
yes. this is AMI script
current with this, I can call now.

so to call playback, what i have to do ?

RTFM, for example here: Asterisk™: The Definitive Guide

i check.
one question
I am new in freepbx and asterisk. i know a little.
so where is dial plan?
how can i find that?
I know my question is stupid

The answer was a bit rude, but essentially you need to learn the stuff inside “The Definitive Guide”.

oh sorry.
i understand your mean.
but could you help me about playback issues shortly?

Hi if you are using freepbx you should use there forum as freepbx is controlling the asterisk config
or you need to know how to make changes to asterisk config without interfering with freepbx
and that require moderate knowledge of how freepbx interact with asterisk

This is the wrong forum for FreePBX. FreePBX hides the dialplan from simple users. If you do not know about dialplans, it isn’t really possible to support you in terms of Asterisk. Even for FreePBX, one you start using AMI, you are going to need some understanding of the general principles, and may end up needing a detailed understanding.

You should try the FreePBX forum to see if they can give you a GUI solution, but, at the moment, I think you are too out of your depth to do this without paying for consultancy.

MP3 is an inefficient format when dealing with telephone quality audio. It has implications of music, and telephone systems, particularly mobile phones, don’t handle music well.

so what is solution?
I think this problem can solve in my asterisk enoughlly
please help me

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