Coder Social home page Coder Social logo

Comments (7)

havfo avatar havfo commented on August 15, 2024

Hi, this setup is not built for bridging between WebRTC clients by default. The Kamailio config needs some modifications if that is to work. What call scenarios do you plan to support?

To disable WITH_ALWAYS_BRIDGE, change the line:
#!define WITH_ALWAYS_BRIDGE
to
##!define WITH_ALWAYS_BRIDGE

from webrtc-to-sip.

balabanferhat avatar balabanferhat commented on August 15, 2024

My call scenarios are webrtc<>sip , webrtc<>webrtc, sip<>sip

If I change the line like you said, I get compile errors and cannot start kamailio

loading modules under config path: /usr/lib/x86_64-linux-gnu/kamailio/modules/
 0(7298) INFO: tls [tls_init.c:385]: init_tls_compression(): tls: init_tls: disabling compression...
 0(7298) : <core> [cfg.y:3439]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line **619**, column 1: syntax error
 0(7298) : <core> [cfg.y:3439]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line **619**, column 1: invalid  route  statement
 0(7298) : <core> [cfg.y:3436]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line **622**, column 1-12:
ERROR: bad config file (3 errors)

These lines ,619 and 622 can be seen below

My config file is same as yours. Nothing changed only XXXX parts are changed.

route[RTP_BRIDGE] {
	#!ifdef WITH_ALWAYS_BRIDGE
	if (is_method("INVITE")) {
		if ($ru =~ "transport=ws") {
			xlog("L_INFO", "SIP -> WebRTC, bridging RTP->SRTP and adding ICE");
			rtpengine_manage("trust-address replace-origin replace-session-connection rtcp-mux-accept rtcp-mux-offer ICE=force UDP/TLS/RTP/SAVPF");
			t_on_reply("REPLY_FROM_WS");
		} else if ($proto =~ "ws") {
			xlog("L_INFO", "WebRTC -> SIP, bridging SRTP->RTP and removing ICE");
			rtpengine_manage("trust-address replace-origin replace-session-connection rtcp-mux-demux ICE=remove RTP/AVP");
			t_on_reply("REPLY_TO_WS");
		}
	}
	#!endif
}  <------------------619

# manage outgoing branches
branch_route[MANAGE_BRANCH] {   <------------------622

By the way, I am now trying only webrtc<>webrtc and I cannot get rid of this 488 error.

from webrtc-to-sip.

havfo avatar havfo commented on August 15, 2024

Ah, nice catch. A route block always needs to contain something, so put a logging statement or something there. Example:

route[RTP_BRIDGE] {
	xlog("L_INFO", "ROUTE: RTP_BRIDGE");
	#!ifdef WITH_ALWAYS_BRIDGE
...

Like I said, this configuration will not handle all those scenarios by default. The intended use of this configuration is to make WebRTC be able to call SIP and vice versa.

From your description of network issues, I suspect you haven't set up a turn server? The WebRTC clients shouldn't need a RTPEngine between them, the TURN server should be enough.

from webrtc-to-sip.

balabanferhat avatar balabanferhat commented on August 15, 2024

Hi, thanks for your help. I managed to make calls webrtc<>webrtc, webrtc > sip and sip<>sip
but I can do it by changing configurations. How can I detect if call is webrtc<>webrtc and change configuration dynamically?

from webrtc-to-sip.

havfo avatar havfo commented on August 15, 2024

Hi, I just pushed out a new config you can try. It's called kamailio-bridging.cfg. The new config should be smarter in handling the different types of bridging needed based on your needs.

from webrtc-to-sip.

balabanferhat avatar balabanferhat commented on August 15, 2024

Thks, it is much smarter now, and all settings work except video calls between sip<>ws and sip<>sip.

I tested phone calls they are all ok.

for ws<> ws I commented rtpengine_manage and succeeded like this setup. I think we dont need bridging for this?

route[SETUP_BRIDGING] {
	if(!has_totag()) {
		if ($proto =~ "ws") { # Coming from websocket
			if ($ru =~ "transport=ws") { # WebRTC > WebRTC
				xlog("L_INFO", "WebRTC > WebRTC");
				# rtpengine_manage("trust-address replace-origin replace-session-connection ICE=force");
				# t_on_reply("REPLY_WS_TO_WS");
			} else { # WebRTC > SIP
				xlog("L_INFO", "WebRTC > SIP");
				rtpengine_manage("trust-address replace-origin replace-session-connection rtcp-mux-demux ICE=remove RTP/AVP");
				t_on_reply("REPLY_WS_TO_SIP");
			}
		} else { # Coming from SIP
			if ($ru =~ "transport=ws") { # SIP > WebRTC
				xlog("L_INFO", "SIP > WebRTC");
				rtpengine_manage("trust-address replace-origin replace-session-connection rtcp-mux-accept rtcp-mux-offer ICE=force RTP/SAVPF");
				t_on_reply("REPLY_SIP_TO_WS");
			} else { # SIP > SIP
				xlog("L_INFO", "SIP > SIP");
				rtpengine_manage("trust-address replace-origin replace-session-connection");
				t_on_reply("REPLY_SIP_TO_SIP");
			}
		}
	}
}

For sip clients I use linphone. And video is not working in ios and android clients. Has kamailo a configuration to enable video-media streams ? . I have seen that Zopier client has a setting rport that enables media and signaling. If I enable it video starts working. But in linphone there is no such a setting and Nat cannot be handled. Therefore, video works only if clients are in same network.

from webrtc-to-sip.

havfo avatar havfo commented on August 15, 2024

For your first question, you are right that you don't need bridging for all the cases, ws <> ws should be best without RtpEngine.

Regarding the video issue, I am not sure why this doesn't work. There is nothing in Kamailio that has antything to do with video in that sense. RtpEngine modifies the SDP, but doesn't disable streams. Kamailio by itself doesn't care what is in the SDP.

I just pushed out a config that should fix handling of NAT for SIP clients (haven't had time to test it).

from webrtc-to-sip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.