Date created: Monday, January 28, 2013 11:01:58 AM. Last modified: Monday, July 29, 2013 4:51:47 PM

PJSIP Call Testing

Main Site - (Its the SIP stack used to compile CSIPSimple!)

From the site:

PJSIP is a free and open source multimedia communication library written in C language implementing standard based protocols such as SIP, SDP, RTP, STUN, TURN, and ICE. It combines signaling protocol (SIP) with rich multimedia framework and NAT traversal functionality into high level API that is portable and suitable for almost any type of systems ranging from desktops, embedded systems, to mobile handsets.

PJSIP is both compact and feature rich. It supports audio, video, presence, and instant messaging, and has extensive documentation. PJSIP is very portable. On mobile devices, it abstracts system dependent features and in many cases is able to utilize the native multimedia capabilities of the device.

PJSIP can be used for testing SIP calling systems like call queues or concurrent call count. These are some scripts I have written for for automationg calls with PJSIP;

Register SIP Accounts;

#!/bin/bash

# Add the local voice VLAN to our machine
/sbin/vconfig add eth1 98
# Add a load of test IPs on this VLAN
/sbin/ifconfig eth1.98:3 10.224.85.23 netmask 255.255.255.0 up
/sbin/ifconfig eth1.98:4 10.224.85.24 netmask 255.255.255.0 up
/sbin/ifconfig eth1.98:5 10.224.85.25 netmask 255.255.255.0 up
/sbin/ifconfig eth1.98:6 10.224.85.26 netmask 255.255.255.0 up
/sbin/ifconfig eth1.98:7 10.224.85.27 netmask 255.255.255.0 up
# Add a route to a PBX
/sbin/ip route add 1.2.3.4/32 via 10.224.85.1

# Open multiple new terminal windows, each will start PJSIP and register to a different account the PBX
gnome-terminal -x ./pjsua-x86_64-unknown-linux-gnu --id="sip:12323@1.2.3.4" --registrar="sip:1.2.3.4" --realm="*" --username="12323" --password="lalalalala" --bound-addr=10.224.85.23 &

gnome-terminal -x ./pjsua-x86_64-unknown-linux-gnu --id="sip:12324@1.2.3.4" --registrar="sip:1.2.3.4" --realm="*" --username="12324" --password="lalalalala" --bound-addr=10.224.85.24 &

gnome-terminal -x ./pjsua-x86_64-unknown-linux-gnu --id="sip:12325@1.2.3.4" --registrar="sip:1.2.3.4" --realm="*" --username="12325" --password="lalalalala" --bound-addr=10.224.85.25 &

gnome-terminal -x ./pjsua-x86_64-unknown-linux-gnu --id="sip:12326@1.2.3.4" --registrar="sip:1.2.3.4" --realm="*" --username="12326" --password="lalalalala" --bound-addr=10.224.85.26 &

gnome-terminal -x ./pjsua-x86_64-unknown-linux-gnu --id="sip:12327@1.2.3.4" --registrar="sip:1.2.3.4" --realm="*" --username="12327" --password="lalalalala" --bound-addr=10.224.85.27 &

Calling numbers

# Open multiple new terminal windows, each will start PJSIP and register to a different account on the PBX, then all call the same number, playing an individual WAV file on a loop, so you can tell which call has been answered

gnome-terminal -x ./pjsua-x86_64-unknown-linux-gnu --id="sip:12323@1.2.3.4" --registrar="sip:1.2.3.4" --realm="*" --username="12323" --password="lalalalala" --bound-addr=10.224.85.23 --play-file=Line1.wav --auto-play --null-audio --auto-loop sip:01234567890@1.2.3.4 &

gnome-terminal -x ./pjsua-x86_64-unknown-linux-gnu --id="sip:12324@1.2.3.4" --registrar="sip:1.2.3.4" --realm="*" --username="12324" --password="lalalalala" --bound-addr=10.224.85.24 --play-file=Line2.wav --auto-play --null-audio --auto-loop sip:01234567890@1.2.3.4 &

gnome-terminal -x ./pjsua-x86_64-unknown-linux-gnu --id="sip:12325@1.2.3.4" --registrar="sip:1.2.3.4" --realm="*" --username="12325" --password="lalalalala" --bound-addr=10.224.85.25 --play-file=Line3.wav --auto-play --null-audio --auto-loop sip:01234567890@1.2.3.4 &

gnome-terminal -x ./pjsua-x86_64-unknown-linux-gnu --id="sip:12326@1.2.3.4" --registrar="sip:1.2.3.4" --realm="*" --username="12326" --password="lalalalala" --bound-addr=10.224.85.26 --play-file=Line4.wav --auto-play --null-audio --auto-loop sip:01234567890@1.2.3.4 &

gnome-terminal -x ./pjsua-x86_64-unknown-linux-gnu --id="sip:12327@1.2.3.4" --registrar="sip:1.2.3.4" --realm="*" --username="12327" --password="lalalalala" --bound-addr=10.224.85.27 --play-file=Line5.wav --auto-play --null-audio --auto-loop sip:01234567890@1.2.3.4 &

Recording calls

gnome-terminal -x ./pjsua-x86_64-unknown-linux-gnu --id="sip:12323@1.2.3.4" --registrar="sip:1.2.3.4" --realm="*" --username="12323" --password="lalalalala" --bound-addr=10.224.85.23 --play-file=Line1.wav --auto-play --null-audio --auto-loop --auto-rec --rec-file="./`date +%Y-%m-%d--%H-%M-%S`.wav" sip:01234567890@1.2.3.4 &