TLS traffic is being relayed as UDP but on the TLS Port?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

TLS traffic is being relayed as UDP but on the TLS Port?

John Kiniston
I have a proxy that works fine with UDP handling mid-registrar and mediaproxy duties in front of my Asterisk Servers.

I'd like to enable TLS on my proxy and switch my phones to registering via TLS.

I've got my TLS keys working now and I see my phone sending requests to OpenSIPS where they are being processed.

However when OpenSIPS is sending the traffic to my Asterisk boxes it's sending SIP traffic to port 5061 instead of sending TLS.

U 2019/03/14 15:54:33.985636 <Proxy>:5060 -> <Asterisk>:5061 #32
REGISTER sip:<pbx>:5061 SIP/2.0.
Via: SIP/2.0/UDP Proxy:5060;branch=z9hG4bKffdc.94c66575.0;i=a64b8973.
Via: SIP/2.0/TLS 172.16.52.69:12332;received=64.119.40.170;branch=z9hG4bK3157565843;rport=12332.
From: "Test" <sip:7004@<pbx>:5061>;tag=1087298031.
To: "Test" <sip:7004@<pbx>:5061>.
Call-ID: [hidden email].
CSeq: 1 REGISTER.
Contact: <sip:7004@Proxy: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: 3600.
Allow-Events: talk,hold,conference,refer,check-sync.
Mac: 00:15:65:72:e5:f3.
Line: 1.
Content-Length: 0.

I believe this is because the initial request opensips is recieving from the phone has 'sip' in the register?

   REGISTER sip:<pbx>:5061 SIP/2.0 
    Via: SIP/2.0/TLS 172.16.52.69:12122;branch=z9hG4bK2625059359;rport 
    From: "Test" <sip:7004@pbx:5061>;tag=1299551992 
    To: "Test" <sip:7004@pbx:5061> 
    Call-ID: [hidden email] 
    CSeq: 1 REGISTER 
    Contact: <sip:7004@172.16.52.69:12122;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: 3600 
    Allow-Events: talk,hold,conference,refer,check-sync 
    Mac: 00:15:65:72:e5:f3 
    Line: 1 
    Content-Length: 0 


What can I do here? I've tried playing with rewriting $du and $fs but that doesn't seem to be working.
--
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

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: TLS traffic is being relayed as UDP but on the TLS Port?

Johan De Clercq
Rewrite request uri So that transport=TLS

Outlook voor iOS downloaden
 

Van: Users <[hidden email]> namens John Kiniston <[hidden email]>
Verzonden: vrijdag, maart 15, 2019 12:07 AM
Aan: OpenSIPS users mailling list
Onderwerp: [OpenSIPS-Users] TLS traffic is being relayed as UDP but on the TLS Port?
 
I have a proxy that works fine with UDP handling mid-registrar and mediaproxy duties in front of my Asterisk Servers.

I'd like to enable TLS on my proxy and switch my phones to registering via TLS.

I've got my TLS keys working now and I see my phone sending requests to OpenSIPS where they are being processed.

However when OpenSIPS is sending the traffic to my Asterisk boxes it's sending SIP traffic to port 5061 instead of sending TLS.

U 2019/03/14 15:54:33.985636 <Proxy>:5060 -> <Asterisk>:5061 #32
REGISTER sip:<pbx>:5061 SIP/2.0.
Via: SIP/2.0/UDP Proxy:5060;branch=z9hG4bKffdc.94c66575.0;i=a64b8973.
Via: SIP/2.0/TLS 172.16.52.69:12332;received=64.119.40.170;branch=z9hG4bK3157565843;rport=12332.
From: "Test" <sip:7004@<pbx>:5061>;tag=1087298031.
To: "Test" <sip:7004@<pbx>:5061>.
Call-ID: [hidden email].
CSeq: 1 REGISTER.
Contact: <sip:7004@Proxy: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: 3600.
Allow-Events: talk,hold,conference,refer,check-sync.
Mac: 00:15:65:72:e5:f3.
Line: 1.
Content-Length: 0.

I believe this is because the initial request opensips is recieving from the phone has 'sip' in the register?

   REGISTER sip:<pbx>:5061 SIP/2.0 
    Via: SIP/2.0/TLS 172.16.52.69:12122;branch=z9hG4bK2625059359;rport 
    From: "Test" <sip:7004@pbx:5061>;tag=1299551992 
    To: "Test" <sip:7004@pbx:5061> 
    Call-ID: [hidden email] 
    CSeq: 1 REGISTER 
    Contact: <sip:7004@172.16.52.69:12122;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: 3600 
    Allow-Events: talk,hold,conference,refer,check-sync 
    Mac: 00:15:65:72:e5:f3 
    Line: 1 
    Content-Length: 0 


What can I do here? I've tried playing with rewriting $du and $fs but that doesn't seem to be working.
--
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

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: TLS traffic is being relayed as UDP but on the TLS Port?

Bogdan-Andrei Iancu-2
In reply to this post by John Kiniston
Hi John,

Probably the 5061 port (specific to TLS) is not re-written during the routing process - for example see the 5061 in the REGISTER RURI. How do you route the REGISTER from OpenSIPS to Asterisk ? Dispatcher ? or ?

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 01:03 AM, John Kiniston wrote:
I have a proxy that works fine with UDP handling mid-registrar and mediaproxy duties in front of my Asterisk Servers.

I'd like to enable TLS on my proxy and switch my phones to registering via TLS.

I've got my TLS keys working now and I see my phone sending requests to OpenSIPS where they are being processed.

However when OpenSIPS is sending the traffic to my Asterisk boxes it's sending SIP traffic to port 5061 instead of sending TLS.

U 2019/03/14 15:54:33.985636 <Proxy>:5060 -> <Asterisk>:5061 #32
REGISTER sip:<pbx>:5061 SIP/2.0.
Via: SIP/2.0/UDP Proxy:5060;branch=z9hG4bKffdc.94c66575.0;i=a64b8973.
Via: SIP/2.0/TLS 172.16.52.69:12332;received=64.119.40.170;branch=z9hG4bK3157565843;rport=12332.
From: "Test" <<a class="moz-txt-link-freetext" href="sip:7004@">sip:7004@<pbx>:5061>;tag=1087298031.
To: "Test" <<a class="moz-txt-link-freetext" href="sip:7004@">sip:7004@<pbx>:5061>.
Call-ID: [hidden email].
CSeq: 1 REGISTER.
Contact: <a class="moz-txt-link-rfc2396E" href="sip:7004@Proxy:5060"><sip:7004@Proxy: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: 3600.
Allow-Events: talk,hold,conference,refer,check-sync.
Mac: 00:15:65:72:e5:f3.
Line: 1.
Content-Length: 0.

I believe this is because the initial request opensips is recieving from the phone has 'sip' in the register?

   REGISTER sip:<pbx>:5061 SIP/2.0 
    Via: SIP/2.0/TLS 172.16.52.69:12122;branch=z9hG4bK2625059359;rport 
    From: "Test" <a class="moz-txt-link-rfc2396E" href="sip:7004@pbx:5061"><sip:7004@pbx:5061>;tag=1299551992 
    To: "Test" <a class="moz-txt-link-rfc2396E" href="sip:7004@pbx:5061"><sip:7004@pbx:5061> 
    Call-ID: [hidden email] 
    CSeq: 1 REGISTER 
    Contact: <a class="moz-txt-link-rfc2396E" href="sip:7004@172.16.52.69:12122;transport=TLS"><sip:7004@172.16.52.69:12122;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: 3600 
    Allow-Events: talk,hold,conference,refer,check-sync 
    Mac: 00:15:65:72:e5:f3 
    Line: 1 
    Content-Length: 0 


What can I do here? I've tried playing with rewriting $du and $fs but that doesn't seem to be working.
--
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


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: TLS traffic is being relayed as UDP but on the TLS Port?

Bogdan-Andrei Iancu-2
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");
>
>
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: TLS traffic is being relayed as UDP but on the TLS Port?

John Kiniston
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@...:5061>;tag=3020551445 
    To: "Test" <sip:7004salesdemo@...:5061
    Call-ID: [hidden email] 
    CSeq: 1 REGISTER 
    Contact: <sip:7004salesdemo@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@...:5061>;tag=3020551445'
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]: DBG:mid_registrar:prepare_forward: Call-ID: '[hidden email]'
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]: DBG:mid_registrar:prepare_forward: Contact: '<sip:7004salesdemo@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@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@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@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@...:5061' 0x7f46e9d8eaa8
Mar 20 15:28:46 sip2 /usr/sbin/opensips[20400]: DBG:mid_registrar:mri_free: to: 'sip:7004salesdemo@...:5061' 0x7f46e9da9e60
Mar 20 15:28:46 sip2 /usr/sbin/opensips[20400]: DBG:mid_registrar:mri_free: callid: '[hidden email]' 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@...:5061>;tag=3020551445 
    To: "Test" <sip:7004salesdemo@...:5061
    Call-ID: [hidden email] 
    CSeq: 1 REGISTER 
    Contact: <sip:7004salesdemo@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 <[hidden email]> 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

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: TLS traffic is being relayed as UDP but on the TLS Port?

John Kiniston
I'm still fighting with this and would love some assistance.

Is there more data I should be collecting? do I need to post more configuration details?

On Wed, Mar 20, 2019 at 4:09 PM John Kiniston <[hidden email]> wrote:
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@...:5061>;tag=3020551445 
    To: "Test" <sip:7004salesdemo@...:5061
    Call-ID: [hidden email] 
    CSeq: 1 REGISTER 
    Contact: <sip:7004salesdemo@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@...:5061>;tag=3020551445'
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]: DBG:mid_registrar:prepare_forward: Call-ID: '[hidden email]'
Mar 20 15:28:10 sip2 /usr/sbin/opensips[20404]: DBG:mid_registrar:prepare_forward: Contact: '<sip:7004salesdemo@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@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@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@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@...:5061' 0x7f46e9d8eaa8
Mar 20 15:28:46 sip2 /usr/sbin/opensips[20400]: DBG:mid_registrar:mri_free: to: 'sip:7004salesdemo@...:5061' 0x7f46e9da9e60
Mar 20 15:28:46 sip2 /usr/sbin/opensips[20400]: DBG:mid_registrar:mri_free: callid: '[hidden email]' 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@...:5061>;tag=3020551445 
    To: "Test" <sip:7004salesdemo@...:5061
    Call-ID: [hidden email] 
    CSeq: 1 REGISTER 
    Contact: <sip:7004salesdemo@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 <[hidden email]> 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


--
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

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users