<div dir="ltr"><div>Hi Bogdan</div><div><br></div>That&#39;s great, it will help a lot.<div><br></div><div>Thanks</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 19, 2016 at 6:45 AM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Hi Daniel,<br>
    <br>
    The terminate_dlg() function is exclusively used via the dialog API
    (it is not internally used by the dialog module).<br>
    <br>
    The only module that uses the function via the dialog API is the
    rtpproxy module, which is testing the return code in a convenient
    way ( &lt; 0 -&gt; error).<br>
    <br>
    So, returning 1 (instead of 0) for dialog not found should not break
    anything right now.<span class=""><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>
    </span><div><div class="h5"><div>On 15.07.2016 19:59, Daniel Zanutti
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Actually I did register to receive the dialog
        callback and it&#39;s working fine.
        <div><br>
        </div>
        <div>The problem happens when I receive a 200 OK of the Invite,
          simultaneously with BYE. On BYE i delete the call from my
          controls, then process the 200 OK, dialog has all info of the
          call and I load it back. I&#39;m not sure if it&#39;s a bug but the
          fact is that I need to check if dialog still exist.</div>
        <div><br>
        </div>
        <div>Will it embarrass so much the system to return a different
          positive value?</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, Jul 15, 2016 at 12:48 PM,
          Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@opensips.org" target="_blank"></a><a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;</span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF"> <tt>Hi,<br>
                <br>
                Why don&#39;t you register dialog callback to get notified
                when the call is terminated ? in this case, the dialog
                module will trigger you if a call gets terminated
                (expired or bye&#39;ed)<br>
                <br>
                Regards,<br>
              </tt><span>
                <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>
              </span>
              <div>
                <div>
                  <div>On 15.07.2016 17:58, Daniel Zanutti wrote:<br>
                  </div>
                  <blockquote type="cite">
                    <div dir="ltr">Hi Bogdan
                      <div><br>
                      </div>
                      <div>I developed a billing mecanism to control how
                        long calls can last, so I need to keep tracking
                        all calls until they hangup. Every X seconds, I
                        check all calls on Opensips and hangup some of
                        them if necessary.</div>
                      <div><br>
                      </div>
                      <div>For some reason (maybe a bug), some random
                        calls (1 in a 1M or more) still exist in my
                        mecanism after call is hangup, so I try to
                        hangup this call using terminate_dlg() and wait
                        until I receive a trigger from dialog module,
                        confirming that it is finalized. In fact, I
                        never receive the trigger from dialog module,
                        because the call no longer exist and I have no
                        way to check this.</div>
                      <div><br>
                      </div>
                      <div>I think just changing the terminate_dlg
                        function to return any number that identifies
                        this dialog is no longer valid, it&#39;s OK to me
                        and I can remove this call from my structure. A
                        possibility to check if call is UP would be even
                        better.</div>
                      <div><br>
                      </div>
                      <div>What do you think can be done?</div>
                      <div><br>
                      </div>
                      <div>Thanks for responding.</div>
                      <div><br>
                      </div>
                    </div>
                    <div class="gmail_extra"><br>
                      <div class="gmail_quote">On Thu, Jul 14, 2016 at
                        1:18 PM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@opensips.org" target="_blank"></a><a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;</span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                          <div text="#000000" bgcolor="#FFFFFF"> <tt>Hi
                              Daniel,<br>
                              <br>
                              Indeed, there is none. Why is so important
                              to know if the dialog really existed ? you
                              want to know if it was terminated by YOU
                              and not by something else prior to your
                              terminate_dlg() ?<br>
                              <br>
                              We may consider returning a different
                              positive code if no dialog was found.<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>
                            <div>
                              <div>
                                <div>On 13.07.2016 21:21, Daniel Zanutti
                                  wrote:<br>
                                </div>
                              </div>
                            </div>
                            <blockquote type="cite">
                              <div>
                                <div>
                                  <div dir="ltr">Hi
                                    <div><br>
                                      <div>Anyone could please help on
                                        this? </div>
                                      <div><br>
                                      </div>
                                      <div>Thanks</div>
                                      <div><br>
                                      </div>
                                    </div>
                                  </div>
                                  <div class="gmail_extra"><br>
                                    <div class="gmail_quote">On Mon, Jul
                                      11, 2016 at 3:23 PM, Daniel
                                      Zanutti <span dir="ltr">&lt;<a href="mailto:daniel.zanutti@gmail.com" target="_blank"></a><a href="mailto:daniel.zanutti@gmail.com" target="_blank">daniel.zanutti@gmail.com</a>&gt;</span>
                                      wrote:<br>
                                      <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                        <div dir="ltr">Hi
                                          <div><br>
                                          </div>
                                          <div>I need to confirm if a
                                            call is UP and terminate it
                                            from my code. I have
                                            previously stored callid,
                                            h_entry and h_id on an
                                            internal list, so I&#39;m
                                            executing at a specific
                                            time:</div>
                                          <div><br>
                                          </div>
                                          <div>dlg_api.terminate_dlg(h_entry,
                                            h_id);<br>
                                          </div>
                                          <div><br>
                                          </div>
                                          <div>If the call is still
                                            running, it works nicely and
                                            hangup the call. If there is
                                            a problem, I get a negative
                                            value and solve too. The
                                            problem is if the call is
                                            not up anymore, I get a
                                            return == 0. This is the
                                            code of terminate_dlg
                                            function:</div>
                                          <div>
                                            <div><br>
                                            </div>
                                            <div>
                                              <div>struct dlg_cell * dlg
                                                = NULL;</div>
                                            </div>
                                            <div><br>
                                            </div>
                                            <div>dlg =
                                              lookup_dlg(h_entry, h_id);</div>
                                            <div><br>
                                            </div>
                                            <div>        if(!dlg)</div>
                                            <div>                return
                                              0;</div>
                                          </div>
                                          <div><br>
                                          </div>
                                          <div>This function
                                            &quot;lookup_dlg&quot; isn&#39;t exported.<br>
                                          </div>
                                          <div><br>
                                          </div>
                                          <div>Is there anyway to
                                            confirm if the call is still
                                            running, if I have these
                                            values Callid, h_entry and
                                            h_id?</div>
                                          <div><br>
                                          </div>
                                          <div>Thanks!</div>
                                          <div><br>
                                          </div>
                                        </div>
                                      </blockquote>
                                    </div>
                                    <br>
                                  </div>
                                  <br>
                                  <fieldset></fieldset>
                                  <br>
                                </div>
                              </div>
                              <pre>_______________________________________________
Devel mailing list
<a href="mailto:Devel@lists.opensips.org" target="_blank">Devel@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/devel" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/devel</a>
</pre>
                            </blockquote>
                            <br>
                          </div>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>