On Sat, Aug 12, 2017 at 08:49:45AM +0300, v...@cell.tel wrote:
>    Using alias_db - 7XXX calls were succesfully aliased and routed to
>    Asterisk through 4444 user (asterisk server did not accept connections to
>    sip ports from Internet due to security reasons).
>    On asterisk side, all this calls had equal extension, configured in
>    sip.conf "REGISTER =>.../exten" string.
>     
>    So I had to extract right exten from TO: header in dialplan like this:
...
asterisk conf
...

Alternative is to first do the lookup in kamailio and then restore the
$rU variable:

$var(orgRu)=$rU;
if lookup()/alias_db_lookup success
$rU=$var(orgRu);

     
>    One disadvantage with alias_db - is that i cant use regex to alias all
>    7XXX numbers with 4444 user, so i need to create aliases for every 7XXX
>    user in dbaliases table using this scenario.
>     
>    Is the any other not very difficult way to route all 7XXX calls in
>    Kamailio to Asterisk through 4444 user without creating alias dbrecords
>    for every number?

A way to do this is by storing prefixex in the aliasdb table. I use this
brilliant piece of code to match exact numers, 10 number blocks, 100
and 1000 number blocks. 

if(!alias_db_lookup("dbaliases"))
{
        strip_tail(1);

        if(!alias_db_lookup("dbaliases"))
        {
                strip_tail(1);
                if(!alias_db_lookup("dbaliases"))
                {
                        strip_tail(1);
                        alias_db_lookup("dbaliases");
                }
        }
}

Since my dbaliases contains full e164 number/prefixes there are no
collisions. Adapt for your number schemes.

An alternative is to use sqlops to do custom queries and for example
retrieve the username and use lookup() to route.


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to