[OpenSIPS-Users] Drouting problem

Bogdan-Andrei Iancu bogdan at voice-system.ro
Wed Sep 2 15:01:18 CEST 2009


Hi Brett,

:D oh...I'm wrong - i forgot that DR accepts only avps and not generic 
PVs ; when a generic PV is evaluated, you can use transformations (as 
they will be used), but in this particular case (only AVPs), the 
transformation will not be automatically applied :(.

So, you are right, here the correct way to do it is via an intermediary 
INT AVP.

Regards,
Bogdan

Brett Nemeroff wrote:
> Bogdan,
> I'm a little confused as to which modules can take avp transformations 
> INSIDE of the parameters and which can't..
>
> For example, I didn't think this worked (as you suggested):
>      do_routing("$(avp(dr_id){s.int <http://s.int>})
>
> I thought you had to do:
>      $avp(n_dr_id) = $(avp(dr_id){s.int <http://s.int>});
>      do_routing("$avp(n_dr_id)");
>
> Thanks,
> Brett
>
>
> On Wed, Sep 2, 2009 at 3:34 AM, Bogdan-Andrei Iancu 
> <bogdan at voice-system.ro <mailto:bogdan at voice-system.ro>> wrote:
>
>     Hi Sebastian,
>
>     The problem is that the dialplan returns the 200 ID as string
>     value,the
>     "200" string, while the drouting module does expect an integer value.
>
>     So use a transformation to convert from string to integer :
>         do_routing("$(avp(dr_id){s.int <http://s.int>})")
>
>     See: http://www.opensips.org/Resources/DocsCoreTran15#toc2
>
>     Regards,
>     Bogdan
>
>     Sebastian Sastre wrote:
>     > Hello
>     >
>     > As per bogdan's recommendation I used the dialplan module to
>     convert the
>     > soruce ip to a group number, but drouting is not able to get it.
>     > dp_translates the given ip to the correct group number, but when
>     passing it
>     > to drouting, it can't find it.
>     >
>     > Any ideas?
>     >
>     > route[2]{
>     >         xlog("-> Route(2) - Enter\n");
>     >         dp_translate("1", "$fd/$avp(dr_id)");
>     >         xlog("-> HOST $fd got group $avp(dr_id) \n");
>     >         if (!do_routing("$avp(dr_id)")){
>     >                 xlog("-> Route(2) - No routes found \n");
>     >                 sl_send_reply("503", "No available gateways route");
>     >                 exit;
>     >         }
>     >         xlog("-> Route(2) - Found Routes for request, routing...
>     \n");
>     > }
>     >
>     >
>     > This is the log
>     >
>     > /usr/sbin/opensips[8188]: -> Route(2) - Enter
>     > /usr/sbin/opensips[8188]: DBG:dialplan:dp_get_ivalue: integer value
>     > /usr/sbin/opensips[8188]: DBG:dialplan:dp_translate_f: dpid is 1
>     > /usr/sbin/opensips[8188]: DBG:dialplan:dp_get_svalue: searching 20
>     > /usr/sbin/opensips[8188]: DBG:dialplan:dp_translate_f: input is
>     192.168.0.10
>     > /usr/sbin/opensips[8188]: DBG:dialplan:translate: regex operator
>     testing
>     > /usr/sbin/opensips[8188]: DBG:dialplan:test_match: test string
>     192.168.0.10
>     > against a pattern 192.168.0.10
>     >
>     > /usr/sbin/opensips[8188]: DBG:dialplan:test_match: test_match:[0]
>     > 192.168.0.10
>     >
>     > /usr/sbin/opensips[8188]: DBG:dialplan:translate: found a
>     matching rule
>     > 0x7fa7fe6898d0: pr 0, match_exp 192.168.0.10
>     >
>     > /usr/sbin/opensips[8188]: DBG:dialplan:rule_translate: simply
>     replace the
>     > string, subst_comp (nil), n_escapes 0
>     >
>     > /usr/sbin/opensips[8188]: DBG:dialplan:dp_translate_f: input
>     192.168.0.10
>     > with dpid 1 => output 100
>     >
>     > /usr/sbin/opensips[8188]: -> HOST 192.168.0.10 got group 100
>     > /usr/sbin/opensips[8188]: ERROR:drouting:do_routing: failed to
>     get group id
>     > /usr/sbin/opensips[8188]: -> Route(2) - No routes found
>     >
>     >
>     >
>     > Thanks again,
>     >
>     >
>     > Sebastian Sastre
>     >
>     >
>     >
>     >
>     >
>     >
>     >
>     > _______________________________________________
>     > Users mailing list
>     > Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>     >
>     >
>
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   




More information about the Users mailing list