<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    <tt>Hi Ali,<br>
      <br>
      For profiling, use the GW ID - as value for the profile - (you can
      instruct DR to return the GW ID in an AVP) ; now, about the limit,
      use the "attrs" from GWs to keep it<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>
    <br>
    On 08/29/2012 07:35 PM, Ali Pey wrote:
    <blockquote
cite="mid:CA+q4kRKyX6LwPN7f4vN44ZLaH+GWKhfnWmO79aWku6y6cAA_wA@mail.gmail.com"
      type="cite">Hi Jeff,
      <div><br>
      </div>
      <div>Thank you for the reply but unfortunately this doesn't answer
        my questions. I need to bind this to the drouting module, so
        when I call do_routing, I need a parameter for
        set_dialog_profile for whatever gateway do_routing() picks. That
        was my first and second questions.</div>
      <div><br>
      </div>
      <div>Also in your case, where do you set $var(dlgsize_out)? where
        do you get it from? How would you change it? I don't want to
        have to change my script or restart opensips to change this.</div>
      <div><br>
      </div>
      <div>Regards,</div>
      <div>Ali Pey</div>
      <div><br>
      </div>
      <div><br>
        <div class="gmail_quote">On Wed, Aug 29, 2012 at 12:27 PM, Jeff
          Pyle <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:jpyle@fidelityvoice.com" target="_blank">jpyle@fidelityvoice.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            <div>Ali,</div>
            <div><br>
            </div>
            <div>Oops, I had some inconsistent rewrites. &nbsp;So much for
              improved readability. &nbsp;Consider this instead:</div>
            <div><br>
            </div>
            <div>
              <div><font face="courier new, monospace" size="1">&nbsp; &nbsp; &nbsp; &nbsp;
                  # Check to see if we're at maximum capacity for this
                  gateway</font></div>
              <div class="im">
                <div><font face="courier new, monospace" size="1">&nbsp; &nbsp; &nbsp;
                    &nbsp; if !(get_profile_size("outbound",
                    "$avp(s:dlgid_out)", "$var(dlgsize_out)")) {</font></div>
                <div><font face="courier new, monospace" size="1">&nbsp; &nbsp; &nbsp;
                    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xlog("L_INFO", "Couldn't get dialog size,
                    continuing route-out\n");</font></div>
                <div><font face="courier new, monospace" size="1">&nbsp; &nbsp; &nbsp;
                    &nbsp; } else {</font></div>
              </div>
              <div><font face="courier new, monospace" size="1">&nbsp; &nbsp; &nbsp; &nbsp;
                  &nbsp; &nbsp; &nbsp; &nbsp; if (is_avp_set("$avp(s:gw_maxcalls)")
                  &amp;&amp; $var(dlgsize_out) &gt;=
                  $avp(s:gw_maxcalls)) {</font></div>
              <div><font face="courier new, monospace" size="1">&nbsp; &nbsp; &nbsp; &nbsp;
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # We're full, so cycle around to the
                  next gateway...</font></div>
              <div><font face="courier new, monospace" size="1">&nbsp; &nbsp; &nbsp; &nbsp;
                  &nbsp; &nbsp; &nbsp; &nbsp; }</font></div>
              <div><font face="courier new, monospace" size="1">&nbsp; &nbsp; &nbsp; &nbsp;
                  }</font></div>
            </div>
            <div><br>
            </div>
            <div>That should make more sense.</div>
            <span class="HOEnZb"><font color="#888888">
                <div><br>
                </div>
                <div><br>
                </div>
                <div>- Jeff</div>
              </font></span>
            <div class="HOEnZb">
              <div class="h5">
                <div><br>
                </div>
                <br>
                <br>
                <br>
                <div class="gmail_quote">On Wed, Aug 29, 2012 at 12:24
                  PM, Jeff Pyle <span dir="ltr">&lt;<a
                      moz-do-not-send="true"
                      href="mailto:jpyle@fidelityvoice.com"
                      target="_blank">jpyle@fidelityvoice.com</a>&gt;</span>
                  wrote:<br>
                  <blockquote class="gmail_quote" style="margin: 0pt 0pt
                    0pt 0.8ex; border-left: 1px solid rgb(204, 204,
                    204); padding-left: 1ex;">
                    <div>Hi Ali,</div>
                    <div><br>
                    </div>
                    <div>I have the same application. &nbsp;A little before
                      the <font face="courier new, monospace">t_relay()</font>
                      to the gateway, I have:</div>
                    <div>
                      <div><br>
                      </div>
                      <div><font face="courier new, monospace" size="1">&nbsp;
                          &nbsp; &nbsp; &nbsp; # Check to see if we're at maximum
                          capacity</font></div>
                      <div><font face="courier new, monospace" size="1">&nbsp;
                          &nbsp; &nbsp; &nbsp; if !(get_profile_size("outbound",
                          "$avp(s:dlgid_out)", "$var(dlgsize_out)")) {</font></div>
                      <div><font face="courier new, monospace" size="1">&nbsp;
                          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xlog("L_INFO", "Couldn't get
                          dialog size, continuing route-out\n");</font></div>
                      <div><font face="courier new, monospace" size="1">&nbsp;
                          &nbsp; &nbsp; &nbsp; } else {</font></div>
                      <div><font face="courier new, monospace" size="1">&nbsp;
                          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if
                          (is_avp_set("$avp(s:gw_maxcalls)") &amp;&amp;
                          $var(dlgsize_out) &gt;= $avp(s:car_maxcalls))
                          {</font></div>
                      <div><font face="courier new, monospace" size="1">&nbsp;
                          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Move on to the next
                          carrier...</font></div>
                      <div><font face="courier new, monospace" size="1">&nbsp;
                          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</font></div>
                      <div><font face="courier new, monospace" size="1">&nbsp;
                          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</font></div>
                      <div><font face="courier new, monospace" size="1">&nbsp;
                          &nbsp; &nbsp; &nbsp; }</font></div>
                    </div>
                    <div><font face="courier new, monospace" size="1">&nbsp;
                        &nbsp; &nbsp; &nbsp; # Continue towards t_relay() for this
                        gateway...</font></div>
                    <div><br>
                    </div>
                    <div>This verifies our counts to make sure we have
                      room. &nbsp;If I'm at that value (or over) I cycle
                      around and select the next gateway. &nbsp;If all is
                      well I&nbsp;run&nbsp;<font face="courier new, monospace">set_dlg_profile("outbound",
                        "</font><span style="font-family: 'courier
                        new',monospace;">$avp(s:dlgid_out)</span><font
                        face="courier new, monospace">")</font>. &nbsp;Since
                      you're using drouting, perhaps you'll use another
                      variable here in place of&nbsp;<span
                        style="font-family: 'courier new',monospace;">$avp(s:dlgid_out)</span>.</div>
                    <div><br>
                    </div>
                    <div>I implement serial forking for my gateways. &nbsp;In
                      the selected failure_route I run&nbsp;<font
                        face="courier new, monospace">unset_dlg_profile("outbound",
                        "$avp(s:dlgid_out)")</font>. &nbsp;If I'm in this
                      section I know the call has failed, so I want to
                      remove its count from the profile.</div>
                    <div><br>
                    </div>
                    <div>This configure is old enough to be pre-drouting
                      but the concepts are still the same.</div>
                    <div><br>
                    </div>
                    <div>Is that helpful?</div>
                    <div><br>
                    </div>
                    <div><br>
                    </div>
                    <div>- Jeff</div>
                    <div><br>
                    </div>
                    <br>
                    <br>
                    <div class="gmail_quote">
                      <div>
                        <div>On Wed, Aug 29, 2012 at 11:53 AM, Ali Pey <span
                            dir="ltr">&lt;<a moz-do-not-send="true"
                              href="mailto:alipey@gmail.com"
                              target="_blank">alipey@gmail.com</a>&gt;</span>
                          wrote:<br>
                        </div>
                      </div>
                      <blockquote class="gmail_quote" style="margin: 0pt
                        0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
                        204, 204); padding-left: 1ex;">
                        <div>
                          <div>
                            Hi All,
                            <div><br>
                            </div>
                            <div>I would like to limit number of
                              concurrent calls to a gateway in
                              dr_gateways table (drouting module).</div>
                            <div><br>
                            </div>
                            <div>I have looked at the tutorial on the
                              opensips webiste (<a
                                moz-do-not-send="true"
                                href="http://www.opensips.org/Resources/DocsTutConcurrentCalls"
                                target="_blank">http://www.opensips.org/Resources/DocsTutConcurrentCalls</a>)
                              and this is not the same.&nbsp;</div>
                            <div><br>
                            </div>
                            <div>I do create a dialog and then I do
                              do_routing(). At this point I don't know:</div>
                            <div><br>
                            </div>
                            <div>1- What parameters to pass
                              to&nbsp;set_dlg_profile() to increase the
                              number of calls for whatever particular
                              gateway do_routing happened to select?</div>
                            <div><br>
                            </div>
                            <div>2- How to use&nbsp;get_profile_size() to see
                              if the gateway has reached it's maximum
                              number of channels?</div>
                            <div><br>
                            </div>
                            <div>3- Where would be the best place to
                              record and read the max number of channels
                              available for each gateway? some place
                              that I wouldn't need to do a db quey but I
                              would be able to make changes while
                              opensips is running similar to the
                              drouting module parameters itself.</div>
                            <div><br>
                            </div>
                            <div><br>
                            </div>
                            <div>Any help/suggestion would be
                              appreciated.</div>
                            <div><br>
                            </div>
                            <div>Thanks,</div>
                            <div>Ali Pey</div>
                            <div><br>
                            </div>
                            <br>
                          </div>
                        </div>
                        _______________________________________________<br>
                        Users mailing list<br>
                        <a moz-do-not-send="true"
                          href="mailto:Users@lists.opensips.org"
                          target="_blank">Users@lists.opensips.org</a><br>
                        <a moz-do-not-send="true"
                          href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
                          target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
                        <br>
                      </blockquote>
                    </div>
                    <br>
                  </blockquote>
                </div>
                <br>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            Users mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
              target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
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>
  </body>
</html>