[OpenSIPS-Users] TLS traffic is being relayed as UDP but on the TLS Port?

John Kiniston johnkiniston at gmail.com
Wed Mar 20 19:09:19 EDT 2019


Phone sends it's request to the Proxy, the VIA specifies TLS, The From & To
are using port 5061, the Contact has transport=TLS


    REGISTER sip:pbxj.simplybits.net:5061 SIP/2.0
    Via: SIP/2.0/TLS 172.16.52.69:11974;branch=z9hG4bK4233722137;rport
    From: "Test" <sip:7004salesdemo at pbxj.simplybits.net:5061>;tag=3020551445

    To: "Test" <sip:7004salesdemo at pbxj.simplybits.net:5061>
    Call-ID: 0_3070192302 at 172.16.52.69
    CSeq: 1 REGISTER
    Contact: <sip:7004salesdemo at 172.16.52.69:11974;transport=TLS>
    Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY,
REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
    Max-Forwards: 70
    User-Agent: Yealink SIP-T42G 29.83.0.50
    Expires: 300
    Allow-Events: talk,hold,conference,refer,check-sync
    Mac: 00:15:65:72:e5:f3
    Line: 1
    Content-Length: 0

I see in my opensips logs:

Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:mid_reg_save: saving to location...
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:prepare_forward: from: '"Test" <
sip:7004salesdemo at pbxj.simplybits.net:5061>;tag=3020551445'
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:prepare_forward: Call-ID: '0_3070192302 at 172.16.52.69'
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:prepare_forward: Contact:
'<sip:7004salesdemo at 172.16.52.69:11974;transport=TLS>'
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:prepare_forward: registering ptr 0x7f46e9dad850 on
TMCB_REQUEST_FWDED ...
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:prepare_forward: registering for TMCB_RESPONSE_FWDED,
mri=0x7f46e9dad850 ...
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:prepare_forward: registering for TMCB_RESPONSE_DELETED,
mri=0x7f46e9dad850 ...
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:mid_reg_req_fwded: msg expires: '300'
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:calc_contact_expires: expires: 300
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:calc_ob_contact_expires: outgoing expires: 1553121490
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:overwrite_contact_expirations: ....... contact:
'sip:7004salesdemo at 172.16.52.69:11974;transport=TLS>#015' Calculated
TIMEOUT = 1553121490 (600)
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:replace_expires_hf: ....... Exp hdr: '300'
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:mid_reg_req_fwded: trimming all Contact URIs into one...
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:calc_contact_expires: expires: 300

Everything is transport=TLS up until this line:
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:trim_to_single_contact: deleting Contact
'<sip:7004salesdemo at 172.16.52.69:11974;transport=TLS>'
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:trim_to_single_contact: inserting new Contact '<
sip:7004salesdemo at 67.212.192.99:5060>'
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:calc_contact_expires: expires: 300

Here's the forward to the right host, the right port and the wrong protocol
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]:
DBG:mid_registrar:mid_reg_req_fwded: REQ FORWARDED TO 'sip:
pbxj.simplybits.net:5061' (obp: ), expires=600
Mar 20 15:28:46 sip2 /usr/sbin/opensips[20400]: DBG:mid_registrar:mri_free:
aor: '7004salesdemo' 0x7f46e9daa928
Mar 20 15:28:46 sip2 /usr/sbin/opensips[20400]: DBG:mid_registrar:mri_free:
from: 'sip:7004salesdemo at pbxj.simplybits.net:5061' 0x7f46e9d8eaa8
Mar 20 15:28:46 sip2 /usr/sbin/opensips[20400]: DBG:mid_registrar:mri_free:
to: 'sip:7004salesdemo at pbxj.simplybits.net:5061' 0x7f46e9da9e60
Mar 20 15:28:46 sip2 /usr/sbin/opensips[20400]: DBG:mid_registrar:mri_free:
callid: '0_3070192302 at 172.16.52.69' 0x7f46e9daaea0
Mar 20 15:28:46 sip2 /usr/sbin/opensips[20400]: DBG:mid_registrar:mri_free:
main reg: 'sip:pbxj.simplybits.net:5061' 0x7f46e9da0d60
Mar 20 15:28:46 sip2 /usr/sbin/opensips[20400]: DBG:mid_registrar:mri_free:
ct_uri: '' (nil)

Heres the registration as it goes out from the Proxy to the PBX.

    REGISTER sip:pbxj.simplybits.net:5061 SIP/2.0
    Via: SIP/2.0/UDP
67.212.192.99:5060;branch=z9hG4bK9c1a.7b3004a7.0;i=8f1ca045

    Via: SIP/2.0/TLS
172.16.52.69:11974;received=64.119.40.170;branch=z9hG4bK4233722137;rport=11974

    From: "Test" <sip:7004salesdemo at pbxj.simplybits.net:5061>;tag=3020551445

    To: "Test" <sip:7004salesdemo at pbxj.simplybits.net:5061>
    Call-ID: 0_3070192302 at 172.16.52.69
    CSeq: 1 REGISTER
    Contact: <sip:7004salesdemo at 67.212.192.99:5060>
    Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY,
REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
    Max-Forwards: 69
    User-Agent: Yealink SIP-T42G 29.83.0.50
    Expires: 600
    Allow-Events: talk,hold,conference,refer,check-sync
    Mac: 00:15:65:72:e5:f3
    Line: 1
    Content-Length: 0

And the PBX never processes the registration request (it's being
communicated via the wrong protocol on the wrong port so it's ignoring it
which it should)

How can mid_registrar return code '2' if there is no response from the PBX?

On Mon, Mar 18, 2019 at 8:35 AM Bogdan-Andrei Iancu <bogdan at opensips.org>
wrote:

> Hi,
>
> When mid_registrar_save() returns code "2", you need to explicitly route
> (by changing RURI or DST URI) to the address of the main registrar (by
> IP+port+proto). See
>
> https://opensips.org/html/docs/modules/2.4.x/mid_registrar.html#func_mid_registrar_save
> .
>
> Regards,
>
> Bogdan-Andrei Iancu
>
> OpenSIPS Founder and Developer
>    https://www.opensips-solutions.com
> OpenSIPS Summit 2019
>    https://www.opensips.org/events/Summit-2019Amsterdam/
>
> On 03/15/2019 06:50 PM, John Kiniston wrote:
> > I'm using mid_registrar.
> >
> > modparam("mid_registrar", "mode", 2)
> > modparam("mid_registrar", "received_avp", "$avp(received)")
> > modparam("mid_registrar", "max_contacts", 4)
> > modparam("mid_registrar", "outgoing_expires", 3600)
> > modparam("mid_registrar", "default_expires", 300)
> > modparam("mid_registrar", "min_expires", 60)
> > modparam("mid_registrar", "max_expires", 600)
> > modparam("mid_registrar", "tcp_persistent_flag",
> > "TCP_PERSIST_REGISTRATIONS")
> >
> > I'm not modifying RURI in my script anywhere, this is working fine
> > with udp, just a t_relay at the end of my script.
> >
> > mid_registrar_save("location", , , "3600");
> >
> >
> >
>
>

-- 
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts,
build a wall, set a bone, comfort the dying, take orders, give orders,
cooperate, act alone, solve equations, analyze a new problem, pitch manure,
program a computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects.
---Heinlein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20190320/02e3e8e9/attachment.html>


More information about the Users mailing list