Page 1 of 1

Fritzbox as SIP Client over Mikrotik VPN

Posted: Thu Oct 10, 2019 2:50 pm
by indnti
It costs me many hours so I will share it with you.

The situation: German AVM "fritzbox" as a little telephone switchboard at home. At the company a "unify" (formerly "Siemens") telephone switchboard witch offers SIP. I want the FritzBox to work as a SIP client on the companies unify. The problem is, that the FritzBox routes all SIP telephony over its internet connection per default, regardless which IP routes you have at the homenet configuration. At the web gui you can't configure anything else. You have to backup the configuration, edit it, and restore it. For this the fb-tools are very helpful: https://www.mengelke.de/Projekte/FritzBoxTools

Requirement: you have a working VPN connection between your home office and the company and you can reach its telephone switchboard on udp port 5060,
E.g. the unify will have the IP-Number "192.168.100.2", your mikrotik "192.168.178.254" and the FritzBox "192.168.178.1". The telephone have the direct line number "10"

* First establish a route at FritzBox homenet to the unify IP net 192.168.100.0/24 over the MK router 192.168.178.254
* Make a SIP configuration for your company number at the FritzBox telephony, registrar is the unify IP: 192.168.100.2 See point 2 at:
https://en.avm.de/service/fritzbox/frit ... FRITZ-Box/
But it will not work.
* Backup your FritzBox configuration with password
* Edit the file you have saved. Go to the section "voipcfg" and the ua for the company SIP. The essential options are:
  • localip = 192.168.178.1 #(default: "0.0.0.0")
  • route_always_over_internet = no; #(default: "yes")
  • sipiface = sipiface_homenet; #(default: "sipiface_automatic" - possible options are: sipiface_automatic, sipiface_internet, sipiface_voip, sipiface_mta, sipiface_homenet, sipiface_vpn, sipiface_tunnel)
* restore the FritzBox Configuration with the fb_tools. Before configure "myfritz" in "fb_config.php" with IP 192.168.178.1 and your FritzBox webui password.
fb_tools % ./fb_tools.php myfritz konfig ImPort-CalcSum FRITZ.Box\ Fon\ WLAN\<your edited backup>.export <backup password>
My configuration:
ua5 {
                enabled = yes;
                username = "$$$$VQ....";
                authname = "";
                passwd = "$$$$WZ...";
                registrar = "192.168.100.2";
                ttl = 30m;
                sipping_enabled = no;
                sipping_interval = 280s;
                name = "10";
                providername = "provider_id=other_192.168.100.2;parentprovider_id=;numberprefix=;usersprefix=;usersuffix=";
                ims_client = no;
                with_displayname = no;
                read_from_displayname = yes;
                dtmfcfg = dtmfcfg_automatic;
                rtpevent_keep_packetrate = no;
                register_failwait = 0w;
                register_failwaitmax = 30m;
                stunserver = "";
                stunserverport = 3478;
                use_internat_calling_numb = no;
                is_nat_aware = no;
                localip = 192.168.178.1;
                protocolprefer = protocolprefer_ipv4only;
                ignore_received_header = no;
                always_clir = no;
                clirtype = clir_displayname;
                reject_anonymous_call_with_433 = no;
                colptype = colp_none;
                clipnstype = clipns_off;
                vad_enabled = no;
                only_one_dialog = no;
                presence_supported = no;
                mwi_supported = yes;
                mwi_inmemoria = no;
                ccbs_supported = no;
                reg_support = regsupport_auto;
                packetization = packetization_fixed;
                tx_packetsize_in_ms = 30;
                xrtp_periodic = 0;
                reject_refer = yes;
                sip_instance = no;
                no_register_fetch = yes;
                do_not_register = no;
                only_call_from_registrar = no;
                invite_without_register_allowed = no;
                outboundproxy = "";
                outboundproxy_without_route_header = no;
                factory_3pty_uri = "";
                no_hold_speech = no;
                dditype = ddi_none;
                ddireception = "";
                webui_trunk_id = "multisip:80118115-....";
                alias_head_number = "";
                cfxsignaling = cfx_standard;
                backup_wanted = no;
                use_session_timer = no;
                use_rport = yes;
                add_rtpmap_for_all_codecs = no;
                answer_only_one_codec = no;
                without_annexb_no = no;
                srtp_supported = no;
                crypto_avp_mode = crypto_mode_avp_only;
                use_488_for_no_t38 = no;
                g726_via_rfc3551 = no;
                no_g726_32_offer_with_pt2 = no;
                g726_fixed_ptime30 = no;
                dtmf_inband_on_g711g722 = no;
                enable_3xx = yes;
                t38_reinvite_from_remote = no;
                use_t38version0 = no;
                rtcp_xr_media_attribute = no;
                ptime_a_attribute = yes;
                tones_and_announcements_for_service = no;
                read_p_asserted_identity_header = no;
                route_always_over_internet = no;
                sipiface = sipiface_homenet;
                altc_attribute_rfc6947 = no;
                send_extended_sip_client_info = no;
                gui_readonly = no;
                convertstate = 0;
                snmp_instance = 0;
                loopback_client_username_fos = "";
                loopback_client_username_pass_through = "";
                directloopback_client_username = "";
        }