Establish connection between Asterisk and Kurento

1,490 views
Skip to first unread message

akshay...@gmail.com

unread,
Jun 20, 2016, 9:25:34 AM6/20/16
to kurento
After going through a number of webpages and forums I couldnt find a clear solution to establish a connection between kurento and asterisk. Can someone please help. Or atleast give a direction/head start.

It is said here that it is necessary to exchange an sdp with asterisk to initiate call. But how exactly to exchange the sdp with asterisk using a endpoint(webrtc/rtp)?

Also here and here I found a set of steps to connect a webrtc client to asterisk. SIP is being used in these steps. It is suggested to send the SDP generated by kurento's endpoint to asterisk in an INVITE request. But how exactly to send this 'INVITE' request to asterisk. What medium should be used? I have searched through the kurento google group and stackoverflow throughly. But couldnt find a way.

I also found from the comments in this question that to establish  a connection with asterisk, sip/webrtc both can be used as asterisk supports webrtc now. Further search( link1, link2 ) suggests me to make use of webrtc clients like SipML, sip.js etc. But as kurento's sample examples of onetoOne call/ group call already act as one.

Also I read that sip servlets can be used. But I am unable to find even simple hello world or demo samples which can be excuted and tested for study. The most suggested link even by oracle and sailfin doesnt seem to work. link (link of the oracles sip servlets tutorial). sample examples link which doesnt work. I also checked up with the mobicents servlets examples but they too provide just a .war file.

I just want to know a way to send and receive a sip request with an kurento endpoint and exchange the sdp.
Please give me atleast some direction.
Any help will be greatly appreciated.
Thank you in advance.

Warm regards,
Akshay

Javier Lopez Fernandez

unread,
Jun 20, 2016, 9:56:13 AM6/20/16
to kur...@googlegroups.com
Akshay,
You’ll need indeed a SIP UA to talk to asterisk. If your’re using java I can recommend jainsip or sipservlet implementation, like Mobicents. Unfortunately kurento does not provide any tutorial about this, so you’ll need to look for it in SIP forums.

Regards
Javier

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Javier Lopez Fernandez





akshay...@gmail.com

unread,
Jun 20, 2016, 10:02:10 AM6/20/16
to kurento
Javier,
Thank you for the prompt reply.

But as asterisk also supports webrtc wouldnt it be easier to communicate to kurento using webrtc? That way I wouldnt need to do major implementation changes. Are you aware of  a way to do that?

Akshay

Javier Lopez Fernandez

unread,
Jun 20, 2016, 10:10:12 AM6/20/16
to kur...@googlegroups.com
Akshay,
Kurento does not implement SIP. You’ll need an external app implementing the SIP UA. Then you can use RTP or WebRTC to connect to Asterisk, but this has to do anything with signaling.

Regards
Javier

Damien Fétis

unread,
Jun 20, 2016, 11:26:08 AM6/20/16
to kur...@googlegroups.com
Hi,
as said Javier, you should use a sip UA using Jainsip  to talk to Astersik using SIP over tcp socket.
It's the simplest solution to connect Kurento and Astersik for SDP exchange.
But if you're using node.js you could send your sip over websocket using SipML

The webrtc support on Astersik is just SIP over websocket and DTLS-SRTP for media.

So, to send sip to Astersik  2 solution : SIP/TCP or SIP over websocket.
To send media to Astersik with Kurento 2 solution : rtpendpoint (tested and in production in our platform since 1 year ) or webrtcendpoint (never try so ...... ).

What I learn using DTLS-SRTP   to Astersik  (on an old asterisk 11 version ):
- Sound works fine but not video.
- It's tricky to configure DTLS-SRTP.
- Astersik doesn't transcode opus.

Regards,
Damien


 

akshay...@gmail.com

unread,
Jun 21, 2016, 5:30:07 AM6/21/16
to kurento
Thank you for your help and observation inputs Damien. It is greatly appreciated. :-)

akshay...@gmail.com

unread,
Jun 21, 2016, 5:31:46 AM6/21/16
to kurento
Thank you sooo much for your help and response Javier. :-)

akshay...@gmail.com

unread,
Sep 7, 2016, 8:40:14 AM9/7/16
to kurento, akshay...@gmail.com

Hi,

I finally I have managed to establish and audio call between Asterisk and Kurento. I made use of JAIN-SIP api for creating a sip UA for kurento. I made use of rtpendpoint to exchange SDP with asterisk. I also managed to establish a video call using the same setup.

Next I was trying to make use of the ConfBridge module of Asterisk. Using ConfBridge I established a conference on Asterisk Server. I am connecting multiple sip softphones (like zoiper, ring, jitsi etc) as participants as well as the Kurento using its sip UA.


The weird issue that I face when using ConfBridge module is that the audio is received only from kurento to asterisk direction. No matter what I have tried the audio is not heard at all at the kurento end.


I will just describe my setup in breif:

I am working on a lan with 3 machines, M1, M2, M3.

Asterisk server is running on M1. Asterisk is not assigned a public ip.

App-server , SIP UA for kurento and KMS is on M2

And a user with a sip softphone tries to connect the call from M3

The flow is as follows:

- Send an INVITE request to asterisk

- Receive 200 OK response from asterisk + sdp offer

- generate sdp answer for this offer using rtpendpoint.

- send ACK + sdp answer to asterisk


This exact same setup when used to establish a one to one call from kurento to a sip softphone through asterisk works perfectly. Both users can see and/or hear each other. It is only when the confBridge is introduced that the one way audio issue started.


To solve this I have tried out a number of ways:

  • NAT issue:

- The very first and obvious approach was the NATing issue. Asterisk has provided the sip.conf and the rtp.conf to make changes related to nat.
- In sip.conf I have tried changing the nat as one of the options and none of it works

nat = yes

nat = comedia

nat = force_rport

nat = force_rport, comedia

- In rtp.conf I have tried assigning a stun server. Also by changing the 'strictrtp' parameter as well.

  • I tried enabling directmedia = yes in sip.conf

  • Codec Issue:

- Codecs supported by asterisk and kurento vary alot. Kuento claims that the rtpendpoint supports the major codecs like opus, speex etc on their site here https://www.kurento.org/kurento-media-element-toolbox. But in /etc/kurento/modules/kurento/Sdpendpoint.conf.ini I have verified that only OPUS, PCMU and AMR are supported.

- I have tried restricting the codecs by adding the following lines in sip.conf

disallow = all

allow = ulaw ;(for pcmu)

After adding these lines the sdp offer and answers reflect the codec changes. Still no change in the output.

  • Call Transfer feature of Asterisk:

Because the same setup works when not using a confBridge I also tried to do call forwarding from a sip softphone to confBridge. But alas!

  • WebRtcEndpoint:

I next tried to solve the NAT issue by introducing ICE and using the webrtcendpoints to generate the candidates. The issue I faced here is that the webrtcendpoint doesnt generate the ice candidates no matter what. I have waited for the ice candidates gathering completion. I have also attached the listeners 'iceGatheringStateChange and iceGatheringDone' but none of them get triggered nor the ice gathering procedure starts. Couldnt understand the reason.

On adding icesupport = yes in sip.conf the asterisk sent and sdp with candidates appended. But the sdp answer from the webrtcendpoint couldnt append any candidates for the above reason.

  • Using wireshark I have confirmed that media is flowing from the asterisk to kurento. And the rtp packets are received at the kurento end. The rtp packets received at the kurento end to reflect that. But the mediaflow event of rtpendpoint states is as NOT_FLOWING.

  • The same is verified using the rtp debug option on asterisk server.

  • I have also tried to use asterisk on different machine to make sure it is not a machine specific issue.

  • Also as mentioned before I have tried different sip softphones too so it is not specific to a particular softphone.

  • I have also tried different browsers (chrome, firefox) at the kurento client end so it is not a browser specific issue either.


I am now left completly clueless as to what else should be tried out. And not understanding where exactly I am going wrong.


Can anyone direct me in the right direction? Any help will be greatly appreciated.


Thanking you,

Warm Regards,

Akshay

Damien Fétis

unread,
Sep 7, 2016, 9:45:11 AM9/7/16
to kur...@googlegroups.com
Hi Akshay,
sorry for not responding to your private message, but I just see it today.

And I think it's more useful to resolve your issue in this group.

So you have a working bi directionnal call from a brower client to a SIP phone through Kurento to Astersik with a sip-ua to manage the sdp exchange.
But it's not working with Asterisk Confbridge.
  
We have exactly the same configuration and Confbridge is working fine (but not in opus).
In sip.conf we set :


disallow = all
allow = ulaw
direct_media = no
nat = comedia



What's your Asterisk Versions ?
How do you configure your Confridge in dialplan ?

Could you post tcpdump capture between Kurento and Astersik ?

In your Kurento app, do you connect rtp-endpoint to webrtc-endpoint and webrtc-endpoint to rtp-endpoint ?

Best Regards,
Damien.

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+unsubscribe@googlegroups.com.

akshay...@gmail.com

unread,
Sep 8, 2016, 12:48:51 AM9/8/16
to kurento
Hi Damien,

Thank you sooooo much for replying....Answering your questions inline...


On Wednesday, September 7, 2016 at 7:15:11 PM UTC+5:30, Damien Fétis wrote:
Hi Akshay,
sorry for not responding to your private message, but I just see it today.

And I think it's more useful to resolve your issue in this group.

So you have a working bi directionnal call from a brower client to a SIP phone through Kurento to Astersik with a sip-ua to manage the sdp exchange.
But it's not working with Asterisk Confbridge.
  
We have exactly the same configuration and Confbridge is working fine (but not in opus).
In sip.conf we set :

disallow = all
allow = ulaw
direct_media = no
nat = comedia



Yes I have tried making all possible combination of nat, directmedia, allow and other parameters in sip.conf with all of their permissible values. I have tried your suggested configuration as well. And still the output has been exactly the same. Only one way audio!

What's your Asterisk Versions ?
Oops Thats something important I forgot to mention. My asterisk version is 13.9.0. KMS version is 6.5.0
 
How do you configure your Confridge in dialplan ?
Here are the contents of my 
extension.conf:
[default]

[testphone]
exten=>5001,1,Dial(SIP/5001,20)
exten=>5002,1,Dial(SIP/5002,20)
exten=>5003,1,Dial(SIP/5003,20)

exten=>1111,1,Answer()
same=>n,ConfBridge(${EXTEN},1111_bridge,1111_user,)


 confBridge.conf:
[general]


; --- ConfBridge User Profile Options ---
[1111_user]
type
=user


; --- ConfBridge Bridge Profile Options ---
[1111_bridge]
type
=bridge
record_conference
=yes

in Sip.conf I have tried the configuration suggested by you.

Could you post tcpdump capture between Kurento and Astersik ?
I am sorry I dont have the tcpdump capture available right now. 

In your Kurento app, do you connect rtp-endpoint to webrtc-endpoint and webrtc-endpoint to rtp-endpoint ?
Yes I am connecting both the endpoints to each other.
 

Best Regards,
Damien.

To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.

akshay...@gmail.com

unread,
Sep 8, 2016, 12:56:19 AM9/8/16
to kurento
Damien,

Have you tried the new sipstack of asterisk chan_pjsip?
I tried to make use of this sipstack of asterisk, thinking that I am facing the above issues because of the chan_sip (the current sipstack) but went into very different kind of difficulties and ended up giving up trying with this stack.

Thank you,
Warm Regards,
Akshay



On Wednesday, September 7, 2016 at 7:15:11 PM UTC+5:30, Damien Fétis wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.

Ehsan Arshad

unread,
May 17, 2017, 2:47:44 AM5/17/17
to kurento, akshay...@gmail.com
Akshay,

i want to make connection between asterisk and kurento. I've researched on it but still new to it. Im really confused either i should use Mobicents Sip servelet or Jain sip api to make this connection.Can you guide me through the steps.What should i do to place a sip call in kurento media server.It would be great help.  

bessan degboe

unread,
May 30, 2017, 12:25:22 PM5/30/17
to kurento, akshay...@gmail.com
Hi,
I'm looking for the same thing : would like to make connection between asterisk and kurento. I've found this : https://github.com/chealwoo/kurento-asterisk But not working really, and I want to do it myself step by step.

Someone can please give me a tutorial to do it by myself step by step ?

bessan degboe

unread,
May 30, 2017, 1:04:23 PM5/30/17
to kurento, akshay...@gmail.com
Hello,
It's great to see that you finally get this. But it'll be more usefull for the community to make a full tutorial to explain step by step how you do that. Unless it's a solution that you're selling.

;(

Ehsan

unread,
Jun 5, 2017, 2:17:38 AM6/5/17
to kurento, akshay...@gmail.com
Follow these:
1 - WebrtcClient send its SDP to Kurento
2 - Create a new  webRtcEndpoint and process WebrtcClient SDP offer :         webRtcEndpoint.processOffer(sdpOffer); 
3 - Use  new  RTPEndpoint in kurento and generate its offer SDP : rtpEndpoint.generateOffer().
4 - Send generated SDP to Asterick with an INVITE
5 - On Astersik 200OK :
  rtpEndpoint.processAnswer(AstersikSDP);
                    webRtcEndpoint.connect(rtpEndpoint);
                    rtpEndpoint.connect(webRtcEndpoint);
6 - Generate kurento webrtcEndpoint SDP with webRtcEndpoint.getLocalSessionDescriptor() and send it to WebRTClient.

So, we delayed webrtcEndpoint SDP generation after SIP SDP negotiation end.

bessan degboe

unread,
Jun 5, 2017, 4:51:10 PM6/5/17
to kurento, akshay...@gmail.com
Can you give me a little more detail on this solution that you propose? Did you do that using what's on this link? https://github.com/agilityfeat/kurento-asterisk/issues/1

Related to this link too: https://github.com/agilityfeat/kurento-asterisk/issues/1

I had the same problem. Could you fix that?

Naeem Abdulaziz

unread,
May 17, 2018, 1:51:02 AM5/17/18
to kurento
Dear Akshay,

Please let me know if I have kurento version 6.6 and i have asterisk now how can i configure kurrento and asterisk. 

Looking forward to you reply.

Regards,
Naeem
Reply all
Reply to author
Forward
0 new messages