Bogdan,<div>I just read the docs it says: </div><div>"<span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">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."</span></div>
<div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px;"><br></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px;">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:</span></div>
<div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px;"><br></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px;">function do_routing(avp "[group id]")</span></div>
<div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px;"><br></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px;">or if it supported avp and/or pv:</span></div>
<div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px;">function do_routing(avp/pv "[group id]")</span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px;"><br>
</span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px;">Something like that. .a cheat sheet with one func per line would be really handy (hyperlinked, even better!!) :)</span></div>
<div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px;"><br></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px;">-Brett</span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px;"><br>
</span></div><div><div><br><div class="gmail_quote">On Wed, Sep 2, 2009 at 8:01 AM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Brett,<br>
<br>
:D oh...I'm wrong - i forgot that DR accepts only avps and not generic<br>
PVs ; when a generic PV is evaluated, you can use transformations (as<br>
they will be used), but in this particular case (only AVPs), the<br>
transformation will not be automatically applied :(.<br>
<br>
So, you are right, here the correct way to do it is via an intermediary<br>
INT AVP.<br>
<br>
Regards,<br>
Bogdan<br>
<div class="im"><br>
Brett Nemeroff wrote:<br>
> Bogdan,<br>
> I'm a little confused as to which modules can take avp transformations<br>
> INSIDE of the parameters and which can't..<br>
><br>
> For example, I didn't think this worked (as you suggested):<br>
</div>> do_routing("$(avp(dr_id){<a href="http://s.int" target="_blank">s.int</a> <<a href="http://s.int" target="_blank">http://s.int</a>>})<br>
<div class="im">><br>
> I thought you had to do:<br>
</div>> $avp(n_dr_id) = $(avp(dr_id){<a href="http://s.int" target="_blank">s.int</a> <<a href="http://s.int" target="_blank">http://s.int</a>>});<br>
<div class="im">> do_routing("$avp(n_dr_id)");<br>
><br>
> Thanks,<br>
> Brett<br>
><br>
><br>
> On Wed, Sep 2, 2009 at 3:34 AM, Bogdan-Andrei Iancu<br>
</div><div class="im">> <<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a> <mailto:<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>>> wrote:<br>
><br>
> Hi Sebastian,<br>
><br>
> The problem is that the dialplan returns the 200 ID as string<br>
> value,the<br>
> "200" string, while the drouting module does expect an integer value.<br>
><br>
> So use a transformation to convert from string to integer :<br>
</div>> do_routing("$(avp(dr_id){<a href="http://s.int" target="_blank">s.int</a> <<a href="http://s.int" target="_blank">http://s.int</a>>})")<br>
<div><div></div><div class="h5">><br>
> See: <a href="http://www.opensips.org/Resources/DocsCoreTran15#toc2" target="_blank">http://www.opensips.org/Resources/DocsCoreTran15#toc2</a><br>
><br>
> Regards,<br>
> Bogdan<br>
><br>
> Sebastian Sastre wrote:<br>
> > Hello<br>
> ><br>
> > As per bogdan's recommendation I used the dialplan module to<br>
> convert the<br>
> > soruce ip to a group number, but drouting is not able to get it.<br>
> > dp_translates the given ip to the correct group number, but when<br>
> passing it<br>
> > to drouting, it can't find it.<br>
> ><br>
> > Any ideas?<br>
> ><br>
> > route[2]{<br>
> > xlog("-> Route(2) - Enter\n");<br>
> > dp_translate("1", "$fd/$avp(dr_id)");<br>
> > xlog("-> HOST $fd got group $avp(dr_id) \n");<br>
> > if (!do_routing("$avp(dr_id)")){<br>
> > xlog("-> Route(2) - No routes found \n");<br>
> > sl_send_reply("503", "No available gateways route");<br>
> > exit;<br>
> > }<br>
> > xlog("-> Route(2) - Found Routes for request, routing...<br>
> \n");<br>
> > }<br>
> ><br>
> ><br>
> > This is the log<br>
> ><br>
> > /usr/sbin/opensips[8188]: -> Route(2) - Enter<br>
> > /usr/sbin/opensips[8188]: DBG:dialplan:dp_get_ivalue: integer value<br>
> > /usr/sbin/opensips[8188]: DBG:dialplan:dp_translate_f: dpid is 1<br>
> > /usr/sbin/opensips[8188]: DBG:dialplan:dp_get_svalue: searching 20<br>
> > /usr/sbin/opensips[8188]: DBG:dialplan:dp_translate_f: input is<br>
> 192.168.0.10<br>
> > /usr/sbin/opensips[8188]: DBG:dialplan:translate: regex operator<br>
> testing<br>
> > /usr/sbin/opensips[8188]: DBG:dialplan:test_match: test string<br>
> 192.168.0.10<br>
> > against a pattern 192.168.0.10<br>
> ><br>
> > /usr/sbin/opensips[8188]: DBG:dialplan:test_match: test_match:[0]<br>
> > 192.168.0.10<br>
> ><br>
> > /usr/sbin/opensips[8188]: DBG:dialplan:translate: found a<br>
> matching rule<br>
> > 0x7fa7fe6898d0: pr 0, match_exp 192.168.0.10<br>
> ><br>
> > /usr/sbin/opensips[8188]: DBG:dialplan:rule_translate: simply<br>
> replace the<br>
> > string, subst_comp (nil), n_escapes 0<br>
> ><br>
> > /usr/sbin/opensips[8188]: DBG:dialplan:dp_translate_f: input<br>
> 192.168.0.10<br>
> > with dpid 1 => output 100<br>
> ><br>
> > /usr/sbin/opensips[8188]: -> HOST 192.168.0.10 got group 100<br>
> > /usr/sbin/opensips[8188]: ERROR:drouting:do_routing: failed to<br>
> get group id<br>
> > /usr/sbin/opensips[8188]: -> Route(2) - No routes found<br>
> ><br>
> ><br>
> ><br>
> > Thanks again,<br>
> ><br>
> ><br>
> > Sebastian Sastre<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > Users mailing list<br>
</div></div>> > <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
<div class="im">> > <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
> ><br>
> ><br>
><br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
</div>> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
<div><div></div><div class="h5">> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
><br>
> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br></div></div>