[OpenSIPS-Users] Possible mid-registrar bug

Kirill Galinurov k.galinurov at gmail.com
Thu Mar 30 03:20:10 EDT 2017


Hi all. We try test new mid-registar feature in opensips 2.3

loadmodule "mid_registrar.so"
modparam("mid_registrar", "mode", 1) /* 0 = mirror / 1 = ct / 2 = AoR */
modparam("mid_registrar", "outgoing_expires", 3600)
modparam("mid_registrar", "insertion_mode", 0) /* 0 = contact; 1 = path */
modparam("mid_registrar", "max_contacts", 1)
modparam("mid_registrar", "retry_after", 30)
modparam("mid_registrar", "contact_match_param", "rid")

if (is_method("REGISTER")) {
        mid_registrar_save("location");
        switch ($retcode) {
        case 1:
                 xlog("L_INFO", "forwarding REGISTER to main
registrar...\n");
                $ru = "sip:192.168.77.49:5060";
                if (!t_relay()) {
                        send_reply("500", "Server Internal Error 1");
                }

                break;
        case 2:
                 xlog("L_INFO", "REGISTER has been absorbed!\n");
                break;
        default:
                xlog("L_ERR", "mid-registrar error!\n");
                send_reply("500", "Server Internal Error 2");
        }

  exit;
}

if (is_method("INVITE") and $si == "192.168.77.49" and $sp == 5060) {
                if (!mid_registrar_lookup("location")) {
                        t_reply("404", "Not Found");
                        exit;
                }

                if (!t_relay())
                        send_reply("500", "Server Internal Error 3");

            exit;
        }
When we use rid parameter we have a error in Asterisk.

Initial Register from Client to Opensips

*REGISTER sip:192.168.10.200;transport=UDP SIP/2.0*
*Via: SIP/2.0/UDP
192.168.76.224:33593;branch=z9hG4bK-524287-1---52af00d0e9d590fd*
*Max-Forwards: 70*
*Contact:
<sip:2101 at 192.168.76.224:33593;rinstance=a6bb1857f7e41f30;transport=UDP>*
*To: <sip:2101 at 192.168.10.200 <sip%3A2101 at 192.168.10.200>;transport=UDP>*
*From: <sip:2101 at 192.168.10.200
<sip%3A2101 at 192.168.10.200>;transport=UDP>;tag=66282f00*
*Call-ID: zHst9ROVeEmKYQVPUwDz8w..*
*CSeq: 6 REGISTER*
*Expires: 3600*
*User-Agent: Z 3.15.40006 rv2.8.20*
*Authorization: Digest
username="2101",realm="asterisk",nonce="1490856865/be28c84459a2237855ebfa2521ba0bb8",uri="sip:192.168.10.200;transport=UDP",response="753e7a589c04180fa63aecc08bb4b40a",cnonce="91b8e43b5c5c0bc2e45ec37f8ddf53d9",nc=00000003,qop=auth,algorithm=md5,opaque="488632b65bf44460"*
*Allow-Events: presence, kpml, talk*
*Content-Length: 0*

>From Opensips to Asterisk

*REGISTER sip:192.168.77.49:5060 <http://192.168.77.49:5060> SIP/2.0*
*Via: SIP/2.0/UDP 192.168.10.200:5060;branch=z9hG4bK8fa9.40aab787.0*
*Via: SIP/2.0/UDP
192.168.76.224:33593;branch=z9hG4bK-524287-1---52af00d0e9d590fd*
*Max-Forwards: 69*
*Contact:
<sip:2101 at 192.168.10.200:5060;rinstance=a6bb1857f7e41f30;transport=UDP;rid=c2lwOjIxMDFAMTkyLjE2OC43Ni4yMjQ6MzM1OTM7cmluc3RhbmNlPWE2YmIxODU3ZjdlNDFmMzA7dHJhbnNwb3J0PVVEUA==>*
*To: <sip:2101 at 192.168.10.200 <sip%3A2101 at 192.168.10.200>;transport=UDP>*
*From: <sip:2101 at 192.168.10.200
<sip%3A2101 at 192.168.10.200>;transport=UDP>;tag=66282f00*
*Call-ID: zHst9ROVeEmKYQVPUwDz8w..*
*CSeq: 6 REGISTER*
*Expires: 3600*
*User-Agent: Z 3.15.40006 rv2.8.20*
*Authorization: Digest
username="2101",realm="asterisk",nonce="1490856865/be28c84459a2237855ebfa2521ba0bb8",uri="sip:192.168.10.200;transport=UDP",response="753e7a589c04180fa63aecc08bb4b40a",cnonce="91b8e43b5c5c0bc2e45ec37f8ddf53d9",nc=00000003,qop=auth,algorithm=md5,opaque="488632b65bf44460"*
*Allow-Events: presence, kpml, talk*
*Content-Length: 0*

Asterisk console log:

*[2017-03-30 10:01:31] ERROR[20693]: pjproject:0 <?>:   sip_transport.
Error processing 658 bytes packet from UDP 192.168.10.200:5060
<http://192.168.10.200:5060> : PJSIP syntax error exception when parsing ''
header on line 5 col 180:*
*REGISTER sip:192.168.77.49:5060 <http://192.168.77.49:5060> SIP/2.0*
*Via: SIP/2.0/UDP 192.168.10.200:5060;branch=z9hG4bK4e1d.2e61df17.0*
*Via: SIP/2.0/UDP
192.168.76.224:33593;branch=z9hG4bK-524287-1---51b24eac9ec64d78*
*Max-Forwards: 69*
*Contact:
<sip:2101 at 192.168.10.200:5060;rinstance=a6bb1857f7e41f30;transport=UDP;rid=c2lwOjIxMDFAMTkyLjE2OC43Ni4yMjQ6MzM1OTM7cmluc3RhbmNlPWE2YmIxODU3ZjdlNDFmMzA7dHJhbnNwb3J0PVVEUA==>*
*To: <sip:2101 at 192.168.10.200 <sip%3A2101 at 192.168.10.200>;transport=UDP>*
*From: <sip:2101 at 192.168.10.200
<sip%3A2101 at 192.168.10.200>;transport=UDP>;tag=66282f00*
*Call-ID: zHst9ROVeEmKYQVPUwDz8w..*
*CSeq: 15 REGISTER*
*Expires: 3600*
*User-Agent: Z 3.15.40006 rv2.8.20*
*Allow-Events: presence, kpml, talk*
*Content-Length: 0*

So the problem in rid parameter Contact field
 rid=c2lwOjIxMDFAMTkyLjE2OC43Ni4yMjQ6MzM1OTM7cmluc3RhbmNlPWE2YmIxODU3ZjdlNDFmMzA7dHJhbnNwb3J0PVVEUA==>
in ==> symbols.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20170330/8258d32a/attachment-0001.html>


More information about the Users mailing list