[OpenSIPS-Users] Opensips as SIP Proxy and WebRTC Media Gateway

Bogdan-Andrei Iancu bogdan at opensips.org
Tue Jul 4 11:07:49 EDT 2017


Hi Alex,

Thank you for the offlist provided data. Shortly, the ACK received by 
OpenSIPS from OmniPCX is broken as it is missing all the Route headers. 
According to the pcap, it looks like:

ACK sip:udoioiia at 10.0.1.106:49246;transport=ws SIP/2.0
Record-Route: 
<sip:10.0.1.200:5059;ftag=d5de999de446df5165d773dac1f369ec;lr=on>
Contact: "Megalokonomos A." <sip:694 at 10.0.1.200:45698>
User-Agent: OxO_SPG_103/012.001
Content-Type: application/sdp
To: sip:694 at 10.0.1.200;tag=4em4m1ah9r
From: "Megalokonomos A." 
<sip:610 at 10.0.1.200>;tag=d5de999de446df5165d773dac1f369ec
Call-ID: af3cc9085db1c8dd86050eb91d747249 at 10.0.1.200
CSeq: 659214613 ACK
Via: SIP/2.0/UDP 
10.0.1.200:5059;branch=z9hG4bKf3de.2fc1fc65cece765af47f9baf8bf0906e.0;i=c
Via: SIP/2.0/TCP 
10.0.1.200:5080;rport=45698;branch=z9hG4bK89fca3417cd4e227b4315145d96657c7
Max-Forwards: 69
Content-Length: 2960

v=0
o=default 14
.....


As OpenSIPS does not find the Route (former Record-Route) it inserted 
into the dialog, the routing logic in the script does not work as 
expected. According to RFC3261, the RR headers MUST be mirrored back in 
2xx replies.

Let's try to hack to cope with the broken SIP stack onOmniPCX. In script 
you have something like:

				} else {
					# ACK without matching transaction ->
					# ignore and discard
					exit;
				}

Try replacing it with

				} else {
					# ACK without matching transaction ->
					# ignore and discard
					t_relay();
					exit;
				}

Let's see if this does the trick. If yes, I can suggest a even better way to fix the broken signaling, using the dialog support in OpenSIPS.

Best regards,

Bogdan-Andrei Iancu
   OpenSIPS Founder and Developer
   http://www.opensips-solutions.com

OpenSIPS Bootcamp 2017, Houston, US
   http://opensips.org/training/OpenSIPS_Bootcamp_2017.html

On 07/03/2017 01:08 PM, Bogdan-Andrei Iancu wrote:
> Hi Alex,
>
> As suspected, the ACK is not properly routed  - see the 
> retransmissions of the 200OK + ACK. SImply based on the logs I cannot 
> see what the problem is - probably some missing fix_nated_contact() 
> for the replies coming from the WS party.
>
> Please make a pcap capture + opensips log (level 4) and send them to 
> me *offlist* !
>
> Best regards,
> Bogdan-Andrei Iancu
>    OpenSIPS Founder and Developer
>    http://www.opensips-solutions.com
>
> OpenSIPS Bootcamp 2017, Houston, US
>    http://opensips.org/training/OpenSIPS_Bootcamp_2017.html
> On 06/30/2017 05:37 PM, Alex Megalokonomos wrote:
>> I have attached the debug log so you get a fuller picture. I hope 
>> that's ok
>>
>> (Incoming call to WS client 694 is the WS extension...610 is my 
>> normal desk phone which is connected to OmniPCX) (10.0.1.63-> 
>> OpenSIPS ,10.0.1.200-> OmniPCX)
>>
>>
>>
>> On Fri, Jun 30, 2017 at 5:20 PM, Bogdan-Andrei Iancu 
>> <bogdan at opensips.org> wrote:
>>
>>     Good, there is some progress :).
>>
>>     On the incoming calls, if the WS get's the call, we can park the
>>     part with the auth (it seems your opensips script is accepting
>>     calls from unknown sources...we can address this security hole later.
>>
>>     So, if a call drop after 30 secs it usually means there is no
>>     ACK. Can you make a mgrep capture on OpenSIPS to grab the whole
>>     call flow ? (grab 5060 and 80 ports)
>>
>>     Regards,
>>
>>     Bogdan-Andrei Iancu
>>        OpenSIPS Founder and Developer
>>        http://www.opensips-solutions.com <http://www.opensips-solutions.com>
>>
>>     OpenSIPS Bootcamp 2017, Houston, US
>>        http://opensips.org/training/OpenSIPS_Bootcamp_2017.html
>>     <http://opensips.org/training/OpenSIPS_Bootcamp_2017.html>
>>
>>     On 06/30/2017 04:52 PM, Alex Megalokonomos wrote:
>>>     I think I set up uac_registrant correctly.
>>>     I can dial out from a ws client and the ws extension rings from
>>>     outside calls.
>>>     However:  a) on incoming calls, when ws client accepts, there is
>>>     no sound and the line is dropped after 30 secs or so
>>>     b) on outgoing calls, when the called extension accepts the ws
>>>     client immediately responds with 401 Unauthorised and then BYE
>>>     b) I believe is what you mentioned here "In OpenSIPS, when
>>>     receiving calls, you need to authorize (by IP) the calls from
>>>     OmniPCX "
>>>     How do I do this?
>>>     and a) seems to be rtp proxy related since I see the following
>>>     errors in the logs¨
>>>     ERROR:rtpengine:rtpe_function_call: proxy replied with error:
>>>     Unknown call-id
>>>     and
>>>     no matching transaction
>>>     On Fri, Jun 30, 2017 at 2:27 PM, Bogdan-Andrei Iancu
>>>     <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>>>
>>>         I checked the script you mentioned and it does not help you
>>>         - it has only UDP (no WS), it is really basic and it does
>>>         not handle any REGISTER stuff, which is the trickiest - see
>>>         https://blog.opensips.org/2016/12/13/how-to-proxy-sip-registrations/
>>>         <https://blog.opensips.org/2016/12/13/how-to-proxy-sip-registrations/>
>>>         or
>>>         https://blog.opensips.org/2016/12/20/mid-registrar-scalable-registration-and-call-forking/
>>>         <https://blog.opensips.org/2016/12/20/mid-registrar-scalable-registration-and-call-forking/>
>>>         Maybe you can start with handling REGISTERs - what you need
>>>         (on top of the script from the WSS tutorial) is to add this
>>>         uac_registrant, to have the WS extensions registered into
>>>         OmniPCX with a contact URI pointing back to OpenSIPS IP:
>>>         http://www.opensips.org/html/docs/modules/2.3.x/uac_registrant.html
>>>         <http://www.opensips.org/html/docs/modules/2.3.x/uac_registrant.html>
>>>         Let me know if you get stuck in this first step. Regards,
>>>
>>>         Bogdan-Andrei Iancu
>>>            OpenSIPS Founder and Developer
>>>            http://www.opensips-solutions.com
>>>         <http://www.opensips-solutions.com>
>>>
>>>         OpenSIPS Bootcamp 2017, Houston, US
>>>            http://opensips.org/training/OpenSIPS_Bootcamp_2017.html
>>>         <http://opensips.org/training/OpenSIPS_Bootcamp_2017.html>
>>>
>>>         On 06/30/2017 12:22 PM, Alex Megalokonomos wrote:
>>>>         Hello Bogdan,
>>>>         First of all, thanks for your time.
>>>>         Unfortunately my SIP/OpensSIPS skills are what I've managed
>>>>         to learn in the last couple of days. I am a programmer but
>>>>         I've never had to work on SIP stuff before.
>>>>         Frankly to me, both solutions sound equally difficult since
>>>>         I have no idea where to start. (And to be honest, I
>>>>         expected the first to be simpler)
>>>>         I found this
>>>>         https://blog.voipxswitch.com/2015/03/27/kamailio-basic-sip-proxy-all-requests-setup/
>>>>         <https://blog.voipxswitch.com/2015/03/27/kamailio-basic-sip-proxy-all-requests-setup/>
>>>>         and tried to port the config to OpenSIPS since from what I
>>>>         understand Kamailio and OpenSIPS share a common codebase to
>>>>         an extent but was unsuccesful.
>>>>         In your second scenario,  I am not interested in WS->WS
>>>>         calls so that auth part is not an issue.
>>>>         So I guess I need the uac_registrar, authorize by IP and
>>>>         usrloc parts.
>>>>         Any relevant documentation to get me started since I'm
>>>>         still not clear on what I need to change?
>>>>         Best regards,
>>>>         Alex
>>>>         On Fri, Jun 30, 2017 at 11:29 AM, Bogdan-Andrei Iancu
>>>>         <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>>>>
>>>>             Hi Alex, To make a kind of WS<>UDP gateway you need a
>>>>             complete rework of the script presented in the
>>>>             tutorial, as it is a completely different SIP scenario.
>>>>             Not sure what are your SIP/OpenSIPS skills. But, there
>>>>             is a simpler alternative . Instead of a GW, you can
>>>>             make OpenSIPS as a sub-server for the WS extensions:
>>>>             Registration handling: 1) WS extensions register only
>>>>             with OpenSIPS (as right now) - authentication is done
>>>>             by OpenSIPS 2) OpenSIPS registers the 3 extensions into
>>>>             OmniPCX using the uac_registrar By this, we simply add
>>>>             the uac_registration and you achieve kind of decoupled
>>>>             2 steps registration (with a minimum change in the cfg)
>>>>             Inbound calls: 1) OmniPCX will send all the calls (from
>>>>             other extensions) for the WS extension to OpenSIPS (due
>>>>             the registration via uac_registrar) - this is default
>>>>             behavior , so nothing to change 2) In OpenSIPS, when
>>>>             receiving calls, you need to authorize (by IP) the
>>>>             calls from OmniPCX - and as the current script does,
>>>>             you will handle them via the local opensips usrloc ->
>>>>             calls are sent to WS extension Outbound calls: 1) when
>>>>             you receive a call from a WS extension, you have to
>>>>             check if the call is for a local extension (on
>>>>             opensips) or for an extension in OmniPCX 2) if call is
>>>>             local (WS to WS) you will do authentication for the
>>>>             call 3) if the call is to be sent to OmniPCX, simply
>>>>             send the call to OmniPCX without auth - the auth will
>>>>             be done by OmniPCX as for any other extension Hopefully
>>>>             this will work for you :) Best regards,
>>>>
>>>>             Bogdan-Andrei Iancu
>>>>                OpenSIPS Founder and Developer
>>>>                http://www.opensips-solutions.com
>>>>             <http://www.opensips-solutions.com>
>>>>
>>>>             OpenSIPS Bootcamp 2017, Houston, US
>>>>                http://opensips.org/training/OpenSIPS_Bootcamp_2017.html
>>>>             <http://opensips.org/training/OpenSIPS_Bootcamp_2017.html>
>>>>
>>>>             On 06/29/2017 11:54 AM, Alex Megalokonomos wrote:
>>>>>             Hello Bogdan,
>>>>>             Yes, a gateway from WS to UDP (as well as DTLS-SRTP to
>>>>>             RTP in order for it to work) is exactly what we're
>>>>>             looking for.
>>>>>             Unfortunately our Alcatel OmniPCX call center  is a
>>>>>             proprietary system that only allows for a limited
>>>>>             number of SIP extensions (served from what appears to
>>>>>             be an outdated customised  Kamailio 3.2.2 from what I
>>>>>             can tell from the headers.
>>>>>             For our normal internal office use it all works fine.
>>>>>             However we have 3 customer support lines that are
>>>>>             currently routed to 3 extensions via OmniPCX.
>>>>>             We want to integrate these to our custom web-based CRM
>>>>>             and the best way for us to do it is to use something
>>>>>             like SIP js to handle and log calls, identify calling
>>>>>             parties, bring up customer details etc.
>>>>>             Since the kamailio version inside OmniPCX does not
>>>>>             support ws/webrtc we are looking to set up Opensips in
>>>>>             exactly the way you described as a gateway/proxy for
>>>>>             everything in order to convert the UDP-only sip
>>>>>             extensions to ws+ webRTC capable ones.
>>>>>             I have used this tutorial
>>>>>             http://www.opensips.org/Documentation/Tutorials-WebSocket-2-1
>>>>>             <http://www.opensips.org/Documentation/Tutorials-WebSocket-2-1>
>>>>>             to get what I assume is half the work (for RTP
>>>>>             proxying)  but I havent figured out the rest yet.
>>>>>             Best regards,
>>>>>             Alex
>>>>>             On Thu, Jun 29, 2017 at 11:43 AM, Bogdan-Andrei Iancu
>>>>>             <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>>>>>
>>>>>                 Hi Alex, First, some questions regarding the
>>>>>                 desired topology:     1) the WS end-points should
>>>>>                 register in OpenSIPS or all the way into Kamailio
>>>>>                 ?     2) also, the calls from the WS end-points
>>>>>                 should be all the time sent to Kamailio ? More or
>>>>>                 less, what I'm asking is : is OpenSIPS suppose to
>>>>>                 act as a gateway from WS to UDP , but pass all the
>>>>>                 resulting traffic to Kamailio ? Regards,
>>>>>
>>>>>                 Bogdan-Andrei Iancu
>>>>>                    OpenSIPS Founder and Developer
>>>>>                    http://www.opensips-solutions.com
>>>>>                 <http://www.opensips-solutions.com>
>>>>>
>>>>>                 OpenSIPS Bootcamp 2017, Houston, US
>>>>>                    http://opensips.org/training/OpenSIPS_Bootcamp_2017.html
>>>>>                 <http://opensips.org/training/OpenSIPS_Bootcamp_2017.html>
>>>>>
>>>>>                 On 06/28/2017 12:47 PM, Alex Megalokonomos wrote:
>>>>>>                 Hello,
>>>>>>                 We have the following scenario: our office call
>>>>>>                 center is an Alcatel OmniPCX Office setup.
>>>>>>                 This handles most of our needs and also provides
>>>>>>                 4 SIP extensions.
>>>>>>                 These are provided by what appears to be a
>>>>>>                 Kamailio SIP server v 3.2.2 (no webrtc or
>>>>>>                 websockets support)
>>>>>>                 What we would like to do is set up an OpenSIPS
>>>>>>                 instance to handle WebRTC and proxy everything to
>>>>>>                 this Kamailio SIP server.
>>>>>>                 The idea is to allow a web client (using sip js
>>>>>>                 or something similar) to register / make /
>>>>>>                 receive calls as one of the Kamailio extensions.
>>>>>>                 I think half of the configuration is this :
>>>>>>                 http://www.opensips.org/Documentation/Tutorials-WebSocket-2-1
>>>>>>                 <http://www.opensips.org/Documentation/Tutorials-WebSocket-2-1>
>>>>>>                 which I've already completed and indeed, clients
>>>>>>                 can register to opensips and chat/make calls over
>>>>>>                 websockets between them.
>>>>>>                 How do I go about proxying
>>>>>>                 registrations/invites/etc to the kamailio server
>>>>>>                 instead?
>>>>>>                 best regards
>>>>>>
>>>>>>                 _______________________________________________
>>>>>>                 Users mailing list
>>>>>>                 Users at lists.opensips.org
>>>>>>                 <mailto:Users at lists.opensips.org>
>>>>>>                 http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>                 <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
>>>>>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20170704/4eccfe38/attachment-0001.html>


More information about the Users mailing list