Voice over SIP

Posted on

Tags: voice telecom SIP siproxd FreeBSD

It’s been a decade since I did anything with SIP, other than packaging ejabberd which supports SIP as an option. My previous adventures with SIP was unsuccessfully trying out Ekiga with various configurations, along with Asterisk, and that’s it. One of my first paid jobs was to write a SIP messenger client using Windows RTC APIs in 2004 or something.

Anyways, back from nostalgia. Few months ago we got a internet over fiber connection, and ISP decided to provide POTS over IP. The way they implemented this is their ethernet has two VLANs one for carrying internet traffic, and one for carrying SIP communication to provide voice service (as the title says). Their CPE has a RJ-11 port which is connected to a regular telephone device. The CPE runs some SIP client which interacts with their server, and provide user with the phone/voice service. For few months, I’d been having an urge to actually connect to their SIP server through a SIP user-agent on my computer, or mobile phone, and make a phone call. I never knowingly had a phone call over SIP ever (irony).

So I put the SIP VLAN network connection in the CPE’s web UI in bridge mode, and had it forward packets to my computer, and then with the same parameters as in the CPE, I was able to make a phone call with the help of Linphone. As they were using an RFC1918 network block for this, and I wanted to actually try it on my mobile phone part of the same ethernet network as my computer. I installed siproxd from FreeBSD ports, and after some tweaks to its configuration, I made it work with my phone. Following is the siproxd configuration with parameters changed:

# re0             - network interface
#   - my LAN
#      - ISP's SIP LAN
# sip.cli.ent.add - IP address from ISP's SIP LAN, that was assigned to my CPE when it was being SIP client
# bsd.cli.ent.add - IP address from my LAN, or more precisely my computer's IP address
# sip.ser.ver.add - SIP server/registrar/outbound proxy's address

if_inbound  = re0
if_outbound = re0
host_outbound = sip.cli.ent.add
hosts_allow_reg =,
hosts_allow_sip =,
sip_listen_port = 5060
daemonize = 1
silence_log = 0
user = nobody

registration_file = /tmp/siproxd_registrations
autosave_registrations = 300
pid_file = /var/run/siproxd/siproxd.pid
rtp_proxy_enable = 1
rtp_port_low  = 7070
rtp_port_high = 7089
rtp_timeout = 300
rtp_dscp = 46
sip_dscp = 0
rtp_input_dejitter  = 0
rtp_output_dejitter = 0
tcp_timeout = 600
tcp_connect_timeout = 500
tcp_keepalive = 20

debug_level = 0x0
debug_port = 0

mask_host = bsd.cli.ent.add
masked_host = sip.cli.ent.add

ua_string = SIP USER AGENT

outbound_proxy_host = sip.ser.ver.add
outbound_proxy_port = 5060



plugin_regex_desc = Replace destination for outbound calls
plugin_regex_pattern = @sip\.ser\.ver\.add
plugin_regex_replace = @bsd.cli.ent.add

I tested with Linphone in my mobile phone, providing the same parameters as they’re in CPE, except specified my computer (bsd.cli.ent.add) as the outbound proxy. And ofcourse also allowed UDP ports 5060 (SIP), 7070-7089 (RTP) ports in the host firewall to allow mobile phone, as well as SIP server (sip.ser.ver.add) to be able to connect to computer. The phone call both inbound, and outbound worked flawlessly, and it felt pretty cool. I wanted to mention to an old friend, but apparently they’re unreachable or their contact information in my brain is outdated, as I have not spoken to them in eight years now.

Also I tested registering with another phone number, and guess what? !success ๐Ÿ˜‰

In the end, I concluded what a big waste of time it was. ๐Ÿ˜ฆ