<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font face="monospace">There are several options here, unfortunately
      none really simple. Here is one:<br>
      <br>
      a) after creating the dialog (at initial INVITE time), save the
      Call-id into a $dlg_val [1]<br>
          $dlg_val(my_callid) = $ci;<br>
      <br>
      b) in event route, use load_dialog_ctx() [2] - do NOT forget to
      pair it with the unload function<br>
          load_dialog_ctx("$param(id)", "did");<br>
          $var(callid) = </font><font face="monospace"><font
        face="monospace">$dlg_val(my_callid);<br>
            </font></font><font face="monospace"><font face="monospace"><font
          face="monospace">load_dialog_ctx();<br>
              ....<br>
              # you have the callid into </font></font></font><font
      face="monospace"><font face="monospace"><font face="monospace"><font
            face="monospace">$var(callid) for further processing<br>
            <br>
          </font></font></font>[1]
      <a class="moz-txt-link-freetext" href="https://opensips.org/html/docs/modules/3.2.x/dialog.html#pv_dlg_val">https://opensips.org/html/docs/modules/3.2.x/dialog.html#pv_dlg_val</a><br>
      [2]
<a class="moz-txt-link-freetext" href="https://opensips.org/html/docs/modules/3.2.x/dialog.html#func_load_dialog_ctx">https://opensips.org/html/docs/modules/3.2.x/dialog.html#func_load_dialog_ctx</a><br>
      <br>
      <br>
      Another option may be the usage of local cache to store the SIP
      callid under the dialog ID as key, at INVITE time:<br>
         
      <a class="moz-txt-link-freetext" href="https://opensips.org/html/docs/modules/3.2.x/dialog.html#pv_DLG_did">https://opensips.org/html/docs/modules/3.2.x/dialog.html#pv_DLG_did</a><br>
         
<a class="moz-txt-link-freetext" href="https://www.opensips.org/Documentation/Script-CoreFunctions-3-2#cache_store">https://www.opensips.org/Documentation/Script-CoreFunctions-3-2#cache_store</a><br>
      And in event route simply use the cache_fetch() with the dialog ID
      as key also.<br>
      <br>
      Regards,<br>
    </font>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
OpenSIPS Summit 27-30 Sept 2022, Athens
  <a class="moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2022Athens/">https://www.opensips.org/events/Summit-2022Athens/</a></pre>
    <div class="moz-cite-prefix">On 9/14/22 5:31 PM, Saint Michael
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAC9cSOA=wR=CEXiHdqGnQQqX42ppsy3mjwAG45Gq=FqG9v5FAA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div class="gmail_default" style="font-size:small">Is there way
          to obtain the SIP Call ID from the "id" or when is_callid=0?</div>
        <div class="gmail_default" style="font-size:small">if I save the
          callID on a global variable, will it be visible around all the
          code?</div>
        <div class="gmail_default" style="font-size:small">Sorry I am
          still learning the ropes.</div>
        <div class="gmail_default" style="font-size:small"><br>
        </div>
        <div class="gmail_default" style="font-size:small"><br>
        </div>
        <div class="gmail_default" style="font-size:small"><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Sep 14, 2022 at 9:38
          AM Bogdan-Andrei Iancu <<a
            href="mailto:bogdan@opensips.org" moz-do-not-send="true">bogdan@opensips.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div> <font face="monospace">Hi,<br>
              <br>
              As per docs [1], you have in event_route :<br>
              <br>
               id - represents the identifier of the call for which that
              event was received.<br>
              <br>
               is_callid - is 0 if the id parameter represents the
              Dialog ID, or 1 if it is a callid. <br>
              <br>
              [1]
              <a
href="https://opensips.org/html/docs/modules/3.2.x/rtpproxy.html#event_E_RTPPROXY_DTMF"
                target="_blank" moz-do-not-send="true">https://opensips.org/html/docs/modules/3.2.x/rtpproxy.html#event_E_RTPPROXY_DTMF</a><br>
              <br>
              Regards,<br>
            </font>
            <pre cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a href="https://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">https://www.opensips-solutions.com</a>
OpenSIPS Summit 27-30 Sept 2022, Athens
  <a href="https://www.opensips.org/events/Summit-2022Athens/" target="_blank" moz-do-not-send="true">https://www.opensips.org/events/Summit-2022Athens/</a></pre>
            <div>On 9/14/22 10:46 AM, Saint Michael wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div class="gmail_quote">
                  <blockquote class="gmail_quote" style="margin:0px 0px
                    0px 0.8ex;border-left:1px solid
                    rgb(204,204,204);padding-left:1ex"><span
                      class="gmail_default" style="font-size:small">My
                      goal is to close the call as soon as the callee
                      presses any DTMF</span></blockquote>
                  <div><span class="gmail_default"
                      style="font-size:small">when any DTMF is
                      detected,  then I need to access the callID
                      variable, </span> <span class="gmail_default"
                      style="font-size:small">$ci</span></div>
                  <div><span class="gmail_default"
                      style="font-size:small">but it's nowhere to be
                      found</span></div>
                  <div><span class="gmail_default"
                      style="font-size:small">Also I
                      need $avp(start_time) and $avp(duration)</span></div>
                  <div><span class="gmail_default"
                      style="font-size:small">I am at a loss as to how
                      to retrieve this information. The call is
                      connected</span></div>
                  <div><span class="gmail_default"
                      style="font-size:small">I need to fire a database
                      query to close the call.</span></div>
                  <div>
                    <div class="gmail_default" style="font-size:small">I
                      imagine that when the call got connected, some
                      variable stored that unix-time .</div>
                    <div class="gmail_default" style="font-size:small">But
                      it does not seem to be available in this part of
                      the code.</div>
                    <div class="gmail_default" style="font-size:small">Philip</div>
                    <div class="gmail_default" style="font-size:small"><br>
                    </div>
                    <br>
                  </div>
                  <div><span class="gmail_default"
                      style="font-size:small"><br>
                    </span></div>
                  <div><span class="gmail_default"
                      style="font-size:small"><br>
                    </span></div>
                  <div><span class="gmail_default"
                      style="font-size:small"><br>
                    </span></div>
                  <blockquote class="gmail_quote" style="margin:0px 0px
                    0px 0.8ex;border-left:1px solid
                    rgb(204,204,204);padding-left:1ex"><span
                      class="gmail_default" style="font-size:small"></span><br>
                  </blockquote>
                </div>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>