[OpenSIPS-Users] Drouting problem

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri Sep 4 14:48:05 CEST 2009


Hi Brett,

indeed, so far there was no standardization of how to describe the 
params that may takes different vals - I mean as notation and not as 
text description.

But I admit it will be a good idea to do so.

Regards,
bogdan

Brett Nemeroff wrote:
> Bogdan,
> I just read the docs it says: 
> "The module can take one optional parameter: the routing group the 
> caller belongs to - this may be a static numerical value or an AVP 
> specification. If none specified, the function will automatically try 
> to query the dr_group table to get this information."
>
> I have a request. A "quick reference card" that lists, in very 
> abbreviated form all the module functions and parameters and the 
> allowed values of the parameters.. Perhaps the parameters should be 
> listed like "C" function declarations:
>
> function do_routing(avp "[group id]")
>
> or if it supported avp and/or pv:
> function do_routing(avp/pv "[group id]")
>
> Something like that. .a cheat sheet with one func per line would be 
> really handy (hyperlinked, even better!!) :)
>
> -Brett
>
>
> On Wed, Sep 2, 2009 at 8:01 AM, Bogdan-Andrei Iancu 
> <bogdan at voice-system.ro <mailto:bogdan at voice-system.ro>> wrote:
>
>     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> <http://s.int>})
>     >
>     > I thought you had to do:
>     >      $avp(n_dr_id) = $(avp(dr_id){s.int <http://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>
>     <mailto: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>
>     <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>
>     <mailto: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>
>     <mailto: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 <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