<div dir="ltr">Also I would like to try and store these numbers in a the DB somehow to minimise code.<div><br></div><div>Keith<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 3, 2013 at 1:40 PM,  <span dir="ltr"><<a href="mailto:sr-users-request@lists.sip-router.org" target="_blank">sr-users-request@lists.sip-router.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send sr-users mailing list submissions to<br>
        <a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:sr-users-request@lists.sip-router.org">sr-users-request@lists.sip-router.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:sr-users-owner@lists.sip-router.org">sr-users-owner@lists.sip-router.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of sr-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Destination number restriction (Keith)<br>
   2. Re: append_hf to reply generated by kamailio (Grant Bagdasarian)<br>
   3. Re: append_hf to reply generated by kamailio (Grant Bagdasarian)<br>
   4. Re: append_hf to reply generated by kamailio (Klaus Darilion)<br>
   5. Re: Destination number restriction (Morten Isaksen)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Thu, 3 Oct 2013 11:14:10 +0100<br>
From: Keith <<a href="mailto:keith@hubner.co.uk">keith@hubner.co.uk</a>><br>
To: "SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) -<br>
        Users   Mailing List" <<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>><br>
Subject: [SR-Users] Destination number restriction<br>
Message-ID:<br>
        <CAK7Ybu8=<a href="mailto:JNk%2BP4ASeB66XP6_3jUqxO1jhQBiPvAbDoEg5gjeDQ@mail.gmail.com">JNk+P4ASeB66XP6_3jUqxO1jhQBiPvAbDoEg5gjeDQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hi,<br>
<br>
I am looking to restrict calls based on destination numbers, e.g. so people<br>
can't call premium rate etc. Which module is best to achieve this?<br>
<br>
Thanks,<br>
Keith<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.sip-router.org/pipermail/sr-users/attachments/20131003/b0f780c0/attachment-0001.html" target="_blank">http://lists.sip-router.org/pipermail/sr-users/attachments/20131003/b0f780c0/attachment-0001.html</a>><br>

<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Thu, 3 Oct 2013 12:31:25 +0200<br>
From: Grant Bagdasarian <<a href="mailto:GB@cm.nl">GB@cm.nl</a>><br>
To: "Kamailio (SER) - Users Mailing List"<br>
        <<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>><br>
Subject: Re: [SR-Users] append_hf to reply generated by kamailio<br>
Message-ID:<br>
        <FB7D97A214987F458242ACBDF87614073B1C757D31@clubvirtual40.ClubMessage.local><br>
<br>
Content-Type: text/plain; charset="us-ascii"<br>
<br>
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.<br>
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).<br>
<br>
Why does this happen?<br>
<br>
From: <a href="mailto:sr-users-bounces@lists.sip-router.org">sr-users-bounces@lists.sip-router.org</a> [mailto:<a href="mailto:sr-users-bounces@lists.sip-router.org">sr-users-bounces@lists.sip-router.org</a>] On Behalf Of Grant Bagdasarian<br>

Sent: Thursday, October 3, 2013 11:39 AM<br>
To: <a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
Subject: [SR-Users] append_hf to reply generated by kamailio<br>
<br>
Hello,<br>
<br>
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?<br>
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.<br>
>From what I understood: onreply_route is only executed when receiving replies.<br>
<br>
Is there a reply_route which is executed for all replies, including the ones generated by kamailio itself?<br>
<br>
For instance inside this code block:<br>
<br>
request_route {<br>
<br>
.....<br>
<br>
                if($var(routing_query_result) =~ "DESTINATION_NOT_ALLOWED") {<br>
                                xlog("L_INFO", "[R-CORE-INCOMING-INVITE:$ci] !>" "Rejecting the call, because the destination is not allowed\r\n");<br>
                                sl_send_reply("603", "Decline");<br>
                                exit;<br>
                }<br>
<br>
.....<br>
<br>
}<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.sip-router.org/pipermail/sr-users/attachments/20131003/1b8d073f/attachment-0001.html" target="_blank">http://lists.sip-router.org/pipermail/sr-users/attachments/20131003/1b8d073f/attachment-0001.html</a>><br>

<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Thu, 3 Oct 2013 12:57:22 +0200<br>
From: Grant Bagdasarian <<a href="mailto:GB@cm.nl">GB@cm.nl</a>><br>
To: "Kamailio (SER) - Users Mailing List"<br>
        <<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>><br>
Subject: Re: [SR-Users] append_hf to reply generated by kamailio<br>
Message-ID:<br>
        <FB7D97A214987F458242ACBDF87614073B1C757D49@clubvirtual40.ClubMessage.local><br>
<br>
Content-Type: text/plain; charset="us-ascii"<br>
<br>
My bad, I forgot to make something clear.<br>
<br>
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?<br>

<br>
From: <a href="mailto:sr-users-bounces@lists.sip-router.org">sr-users-bounces@lists.sip-router.org</a> [mailto:<a href="mailto:sr-users-bounces@lists.sip-router.org">sr-users-bounces@lists.sip-router.org</a>] On Behalf Of Grant Bagdasarian<br>

Sent: Thursday, October 3, 2013 12:31 PM<br>
To: Kamailio (SER) - Users Mailing List<br>
Subject: Re: [SR-Users] append_hf to reply generated by kamailio<br>
<br>
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.<br>
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).<br>
<br>
Why does this happen?<br>
<br>
From: <a href="mailto:sr-users-bounces@lists.sip-router.org">sr-users-bounces@lists.sip-router.org</a><mailto:<a href="mailto:sr-users-bounces@lists.sip-router.org">sr-users-bounces@lists.sip-router.org</a>> [mailto:<a href="mailto:sr-users-bounces@lists.sip-router.org">sr-users-bounces@lists.sip-router.org</a>] On Behalf Of Grant Bagdasarian<br>

Sent: Thursday, October 3, 2013 11:39 AM<br>
To: <a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><mailto:<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>><br>
Subject: [SR-Users] append_hf to reply generated by kamailio<br>
<br>
Hello,<br>
<br>
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?<br>
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.<br>
>From what I understood: onreply_route is only executed when receiving replies.<br>
<br>
Is there a reply_route which is executed for all replies, including the ones generated by kamailio itself?<br>
<br>
For instance inside this code block:<br>
<br>
request_route {<br>
<br>
.....<br>
<br>
                if($var(routing_query_result) =~ "DESTINATION_NOT_ALLOWED") {<br>
                                xlog("L_INFO", "[R-CORE-INCOMING-INVITE:$ci] !>" "Rejecting the call, because the destination is not allowed\r\n");<br>
                                sl_send_reply("603", "Decline");<br>
                                exit;<br>
                }<br>
<br>
.....<br>
<br>
}<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.sip-router.org/pipermail/sr-users/attachments/20131003/d203f913/attachment-0001.html" target="_blank">http://lists.sip-router.org/pipermail/sr-users/attachments/20131003/d203f913/attachment-0001.html</a>><br>

<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Thu, 03 Oct 2013 13:37:25 +0200<br>
From: Klaus Darilion <<a href="mailto:klaus.mailinglists@pernau.at">klaus.mailinglists@pernau.at</a>><br>
To: "Kamailio (SER) - Users Mailing List"<br>
        <<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>><br>
Subject: Re: [SR-Users] append_hf to reply generated by kamailio<br>
Message-ID: <<a href="mailto:524D56F5.4020005@pernau.at">524D56F5.4020005@pernau.at</a>><br>
Content-Type: text/plain; charset=windows-1252; format=flowed<br>
<br>
Use append_to_reply(txt) before sl_send_reply():<br>
<a href="http://kamailio.org/docs/modules/4.1.x/modules/textops.html#idp17040608" target="_blank">http://kamailio.org/docs/modules/4.1.x/modules/textops.html#idp17040608</a><br>
<br>
regards<br>
Klaus<br>
<br>
On 03.10.2013 11:38, Grant Bagdasarian wrote:<br>
> Hello,<br>
><br>
> Is it possible to append a new header to a reply generated by Kamailio<br>
> and also have it present when duplicating the message to a capture server?<br>
><br>
> At the moment the 603 Reply is duplicated to my capture server, but I<br>
> don?t know how to append a new header, because the kamailio script stops<br>
> executing after exit is called.<br>
><br>
>  From what I understood: onreply_route is only executed when receiving<br>
> replies.<br>
><br>
> Is there a reply_route which is executed for all replies, including the<br>
> ones generated by kamailio itself?<br>
><br>
> For instance inside this code block:<br>
><br>
> request_route {<br>
><br>
> .....<br>
><br>
>                  if($var(routing_query_result) =~<br>
> "DESTINATION_NOT_ALLOWED") {<br>
><br>
>                                  xlog("L_INFO",<br>
> "[R-CORE-INCOMING-INVITE:$ci] !>" "Rejecting the call, because the<br>
> destination is not allowed\r\n");<br>
><br>
>                                  sl_send_reply("603", "Decline");<br>
><br>
>                                  exit;<br>
><br>
>                  }<br>
><br>
> .....<br>
><br>
> }<br>
><br>
><br>
><br>
> _______________________________________________<br>
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
> <a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
> <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
><br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Thu, 3 Oct 2013 14:40:36 +0200<br>
From: Morten Isaksen <<a href="mailto:misak@misak.dk">misak@misak.dk</a>><br>
To: "Kamailio (SER) - Users Mailing List"<br>
        <<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>><br>
Subject: Re: [SR-Users] Destination number restriction<br>
Message-ID:<br>
        <CAAyFOkH7nh=<a href="mailto:3d7Yj4dXjVrpQmMgGOqViA8BrauJ%2B4V_e5HxJHA@mail.gmail.com">3d7Yj4dXjVrpQmMgGOqViA8BrauJ+4V_e5HxJHA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
We use something like this:<br>
<br>
        if ((uri =~ "^sip:90[0-9]{6}@.*") &&<br>
(!avp_check("$avp(s:perms)","re/9/g"))) {<br>
                xlog("$ru : No permissions to call 90X numbers ($ci)");<br>
                sl_send_reply("403", "No permissions to call 90XXXXXX");<br>
                exit;<br>
        }<br>
<br>
and then store the information in usr_prefences table.<br>
<br>
/Morten<br>
<br>
<br>
<br>
On Thu, Oct 3, 2013 at 12:14 PM, Keith <<a href="mailto:keith@hubner.co.uk">keith@hubner.co.uk</a>> wrote:<br>
<br>
> Hi,<br>
><br>
> I am looking to restrict calls based on destination numbers, e.g. so<br>
> people can't call premium rate etc. Which module is best to achieve this?<br>
><br>
> Thanks,<br>
> Keith<br>
><br>
> _______________________________________________<br>
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
> <a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
> <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
><br>
><br>
<br>
<br>
--<br>
Morten Isaksen<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.sip-router.org/pipermail/sr-users/attachments/20131003/319d28bb/attachment.html" target="_blank">http://lists.sip-router.org/pipermail/sr-users/attachments/20131003/319d28bb/attachment.html</a>><br>

<br>
------------------------------<br>
<br>
_______________________________________________<br>
sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
<br>
End of sr-users Digest, Vol 101, Issue 22<br>
*****************************************<br>
</blockquote></div><br></div></div></div>