<div dir="ltr"><div>Hello Nick,</div><div><br></div>(Since you are from Toronto, I looked that up for you. I&#39;m from Ottawa)<div><br></div><div>It&#39;s fairly simple. In your perl code, you do lookup $rU and then set some flag. Then back in your opensips route, you can examine this flag and route accordingly. I don&#39;t think you can return a result set to your opensips route.</div>
<div><br></div><div><div>sub check_number {</div><div><span class="" style="white-space:pre">        </span>my $m = shift;</div><div><span class="" style="white-space:pre">        </span>my $snumber = get_snumber( $m );</div><div>        my $called = $m-&gt;pseudoVar( &#39;$rU&#39; );<br>
</div><div><br></div><div><span class="" style="white-space:pre">        </span>if ( $called ne &#39;&#39; ) {</div><div><span class="" style="white-space:pre">                </span>my $p = select_row( &#39;select number from numbers where number=&#39; . quote( $called ) . &#39; limit 1&#39; );</div>
<div><span class="" style="white-space:pre">                </span>if ( defined $p &amp;&amp; $p-&gt;{ &#39;number&#39; } ne &#39;&#39; ) {</div><div><span class="" style="white-space:pre">                        </span>$m-&gt;setFlag( 7 );</div><div><span class="" style="white-space:pre">                        </span>return 1;</div>
<div><span class="" style="white-space:pre">                </span>}</div><div><span class="" style="white-space:pre">        </span>}</div><div><br></div><div><span class="" style="white-space:pre">        </span>$m-&gt;resetFlag( 7 );</div><div><span class="" style="white-space:pre">        </span>return 1;</div>
<div>}</div></div><div><br></div><div><br></div><div>Regards,</div><div>Ali Pey<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 3, 2013 at 12:45 PM, Nick Cameo <span dir="ltr">&lt;<a href="mailto:symack@gmail.com" target="_blank">symack@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hello Ali,<br>
<br>
Thank your for your response. Yes I was inquiring about a OpenSIPS<br>
perl API (use OpenSIPS). The only thing is I cannot find any API<br>
documentation in terms of what implementation is available. Only<br>
complex examples that I am looking into right now. With that said,<br>
what I am working on initially is not that complicated.<br>
<br>
For every INVITE:<br>
<br>
1) Extract the TO info (substring first 3/4 digits)<br>
2) Query the databases for all prefixes that LIKE the substring of the<br>
TO number order by price<br>
3) do_routing (or whatever) for the first record in the result set.<br>
Failing over to the next etc..<br>
<br>
Kind Regards,<br>
<br>
Nick from Toronto.<br>
<div class=""><div class="h5"><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><img class="" src="https://contactmonkey.com/api/v1/tracker?cm_session=6fd96d4d-60f1-487a-9db9-b5a26e55c527&amp;cm_type=open&amp;cm_user_email=alipey@gmail.com"></div></div>