Trick - put the lookup in a sub-route and call it from local route :)

Regards,

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

On 04.06.2015 16:20, Stas Kobzar wrote:
Yes, I had the same idea first, but lookup function is not available in local_route.

Thanks,

On Thu, Jun 4, 2015 at 9:15 AM, Newlin, Ben <[email protected] <mailto:[email protected]>> wrote:

    Can you not perform the lookup in local_route? Then you could send
    it where it is supposed to go without the need for the loop.

    Ben Newlin

    From: Stas Kobzar
    Reply-To: OpenSIPS users mailling list
    Date: Wednesday, June 3, 2015 at 8:45 PM
    To: OpenSIPS users mailling list

    Subject: Re: [OpenSIPS-Users] Double via in MI generated NOTIFY

    Yes, it resolves to itself. The domain is the one from OpenSIPS
    domains table.
    And this is actually what I want. I want OpenSIPS to find the
    contact from its locations table using function lookup("locations");

    And it works, OpenSIPS finds contact IP and sends NOTIFY to the phone.
    The only thing is that the packet has 2 Via headers with the same
    IP and port of OpenSIPS server.

    As I said, it works, but looks weird.


    On Wed, Jun 3, 2015 at 7:00 PM, Newlin, Ben <[email protected]
    <mailto:[email protected]>> wrote:

        It sounds like you may be sending the NOTIFY to yourself when
        you use the domain name instead of the IP. Have you verified
        the address that the domain resolves to? Is it the same as the
        OpenSIPS instance?

        Ben Newlin

        From: Stas Kobzar
        Reply-To: OpenSIPS users mailling list
        Date: Wednesday, June 3, 2015 at 6:00 PM
        To: Bogdan-Andrei Iancu
        Cc: OpenSIPS users mailling list
        Subject: Re: [OpenSIPS-Users] Double via in MI generated NOTIFY

        Hi Bogdan,

        No, I do not use local_route at all.

        My code for these kind of notifies is in the beginning of the
        initial part  or main route after t_check_trans and looks like
        this:

        
----------------------------------------------------------------------------------------
        t_check_trans();

        # RFC3265: NOTIFY can not be outside SIP dialog.
        # So we should drop the packet
        if(is_method("NOTIFY")) {
          # There is an exception: if this is a check-sync packet
          # for phone configuration reload request
          if($hdr(Event) =~ "check-sync"){
        lookup("locations", "m");
        xlog("L_INFO", "$ci|$rm| Send reboot request notify packet to
        destination $ru");
            t_relay();
            exit();
          }
        send_reply("481","Dialog does not exists");
          exit;
        }
        
----------------------------------------------------------------------------------------

        I have tried different scenarios:
        - Put this code before t_check_trans
        - do not use lookup function
        - replaced t_relay with forward

        Nothing helped.

        However, when I run fifo command using IP address in sip URI,
        like this:
        opensipsctl fifo t_uac_dlg NOTIFY sip:[email protected]
        <mailto:sip%[email protected]> . . '"From:
        <sip:[email protected]
        
<mailto:sip%[email protected]>>;tag=8755a8d01aa27e903a6f4ccaf393f04\r\nTo:
        <sip:[email protected]
        <mailto:sip%[email protected]>>\r\nEvent: check-sync\r\n"'

        then, the packet seems to send directly from local_route.
        Because, in this case, I do not even see it in the logs.

        Thank you!
        Stas





        On Wed, Jun 3, 2015 at 11:05 AM, Bogdan-Andrei Iancu
        <[email protected] <mailto:[email protected]>> wrote:

            Hi Stas,

            Do you do any local_route stuff ? If yes, do you modify
            the RURI/DURI or other parts of the requests?

            Regards,

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

            On 01.06.2015 17:42, Stas Kobzar wrote:
            Hello,

            I am sending NOTIFY packet with event "check-sync" to
            reload phone configuration.

            I am doing it with opensips FIFO mi.

            My command looks like this:
            opensipsctl fifo t_uac_dlg NOTIFY sip:[email protected]
            <mailto:sip%[email protected]> . . '"From:
            <sip:[email protected]
            
<mailto:sip%[email protected]>>;tag=8755a8d01aa27e903a6f4ccaf393f04\r\nTo:
            <sip:[email protected]
            <mailto:sip%[email protected]>>\r\nEvent:
            check-sync\r\n"'

            When I use IP address in RURI (sip:[email protected]
            <mailto:sip%[email protected]>) it works as expected.

            However, when I use domain name in RURI (like this:
            sip:[email protected]
            <mailto:sip%[email protected]>) and my command
            looks like this:
            opensipsctl fifo t_uac_dlg NOTIFY
            sip:[email protected]
            <mailto:sip%[email protected]> . . '"From:
            <sip:[email protected]
            
<mailto:sip%[email protected]>>;tag=8755a8d01aa27e903a6f4ccaf393f04\r\nTo:
            <sip:[email protected]
            <mailto:sip%[email protected]>>\r\nEvent:
            check-sync\r\n"'

            I have two Via headers in my resulting NOTIFY packet with
            different branche tags:

            NOTIFY sip:[email protected]
            <mailto:sip%[email protected]> SIP/2.0.
            Via: SIP/2.0/UDP
            10.130.8.20:5060;branch=z9hG4bK0872.598957f2.0.
            Via: SIP/2.0/UDP
            10.130.8.20:5060;branch=z9hG4bK0872.498957f2.0.
            To: sip:[email protected]
            <mailto:sip%[email protected]>.
            From: <sip:[email protected]
            
<mailto:sip%[email protected]>>;tag=734c62bd59eb9f33d3e6313898450dd1.
            CSeq: 10 NOTIFY.
            Call-ID: [email protected]
            <mailto:[email protected]>.
            Max-Forwards: 69.
            Content-Length: 0.
            Server: ETS voip router01.
            Event: check-sync
            .


            In first case, I do not even see the packet in main route
            but I see it in local_route.

            In my second case I see it in main route but the packet
            is sent with double Via header.

            I am sure it is not my routing script, because I have
            just put a forward to some IP whenever NOTIFY is received
            and I still have this problem.

            Is it a known issue?

            Everything still works fine, but having a double Via in
            logs a bit confusing.

            Thank you,
--
            Stas Kobzar

            Developeur VoIP / VoIP Developer

            ___________________


            Modulis­.ca Inc.

            # Bureau / Office: 514-284-2020 x 246
            <tel:514-284-2020%20x%20246>

            Email: s <http://firstname.lastname>[email protected]

            https://www.modulis.com <https://www.modulis.com/>


            <https://www.modulis.com/es-url-001>


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




--
        Stas Kobzar

        Developeur VoIP / VoIP Developer

        ___________________


        Modulis­.ca Inc.

        # Bureau / Office: 514-284-2020 <tel:514-284-2020> x 246

        Email: s <http://firstname.lastname>[email protected]

        https://www.modulis.com <https://www.modulis.com/>


        <https://www.modulis.com/es-url-001>

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




--
    Stas Kobzar

    Developeur VoIP / VoIP Developer

    ___________________


    Modulis­.ca Inc.

    # Bureau / Office: 514-284-2020 <tel:514-284-2020> x 246

    Email: s <http://firstname.lastname>[email protected]

    https://www.modulis.com <https://www.modulis.com/>


    <https://www.modulis.com/es-url-001>

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




--

Stas Kobzar

Developeur VoIP / VoIP Developer

___________________


Modulis­.ca Inc.

# Bureau / Office: 514-284-2020 x 246

Email: s <http://firstname.lastname>[email protected]

https://www.modulis.com <https://www.modulis.com/>


<https://www.modulis.com/es-url-001>


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

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

Reply via email to