[OpenSIPS-Users] Implementing routing and failure using perl

Ali Pey alipey at gmail.com
Tue Dec 3 19:03:37 CET 2013


Hello Nick,

(Since you are from Toronto, I looked that up for you. I'm from Ottawa)

It'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't think you can return a result set to your opensips
route.

sub check_number {
my $m = shift;
my $snumber = get_snumber( $m );
        my $called = $m->pseudoVar( '$rU' );

if ( $called ne '' ) {
my $p = select_row( 'select number from numbers where number=' . quote(
$called ) . ' limit 1' );
if ( defined $p && $p->{ 'number' } ne '' ) {
$m->setFlag( 7 );
return 1;
}
}

$m->resetFlag( 7 );
return 1;
}


Regards,
Ali Pey


On Tue, Dec 3, 2013 at 12:45 PM, Nick Cameo <symack at gmail.com> wrote:

> Hello Ali,
>
> Thank your for your response. Yes I was inquiring about a OpenSIPS
> perl API (use OpenSIPS). The only thing is I cannot find any API
> documentation in terms of what implementation is available. Only
> complex examples that I am looking into right now. With that said,
> what I am working on initially is not that complicated.
>
> For every INVITE:
>
> 1) Extract the TO info (substring first 3/4 digits)
> 2) Query the databases for all prefixes that LIKE the substring of the
> TO number order by price
> 3) do_routing (or whatever) for the first record in the result set.
> Failing over to the next etc..
>
> Kind Regards,
>
> Nick from Toronto.
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20131203/cc3d2d38/attachment.htm>


More information about the Users mailing list