4. Steps to Build Docker Image
5. Interact with the docker compose project
8. Files and directories description in this Repository
This repository is a docker compose containing Kamailio as a SIP Proxy and SIPp as the UAC and UAS. It handles a scenario when Kamailio receives a negative SIP response (e.g., 486) from the UAS, processes it in the failure_route, and sends a different SIP response to the UAC.
- Kamailio 5.7.5 (SIP Proxy)
- SIPp (SIP injector for UAC and UAS)
- UAC SIP Address: 200.200.200.2:5080
- Kamailio SIP Address: 200.200.200.3:5060
- UAS SIP Address: 200.200.200.4:5060
The Dockerfiles for Kamailio and SIPp are located in ./kamailio_handle_PRACK/dockerfiles. To set up the environment, you need to build a Docker image for Kamailio version 5.7.5 in the kamailio_handle_PRACK/dockerfiles/kamailio\ 5.7.5 directory.
If you already have the Kamailio Docker image, you can use it and change the image value in the docker-compose.yml file. The same applies to the SIPp Dockerfile located in kamailio_handle_PRACK/dockerfiles/SIPp.
Navigate to the directory containing the kamailio 5.7.5 Dockerfile, then run the build command:
cd ./kamailio_handle_PRACK/dockerfiles/kamailio\ 5.7.5
docker builder build -t debian_11_kamailio:5.7.5 .
#or
docker build -t debian_11_kamailio:5.7.5 .
Navigate to the directory containing the SIPp Dockerfile, then run the build command:
cd ./kamailio_handle_PRACK/dockerfiles/SIPp
docker builder build -t debian-sipp:latest .
#or
docker build -t debian-sipp:latest .
You can interact with this docker compose project in two ways, the first one it to type directly the commands to launch the SIPp call, launch the sngrep application and gettings logs or execute the ./kamailio_handle_PRACK/env.bash bash file which contains bash shortcuts and one alias to interact with the docker containers like making calls, launching the sngrep on the containers...
Read the ./kamailio_handle_PRACK/env.bash file for more details.
Navigate to the directory containing the env.bash file, then execute it:
cd ./kamailio_handle_PRACK/
source env.bash
To start the docker compose containers, type:
$up
To stop the docker compose project, type:
$down
To get the stats of containers, type
$docker_ps
To get logs of each container, type:
$the_proxy_logs #get the kamailio container's logs
$the_caller_logs #get the UAC container's logs
$the_callee_logs #get the UAS container's logs
To launch SNGRep application on each container type:
$the_proxy_sngrep #launch sngrep on the kamailio container
$the_caller_sngrep #launch sngrep on the UAC container
$the_callee_sngrep #launch snrep on the UAS container
Launch the call from the UAC, type the following alias client_call (note: it is not a shortcut starting with $):
client_call #this alias is well defined in the env.bash file, it starts the sipp as UAC and sends SIP requests to the kamailio
In case you did some changes to the UAS xml file scenario located in the host ./kamailio_handle_PRACK/sipp_scenarios/uas.xml and you want to resart the UAS SIPp container type:
$callee #this will just restart the container
In case you did some changes to the kamailio configuration file located in the host ./kamailio_handle_PRACK/kamailio_configuration/kamailio.cfg and you want to resart kamailio, type:
$restart_proxy
To start the docker compose containers, type:
docker compose up -d
To stop the docker compose project, type:
docker compose down -t0
To get the stats of containers, type
docker compose ps -a
To get logs of each container, type:
docker compose logs -f container_name
To launch SNGRep application on each container type:
docker compose exec -it conainer_name sngrep
Launch the call from the UAC, type the following alias client_call (note: it is not a shortcut starting with $):
docker compose exec -it the_caller sh -c "pkill sipp; sipp -aa -trace_err -sf sipp_scenarios/uac.xml -i 200.200.200.2 -p 5080 -s called_party 200.200.200.3:5060 -m 1"
In case you did some changes to the UAS xml file scenario located in the host ./kamailio_handle_PRACK/sipp_scenarios/uas.xml and you want to resart the UAS SIPp container type:
docker compose restart -t0 the_callee
In case you did some changes to the kamailio configuration file located in the host ./kamailio_handle_PRACK/kamailio_configuration/kamailio.cfg and you want to resart kamailio, type:
docker compose restart kamailio_sip_proxy -t0
- Build the Docker images or use your own Docker images.
- If using your own Docker images, ensure to change the volumes path in the docker-compose.yml file to take the kamailio configuration file.
- Start the Docker Compose project.
- Start SNGRep on each container to capture SIP traffic or use SNGRep on your host machine.
- Launch the call from the UAC. The UAS is already running (check the docker-compose.yml file).
- Check SNGRep in Kamailio to see the changes made to the "To" tag in the forwarded Negative SIP message reply.
- UAC sends an INVITE to Kamailio (including 100rel in Require & Supported headers).
- Kamailio replies to the INVITE with 100 Trying.
- Kamailio forwards the INVITE to UAS.
- UAS responds with 100 Trying and 180 Ringing (with RSeq and 100rel required), the 180 Ringing contains the "To" Tag.
- Kamailio forwards the 180 Ringing reply to the UAC.
- UAC sends PRACK (with RAck header).
- Kamailio forwards the PRACK to UAS.
- UAS responds with 200 OK to the PRACK.
- Kamailio forwards the 200 OK to the UAC.
- UAS responds with 486 Busy Here final response to the INVITE transaction and sends it to Kamailio.
- Kamailio receives the final response from the UAS, enters the failure_route, and sends a new reply using send_reply or t_send_reply. The reply sent from Kamailio has a different "To" tag from the previous SIP messages.
- UAC receives the final response from Kamailio.
- UAC sends an ACK to finish the INVITE transaction.
When Kamailio receives the Client Error SIP Reply "486 Busy here in this case, you can change to what ever >399 SIP Response, the same behaviour occurs" and executes the send_reply or t_send_reply methods, it should keep the same "To" tag in the generated SIP response.
- docker-compose.yml: A file which defines the services/containers, each with a volume to take the new configuration of kamailio.cfg and SIPp scenarios, as well as the network configuration.
- env.bash: A file contains important shortcuts to execute commands
- sipp_scenarios: Directory containing the XML files for UAC and UAS scenarios:
- uac.xml: UAC scenario.
- uas.xml UAS scenario.
- kamailio_configuration: Directory containing the kamailio.cfg file, which you can configure or change.
- dockerfiles: A directory containing subdirectories for Kamailio and SIPp, each with a Dockerfile to build the respective Docker image.
Thank you for taking the time to explore this project and help to fix the problem. If you have any suggestion or need further informations, please feel free to contact me at [email protected].