Hey guys and girls,

I'm trying to configure Kamailio so that I can communicate over it using WebRTC 
and SIP.

Client 1 is a softphone based on SIPJS. Client 2 is a Yealink phone.
Both are registered with the Kamailio. Behind the Kamailio there is another 
Asterisk. The Kamailio acts as a proxy here.

So far everything works. Only if I accept the call, which is made from Client 1 
to Client 2 or vice versa, then I get this error in Client 1:
Called with SDP without DTLS fingerprint. I can see that the fingerprint is 
present in the INVITE from Client 1 to Client 2. However, it is missing in the 
OK.

The lower part contains my NATMANAGE config. This could probably be optimized a 
lot, but for now it should work.
Unfortunately I have only recently started with Kamailio. I hope you can help 
me there. I can also send you the SIP-Log if you want to.

Many thanks in advance.


Greetings Benny


route[NATMANAGE] {
        if (is_request()) {
                if(has_totag()) {
                        if (check_route_param("nat=yes")) {
                                setbflag(FLB_NATB);
                        }

                        if (check_route_param("rtp=bridge")) {
                                setbflag(FLB_BRIDGE);
                        }

                        if (check_route_param("rtp=ws")) {
                                setbflag(FLB_RTPWS);
                        }
                }
        }

        if (!isbflagset(FLB_BRIDGE)) {
                return;
        }

        if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB) || 
isbflagset(FLB_RTPWS))) {
                return;
        }

        $xavp(r=>$T_branch_idx) = "replace-origin replace-session-connection";

        if (!nat_uac_test("8")) {
                xlog("IS TRUSTED");
                $xavp(r=>$T_branch_idx) = $xavp(r=>$T_branch_idx) + " 
trust-address";
        }

        if (is_request()) {
                if (!has_totag()) {
                        if (!t_is_failure_route()) {
                                $avp(extra_id) = @via[1].branch + $T_branch_idx;
                                $xavp(r=>$T_branch_idx) = 
$xavp(r=>$T_branch_idx) + " via-branch=extra";
                                xlog("BRANCH: $T_branch_idx");
                        }
                }
        }

        if (is_reply()) {
                $avp(extra_id) = @via[2].branch + $T_branch_idx;
                $xavp(r=>$T_branch_idx) = $xavp(r=>$T_branch_idx) + " 
via-branch=extra";
                xlog("BRANCH: $T_branch_idx");
        }

        if(isbflagset(FLB_RTPWS)){
                xlog("IS WS");
                if(is_request()){
                        xlog("IS REQUEST");
                        if ($proto =~ "ws") {
                                xlog("WEB --> SIP");
                                $xavp(r=>$T_branch_idx) = 
$xavp(r=>$T_branch_idx) + " rtcp-mux-demux DTLS=off SDES-off ICE=remove 
RTP/AVP";
                                rtpengine_manage($xavp(r=>$T_branch_idx));
                                if (route(FROMASTERISK)) {
                                        xlog("FROM INTERNAL");
                                } else {
                                        xlog("FROM EXTERNAL");
                                        rtpengine_manage(" direction=external 
direction=internal ICE=remove loop-protect");
                                }
                        } else {
                                xlog("SIP --> WEB");
                                $xavp(r=>$T_branch_idx) = 
$xavp(r=>$T_branch_idx) + " rtcp-mux-offer generate-mid DTLS=passive SDES-off 
ICE=force RTP/SAVPF direction=internal direction=external loop-protect";
                        }
                } else {
                        xlog("IS RESPONSE");
                        if ($proto =~ "ws") {
                                xlog("WEB --> SIP");
                                $xavp(r=>$T_branch_idx) = 
$xavp(r=>$T_branch_idx) + " rtcp-mux-demux DTLS=off SDES-off ICE=remove RTP/AVP 
direction=external direction=internal loop-protect";
                        } else {
                                xlog("SIP --> WEB");
                                $xavp(r=>$T_branch_idx) = 
$xavp(r=>$T_branch_idx) + " rtcp-mux-offer generate-mid DTLS=passive SDES-off 
ICE=force RTP/SAVPF direction=internal direction=external loop-protect";
                        }
                        rtpengine_manage($xavp(r=>$T_branch_idx));
                }
        } else {
                xlog("SIP --> SIP");
                if (route(FROMASTERISK)) {
                        xlog("FROM INTERNAL");
                        rtpengine_manage(" direction=internal 
direction=external ICE=remove loop-protect");
                } else {
                        xlog("FROM EXTERNAL");
                        rtpengine_manage(" direction=external 
direction=internal ICE=remove loop-protect");
                }
        }
        xlog("NATMANAGE branch_id:$T_branch_idx ruri: $ru, method:$rm, 
status:$rs, extra_id: $avp(extra_id), rtpengine_manage: 
$xavp(r=>$T_branch_idx)\n");

        if (is_request()) {
                if (!has_totag()) {
                        if (t_is_branch_route()) {
                                if (isbflagset(FLB_NATB)) {
                                        add_rr_param(";nat=yes");
                                }

                                if (isbflagset(FLB_BRIDGE)) {
                                        add_rr_param(";rtp=bridge");
                                }

                                if (isbflagset(FLB_RTPWS)) {
                                        add_rr_param(";rtp=ws");
                                }
                        }
                }
        }
        if (is_reply()) {
                if (isbflagset(FLB_NATB)) {
                        if (is_first_hop()) {
                                if (af == INET) {
                                        set_contact_alias();
                                }
                        }
                }
        }
        return;
}

_______________________________________________
Kamailio (SER) - Users Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to