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

Mark Farmer farmorg at gmail.com
Thu Mar 28 12:31:35 EDT 2019


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20190328/281e305d/attachment.html>


More information about the Users mailing list