<div dir="ltr"><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi All,</div><div><br></div><div>Hoping someone can help me with this - I think it should be pretty simple.</div><div><br></div><div>We're using mid_registrar to provide a Proxy between Asterisk and clients (mixed UDP, TCP and TLS).</div><div><br></div><div>Calls in/out work fine, but I'm having some difficulties with NOTIFY messages being transmitted back to the client a "period" of time after the register event. This period of time seems to be 2 minutes or so. It looks like even though the $ru is set correctly, it's not reusing the TLS socket, but instead trying to create a new transaction/socket which doesn't work. I'm assuming from the logs the important thing is the "DBG:tm:t_lookup_request: no transaction found"; and that what has happened is the original register transaction has "expired" and so it needs to create a new one, despite the TCP_NO_CONNECT bflag being set. </div><div><br></div><div>INVITEs are properly relayed and reuse the socket without fail; it "seems" it's only NOTIFY messages that are causing me grief.</div><div><br></div><div>Our config looks like this:</div><div><br></div><div>...</div><div><br></div><div>tcp_no_new_conn_bflag = TCP_NO_CONNECT<br></div><div>tcp_keepidle = 30<br></div><div>...</div><div>loadmodule "tm.so"<br></div><div>modparam("tm", "fr_timeout", 5)<br>modparam("tm", "fr_inv_timeout", 30)<br>modparam("tm", "restart_fr_on_each_reply", 0)<br>modparam("tm", "onreply_avp_mode", 1)<br></div><div><br></div><div>loadmodule "mid_registrar.so"<br>modparam("mid_registrar", "mode", 2) /* 0 = mirror / 1 = ct / 2 = AoR */<br>modparam("mid_registrar", "outgoing_expires", 3600)<br>modparam("mid_registrar", "contact_id_insertion", "ct-param")<br>modparam("mid_registrar", "tcp_persistent_flag", "TCP_PERSIST_REGISTRATIONS")<br></div><div>...</div><div><br></div><div>            if ($si == "asterisk.ip" && $sp == 5060) {<br>                xlog("about to do mid_registrar_lookup\n");<br>                if (!mid_registrar_lookup("location")) {<br>                    xlog("mid registrar lookup failed\n");<br>                    xlog("RU is $ru FU is $fu TU is $tu\n");<br>                    $ru = "sip:"+$tU+"@asterisk.ip";<br>                    xlog("Rewrote to $ru\n"); # This deal with NOTIFY requests that don't have the user in the SIP message<br>                    if (!mid_registrar_lookup("location")) {<br>                        xlog("Could not find user, going to reply 404 and drop the request.\n");<br>                        sl_send_reply(404,"Contact is not here anymore");    <br>                        exit;<br>                    }<br>                }<br>            } else {<br>                fix_nated_contact();<br>                $ru = "sip:"+$tU+"@asterisk.ip:5060";<br>            }<br>            if ( is_method("NOTIFY")) {<br>                setbflag("TCP_NO_CONNECT");<br>                xlog("Notify with to tag\n");<br>                xlog("Ru is $ru\n");<br>                sl_send_reply(200, "OK, we got this!");<br>                t_relay();<br>                exit;<br>            }<br></div><div><br></div><div>...</div><div><br></div><div>Debug Logs:</div><div><br></div><div>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: about to do mid_registrar_lookup<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:core:unescape_user: unescaped string is <><br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:mid_registrar:lookup: '' Not found in usrloc<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: mid registrar lookup failed<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:core:parse_to_param: tag=f7a75172-f02b-419e-89a0-ad2481768e88<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:core:_parse_to: end of header reached, state=29<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:core:_parse_to: display={}, ruri={sip:1014@x.x.x.x}<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: RU is sip:y,y,y,y,y:5061;transport=tls;lr;r2=on;ftag=2210321712 FU is sip:1014@x.x.x.x TU is sip:1003-test@x.x.x.x<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: Rewrote to sip:1003-test@x.x.x.x<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:core:unescape_user: unescaped string is <1003-test><br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:mid_registrar:select_contacts: ct: sip:1003-test@z.z.z.z:3353;transport=TLS<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:mid_registrar:push_branch: setting msg R-URI <sip:1003-test@z.z.z.z:3353;transport=TLS><br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: Notify with to tag<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: Ru is sip:1003-test@z.z.z.z:3353;transport=TLS<br></div><div>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:core:parse_headers: flags=ffffffffffffffff<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:tm:t_newtran: transaction on entrance=0xffffffffffffffff<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:core:parse_headers: flags=ffffffffffffffff<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:core:parse_headers: flags=78<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:tm:t_lookup_request: start searching: hash=65460, isACK=0<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:tm:matching_3261: RFC3261 transaction matching failed<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:tm:t_lookup_request: no transaction found<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:core:mk_proxy: doing DNS lookup...<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:core:parse_headers: flags=2000<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: DBG:core:parse_headers: flags=ffffffffffffffff<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: ERROR:tm:msg_send: send() to x.x.x.x:5061 for proto tls/3 failed<br>May  2 04:59:42 hvprxy /usr/sbin/opensips[96845]: ERROR:tm:t_forward_nonack: sending request failed<br></div><div><br></div><div>Any help would be appreciated :)</div><div><br></div><div>Thanks,</div><div>Andrew</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>