<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>I'm glad you managed to solve the problem.<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 21.01.2016 18:50, Rodrigo Pimenta
      Carvalho wrote:<br>
    </div>
    <blockquote
cite="mid:BY2PR02MB16551A67C7076C71D5A0EB76B5C30@BY2PR02MB1655.namprd02.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
        <p>Hi Bogdan-Andrei.</p>
        <p><br>
        </p>
        <p>Now everything is Ok! I have followed your instructions and I
          got my system working very well.</p>
        <p>The configuration I'm using now is:</p>
        <p><br>
        </p>
        <p>a) no Alias in cfg file</p>
        <p>b) executed command: opensipsctl domain add &lt;mydomain&gt;</p>
        <p>c) in cfg file, for route, I put:</p>
        <p><br>
        </p>
        <p>             avp_db_query("select domain from domain",
          "$avp(DOMAIN)");        #table domain will never has more than
          1 domain.<br>
                       set_advertised_address("$avp(DOMAIN)");<br>
        </p>
        <p><br>
        </p>
        <p>If you see any problem in my idea, comment, please.</p>
        <p>Thank you very much for help me!<br>
        </p>
        <p>Best regards.<br>
        </p>
        <p><br>
        </p>
        <p><br>
        </p>
        <div id="Signature">
          <div name="divtagdefaultwrapper"
            style="font-family:Calibri,Arial,Helvetica,sans-serif;
            font-size:; margin:0">
            <div class="BodyFragment"><font size="2">
                <div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
                  Inatel Competence Center - BRAZIL<br>
                  Software<br>
                  Ph: +55 35 3471 9200 RAMAL 979<br>
                </div>
              </font></div>
          </div>
        </div>
        <br>
        <br>
        <div style="color: rgb(0, 0, 0);">
          <hr tabindex="-1" style="display:inline-block; width:98%">
          <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
              face="Calibri, sans-serif" color="#000000"><b>De:</b>
              Bogdan-Andrei Iancu <a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org">&lt;bogdan@opensips.org&gt;</a><br>
              <b>Enviado:</b> quinta-feira, 21 de janeiro de 2016 08:54<br>
              <b>Para:</b> Rodrigo Pimenta Carvalho;
              <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
              <b>Assunto:</b> Re: [OpenSIPS-Users] Is there some way to
              set Alias at execution time (dinamically)?</font>
            <div> </div>
          </div>
          <div><tt>Hi Rodrigo,<br>
              <br>
              To make things simpler to explain : when you use
              advertised_address, basically you add a new SIP domain to
              your server (the external IP you are advertising). In a
              static setup, you can do the trick by using the alias
              global param (to add a new SIP domain to be handled by
              OpenSIPS). If you want to handle SIP domains in a dynamic
              way, use the domain module.<br>
              So, even from users perspective you have a single SIP
              domain, because of the advertise you actually do create a
              new SIP domain you need to handle (recognize) in script.<br>
              <br>
              Regards,<br>
            </tt>
            <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" id="LPlnk797300" class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
            <div style="margin-bottom: 20px; overflow: auto; width:
              100%; text-indent: 0px;"
              id="LPBorder_GT_14533946174230.7010785678445716">
              <table style="width: 90%; background-color: rgb(255, 255,
                255); position: relative; overflow: auto; padding-top:
                20px; padding-bottom: 20px; margin-top: 20px;
                border-top: 1px dotted rgb(200, 200, 200);
                border-bottom: 1px dotted rgb(200, 200, 200);"
                id="LPContainer_14533946174190.13474521111079607"
                cellspacing="0">
                <tbody>
                  <tr style="border-spacing: 0px;" valign="top">
                    <td colspan="1" style="width: 250px; position:
                      relative; display: table-cell; padding-right:
                      20px;"
                      id="ImageCell_14533946174200.9095369639173565">
                      <div style="background-color: rgb(255, 255, 255);
                        height: 0px; position: relative; margin: auto;
                        display: table; width: 0px;"
                        id="LPImageContainer_14533946174200.492938536276171">
                        <a moz-do-not-send="true" target="_blank"
                          href="http://www.opensips-solutions.com/"
                          style="display: table-cell; text-align:
                          center;"
                          id="LPImageAnchor_14533946174200.6598743593429524"><img
                            moz-do-not-send="true" aria-label="Imagem de
                            visualização com link selecionado. Toque
                            duas vezes para abrir o link."
                            style="display: inline-block; margin-left:
                            auto; margin-right: auto; max-width: 250px;
                            max-height: 250px; height: 38px; width:
                            116px; border-width: 0px; vertical-align:
                            bottom;"
                            src="http://www.opensips-solutions.com/imgs/opensips-solutions-logo.gif"
                            height="38" width="116"></a></div>
                    </td>
                    <td colspan="2" style="vertical-align: top;
                      position: relative; padding: 0px; display:
                      table-cell;"
                      id="TextCell_14533946174210.30652424767922815">
                      <div style="top: 0px; color: rgb(0, 120, 215);
                        font-weight: 400; font-size: 21px; font-family:
                        &quot;wf_segoe-ui_light&quot;,&quot;Segoe UI
                        Light&quot;,&quot;Segoe WP
                        Light&quot;,&quot;Segoe UI&quot;,&quot;Segoe
                        WP&quot;,Tahoma,Arial,sans-serif; line-height:
                        21px;"
                        id="LPTitle_14533946174210.017936385686220357">
                        <a moz-do-not-send="true" target="_blank"
                          href="http://www.opensips-solutions.com/"
                          style="text-decoration: none;"
                          id="LPUrlAnchor_14533946174220.6205082846873009">Home
                          — OpenSIPS Solutions</a></div>
                      <div style="margin: 10px 0px 16px; color: rgb(102,
                        102, 102); font-weight: 400; font-family:
                        &quot;wf_segoe-ui_normal&quot;,&quot;Segoe
                        UI&quot;,&quot;Segoe
                        WP&quot;,Tahoma,Arial,sans-serif; font-size:
                        14px; line-height: 14px;"
                        id="LPMetadata_14533946174220.7892857975048514">
                        <a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></div>
                      <div style="display: block; color: rgb(102, 102,
                        102); font-weight: 400; font-family:
                        &quot;wf_segoe-ui_normal&quot;,&quot;Segoe
                        UI&quot;,&quot;Segoe
                        WP&quot;,Tahoma,Arial,sans-serif; font-size:
                        14px; line-height: 20px; max-height: 100px;
                        overflow: hidden;"
                        id="LPDescription_14533946174220.512808226954213">
                        OpenSIPS is a mature Open Source implementation
                        of a SIP server. OpenSIPS is more than a SIP
                        proxy/router as it includes application-level
                        functionalities.</div>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="moz-cite-prefix">On 20.01.2016 19:31, Rodrigo
              Pimenta Carvalho wrote:<br>
            </div>
            <blockquote type="cite">
              <div id="divtagdefaultwrapper" style="font-size:12pt;
                color:#000000; background-color:#FFFFFF;
                font-family:Calibri,Arial,Helvetica,sans-serif">
                <p>Hi Bogdan-Andrei.</p>
                <p><br>
                </p>
                <p>I have just studied the Domain Module. But I still
                  wasn't able to visualize how it can help me.
                  <br>
                </p>
                <p>According to the documentation: "Domain module
                  implements checks that based on domain table determine
                  if a host part of an
                  <acronym class="acronym">URI</acronym> is “<span
                    class="quote">local</span>” or not. A “<span
                    class="quote">local</span>” domain is one that the
                  proxy is responsible for. "<br>
                </p>
                <p>However, in my project there will be always only one
                  proxy and only one domain. Every sip client will be
                  part of the same unique domain and the unique proxy
                  must be responsible for every message it receives. So,
                  the proxy doesn't have to check if a host part of an <acronym
                    class="acronym">URI</acronym> is “<span
                    class="quote">local</span>” or not.  For my project,
                  it must be always considered as local. In this case,
                  my proxy have to handle every message as responsible
                  for it.</p>
                <p><br>
                </p>
                <p>So, I have the following doubts:</p>
                <p>1 - If I use Domain module and just put that unique
                  domain in the domain table, will it be enough to make
                  OpenSIPS handle every message as being responsible for
                  it? That is, will OpenSIPS automatically become
                  responsible for messages with host part of an
                  <acronym class="acronym">URI equals to domain in
                    database?<br>
                  </acronym></p>
                <p><br>
                </p>
                <p>2 - If the answer for (1) is no (and I guess so), is
                  there a way to force OpenSIPS handle ACK messages as
                  being responsible for it? ( I have cases when RR
                  header field has the proxy's domain, which translate
                  to a public IP and it makes the OpenSIPS consider
                  itself not responsible for the ACK messages. Just when
                  RR has a local IP the OpenSIPS considers itself as
                  responsible.).</p>
                <p><br>
                </p>
                <p>3 - If the answer for (2) is no, should I change the
                  Route header fields of ACK messages (maybe removing
                  that one with public address), to force OpenSIPS be
                  responsible for the messages?</p>
                <p><br>
                </p>
                <p>4 - If the answer for (3) is no, should the client
                  invert the order of RR header fields, so that the
                  proxy will consider first the one with local address
                  and then will become responsible for it? (I have cases
                  when RR has 2 addresses, one local and one public)<br>
                </p>
                <p><br>
                </p>
                <p>Until now, the workaround was the use of Alias, as
                  you tell me to do. But, as long as I can't continue
                  using a static Alias, I have to abandon this.</p>
                <p><br>
                </p>
                <p>Sorry the big message.<br>
                </p>
                <p>Any hint will be very helpful!</p>
                <p><br>
                </p>
                <p>Best regards.</p>
                <br>
                <p><br>
                </p>
                <p><br>
                </p>
                <p><br>
                </p>
                <div id="Signature">
                  <div name="divtagdefaultwrapper"
                    style="font-family:Calibri,Arial,Helvetica,sans-serif;
                    font-size:; margin:0">
                    <div class="BodyFragment"><font size="2">
                        <div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
                          Inatel Competence Center<br>
                          Software<br>
                          Ph: +55 35 3471 9200 RAMAL 979<br>
                        </div>
                      </font></div>
                  </div>
                </div>
                <br>
                <br>
                <div style="color:rgb(0,0,0)">
                  <hr tabindex="-1" style="display:inline-block;
                    width:98%">
                  <div id="divRplyFwdMsg" dir="ltr"><font
                      style="font-size:11pt" face="Calibri, sans-serif"
                      color="#000000"><b>De:</b> Bogdan-Andrei Iancu
                      <a moz-do-not-send="true"
                        class="moz-txt-link-rfc2396E"
                        href="mailto:bogdan@opensips.org">&lt;bogdan@opensips.org&gt;</a><br>
                      <b>Enviado:</b> quarta-feira, 20 de janeiro de
                      2016 10:31<br>
                      <b>Para:</b> OpenSIPS users mailling list; Rodrigo
                      Pimenta Carvalho<br>
                      <b>Assunto:</b> Re: [OpenSIPS-Users] Is there some
                      way to set Alias at execution time (dinamically)?</font>
                    <div> </div>
                  </div>
                  <div><tt>Hi Rodrigo,<br>
                      <br>
                      Use the domain module to list aliases via DB ; and
                      in your script, where you have the "myself" checks
                      use one of the functions from domain module:<br>
                          is_from_local() or is uri_host_local()<br>
                      See:<br>
                          <a moz-do-not-send="true" id="LPlnk898729"
                        class="moz-txt-link-freetext"
                        href="http://www.opensips.org/html/docs/modules/2.1.x/domain.html">
http://www.opensips.org/html/docs/modules/2.1.x/domain.html</a>
                      <div
                        id="LPBorder_GT_14533074180110.8773049302280456"
                        style="margin-bottom:20px; overflow:auto;
                        width:100%" contenteditable="false">
                        <table
                          id="LPContainer_14533074180080.9957093388013678"
                          style="width:90%;
                          background-color:rgb(255,255,255);
                          overflow:auto; padding-top:20px;
                          padding-bottom:20px; margin-top:20px;
                          border-top:1px dotted rgb(200,200,200);
                          border-bottom:1px dotted rgb(200,200,200)"
                          cellspacing="0">
                          <tbody>
                            <tr style="border-spacing:0px" valign="top">
                              <td colspan="2"
                                id="TextCell_14533074180090.8374626661230697"
                                style="vertical-align:top; padding:0px;
                                display:table-cell">
                                <div
                                  id="LPTitle_14533074180100.5716380813701942"
                                  style=""><a moz-do-not-send="true"
                                    target="_blank"
                                    href="http://www.opensips.org/html/docs/modules/2.1.x/domain.html"
id="LPUrlAnchor_14533074180100.9772243916983772"
                                    style="text-decoration:none">Domain
                                    Module - OpenSIPS</a></div>
                                <div
                                  id="LPMetadata_14533074180100.35111165357035046"
                                  style=""><a moz-do-not-send="true"
                                    class="moz-txt-link-abbreviated"
                                    href="http://www.opensips.org">www.opensips.org</a></div>
                                <div
                                  id="LPDescription_14533074180110.17547328012074004"
                                  style="">Domain module implements
                                  checks that based on domain table
                                  determine if a host part of an URI is
                                  “ local ” or not. A “ local ” domain
                                  is one that the proxy is ...</div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <br>
                      <br>
                      Regards,<br>
                    </tt>
                    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
                    <div class="moz-cite-prefix">On 19.01.2016 20:00,
                      Rodrigo Pimenta Carvalho wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <div id="divtagdefaultwrapper"
                        style="font-size:12pt; color:#000000;
                        background-color:#FFFFFF;
                        font-family:Calibri,Arial,Helvetica,sans-serif">
                        <p>Dear OpenSIPS-users,</p>
                        <p><br>
                        </p>
                        <p>I have used the global parameter Alias
                          successful. The same for advertised_address. </p>
                        <p><br>
                        </p>
                        <p>Now, I have to configure these values at
                          execution time. Such values will be determined
                          just after starting my system. So, I need a
                          way to configure these values in a dynamic
                          way.<br>
                        </p>
                        <p><br>
                        </p>
                        <p>Then, I will use the core function
                          set_advertised_address.</p>
                        <p>But, I did not find a core function to set
                          the Alias at execution time?</p>
                        <p><br>
                        </p>
                        <p>Is there a way to set Alias at execution
                          time? Is there a function for that or can I
                          set Alias with a database query. Ex: Alias =
                          select from....</p>
                        <p><br>
                        </p>
                        <p>Any hint will be very helpful!  </p>
                        <p><br>
                        </p>
                        <p>Best regards.<br>
                        </p>
                        <p><br>
                        </p>
                        <div id="Signature">
                          <div name="divtagdefaultwrapper"
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:; margin:0">
                            <div class="BodyFragment"><font size="2">
                                <div class="PlainText">RODRIGO PIMENTA
                                  CARVALHO<br>
                                  Inatel Competence Center<br>
                                  Software<br>
                                  Ph: +55 35 3471 9200 RAMAL 979<br>
                                </div>
                              </font></div>
                          </div>
                        </div>
                      </div>
                      <br>
                      <fieldset class="mimeAttachmentHeader"></fieldset>
                      <br>
                      <pre>_______________________________________________
Users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a moz-do-not-send="true" 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>
                  </div>
                </div>
              </div>
            </blockquote>
            <br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>