How to answer a MO call with an audio file
This article describes how to setup an IMS environment to answer call from UE with an audio file.
Use PJProject as SIP client
First step is to build pjproject with AMR codec support.
Follow the following tutorial.
Note that you can download pjproject sources Here.
When building pjproject, you may have errors and need to install dev packages (alsa, ffmpeg).
After installing packages, start building from scratch (from ./configure).
Convert audio file to wav to use with pjsua
The pjsua SIP clients requires a 16bits mono wav file.
To create it from any audio format use the following command line:
It will generate a test.wav file that will be used in next step.
Configure IMS for pjsua SIP client
When running pjsua SIP client, you need it to register to IMS.
We assume that you use default ims.cfg configuration file.
Add the following entry in your ue_db (ue_db-ims.cfg):
Run pjsua SIP client
After building pjproject, you should find the pjsua SIP client under pjsip-apps/bin/pjsua-x86_64-unknown-linux-gnu pjproject sources subdirectory.
Create the following text file as pjsua.cfg:
Start pjsua
Your IMS server must be running (and thus your MME).
Launch the following command:
It assume your are under pjproject source directory and you have copied your test.wav audio file and pjsua.cfg config file there.
Of course you can change the path if needed.
Once started, the pjsua SIP client should be registered.
You can check it by typing users in IMS CLI with the following result:
Place a call
All you have to do right now is placing a call with 1234 as phone number from your VoLTE client.
You should here your audio file played.
Beyond
Take a look at pjsua configuration, you may find a way to record calls or advanced features.
Start PJSUA as a service linked to LTE
Create a pjsua.sh file with execution permissions and following content:
Create a pjsua.service file with following content:
NB: change path of ExecStart in pjsua.service (Must be an absolute path).
NB: Those two files should be placed at same location as audio file and pjsua config file.
NB: You may change the User parameter of pjsua.service if you have not done first steps of this page as root.
Then execute the following commands as root:
Now, pjsua will be started and stopped automatically depending on LTE service state.
Note that it is launched in a separate screen instance called PJSUA. You may access it via: