<p dir="ltr">Bogdan I was in middle of replying about the exit and you took the words out of my mouth :-)</p>
<div class="gmail_quote">On Jul 15, 2014 12:26 PM, &quot;Bogdan-Andrei Iancu&quot; &lt;<a href="mailto:bogdan@opensips.org">bogdan@opensips.org</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div><tt>Because you need to have an &quot;exit;&quot;
        after the sl_send_reply():<br>
        <br>
      </tt><br>
                      if ($stat(active_dialogs)&gt;=1){<br>
                      sl_send_reply(&quot;503&quot;, &quot;Service Unavailable&quot;);<br>
                 <b>    exit;</b><br>
                      }<br>
      <br>
      Otherwise the script execution will continue.<br>
      <br>
      Regards,<br>
      <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
      On 15.07.2014 12:19, jing wrote:<br>
    </div>
    <blockquote type="cite">
      <div>hi,Bogdan.</div>
      <div> </div>
      <div>I just want to limit the total number of active dialog. And
        now I have 2 questions .</div>
      <div> </div>
      <div>I changed the script like this:</div>
      <div> </div>
      <div>if (is_method(&quot;INVITE&quot;)) {<br>
                        xlog(&quot;active dialog is $stat(active_dialogs)&quot;);<br>
                        xlog(&quot;dlgcount is $DLG_count&quot;);<br>
                        if ($stat(active_dialogs)&gt;=1){<br>
                        sl_send_reply(&quot;503&quot;, &quot;Service Unavailable&quot;);<br>
        <br>
                        }<br>
                        # create dialog with timeout<br>
                        if ( !create_dialog(&quot;B&quot;) ) {<br>
                                send_reply(&quot;500&quot;,&quot;Internal Server
        Error&quot;);<br>
                                exit;<br>
                        }</div>
      <div>                setflag(ACC_DO); # do accounting<br>
                }<br>
      </div>
      <div>Then I started 3 dialog, they were all successful , but no
        503 sent. The log showed:</div>
      <div>
        <div>active dialog is 2<br>
          dlgcount is 2</div>
      </div>
      <div> </div>
      <div>I used opensipsctl fifo command to show the dialog
        statistics, it showed </div>
      <div>dialog:active_dialogs = 3.</div>
      <div>1.what is wrong in my script ?</div>
      <div>2. How to end the dialogs which have been active long time
        ,but have no response.</div>
      <div> </div>
      <div>Or is there other way to limit the total number of active
        dialog?</div>
      <div> </div>
      <div>I am a newbie to opensips,  would you please tell me more
        detailed advice?</div>
      <div>Very thanks!</div>
      <div>kind regards</div>
      <div> </div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div style="font-size:12px;font-family:Arial Narrow;padding:2px 0 2px 0">------------------ 原始邮件 ------------------</div>
      <div style="font-size:12px;background:#efefef;padding:8px">
        <div><b>发件人:</b> &quot;Bogdan-Andrei
          Iancu&quot;<a href="mailto:bogdan@opensips.org" target="_blank">&lt;bogdan@opensips.org&gt;</a>; </div>
        <div><b>发送时间:</b> 2014年7月15日(星期二) 下午4:43</div>
        <div><b>收件人:</b> &quot;users&quot;<a href="mailto:users@lists.opensips.org" target="_blank">&lt;users@lists.opensips.org&gt;</a>; &quot;jing
          &quot;<a href="mailto:605507247@qq.com" target="_blank">&lt;605507247@qq.com&gt;</a>; </div>
        <div><b>主题:</b> Re: [OpenSIPS-Users] 回复: 回复: Dialog Concurrency
          Control Issue.</div>
      </div>
      <div><br>
      </div>
      <div><tt>Hi,<br>
          <br>
          I see you added the missing &quot;exit&quot; after the sl_send_reply()
          and you do create the dialog for each INVITE (hopefully only
          for the initial ones :) ). <br>
          <br>
          What seems to be the exact problem now ?<br>
          <br>
          Regards,<br>
        </tt>
        <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
        On 15.07.2014 05:21, jing wrote:<br>
      </div>
      <blockquote type="cite">
        <div>hi,Schneur.</div>
        <div>Thanks for your advice.</div>
        <div>But I did put the check before  create_dialog(&quot;B&quot;)  in the
          original oprnsips.cfg:</div>
        <div> </div>
        <div>if (is_method(&quot;INVITE&quot;)) {<br>
                          xlog(&quot;active dialog is
          $stat(active_dialogs)&quot;);</div>
        <div>                if ($stat(active_dialogs)&gt;=1){<br>
                          sl_send_reply(&quot;503&quot;, &quot;Service Unavailable&quot;);<br>
                          exit;<br>
                          }<br>
                          # create dialog with timeout<br>
                          if ( !create_dialog(&quot;B&quot;) ) {<br>
                                  send_reply(&quot;500&quot;,&quot;Internal Server
          Error&quot;);<br>
                                  exit;<br>
                          }</div>
        <div>                setflag(ACC_DO); # do accounting<br>
                  }</div>
        <div> </div>
        <div>
          <div><br>
          </div>
          <div>So what is wrong in the script?</div>
          <div>And I still want to know how to judge a call is
            &quot;active_dialogs&quot;?</div>
          <div>Thanks a lot.</div>
          <div> </div>
          <div>regards,</div>
          <div>jing<br>
          </div>
          <div style="PADDING-BOTTOM:2px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT-FAMILY:Arial Narrow;FONT-SIZE:12px;PADDING-TOP:2px">------------------ 原始邮
            件 ------------------</div>
          <div style="PADDING-BOTTOM:8px;PADDING-LEFT:8px;PADDING-RIGHT:8px;BACKGROUND:#efefef;FONT-SIZE:12px;PADDING-TOP:8px">
            <div><b>发件人:</b> &quot;Schneur Rosenberg&quot;;<a href="mailto:rosenberg11219@gmail.com" target="_blank">&lt;rosenberg11219@gmail.com&gt;</a>;</div>
            <div><b>发送时间:</b> 2014年7月14日(星期一) 晚上6:25</div>
            <div><b>收件人:</b> &quot;OpenSIPS users mailling list&quot;<a href="mailto:users@lists.opensips.org" target="_blank">&lt;users@lists.opensips.org&gt;</a>;
              <u></u></div>
            <div><b>主题:</b> Re: [OpenSIPS-Users]回复: Dialog Concurrency
              Control Issue.</div>
          </div>
          <div><br>
          </div>
          <p dir="ltr">You need to do this before the create_dialog()
            call</p>
          <div class="gmail_quote">On Jul 14, 2014 10:33 AM, &quot;jing&quot; &lt;<a href="mailto:605507247@qq.com" target="_blank">605507247@qq.com</a>&gt; wrote:<br type="attribution">
            <blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
              <div><font color="#000000">Thanks for your reply.But I
                  have another question, I used  active_dialogs </font><font color="#000000"> in the cfg file as this:</font></div>
              <div> </div>
              <div><font color="#000000">if (is_method(&quot;INVITE&quot;)) {<br>
                                  if ($stat(active_dialogs)&gt;=1){<br>
                                  sl_send_reply(&quot;503&quot;, &quot;Service
                  Unavailable&quot;);<br>
                                  }<br>
                </font></div>
              <div><font color="#000000">
                  <div><font color="#000000">But it seems not right. </font></div>
                  <div><font color="#000000">I use sipp to test the
                      limit ,but when the value of active_dialogs</font><font color="#000000"> aim to the number I set ,</font></div>
                  <div><font color="#000000">opensips sent 503,but  the
                      value of active_dialogs<font color="#000000"> </font>sitll
                      increase. </font></div>
                  <div><font color="#000000">So I want to know how the
                      value of this paramer come</font><font color="#000000">from.</font></div>
                  <div><font color="#000000">Or is there something wrong
                      in my cfg document?</font></div>
                  <div> </div>
                  <div>regards,</div>
                  <div>Jing</div>
                </font></div>
              <div><br>
              </div>
              <div><br>
              </div>
              <div style="PADDING-BOTTOM:2px;PADDING-LEFT:0px;PADDING-RIGHT:0px;FONT-FAMILY:Arial Narrow;FONT-SIZE:12px;PADDING-TOP:2px">------------------ 原始
                邮 件 ------------------</div>
              <div style="PADDING-BOTTOM:8px;PADDING-LEFT:8px;PADDING-RIGHT:8px;BACKGROUND:#efefef;FONT-SIZE:12px;PADDING-TOP:8px">
                <div><b>发件人:</b> &quot;Schneur Rosenberg [via OpenSIPS (Open
                  SIP Server)]&quot;&lt;<a href="http://user/SendEmail.jtp?type=node&amp;node=7592371&amp;i=0" rel="nofollow" link="external" target="_blank">[hidden
                    email]</a>&gt;; </div>
                <div><b>发送时间:</b> 2014年7月14日(星期一) 下午2:08</div>
                <div><b>收件人:</b> &quot;jing &quot;&lt;<a href="http://user/SendEmail.jtp?type=node&amp;node=7592371&amp;i=1" rel="nofollow" link="external" target="_blank">[hidden
                    email]</a>&gt;; </div>
                <div><b>主题:</b> Re: Dialog Concurrency Control Issue.</div>
              </div>
              <div><br>
              </div>
              <p dir="ltr">Very simple, before creating a new dialog
                check how many open dialogs exist.</p>
              <div class="gmail_quote">On Jul 14, 2014 9:05 AM, &quot;jing&quot;
                &lt;<a href="http://user/SendEmail.jtp?type=node&amp;node=7592369&amp;i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>&gt; wrote:<br type="attribution">
                <blockquote style="BORDER-LEFT:#cccccc 2px solid;PADDING-BOTTOM:0px;PADDING-LEFT:1em;PADDING-RIGHT:1em;PADDING-TOP:0px" class="gmail_quote">hi,Bogdan<br>
                  <br>
                  <br>
                   I want to limit the total number of active dialogs
                  ,what should I do ?<br>
                  <br>
                  I found there are many questions about &quot;Concurrent
                  calls limitation &quot; based<br>
                  on per user, it&#39;s not what I need.<br>
                  <br>
                  I appreciate your advice very much,  more detailed the
                  better.<br>
                  <br>
                  Thanks,<br>
                  Regards,<br>
                  jing<br>
                  <br>
                  <br>
                  <br>
                  --<br>
                  View this message in context: <a href="http://opensips-open-sip-server.1449251.n2.nabble.com/Dialog-Concurrency-Control-Issue-tp6172931p7592368.html" rel="nofollow" link="external" target="_blank">http://opensips-open-sip-server.1449251.n2.nabble.com/Dialog-Concurrency-Control-Issue-tp6172931p7592368.html</a><br>

                  Sent from the OpenSIPS - Users mailing list archive at
                  Nabble.com.<br>
                  <br>
                  _______________________________________________<br>
                  Users mailing list<br>
                  <a href="http://user/SendEmail.jtp?type=node&amp;node=7592369&amp;i=1" rel="nofollow" link="external" target="_blank">[hidden
                    email]</a><br>
                  <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="nofollow" link="external" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
                </blockquote>
              </div>
              <br>
              _______________________________________________ <br>
              Users mailing list <br>
              <a href="http://user/SendEmail.jtp?type=node&amp;node=7592369&amp;i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a> <br>
              <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="nofollow" link="external" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
              <br>
              <br>
              <hr color="#cccccc" noshade size="1">
              <div style="FONT:12px tahoma,geneva,helvetica,arial,sans-serif;COLOR:#444">
                <div style="FONT-WEIGHT:bold">If you reply to this
                  email, your message will be added to the discussion
                  below:</div>
                <a href="http://opensips-open-sip-server.1449251.n2.nabble.com/Dialog-Concurrency-Control-Issue-tp6172931p7592369.html" rel="nofollow" link="external" target="_blank">http://opensips-open-sip-server.1449251.n2.nabble.com/Dialog-Concurrency-Control-Issue-tp6172931p7592369.html</a>
              </div>
              <div style="MARGIN-TOP:0.4em;FONT:11px/1.5em tahoma,geneva,helvetica,arial,sans-serif;COLOR:#666">To
                unsubscribe from Dialog Concurrency Control Issue., <a rel="nofollow" link="external">click
                  here</a>.<br>
                <a style="FONT:9px serif" href="http://opensips-open-sip-server.1449251.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" link="external" target="_blank">NAML</a> </div>

              <br>
              <hr align="left" width="300">
              View this message in context: <a href="http://opensips-open-sip-server.1449251.n2.nabble.com/Dialog-Concurrency-Control-Issue-tp7592371.html" target="_blank">回复: Dialog
                Concurrency Control Issue.</a><br>
              Sent from the <a href="http://opensips-open-sip-server.1449251.n2.nabble.com/OpenSIPS-Users-f1449235.html" target="_blank">OpenSIPS - Users
                mailing list archive</a> at Nabble.com.<br>
              <br>
              _______________________________________________<br>
              Users mailing list<br>
              <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
              <a 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>
        </div>
        <br>
        <fieldset></fieldset>
        <br>
        <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a 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>