<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix"><tt>Hi, Satish!</tt><tt><br>
      </tt><tt><br>
      </tt><tt>The problem is that in your route[3] you are not relaying
        the request. You just change the URI and exit. You should call
        t_relay() just before the exit statement.<br>
      </tt><tt></tt><tt><br>
      </tt><tt>Best regards,</tt><br>
      <pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
      On 08/21/2014 11:56 PM, Satish Patel wrote:<br>
    </div>
    <blockquote
cite="mid:CAPgF-fq-tj-Gpu_sa+VZ4me4dvsRRQWxuiYCrObiUn0RL9YrNQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>We have opensip running with multidomain
                  authentication, now we have purchases SIP trunk from
                  provide to send call to put side country (PSTN)<br>
                  <br>
                </div>
                They gave me Username/Password and IP address of their
                SIP server<br>
                <br>
              </div>
              I have did following configuration to configure my opensip
              as UAC<br>
              <br>
              #### Opensips UAC<br>
              loadmodule "uac_auth.so"<br>
              loadmodule "uac_registrant.so"<br>
              modparam("uac_registrant", "hash_size", 2)<br>
              modparam("uac_registrant", "timer_interval", 100)<br>
              modparam("uac_registrant", "db_url",
              "mysql://opensips:opensipsrw@localhost/opensips")<br>
              modparam("uac_registrant", "table_name", "registrant")<br>
              <br>
              <br>
            </div>
            My Opensip successfully register on their Trunk<br>
            <br>
            # opensipsctl registrant dump<br>
            AOR:: <a class="moz-txt-link-abbreviated" href="mailto:sip:testtrunk@65.xxx.xxx.xxx:5065">sip:testtrunk@65.xxx.xxx.xxx:5065</a> expires=300<br>
                    state:: REGISTERED_STATE<br>
                    last_register_sent:: Fri Aug 22 02:18:14 2014<br>
                    registration_t_out:: Fri Aug 22 02:21:35 2014<br>
                    registrar:: sip:65.xxx.xxx.xxx.xxx:5065<br>
                    binding:: <a class="moz-txt-link-abbreviated" href="mailto:sip:testtrunk@65.xxx.xxx.xxx:5065">sip:testtrunk@65.xxx.xxx.xxx:5065</a><br>
                    dst_IP:: IPv4 ip=xxx.xxx.xxx.xxx<br>
            <br>
            <br>
          </div>
          Now big question is how do i use this trunk in my routing
          script, After google i came up with following configuration
          but it is not working, It is not rewriting host part. <br>
          <br>
           # account only INVITEs<br>
                  if (is_method("INVITE")) {<br>
          <br>
                          setflag(ACC_DO); # do accounting<br>
                          $avp(can_uri) = $ru;<br>
                       <br>
                                };<br>
          <br>
                  }<br>
                  # PSTN Testing<br>
                  if  ( uri=~<a class="moz-txt-link-rfc2396E" href="mailto:^sip:16465352727@.*">"^sip:16465352727@.*"</a>) {<br>
                  route(3);<br>
                  exit;<br>
                  };<br>
          <br>
          ...<br>
          ...<br>
        </div>
        route[3] {<br>
        <br>
        if (method=="INVITE")<br>
         {<br>
          if (uri=~<a class="moz-txt-link-rfc2396E" href="mailto:^sip:16465352727@.*">"^sip:16465352727@.*"</a>) {<br>
        <br>
                rewritehostport("65.xxx.xxx.xxx:5065");<br>
                xlog("Redirecting to SIP Provider.. $ru\n");<br>
            exit;<br>
          };<br>
        };<br>
        }<br>
        <br>
        <div>
          <div><br>
          </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>