Monday, December 10, 2012

WebRTC and Asterisk 11 using sipML5 (with some FreePBX compatibility)

[UPDATED: 29 Mar 2014]

- IMPORTANT: THE PATCH IS NO LONGER NEEDED IN ASTERISK 11.5

The following guide was taken off various sources as initial references such as Digium’s Wiki and sipML5’s how to for Asterisk found here.
And yes, again, this guide is mainly targeted to Debian users, other OS users, please improvise and do your best. Otherwise, drop me a note at sanjayws@gmail.com
OK, to begin, here are my components I am using

  1. Debian 6.0.7
  2. Asterisk 11.5
  3. Chrome Version 29.0.1547.66 m for Windows
  4. sipML5 (Thanks to Dubango Telekom http://www.doubango.org/)
  5. FreePBX (optional)
First, you need a working Asterisk 11.5 installation. If you don’t have one, use this guide here[don’t use this, its not updated, yet].  Be sure to use 11.5 as this guide is designed for that version!
Here’s a step by step with some explanation, remember only # cli codes you can copy paste
  1. Go to your source
  2. # cd /usr/src/
  3. Get libsrtp (as WebRTC only allows comms using secure / encrypted connections)
  4. # wget http://srtp.sourceforge.net/srtp-1.4.2.tgz && tar -zxvf srtp-1.4.2.tgz && cd srtp
  5. # ./configure
  6. # make && make install
  7. Now, we upgrade/update/install asterisk 11.5 if you’re not already running that particular version, if you are, skip the related parts here (points 8-11)
    # wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11.5.tar.gz && tar -zxvf asterisk-11.5.0.tar.gz
    # cd /usr/src/asterisk-11.5.0 && make clean
  8. # ./configure --with-crypto --with-ssl --with-srtp=/usr/local/lib
  9. If you have errors with SRTP, you might want to just simply use apt/yum etc, e.g. #apt-get install libsrtp0 libsrtp0-dev
  10. [FREEPBX USERS]# contrib/scripts/get_mp3_source.sh
  11. [FREEPBX USERS]# make menuselect.makeopts
  12. [FREEPBX USERS]# menuselect/menuselect --enable format_mp3 --enable res_config_mysql --enable app_mysql --enable app_saycountpl --enable cdr_mysql --enable EXTRA-SOUNDS-EN-GSM
  13. Now time to reconfigure and recompile Asterisk with SRTP etc (WARNING, do not make samples if you have working configurations or use FreePBX etc)
  14. # make && make install
  15. Configure some parameters on Asterisk / config files
  16. Edit the /etc/asterisk/sip.conf (or modify Asterisk SIP Settings in FreePBX), add/modify the following settings, in [general]. Notice we add transport ws and wss, these are websocket and websocket secure

    udpbindaddr=0.0.0.0:5060
    realm=<yourIP or name> e.g. 192.168.2.239
    transport=udp,ws
  17. Edit the /etc/asterisk/rtp.conf and we add support for STUN (now supported on Asterisk 11). Read here for more info. Change/modify to your own if you don’t want to use the sample here.

    icesupport=yes

    stunaddr=stun.l.google.com:19302

    NOTE: You can use any STUN server of your choice, but be sure it works otherwise you will have slow network connection etc..
  18. Edit the http.conf file /etc/asterisk/http.conf, look for and modify or with an empty config, paste this below (uncomment if they are commented with a ; )

    [general]
    enabled=yes
    bindaddr=0.0.0.0
    bindport=8088


    Be sure its running after restarting Asterisk, check like below, you should be seeing output showing LISTEN somewhere
    # netstat -an | grep 8088
  19. Now, create one (or more if you wish to do browser to browser calls, for other phones create a normal SIP extensions like how you would do ) SIP accounts in /etc/asterisk/sip.conf with example below (FreePBX users modify it in /etc/asterisk/sip_custom.conf or if you are using FreePBX 2.11.10 or higher, the device/extensions page now directly supports WebRTC settings, see image below)

    [8000]

    secret=C@mplEX123
    context=from-internal
    host=dynamic
    trustrpid=yes
    sendrpid=no
    type=friend
    qualify=yes
    qualifyfreq=600
    transport=udp,ws
    encryption=yes
    dial=SIP/8000
    callerid=Sanjay Willie <8001>
    callcounter=yes
    avpf=yes
    icesupport=yes

    directmedia=no
  20. [FREEPBX USERS] FreePBX 2.11.10 or higher, supports the WebRTC settings directly in its device/extensions settings page, here’s what you set.
    Capture

  21. [FREEPBX USERS Pre versions 2.11.10] Since I also have older FreePBX versions, I use the context from-internal, where my dialplans are already created by FreePBX for me. For this customized extension to work, I created a SIP extension 2001 but under the DIAL I placed SIP/8000 instead so that it will ring my custom sip account and also the dialplan is now registered inside FreePBX’s dialplan to reach 8000. So. basically, now when I want to reach 8000 I actually dial 2001, get it? Otherwise write a simple dialplan like shown below the image
    image

    [from-internal-custom]
    exten => 8000,1,Dial(SIP/8000)
    same  => n,Hangup(16)

  22. [FREEPBX USERS] FreePBX users using 2.11.10 or higher, do not need to the above way as it is directly supported in its device/extensions settings already.
  23. Now, restart Asterisk (kill and start)
  24. Now, its time we get the sipML5 webphone and let’s get started!
  25. Go to your source directory, e.g. /usr/src, get the source using SVN, if you don’t have SVN, you need to install it (see how here)
  26. Assuming your web(http) default directory is in /var/www
  27. # svn checkout http://sipml5.googlecode.com/svn/trunk/ /var/www/myphone (note, some systems it may be /var/www/html/myphone)
  28. chown -R asterisk:asterisk /var/www/myphone/ (or /var/www/html/myphone)
  29. Now, head on to your Google Chrome browser and type
  30. http://<yourIP>/myphone/demos/call.htm (e.g. http://192.168.2.239/myphone/call.htm)
  31. Click on Expert Mode, select to Disable Video.
  32. Enter the information like below except change the part where it says the IP, of course, enter your own IP there
     image
  33. Those NATting, be sure to have a stun entry like shown above: [{ url: 'stun:stun.l.google.com:19302'}]. If you’re not NATting, then just put two [] like that and the ICE/STUN will not be used to manage RTP and you call will be connected faster as well. Be sure the stun you use on your server side is the same used on SIPML5 as well.
  34. Websocket URL: ws://192.168.2.239:8088/ws  (Note this is not an SSL enabled site, i.e. using just ws, not wss, if you want to use WSS as the protocol, then you need to enable it on Asterisk’s HTTP server by generating keys etc…)
  35. Click on Save
  36. Go back to the other tab which the webphone is on, enter the SIP extension detailed you created above, or follow and modify per example below
     image
    Display name: Sanjay Astiostech
    Private Identity: 8000 (or your extension number)
    Public Identity: sip:8000@192.168.2.239 (if you are doing some NAT, it will be like sip:8000@202.188.0.133 where the IP will be a public IP or name)
    Password: C@mplEX123
    Realm: 192.168.2.239
    Now click Login!, you should see the text Connected, like above in my picture
  37. Now, dial and dial away…..e.g. outbound call
    image
  38. Now I use my Zoiper softphone to dial 8018 (or 8000 as per example), remember, it’s a “virtual” number we manipulated on FreePBX or manual dialplan to dial SIP/8018 (or in our example its SIP/8000) instead and here’s how it looks! Chrome receiving a call! [diagram below may not depict actual numbers, these are on my cloud servers]
      image image
  39. Now you can go ahead and try using it on another Chrome browser or other browsers, like Internet Explorer, Firefox and the rest and do give your feedback. But for other browsers you need a piece of software or set some configuration, see here.
  40. For mobile browsers, i tried Google Chrome and it worked with version 29.0.1547.72. Meantime, you can checkout Bowser (yes BOWSER) a WebRTC supported mobile web browser for iPhone and Android, however I had some issues with javascript complaining, hope you have better luck…If you did manage to get it to work, let us know and share with the community.
  41. An important thing to note, Webrtc definition allows to only use only g711 and OPUS. So, consider bandwidth repercussions using this solution as OPUS is not yet ready on Asterisk, so we have to live with g711 for now. In Asterisk 12, Opus support is passthru and that could be very cool :-)
  42. Don’t want the headaches of all of these installation steps, use PIAX - http://pbxinaflash.com/community/index.php?threads/new-webrtc-with-asterisk-11.15274/#post-99636 …ready to rock with WebRTC
  43. If you’re having one way audio issues, enable rtp debugging, you must see the text “VIA ICE” somewhere when the RTP packets are traversing.

 

Field notes

  1. If you get Got SIP response 603 "Failed to get local SDP" back when dialling to a WebRTC client, its probably because you enabled video but didn’t set it up correctly on extension and sip general level (Not covering video here, sorry). Solution is disable video from Asterisk SIP General (FREEPBX USERS, or in your SIP general settings)
  2. To speed up connection(call) you can disable stun gathering in expert setting, by setting ICE Server: [] – Put two square brackets there
  3. Its possible to use and start calling from latest Chome on Android, unfortunately the audio on my side seem to be stuttering, its something to do with ICE haven't got the the time to figure out yet. Perhaps its a fix needed in Chrome for Android, lets wait a tab bit longer for that, shall we..

  4. Each time you reload FreePBX/Asterisk, you need to relogin on SipML5

 

 

86 comments:

James Mortensen said...

Hi Sanjay,

Thank you for outlining these steps. I know the SRTP steps really trip up a lot of people. I just want to point out that the iOS / Android browser you mention in your last paragraph in step #35 is spelled "Bowser" not "Browser". You should correct that so that people can find Ericsson's WebRTC browser more easily.

James

Sanjay Willie said...

Thanks James, correction done.

Anonymous said...

Hello Sanjay,

Thanks for your step by step guide. this is really great news.
What about audio, are you having any difficult to hear the other side on your case?
It looks like I have few problem with audio support via Chrome browser.
Any additional configuration to validate or other suggestions from your side will be appreciated.

Best regards,
Ben.

Sanjay Willie said...

Hi Ben..no issue for me tho

Sanjay Willie said...

Hi Ben

I missed out the part of using ice on rtp.conf, please see the updated info above, where rtp.conf is concerned.

Thanks and good luck!

Sanjay Willie said...

hmm, you might be correct, just tested it does seem to have one 3/4 audio from chrome to chrome...

There's some discussion here:
http://code.google.com/p/sipml5/wiki/Asterisk

Might look into it later...kinda busy today

Anonymous said...

Hello Sanjay,

Thanks for your kind support.
I will try your last suggestion and will update about the result.

Thanks,
Ben.

Nerd Uno said...

Great writeup. For aggregations such as PBX in a Flash, the default web directory should be /var/www/html instead of /var/www. Thanks!!

Anonymous said...

Thank you for choosing Debian ))

Sanjay Willie said...

Audio now works all case scenarios and properly with this update.

Chris said...

Thanks, I've "kinda of" got this working using am Amazon AWS instance and peered it with a traditional VoIP service. Problem - I'm getting one way audio. Can hear the far end fine, but they don't hear me.

Looking at Wireshare, doesn't appear as if my 'sending' PC is even attempting to send any packets out. Ugh.

Sanjay Willie said...

Hi Chris

1) Try loopback test
2) Ensure you got the stun server working properly, you can google and try looking for other alternatives.
3) Make sure any NAT settings are correct

Chris said...

Thanks for help. I conf'd inbound SIP trunk to the WebRTC client, I get 2-way audio and works fine. Outbound FROM the WebRTC client still only 1-way (can only hear the far end).

Will keep investigating, likely something small and overlook.

Nerd Uno said...

Great writeup. Works like a champ. Step #25 should be /var/www/html on FreePBX-based systems. We have a working demo on the PIAF Forum. Thanks!

Sanjay Willie said...

Thanks NerdUno.

Appreciate your efforts for the community too PIAF rocks. :)

Anonymous said...

Hi Sanjay.
Great work! BTW, I can see that there is a webrtc2sip utility to solve most of the voice issues for sipml5 and Asterisk. Did you have any hands on experience with it?

Thanks.

Andrew Robinson said...

Hi Sanjay,

thanks for the detailed process, but I have few questions...
After executing step 15 it had two configure error in /usr/src/asterisk-11.2.1 and c++ preprocessor fails in sanity check

Also,when I try to execute step 17 it reports that the folder is not found. Should I create cd /etc/asterisk/ ?

Sanjay Willie said...

Do you have a working asterisk 11 already installed?

Satish Barot said...

Wonderful article Sanjay,
There is a typo in step no 20. /etc/sip.conf should be /etc/asterisk/sip.conf

--Satish Barot

Sanjay Willie said...

Thanks and corrected.

Anonymous said...

sanjay i cannot get to compile. keep getting the following error:
checking for the ability of -lsrtp to be linked in a shared object... no
configure: WARNING: ***
configure: WARNING: *** libsrtp could not be linked as a shared object.

please help i have tried everything

Sanjay Willie said...
This comment has been removed by the author.
Sanjay Willie said...

Hi try to configure like this
./configure CFLAGS='-fPIC -Wall -O4 -fexpensive-optimizations -funroll-loops' --prefix=/usr

Chin Theong Tan said...

Thank you for providing this excellent guide.

Do you get video between the endpoints?

Chin Theong Tan said...

Thank you for providing this excellent guide.
Do you get video between the endpoints?

chris said...

Hi,

I have tried to configure srtp with
./configure CFLAGS='-fPIC -Wall -O4 -fexpensive-optimizations -funroll-loops' --prefix=/usr
Still the same error comes during the asterisk configure
System is Ubuntu 10.04 64bits

Any other ideas?
Could I just continue with the make of asterisk in this state and ignore that error?
Would love to test asterisk with WebRTC

chris said...

Hi, I have tried and configured srtp with
./configure CFLAGS='-fPIC -Wall -O4 -fexpensive-optimizations -funroll-loops' --prefix=/usr

However, asterisk configure still shows the same error msg at the end :-(

System is Ubuntu 10.04 64bit

I'd love to test asterisk with WebRTC - could I just ignore that error and proceed to the make & install of asterisk?

Your help woud be much appreciated.

Tamil Manthram said...

Hi, I have a doubt, Can we integrate WebRTC with Asterisk without using any browser? Please clarify it.

Advanced a lot of Thanks.

Tamil Manthram said...

Hi, I have a doubt, Can we integrate WebRTC with Asterisk without using any browser? Please clarify it.

Advanced a lot of Thanks.

Tamil Manthram said...

Hi all,
Please tell about configuration between Asterisk and WebRTC with explanation.

Thank you.

Alejandro said...

Error in paragraph 10 (One --eneble delete). correctly so

menuselect/menuselect --enable format_mp3 --enable res_config_mysql --enable app_mysql --enable app_saycountpl --enable cdr_mysql --enable EXTRA-SOUNDS-EN-GSM menuselect.makeopts

Alejandro said...

Error in paragraph 10 (One --eneble delete). correctly so

menuselect/menuselect --enable format_mp3 --enable res_config_mysql --enable app_mysql --enable app_saycountpl --enable cdr_mysql --enable EXTRA-SOUNDS-EN-GSM menuselect.makeopts

Earl Viant said...

can I use the video mode?because you said "everything works"?
thanks in advance

Earl Viant said...

can I use the video mode?I'm curious how to make video call using Asterisk+webRTC, since I know video call using webRTC is not using Flash Player,but HTML 5..
thanks in advance.

Sanjay Willie said...

HI Earl,

I've not tried video, will try in next few days...

If you (or someone) gets it working, please let us know.

I've tried once like last year, it worked only for a short while and Asterisk kept crashing...

sachin19183 said...

Hi Sanjay, I followed the steps mentioned in your blog and compiled asterisk 11.2.1 with the mentioned patch on debian 6. After compilation i found that res_features.so is not getting created which is a must for sip_chan.so. Can you suggest a solution for this .

Sanjay Willie said...

What error do u get while compiling?

sachin19183 said...

I didnt got any error while compiling... I thought that i might be missing on some libraries that i need to install. i ran the install_prereq script to install any dependency that might be missing. I could see in the make install output that res_features.so was not created. I suspect something is wrong with the patch. Please suggest.

sachin19183 said...

Hi Sanjay,
Can you share the config files which are working for you so that i can validate my asterisk installation(sip.conf,http.conf,modules.conf,extensions.conf,user.conf) Your help is very much required as i am stuck here

Anonymous said...

using chrome i face this warning then call hanged:

WARNING[15242][C-00000009]: chan_sip.c:10427 process_sdp: Can't provide secure audio requested in SDP offer

>please help

Frederik89 said...

Hello,

On step 15 make && make install I keep getting the following error:

make[1]: Entering directory `/usr/src/srtp/asterisk-11.3.0'
[CC] sip/sdp_crypto.c -> sip/sdp_crypto.o
sip/sdp_crypto.c:53: error: duplicate member âtagâ
make[2]: *** [sip/sdp_crypto.o] Error 1
make[1]: *** [channels] Error 2
make[1]: Leaving directory `/usr/src/srtp/asterisk-11.3.0'
make: *** [_cleantest_all] Error 2


I'm using Asterisk 11.3.0 with FreePBX.


Any help is much appreciated.


Frederik

Sanjay Willie said...

Frederik89

Looks like its looking for SRTP in the wrong location. Not sure why tho.

Sanjay Willie said...

Fredrik

Also those steps above was for 11.2.1

Didn't really test on 11.3

Vlad said...

Works fine with Chrome (on Linux) 24.0.1312.57 (Official Build 178923)
and does not work on Windows with Chrome 26.....

Anonymous said...

Hi Sir,

Whenever I am intsalling patch by following your step then I am getting below error,

# patch -p0 -i ./asterisk_379070.patch
patching file channels/chan_sip.c
Hunk #1 succeeded at 12547 (offset -52 lines).
Hunk #2 succeeded at 12569 (offset -52 lines).
Hunk #3 succeeded at 13227 (offset -53 lines).
patching file channels/sip/sdp_crypto.c
Hunk #1 succeeded at 48 with fuzz 2.
Hunk #2 succeeded at 65 with fuzz 2 (offset 1 line).
Hunk #3 FAILED at 283.
Hunk #4 FAILED at 296.
2 out of 4 hunks FAILED -- saving rejects to file channels/sip/sdp_crypto.c.rej

Why it is showing Failed 283 and 296, Am I missing something.

Thanks

Anonymous said...

Hi Sanjay,
Whenever I am running make command according to your steps then I am getting below error, What could be issue,


ip/sdp_crypto.c:53: error: duplicate member âtagâ
make[2]: *** [sip/sdp_crypto.o] Error 1
make[1]: *** [channels] Error 2
make[1]: Leaving directory `/usr/src/asterisk-11.3.0'
make: *** [_cleantest_all] Error 2



Any help ?

Anonymous said...

Hi Willi,
When I am running patch command then I am getting below error, What would be resolution for it.


# patch -p0 -i ./asterisk_379070.patch
patching file channels/chan_sip.c
Hunk #1 succeeded at 12547 (offset -52 lines).
Hunk #2 succeeded at 12569 (offset -52 lines).
Hunk #3 succeeded at 13227 (offset -53 lines).
patching file channels/sip/sdp_crypto.c
Hunk #1 succeeded at 48 with fuzz 2.
Hunk #2 succeeded at 65 with fuzz 2 (offset 1 line).
Hunk #3 FAILED at 283.
Hunk #4 FAILED at 296.
2 out of 4 hunks FAILED -- saving rejects to file channels/sip/sdp_crypto.c.rej

if you have any idea about it then please let me know.

Diego Gosmar said...

Hello,
we are experiencing a wrong behaviour if the caller hangups the call before the caller pick-up: the called SIPML5 peer will keep on ringing!

Here it is what we get in the Asterisk CLI when the caller hangup:

chan_sip.c:23657 handle_response: Remote host can't match request ACK to call '226da0a8e2b@IP:5060'. Giving up.

If the called simpl5 peer pickup the call, there are no issues. The problem arises each time the caller hangups before the called guy answers.

Any tricks to make it working?

Diego

jose jose said...

Hello

I have followed your manual, and when I try to call the call does not reach the destination appears this error:

WARNING[8667][C-00000067]: chan_sip.c:10073 process_sdp: Received SAVPF profle in audio offer but AVPF is not enabled: audio 62210 UDP/TLS/RTP/SAVPF 109 0 8 101

[2013-07-08 11:26:30] WARNING[8667][C-00000067]: chan_sip.c:10430 process_sdp: Insufficient information in SDP (c=)...

Tanks

jose jose said...

Hello

I have followed your manual, and when I try to call the call does not reach the destination appears this error:

WARNING[8667][C-00000067]: chan_sip.c:10073 process_sdp: Received SAVPF profle in audio offer but AVPF is not enabled: audio 62210 UDP/TLS/RTP/SAVPF 109 0 8 101

[2013-07-08 11:26:30] WARNING[8667][C-00000067]: chan_sip.c:10430 process_sdp: Insufficient information in SDP (c=)...

Tanks

jose jose said...

Hello

I have followed your manual, and when I try to call the call does not reach the destination appears this error:

WARNING[8667][C-00000067]: chan_sip.c:10073 process_sdp: Received SAVPF profle in audio offer but AVPF is not enabled: audio 62210 UDP/TLS/RTP/SAVPF 109 0 8 101

[2013-07-08 11:26:30] WARNING[8667][C-00000067]: chan_sip.c:10430 process_sdp: Insufficient information in SDP (c=)...

Tanks

jose jose said...

Hello

I have followed your manual, and when I try to call the call does not reach the destination appears this error:

WARNING[8667][C-00000067]: chan_sip.c:10073 process_sdp: Received SAVPF profle in audio offer but AVPF is not enabled: audio 62210 UDP/TLS/RTP/SAVPF 109 0 8 101

[2013-07-08 11:26:30] WARNING[8667][C-00000067]: chan_sip.c:10430 process_sdp: Insufficient information in SDP (c=)...

Tanks

jose jose said...

Hello

I have the following problem when I call an extension to another extension the communicating takes 20 seconds. My question is you can reduce that time?.

Environment:
Astrerisk 11 / 2.11 Freepbx

Sanjay Willie said...

Try using a different stunserver.

jose jose said...

Hello

This is solved with your comment. Now I have the following problem when I call from the web using webrtc in softphone can I hear but there is noise blank in the web. And this is the error that get me in the click:

2013-09-03 14:41:07 DEBUG7030C-00000000 sipsdpcrypto.c: Crypto line: acrypto:0 AESCM128HMACSHA132 inline:sejcBUBbZf9GYHAlMeG979xU4sr3UwCBbkHYR

Tanks Sanjay

jose jose said...

Hello Sanjay

This is solved with your comment. Now I have the following problem when I call from the web using webrtc in softphone can I hear but there is noise blank in the web. And this is the error that get me in the click:

2013-09-03 14:41:07 DEBUG7030C-00000000 sipsdpcrypto.c: Crypto line: acrypto:0 AESCM128HMACSHA132 inline:sejcBUBbZf9GYHAlMeG979xU4sr3UwCBbkHYR

jose jose said...

Hello Sanja I need your help me this is going to go crazy.

I have Asterisk 11.4 Freepbx

And when I call from Chrome 27.0.1453.110 or latest version I get this error:

2013-09-05 23:24:49 DEBUG2752C-00000007 sipsdpcrypto.c: Crypto line: acrypto:0 AESCM128HMACSHA132 inline:lQN5KTm89spB7UKrUDRne3Mwp7HC2F3KB6cQW

I have followed the manual and tried with various servidiores of STUN and with it the same mistake can't hear anything from the web but in softphone if I can hear. Do over there say that it fixes configuring WSS, you have idea that can be?, know how to configure WSS?

Greetings and appreciate your help.

jose jose said...

Hello Sanja I need your help me this is going to go crazy.

I have Asterisk 11.4 Freepbx

And when I call from Chrome 27.0.1453.110 or latest version I get this error:

2013-09-05 23:24:49 DEBUG2752C-00000007 sipsdpcrypto.c: Crypto line: acrypto:0 AESCM128HMACSHA132 inline:lQN5KTm89spB7UKrUDRne3Mwp7HC2F3KB6cQW

I have followed the manual and tried with various servidiores of STUN and with it the same mistake can't hear anything from the web but in softphone if I can hear. Do over there say that it fixes configuring WSS, you have idea that can be?, know how to configure WSS?

Greetings and appreciate your help.

jose jose said...

Hello Sanja I need your help me this is going to go crazy.

I have Asterisk 11.4 Freepbx

And when I call from Chrome 27.0.1453.110 or latest version I get this error:

2013-09-05 23:24:49 DEBUG2752C-00000007 sipsdpcrypto.c: Crypto line: acrypto:0 AESCM128HMACSHA132 inline:lQN5KTm89spB7UKrUDRne3Mwp7HC2F3KB6cQW

I have followed the manual and tried with various servidiores of STUN and with it the same mistake can't hear anything from the web but in softphone if I can hear. Do over there say that it fixes configuring WSS, you have idea that can be?, know how to configure WSS?

Greetings and appreciate your help.

Sanjay Willie said...

ttp://code.google.com/p/natvpn/source/browse/trunk/stun_server_list
# A list of available STUN server.

stun.l.google.com:19302
stun1.l.google.com:19302
stun2.l.google.com:19302
stun3.l.google.com:19302
stun4.l.google.com:19302
stun01.sipphone.com
stun.ekiga.net
stun.fwdnet.net
stun.ideasip.com
stun.iptel.org
stun.rixtelecom.se
stun.schlund.de
stunserver.org
stun.softjoys.com
stun.voiparound.com
stun.voipbuster.com
stun.voipstunt.com
stun.voxgratia.org
stun.xten.com

Sanjay Willie said...

Jose,

Did u get SRTP working properly?

I just did the entire install using Asterisk 11.5 and I didn't have to patch, works straight away on latest Chrome 29.0.1547.66 m

I will update the guide when I have some time. Very busy now :S

Sanjay Willie said...

Happy to report, this now works even on Android Chorme (latest version). Audio seem distorted a little but we'll fix it, we'll fix it...{insane cool}

Anonymous said...

Hi Sanjay

Nice post. I have tried and found

[Oct 1 08:41:04] WARNING[28698][C-00000000]: sip/sdp_crypto.c:172 sdp_crypto_activate: Could not set SRTP policies
[Oct 1 08:41:04] WARNING[28698][C-00000000]: sip/sdp_crypto.c:172 sdp_crypto_activate: Could not set SRTP policies
[Oct 1 08:41:04] WARNING[28698][C-00000000]: chan_sip.c:11155 process_sdp_a_audio: Got Opus minptime=10
[Oct 1 08:41:04] WARNING[28698][C-00000000]: chan_sip.c:10492 process_sdp: Rejecting secure audio stream without encryption details: audio 17081 RTP/SAVPF 111 103 104 0 8 106 105 13 126


Changed the stun server many but all result same.

Anonymous said...

Nice post.
I have tried with many STUN but result same:

[Oct 1 08:41:04] WARNING[28698][C-00000000]: sip/sdp_crypto.c:172 sdp_crypto_activate: Could not set SRTP policies
[Oct 1 08:41:04] WARNING[28698][C-00000000]: sip/sdp_crypto.c:172 sdp_crypto_activate: Could not set SRTP policies
[Oct 1 08:41:04] WARNING[28698][C-00000000]: chan_sip.c:11155 process_sdp_a_audio: Got Opus minptime=10
[Oct 1 08:41:04] WARNING[28698][C-00000000]: chan_sip.c:10492 process_sdp: Rejecting secure audio stream without encryption details: audio 17081 RTP/SAVPF 111 103 104 0 8 106 105 13 126

Anonymous said...

Nice post. I have tried with different STUN but all result same:


[Oct 1 08:41:04] WARNING[28698][C-00000000]: sip/sdp_crypto.c:172 sdp_crypto_activate: Could not set SRTP policies
[Oct 1 08:41:04] WARNING[28698][C-00000000]: sip/sdp_crypto.c:172 sdp_crypto_activate: Could not set SRTP policies
[Oct 1 08:41:04] WARNING[28698][C-00000000]: chan_sip.c:11155 process_sdp_a_audio: Got Opus minptime=10
[Oct 1 08:41:04] WARNING[28698][C-00000000]: chan_sip.c:10492 process_sdp: Rejecting secure audio stream without encryption details: audio 17081 RTP/SAVPF 111 103 104 0 8 106 105 13 126

gnu_d said...

Hi,

in the rtp.conf file, the value of stunaddr, do I really need a STUN server for a LAN setup ?

If so, can I've a local STUN server, so it won't need any connection from outside ?

Sanjay Willie said...

You dont need for LAN..think u need to.enable ice

Sanjay Willie said...

You dont need for LAN..think u need to.enable ice

Anonymous said...

Have you tried the sipml5 behind a NAT other than your servers is in using its public IP? Or is all this just a theory?

Sanjay Willie said...

haha I know how you feel, been having nightmares figuring it out without hacking asterisk codes to get it work. Try googling it, James Mortensen had a good hack that worked for me...

Anonymous said...

Thanks, I thought the Solution described here is a complete solution where no additional hacks are required.

Anonymous said...

Can you please share the secret to get this working behind NAT?

Rafael said...

Awesome! This worked like a charm for me!

Hades N said...

Hi Sanjay, Thanks for this tutorial. I've been working at it for about 3 days now and your tutorial helped fix things along the way. So thank you very much for that.

I have a question though. I am able to call successfully from the browser to a sip client (like Zoiper, Linphone etc). However, I am unable to make browser to browser calls or SIP phone to browser calls. At the moment I am using google chrome - Version 31.0.1650.63.

Is there somewhere I may have gone wrong? Could you tell me what to look for? Asterisk's logs show nothing. This is what I see on my local chrome installation's logs:

[6662:6699:0113/151954:ERROR:audio_manager_base.cc(417)] Not implemented reached in virtual std::string media::AudioManagerBase::GetAssociatedOutputDeviceID(const string&)
[6662:6691:0113/151954:ERROR:audio_manager_base.cc(422)] Not implemented reached in virtual std::string media::AudioManagerBase::GetDefaultOutputDeviceID()
[6662:6683:0113/151955:ERROR:audio_manager_base.cc(422)] Not implemented reached in virtual std::string media::AudioManagerBase::GetDefaultOutputDeviceID()
[6662:6683:0113/151955:ERROR:audio_manager_base.cc(422)] Not implemented reached in virtual std::string media::AudioManagerBase::GetDefaultOutputDeviceID()

Oswaldo said...

Hi There, first at all thank you very much to post this very nice way to implement WEBRtc. I would like to add something that happened to me in order to help to people who have this small failure.

Sometimes at the end you have this problem:

checking for the ability of -lsrtp to be linked in a shared object... no
configure: WARNING: ***
configure: WARNING: *** libsrtp could not be linked as a shared object.
configure: WARNING: *** Try compiling libsrtp manually. Configure libsrtp
configure: WARNING: *** with ./configure CFLAGS=-fPIC --prefix=/usr
configure: WARNING: *** replacing /usr with the prefix of your choice.
configure: WARNING: *** After re-installing libsrtp
configure: WARNING: *** configure script.
configure: WARNING: ***
configure: WARNING: *** If you do not need SRTP support re-run configure
configure: WARNING: *** with the --without-srtp option.

To solve it, I did the following above before to use the command ./configure --with-crypto --with-ssl --with-srtp=/usr/local/lib

In SRTP folder:

make uninstall
make clean
./configure CFLAGS=-fPIC --prefix=/usr/local/lib
make
make runtest
make install

After generating this change, using ./configure --with-crypto --with-ssl --with-srtp=/usr/local/lib will work without any problem.

Cheers.

Saravana Kumar said...

Hi Sanjay,

Kindly suggest me to resolve the issue,

1. I used Ubuntu 12.04, Asterisk(asterisk-11.7.0) and SRTP.
2. Build successfully with srtp as your steps in local PC(192.168.2.221).
3. Created two users in sip.conf file.
4. Downloaded the sipml5 client sources and configured in same server(192.168.2.221).
5.Using sipml5 client at chrome browser register the users in two different PC browsers (Local Network) and It got registered too.
6. When try call from (8000) to another client (8008), the call is going and got a ringtone. but when I try allow from the other client then it got rejected.

The follwoing error message am getting from the CLI mode,
[Mar 3 15:19:40] ERROR[8236][C-00000005]: netsock2.c:269 ast_sockaddr_resolve: getaddrinfo("df7jal23ls0d.invalid", "(null)", ...): Name or service not known
[Mar 3 15:19:40] WARNING[8236][C-00000005]: chan_sip.c:15881 __set_address_from_contact: Invalid host name in Contact: (can't resolve in DNS) : 'df7jal23ls0d.invalid'
[Mar 3 15:19:40] ERROR[8236][C-00000005]: netsock2.c:98 ast_sockaddr_stringify_fmt: getnameinfo(): ai_family not supported

Saravana Kumar said...

Hi Sanjay,

Kindly suggest me to resolve the issue,

1. I used Ubuntu 12.04, Asterisk(asterisk-11.7.0) and SRTP.
2. Build successfully with srtp as your steps in local PC(192.168.2.221).
3. Created two users in sip.conf file.
4. Downloaded the sipml5 client sources and configured in same server(192.168.2.221).
5.Using sipml5 client at chrome browser register the users in two different PC browsers (Local Network) and It got registered too.
6. When try call from (8000) to another client (8008), the call is going and got a ringtone. but when I try allow from the other client then it got rejected.

The follwoing error message am getting from the CLI mode,
[Mar 3 15:19:40] ERROR[8236][C-00000005]: netsock2.c:269 ast_sockaddr_resolve: getaddrinfo("df7jal23ls0d.invalid", "(null)", ...): Name or service not known
[Mar 3 15:19:40] WARNING[8236][C-00000005]: chan_sip.c:15881 __set_address_from_contact: Invalid host name in Contact: (can't resolve in DNS) : 'df7jal23ls0d.invalid'
[Mar 3 15:19:40] ERROR[8236][C-00000005]: netsock2.c:98 ast_sockaddr_stringify_fmt: getnameinfo(): ai_family not supported

milind ranavare said...

hi sanjay ...i install all setup according to your given steps....but when i call from SIPml5 to ziper softphone the call is establish but not giving audio output...plz suggest me to troubleshoot this issue...thanx

Boulfrakh Houssam Eddine said...

waaaaaaaaa3 my prbl is :

WARNING[3756][C-0000000a]: chan_sip.c:10495 process_sdp: Rejecting secure audio stream without encryption details: audio 64393 RTP/SAVPF 111 103 104 0 8 106 105 13 126

whyyyyyyyyyyyyy ? tnks !

Boulfrakh Houssam Eddine said...

WARNING[3756][C-0000000a]: chan_sip.c:10495 process_sdp: Rejecting secure audio stream without encryption details: audio 64393 RTP/SAVPF 111 103 104 0 ,,,,,,,,,,,,,,?????????????????

Sanjay Willie said...

NOTE TO ALL, GOOGLE'S NEW UPDATE ON THEIR BROWSER REQUIRES DTLS A FORMAT WHICH IS DIFFERENT FROM THE PREVIOUS. I AM STILL TRYING TO FIGURE THIS ONE OUT. EVEN THE ASTERISK COMMUNITY ISN'T GIVING MUCH ATTENTION ON THIS ATM. SORRY.

Anonymous said...

Thanks for the tutorial.

Do you know is there any progress on the warning:



chan_sip.c: Rejecting secure audio stream without encryption details: audio 59318 UDP/TLS/RTP/SAVPF 109 0 8 101


I am using wss with my own signed certificate.

Anonymous said...

Hi ;

I try to call but i always have this prblm :

can't provide secure audio requested in sdp offer !? can u help me ?

tnks

Anonymous said...

Hi ;

I try to call but i always have this prblm :

can't provide secure audio requested in sdp offer !? can u help me ?

tnks

Anonymous said...

Hello,
I'm currently studying WebRTC and Asterisk interoperability and this tutorial gives me a lot of elements to make my project work.

I also try to use your VM M.Sanjay but everything works fine, but i Would like to know if I could make video calls with my browser in WebRTC.

For my test I'm running with chrome 29.0.1547.66 m for Windows to avoid problems with (DTLS-SRTP).

I didn't succeed to make it works, but did you try Vidéo Calls with your PBX VM ?


I have a 2nd question : I've read somethere, maybe you posted it, that now with DTLS-SRTP with Chrome selfsigned certificat couldn't be use ? Is it true ?

For the moment there is an bad implementation of DTLS-SRTP in asterisk, and it will be soon resolved (https://reviewboard.asterisk.org/r/3679/).



Thank you for your help.
Regards,
Damien R.

Mihailo Marinkovic said...

Hello,

Have you managed to get this working with chrome? I tried all the settings you wrote, I have installed Asterisk 12 (I guess it doesn't require patching) with SRTP support, created certificatest for rtp, and in asterisk console I get message "Can't provide secure audio requested in SDP offer" and sipml5 says "Not acceptable here".

Any workaround on this?

Thanks!