[OpenSIPS-Users] Dynamic Routing module issue with srip
Bogdan-Andrei Iancu
bogdan at opensips.org
Tue May 3 14:29:19 CEST 2016
Hi Michele,
Sorry for my question, but are you sure that $var(carrier) points to
"toip" carrier ?
Note that the module changes only the username in RURI, it does not
change TO hdr .
Best regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 02.05.2016 12:33, Michele Pinassi wrote:
> Thanks Bogdan for your prompt reply but seems that don't work as
> expected: i need to strip leading '0' from called R-URI and To !
>
> Just to help, i try to describe better my context:
>
> for any external calls, i use route[pstn]:
>
> route[pstn] {
> # Default outbound carrier
> $var(carrier) = "pstn";
>
> # Need to route to specific carrier ?
> if(avp_db_load("$fu","$avp(out_carrier)")) {
> $var(carrier) = $avp(out_carrier);
> # Remove leading zero
> subst_uri('/sip:0(.*)@(.*)/sip:\1@\2/g');
> subst('/^To:(.*)sip:0(.*)@(.*)/sip:\1@\2/g'); <---- Seems that
> don't work !!!
> }
>
> # Need to map outbound caller number ?
> if(avp_db_load("$fu","$avp(out_number_map)")) {
>
> uac_replace_from("$avp(out_number_map)","sip:$avp(out_number_map)@$Ri");
> append_hf("P-Asserted-Identity:
> <sip:$avp(out_number_map)@$Ri>\r\n");
> }
>
> xlog("L_INFO","$ci - Route via $var(carrier) from $fU to $tU (RURI:
> $ru)\n");
>
> if(route_to_carrier("$var(carrier)")) {
> t_on_failure("next_gw");
> t_relay();
> exit;
> }
> }
>
> Here are dynamic routing tables:
>
> dr gateways
> +----+-----------+------+-------------+-------+------------+-------+------------+-------+--------+--------------------+
> | id | gwid | type | address | strip | pri_prefix | attrs |
> probe_mode | state | socket | description |
> +----+-----------+------+-------------+-------+------------+-------+------------+-------+--------+--------------------+
> | 2 | mediabox1 | 1 | 172.y.x.x | 0 | NULL | NULL
> | 2 | 0 | | Mediabox gateway |
> | 1 | pstn1 | 1 | 172.y.x.z | 0 | NULL | NULL
> | 2 | 0 | | Patton GW to MD110 |
> | 5 | toip1 | 1 | 172.w.x.r | 1 | NULL | NULL
> | 2 | 0 | | Trunk VoIP Fastweb |
> | 6 | toip2 | 1 | 172.w.x.f | 1 | NULL | NULL
> | 2 | 0 | | Trunk VoIP Fastweb |
> +----+-----------+------+-------------+-------+------------+-------+------------+-------+--------+--------------------+
> dr groups
> +----+----------+--------+---------+-------------------+
> | id | username | domain | groupid | description |
> +----+----------+--------+---------+-------------------+
> | 1 | .* | .* | 1 | PSTN |
> | 2 | .* | .* | 2 | Asterisk mediabox |
> | 5 | .* | .* | 3 | Trunk TOIP |
> +----+----------+--------+---------+-------------------+
> dr carriers
> +----+-----------+-------------+-------+-------+-------+-------------------------+
> | id | carrierid | gwlist | flags | state | attrs |
> description |
> +----+-----------+-------------+-------+-------+-------+-------------------------+
> | 6 | legacy | pstn1 | 1 | 0 | | Carrier to
> legacy MD110 |
> | 2 | mediabox | mediabox1 | 1 | 0 | | Carrier to
> MEDIA BOX |
> | 1 | pstn | pstn1 | 1 | 0 | | Carrier to
> PSTN |
> | 5 | toip | toip1,toip2 | 1 | 0 | | Carrier to
> Trunk TOIP |
> +----+-----------+-------------+-------+-------+-------+-------------------------+
> dr rules
> +--------+---------+--------+---------+----------+---------+-------------+-------+-----------------------+
> | ruleid | groupid | prefix | timerec | priority | routeid | gwlist
> | attrs | description |
> +--------+---------+--------+---------+----------+---------+-------------+-------+-----------------------+
> | 1 | 1 | | | 100 | NULL | pstn1
> | NULL | Default route to PSTN |
> | 2 | 2 | | | 100 | NULL | mediabox1
> | NULL | Route to MEDIA BOX |
> | 6 | 3 | | | 100 | NULL | toip1,toip2
> | NULL | VoIP Trunk |
>
> When someone call 00xxxxxxxx and need to get out via "toip" carrier,
> just for example, i need to strip out first 0...
>
> Thanks, Michele
>
> Il 29/04/2016 15:59, Bogdan-Andrei Iancu ha scritto:
>> Hi Michele,
>>
>> the per-gw ops are done in all the routing scenarios (per prefix, per
>> carrier, etc). Are you sure your call is routed via that GW ? try to
>> print in cfg the GW ID to see it the right GW is used.
>>
>> Regards,
>>
>> Bogdan-Andrei Iancu
>> OpenSIPS Founder and Developer
>> http://www.opensips-solutions.com
>>
>> On 29.04.2016 12:02, Michele Pinassi wrote:
>>> Hi all,
>>>
>>> on my OpenSIPS 1.11.6 i use dymanic module routing to magare multiple
>>> routes. I need to strip a number for particular gateways and, following
>>> manual, i set to '1' the 'strip' field in dr_gateways table.
>>>
>>> But, using function "route_to_carrier" to manage carrier routing, i get
>>> no number strip...
>>>
>>> Maybe i'm missing something ?
>>>
>>> Thanks, Michele
>>>
More information about the Users
mailing list