Play MP3 for Caller

Let us see how to make your calls more customised by playing a configurated
MP3 file after you have answered the call.
Of course you need to install API Extension and subscribe to Incoming Call URL
with your application’s URL.

Let us see how to make your calls more customised by playing a
configurated MP3 file after you have answered the call.
First of all, please login and connect to the API Extension.
Wait for an Incoming call, and when it is occured just attach into
the call a WaveStreamPlayer object and add the path of your audio file.

First of all, please put an MP3 (or Wav) file to the right directory at your web
server. Please change the yoursite.com text to that ip address where the sample applications are running.
However, it is possible to use an online file too. This file will be played for the caller.

The program will send back the OzML response
to the caller. As you can see,
it is just a simple Play command. Please
write your file path between the <Play> and </Play>
tags.

IN MORE DETAILS

Get the OPSSDK.dll

First you need to add the OPSSDK.dll reference to your project
(You can find OPSSDK.dll at
C:\Program Files\Ozeki\Ozeki Phone System XE\Examples\.NET API\OPSSDK.dll).

Login and connect

Create a new instance of OpsClient, and subscribe to the
ErrorOccurred event.
Your program will communicate with the Ozeki Phone System XE through this client.
Try to login with the client into the running Ozeki Phone System XE,
with the address of the server(ozekixepbx.ip) and a valid username, password combination.

If you are ready, try to get an existing API Extension,
with the GetApiExtension method of the OpsClient.
Read more about installation of API Extension.

Further steps

When you are ready with the initial steps above, subscribe the
IncomingCall event of the apiExtension. This event will be triggered
every time when the selected API Extension is called. In the mentioned
event handler you will see the e.Item paramter, this parameter will be
the call object. This call object has a CallState property, when the
CallState is Ringing subscribe the CallStateChanged
event of the call object and Accept the call.

The CallStateChanged event will trigger when the call is going to
another state . When the CallState is Answered, you can connect
the devices to the call. When the call has ended, please do not
forget to disconnect all devices from the call.

When the CallState is Answered, start and connect to the call a WaveStreamPlayback object, what will play to the caller the
given audio file. When the WaveStreamPlayback is finished the call
will hung up.

With these steps, you learnt how to receive an incoming call, and play an audio file to the caller.