[OpenSIPS-Users] goes_to_gw() not detecting correct gw

Bogdan-Andrei Iancu bogdan at opensips.org
Fri Mar 29 03:36:30 EDT 2019


Hi Mark,

When reporting an issue, one of the most important things to mention is 
what version and revision of OpenSIPS you use (opensips -V).

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   https://www.opensips-solutions.com
OpenSIPS Summit 2019
   https://www.opensips.org/events/Summit-2019Amsterdam/

On 03/28/2019 06:31 PM, Mark Farmer wrote:
> Hi everyone
>
> For some reason my script always thinks the call is destined for gw 
> type 1, even when it should be type 2. Please can somebody explain why?
> The call does ultimately route to the correct gw so it's just the 
> goes_to_gw() that is misbehaving.
>
> This is my route:
>
> route[RTPPROXY] {
>
>         if (is_method("BYE|CANCEL")) {
> rtpproxy_unforce();
>         }
>
>         if (is_method("INVITE")) {
> xlog("Processing INVITE $ru");
> if (is_from_gw("1")) {
> xlog("Outbound Call - Send to 3rd Party...");
> setflag(INT_TPTY);
> } else if (is_from_gw("2")) {
> xlog("Inbound Call - Send to 3rd Party...");
> setflag(EXT_TPTY);
> } else if (is_from_gw("3")) {
>         xlog("Call from 3rd Party. Where is it going?");
>                 if (goes_to_gw("1")) {
>       xlog("... to Asterisk");
> setflag(TPTY_INT);
>                 } else if (goes_to_gw("2")) {
>       xlog("... to Provider");
> setflag(TPTY_EXT);
>                 }
> }
>
>         if (isflagset(INT_TPTY)) {
> rtpproxy_offer("corwfei");
> } else if (isflagset(EXT_TPTY)) {
> rtpproxy_offer("corwfii");
> } else if (isflagset(TPTY_INT)) {
> rtpproxy_offer("corfwie");
> } else if (isflagset(TPTY_EXT)) {
> dp_translate("2","$rU/$rU");
> xlog("Translated number to $rU");
> rtpproxy_offer("corfwii");
> }
>             }
> }
>
> This is my routing db:
>
> dr gateways
> +----+--------------+------+-----------------------+-------+------------+---------+------------+-------+--------+-----------------------+
> | id | gwid       | type | address       | strip | pri_prefix | attrs 
>   | probe_mode | state | socket | description       |
> +----+--------------+------+-----------------------+-------+------------+---------+------------+-------+--------+-----------------------+
> |  2 | BT_SDIN_BCTE |  2 | sip:xxx.xxx.xxx.xxx     |     0 | + 
>  | PROVIDER |        2 |     0 |        | PROVIDER1     |
> |  3 | BT_SDIN_GDH  |  2 | sip:xxx.xxx.xxx.xxx     |     0 | + 
>  | PROVIDER |        2 |     0 |  | PROVIDER2  |
> |  1 | BT_SDIN_LFH  |  2 | sip:xxx.xxx.xxx.xxx   |     0 | + 
>  | PROVIDER |        2 |     0 |  | PROVIDER3  |
> |  4 | BT_SDIN_SEH  |  2 | sip:xxx.xxx.xxx.xxx    |     0 | + 
>  | PROVIDER |        2 |     0 |  | PROVIDER4 |
> |  6 | PCIPAL1      |  3 | sip:xxx.xxx.xxx.xxx:3068  |     0 |      | 
> tp      |          2 | 0 |        | 3rd Party      |
> |  7 | PCIPAL2      |  3 | sip:xxx.xxx.xxx.xxx:3068 |     0 |      | 
> tp      |          2 | 0 |        | 3rd Party      |
> |  5 | TESTPBX1     |  1 | sip:xxx.xxx.xxx.xxx        |     5 | 0     
>      | pbx     |          2 |     0 |  | Asterisk PBX          |
> +----+--------------+------+-----------------------+-------+------------+---------+------------+-------+--------+-----------------------+
> dr groups
> dr carriers
> +----+---------------+--------------------------------------------------+-------+-------+-------+----------------------------+
> | id | carrierid     | gwlist | flags | state | attrs | description   
>          |
> +----+---------------+--------------------------------------------------+-------+-------+-------+----------------------------+
> |  1 | BT  | PROVIDER1, PROVIDER2, PROVIDER3, PROVIDER4 |     0 |     
> 0 |       | BT SDIN    |
> |  3 | PCIPAL        | PCIPAL1,PCIPAL2  |     0 |     0 |       | 3rd 
> Party           |
> |  4 | TestCustomer1 | TESTPBX1 |     0 |     0 |       | Test 
> Customer 1 (Asterisk) |
> +----+---------------+--------------------------------------------------+-------+-------+-------+----------------------------+
> dr rules
> +--------+---------+-----------------+---------+----------+---------+----------------+-------+---------------------+
> | ruleid | groupid | prefix          | timerec | priority | routeid | 
> gwlist         | attrs | description       |
> +--------+---------+-----------------+---------+----------+---------+----------------+-------+---------------------+
> |     14 | 0       | 427441423369030 |         |    0 |         | 
> #TestCustomer1 |       | Route to Asterisk   |
> |     19 | 0       | 441423369030  |         |    0 |         | 
> PCIPAL1        |       | PCIPAL            |
> |     29 | 0       | 724         |   |        0 |       | PCIPAL1     
>    |       | PCIPAL    |
> |     30 | 0       | 427         |   |        0 |       | #BT        | 
>       | PCIPAL    |
> |     22 | 1       |         |   |        0 |       | #BT        |     
>   | Default Route to BT |
> +--------+---------+-----------------+---------+----------+---------+----------------+-------+---------------------+
>
> -- 
> Mark Farmer
> farmorg at gmail.com <mailto:farmorg at gmail.com>
>
>
> _______________________________________________
> 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/20190329/9f842663/attachment-0001.html>


More information about the Users mailing list