Also I would like to try and store these numbers in a the DB somehow to minimise code.

Keith


On Thu, Oct 3, 2013 at 1:40 PM, <sr-users-request@lists.sip-router.org> wrote:
Send sr-users mailing list submissions to
        sr-users@lists.sip-router.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
or, via email, send a message with subject or body 'help' to
        sr-users-request@lists.sip-router.org

You can reach the person managing the list at
        sr-users-owner@lists.sip-router.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of sr-users digest..."


Today's Topics:

   1. Destination number restriction (Keith)
   2. Re: append_hf to reply generated by kamailio (Grant Bagdasarian)
   3. Re: append_hf to reply generated by kamailio (Grant Bagdasarian)
   4. Re: append_hf to reply generated by kamailio (Klaus Darilion)
   5. Re: Destination number restriction (Morten Isaksen)


----------------------------------------------------------------------

Message: 1
Date: Thu, 3 Oct 2013 11:14:10 +0100
From: Keith <keith@hubner.co.uk>
To: "SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) -
        Users   Mailing List" <sr-users@lists.sip-router.org>
Subject: [SR-Users] Destination number restriction
Message-ID:
        <CAK7Ybu8=JNk+P4ASeB66XP6_3jUqxO1jhQBiPvAbDoEg5gjeDQ@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

I am looking to restrict calls based on destination numbers, e.g. so people
can't call premium rate etc. Which module is best to achieve this?

Thanks,
Keith
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20131003/b0f780c0/attachment-0001.html>

------------------------------

Message: 2
Date: Thu, 3 Oct 2013 12:31:25 +0200
From: Grant Bagdasarian <GB@cm.nl>
To: "Kamailio (SER) - Users Mailing List"
        <sr-users@lists.sip-router.org>
Subject: Re: [SR-Users] append_hf to reply generated by kamailio
Message-ID:
        <FB7D97A214987F458242ACBDF87614073B1C757D31@clubvirtual40.ClubMessage.local>

Content-Type: text/plain; charset="us-ascii"

Replacing the exit statement with return, does the trick. The reply reaches the onreply_route and that's where I add the header, but after a while it generates a 483 Too Many Hops.
My capture server also receives a lot of INVITE, ACK, 603 messages. A lot of Via and Record-Route headers are added to the INVITE and 603 (Via only).

Why does this happen?

From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Grant Bagdasarian
Sent: Thursday, October 3, 2013 11:39 AM
To: sr-users@lists.sip-router.org
Subject: [SR-Users] append_hf to reply generated by kamailio

Hello,

Is it possible to append a new header to a reply generated by Kamailio and also have it present when duplicating the message to a capture server?
At the moment the 603 Reply is duplicated to my capture server, but I don't know how to append a new header, because the kamailio script stops executing after exit is called.
>From what I understood: onreply_route is only executed when receiving replies.

Is there a reply_route which is executed for all replies, including the ones generated by kamailio itself?

For instance inside this code block:

request_route {

.....

                if($var(routing_query_result) =~ "DESTINATION_NOT_ALLOWED") {
                                xlog("L_INFO", "[R-CORE-INCOMING-INVITE:$ci] !>" "Rejecting the call, because the destination is not allowed\r\n");
                                sl_send_reply("603", "Decline");
                                exit;
                }

.....

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20131003/1b8d073f/attachment-0001.html>

------------------------------

Message: 3
Date: Thu, 3 Oct 2013 12:57:22 +0200
From: Grant Bagdasarian <GB@cm.nl>
To: "Kamailio (SER) - Users Mailing List"
        <sr-users@lists.sip-router.org>
Subject: Re: [SR-Users] append_hf to reply generated by kamailio
Message-ID:
        <FB7D97A214987F458242ACBDF87614073B1C757D49@clubvirtual40.ClubMessage.local>

Content-Type: text/plain; charset="us-ascii"

My bad, I forgot to make something clear.

The IF statement is in a different route which is called by de main request_route. So when the return statement is executed the control is passed back to the main request_route, which in turn relays the INVITE back to itself. That's probably causing the 483 Too Many Hops response?

From: sr-users-bounces@lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Grant Bagdasarian
Sent: Thursday, October 3, 2013 12:31 PM
To: Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] append_hf to reply generated by kamailio

Replacing the exit statement with return, does the trick. The reply reaches the onreply_route and that's where I add the header, but after a while it generates a 483 Too Many Hops.
My capture server also receives a lot of INVITE, ACK, 603 messages. A lot of Via and Record-Route headers are added to the INVITE and 603 (Via only).

Why does this happen?

From: sr-users-bounces@lists.sip-router.org<mailto:sr-users-bounces@lists.sip-router.org> [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Grant Bagdasarian
Sent: Thursday, October 3, 2013 11:39 AM
To: sr-users@lists.sip-router.org<mailto:sr-users@lists.sip-router.org>
Subject: [SR-Users] append_hf to reply generated by kamailio

Hello,

Is it possible to append a new header to a reply generated by Kamailio and also have it present when duplicating the message to a capture server?
At the moment the 603 Reply is duplicated to my capture server, but I don't know how to append a new header, because the kamailio script stops executing after exit is called.
>From what I understood: onreply_route is only executed when receiving replies.

Is there a reply_route which is executed for all replies, including the ones generated by kamailio itself?

For instance inside this code block:

request_route {

.....

                if($var(routing_query_result) =~ "DESTINATION_NOT_ALLOWED") {
                                xlog("L_INFO", "[R-CORE-INCOMING-INVITE:$ci] !>" "Rejecting the call, because the destination is not allowed\r\n");
                                sl_send_reply("603", "Decline");
                                exit;
                }

.....

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20131003/d203f913/attachment-0001.html>

------------------------------

Message: 4
Date: Thu, 03 Oct 2013 13:37:25 +0200
From: Klaus Darilion <klaus.mailinglists@pernau.at>
To: "Kamailio (SER) - Users Mailing List"
        <sr-users@lists.sip-router.org>
Subject: Re: [SR-Users] append_hf to reply generated by kamailio
Message-ID: <524D56F5.4020005@pernau.at>
Content-Type: text/plain; charset=windows-1252; format=flowed

Use append_to_reply(txt) before sl_send_reply():
http://kamailio.org/docs/modules/4.1.x/modules/textops.html#idp17040608

regards
Klaus

On 03.10.2013 11:38, Grant Bagdasarian wrote:
> Hello,
>
> Is it possible to append a new header to a reply generated by Kamailio
> and also have it present when duplicating the message to a capture server?
>
> At the moment the 603 Reply is duplicated to my capture server, but I
> don?t know how to append a new header, because the kamailio script stops
> executing after exit is called.
>
>  From what I understood: onreply_route is only executed when receiving
> replies.
>
> Is there a reply_route which is executed for all replies, including the
> ones generated by kamailio itself?
>
> For instance inside this code block:
>
> request_route {
>
> .....
>
>                  if($var(routing_query_result) =~
> "DESTINATION_NOT_ALLOWED") {
>
>                                  xlog("L_INFO",
> "[R-CORE-INCOMING-INVITE:$ci] !>" "Rejecting the call, because the
> destination is not allowed\r\n");
>
>                                  sl_send_reply("603", "Decline");
>
>                                  exit;
>
>                  }
>
> .....
>
> }
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>



------------------------------

Message: 5
Date: Thu, 3 Oct 2013 14:40:36 +0200
From: Morten Isaksen <misak@misak.dk>
To: "Kamailio (SER) - Users Mailing List"
        <sr-users@lists.sip-router.org>
Subject: Re: [SR-Users] Destination number restriction
Message-ID:
        <CAAyFOkH7nh=3d7Yj4dXjVrpQmMgGOqViA8BrauJ+4V_e5HxJHA@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

We use something like this:

        if ((uri =~ "^sip:90[0-9]{6}@.*") &&
(!avp_check("$avp(s:perms)","re/9/g"))) {
                xlog("$ru : No permissions to call 90X numbers ($ci)");
                sl_send_reply("403", "No permissions to call 90XXXXXX");
                exit;
        }

and then store the information in usr_prefences table.

/Morten



On Thu, Oct 3, 2013 at 12:14 PM, Keith <keith@hubner.co.uk> wrote:

> Hi,
>
> I am looking to restrict calls based on destination numbers, e.g. so
> people can't call premium rate etc. Which module is best to achieve this?
>
> Thanks,
> Keith
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>


--
Morten Isaksen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20131003/319d28bb/attachment.html>

------------------------------

_______________________________________________
sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


End of sr-users Digest, Vol 101, Issue 22
*****************************************