<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Mark,<br>
    <br>
    When reporting an issue, one of the most important things to mention
    is what version and revision of OpenSIPS you use (opensips -V).<br>
    <br>
    Regards,<br>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
OpenSIPS Summit 2019
  <a class="moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2019Amsterdam/">https://www.opensips.org/events/Summit-2019Amsterdam/</a>
</pre>
    <div class="moz-cite-prefix">On 03/28/2019 06:31 PM, Mark Farmer
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOvQDetLvZ7bbz5oXFAGTKhv=4o=9MVvMATuWimfXv=egJ=eCQ@mail.gmail.com">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div dir="ltr">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div dir="ltr">
                        <div dir="ltr">
                          <div dir="ltr">
                            <div dir="ltr">
                              <div dir="ltr">
                                <div dir="ltr">
                                  <div dir="ltr">
                                    <div dir="ltr">
                                      <div dir="ltr">
                                        <div dir="ltr">
                                          <div dir="ltr">
                                            <div dir="ltr">
                                              <div dir="ltr">
                                                <div dir="ltr">Hi
                                                  everyone
                                                  <div><br>
                                                  </div>
                                                  <div>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?</div>
                                                  <div>The call does
                                                    ultimately route to
                                                    the correct gw so
                                                    it's just the
                                                    goes_to_gw() that is
                                                    misbehaving.</div>
                                                  <div><br>
                                                  </div>
                                                  <div>This is my route:</div>
                                                  <div><br>
                                                  </div>
                                                  <div>
                                                    <div>route[RTPPROXY]
                                                      {</div>
                                                    <div><br>
                                                    </div>
                                                    <div>        if
                                                      (is_method("BYE|CANCEL"))
                                                      {</div>
                                                    <div>               
rtpproxy_unforce();</div>
                                                    <div>        }</div>
                                                    <div><br>
                                                    </div>
                                                    <div>        if
                                                      (is_method("INVITE"))
                                                      {</div>
                                                    <div>               
                                                      xlog("Processing
                                                      INVITE $ru");</div>
                                                    <div>               
                                                      if
                                                      (is_from_gw("1"))
                                                      {</div>
                                                    <div>               
                                                             
                                                      xlog("Outbound
                                                      Call - Send to 3rd
                                                      Party...");</div>
                                                    <div>               
                                                             
                                                      setflag(INT_TPTY);</div>
                                                    <div>               
                                                      } else if
                                                      (is_from_gw("2"))
                                                      {</div>
                                                    <div>               
                                                             
                                                      xlog("Inbound Call
                                                      - Send to 3rd
                                                      Party...");</div>
                                                    <div>               
                                                             
                                                      setflag(EXT_TPTY);</div>
                                                    <div>               
                                                      } else if
                                                      (is_from_gw("3"))
                                                      {</div>
                                                    <div>               
                                                              xlog("Call
                                                      from 3rd Party.
                                                      Where is it
                                                      going?");</div>
                                                    <div>               
                                                                      if
                                                      (goes_to_gw("1"))
                                                      {</div>
                                                    <div>               
                                                                       
                                                            xlog("... to
                                                      Asterisk");</div>
                                                    <div>               
                                                                       
                                                           
                                                      setflag(TPTY_INT);</div>
                                                    <div>               
                                                                      }
                                                      else if
                                                      (goes_to_gw("2"))
                                                      {</div>
                                                    <div>               
                                                                       
                                                            xlog("... to
                                                      Provider");</div>
                                                    <div>               
                                                                       
                                                           
                                                      setflag(TPTY_EXT);</div>
                                                    <div>               
                                                                      }</div>
                                                    <div>               
                                                      }</div>
                                                    <div><br>
                                                    </div>
                                                    <div>        if
                                                      (isflagset(INT_TPTY))
                                                      {</div>
                                                    <div>               
                                                             
                                                      rtpproxy_offer("corwfei");</div>
                                                    <div>               
                                                      } else if
                                                      (isflagset(EXT_TPTY))
                                                      {</div>
                                                    <div>               
                                                             
                                                      rtpproxy_offer("corwfii");</div>
                                                    <div>               
                                                      } else if
                                                      (isflagset(TPTY_INT))
                                                      {</div>
                                                    <div>               
                                                             
                                                      rtpproxy_offer("corfwie");</div>
                                                    <div>               
                                                      } else if
                                                      (isflagset(TPTY_EXT))
                                                      {</div>
                                                    <div>               
                                                             
                                                      dp_translate("2","$rU/$rU");</div>
                                                    <div>               
                                                             
                                                      xlog("Translated
                                                      number to $rU");</div>
                                                    <div>               
                                                             
                                                      rtpproxy_offer("corfwii");</div>
                                                    <div>               
                                                      }</div>
                                                    <div>            }</div>
                                                    <div>}</div>
                                                    <div><br>
                                                    </div>
                                                    <div>This is my
                                                      routing db:</div>
                                                    <div><br>
                                                    </div>
                                                    <div>
                                                      <div>dr gateways</div>
                                                      <div>+----+--------------+------+-----------------------+-------+------------+---------+------------+-------+--------+-----------------------+</div>
                                                      <div>| id | gwid  
                                                              | type |
                                                        address        
                                                              | strip |
                                                        pri_prefix |
                                                        attrs   |
                                                        probe_mode |
                                                        state | socket |
                                                        description    
                                                              |</div>
                                                      <div>+----+--------------+------+-----------------------+-------+------------+---------+------------+-------+--------+-----------------------+</div>
                                                      <div>|  2 |
                                                        BT_SDIN_BCTE |  
                                                         2 |
                                                        <a class="moz-txt-link-freetext" href="sip:xxx.xxx.xxx.xxx">sip:xxx.xxx.xxx.xxx</a>
                                                            |     0 | +
                                                               
                                                         | PROVIDER |  
                                                               2 |     0
                                                        |        |
                                                        PROVIDER1      
                                                            |</div>
                                                      <div>|  3 |
                                                        BT_SDIN_GDH  |  
                                                         2 |
                                                        <a class="moz-txt-link-freetext" href="sip:xxx.xxx.xxx.xxx">sip:xxx.xxx.xxx.xxx</a>
                                                            |     0 | +
                                                               
                                                         | PROVIDER |  
                                                               2 |     0
                                                        |      
                                                         | PROVIDER2  
                                                         |</div>
                                                      <div>|  1 |
                                                        BT_SDIN_LFH  |  
                                                         2 |
                                                        <a class="moz-txt-link-freetext" href="sip:xxx.xxx.xxx.xxx">sip:xxx.xxx.xxx.xxx</a>
                                                          |     0 | +  
                                                             
                                                         | PROVIDER |  
                                                               2 |     0
                                                        |      
                                                         | PROVIDER3  |</div>
                                                      <div>|  4 |
                                                        BT_SDIN_SEH  |  
                                                         2 |
                                                        <a class="moz-txt-link-freetext" href="sip:xxx.xxx.xxx.xxx">sip:xxx.xxx.xxx.xxx</a>
                                                           |     0 | +  
                                                             
                                                         | PROVIDER |  
                                                               2 |     0
                                                        |      
                                                         | PROVIDER4 |</div>
                                                      <div>|  6 |
                                                        PCIPAL1      |  
                                                         3 |
                                                        <a class="moz-txt-link-freetext" href="sip:xxx.xxx.xxx.xxx:3068">sip:xxx.xxx.xxx.xxx:3068</a>
                                                         |     0 |      
                                                             | tp      |
                                                                 2 |    
                                                        0 |        | 3rd
                                                        Party          
                                                             |</div>
                                                      <div>|  7 |
                                                        PCIPAL2      |  
                                                         3 |
                                                        <a class="moz-txt-link-freetext" href="sip:xxx.xxx.xxx.xxx:3068">sip:xxx.xxx.xxx.xxx:3068</a>
                                                        |     0 |      
                                                             | tp      |
                                                                 2 |    
                                                        0 |        | 3rd
                                                        Party          
                                                             |</div>
                                                      <div>|  5 |
                                                        TESTPBX1     |  
                                                         1 |
                                                        <a class="moz-txt-link-freetext" href="sip:xxx.xxx.xxx.xxx">sip:xxx.xxx.xxx.xxx</a>
                                                               |     5 |
                                                        0          | pbx
                                                            |          2
                                                        |     0 |      
                                                         | Asterisk PBX
                                                                 |</div>
                                                      <div>+----+--------------+------+-----------------------+-------+------------+---------+------------+-------+--------+-----------------------+</div>
                                                      <div>dr groups</div>
                                                      <div>dr carriers</div>
                                                      <div>+----+---------------+--------------------------------------------------+-------+-------+-------+----------------------------+</div>
                                                      <div>| id |
                                                        carrierid     |
                                                        gwlist          
                                                                       
                                                                       
                                                        | flags | state
                                                        | attrs |
                                                        description    
                                                                   |</div>
                                                      <div>+----+---------------+--------------------------------------------------+-------+-------+-------+----------------------------+</div>
                                                      <div>|  1 | BT    
                                                             
                                                         | PROVIDER1, PROVIDER2, PROVIDER3, PROVIDER4 |
                                                            0 |     0 |
                                                              | BT SDIN
                                                                       
                                                           |</div>
                                                      <div>|  3 | PCIPAL
                                                               |
                                                        PCIPAL1,PCIPAL2
                                                                       
                                                                       
                                                         |     0 |     0
                                                        |       | 3rd
                                                        Party          
                                                                  |</div>
                                                      <div>|  4 |
                                                        TestCustomer1 |
                                                        TESTPBX1        
                                                                       
                                                                       
                                                        |     0 |     0
                                                        |       | Test
                                                        Customer 1
                                                        (Asterisk) |</div>
                                                      <div>+----+---------------+--------------------------------------------------+-------+-------+-------+----------------------------+</div>
                                                      <div>dr rules</div>
                                                      <div>+--------+---------+-----------------+---------+----------+---------+----------------+-------+---------------------+</div>
                                                      <div>| ruleid |
                                                        groupid | prefix
                                                                 |
                                                        timerec |
                                                        priority |
                                                        routeid | gwlist
                                                                | attrs
                                                        | description  
                                                              |</div>
                                                      <div>+--------+---------+-----------------+---------+----------+---------+----------------+-------+---------------------+</div>
                                                      <div>|     14 | 0
                                                              |
                                                        427441423369030
                                                        |         |    
                                                           0 |         |
                                                        #TestCustomer1 |
                                                              | Route to
                                                        Asterisk   |</div>
                                                      <div>|     19 | 0
                                                              |
                                                        441423369030  
                                                         |         |    
                                                           0 |         |
                                                        PCIPAL1        |
                                                              | PCIPAL  
                                                                   |</div>
                                                      <div>|     29 | 0
                                                              | 724    
                                                                |      
                                                          |        0 |  
                                                              | PCIPAL1
                                                               |       |
                                                        PCIPAL          
                                                           |</div>
                                                      <div>|     30 | 0
                                                              | 427    
                                                                |      
                                                          |        0 |  
                                                              | #BT    
                                                               |       |
                                                        PCIPAL          
                                                           |</div>
                                                      <div>|     22 | 1
                                                              |        
                                                                |      
                                                          |        0 |  
                                                              | #BT    
                                                               |       |
                                                        Default Route to
                                                        BT |</div>
                                                      <div>+--------+---------+-----------------+---------+----------+---------+----------------+-------+---------------------+</div>
                                                    </div>
                                                    <div><br>
                                                    </div>
                                                    -- <br>
                                                    <div dir="ltr"
                                                      class="gmail_signature">Mark
                                                      Farmer<br>
                                                      <a
                                                        href="mailto:farmorg@gmail.com"
                                                        target="_blank"
moz-do-not-send="true">farmorg@gmail.com</a></div>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>