<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>run with debug=3 in kamailio.cfg and see if you spot any debug
      message that can help figuring out what happens.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 06.06.19 13:48, Gertjan Wolzak
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:759c91e9-0bcc-06a6-5545-fc28209a3444@kazlow.nl">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <p>Hello Kamailions,</p>
      <p>After the feedback from Daniel, I have tried some other things.</p>
      <p>The php script works, for testing purposes I changed the php
        action to write a text file in the /tmp directory.</p>
      <p>This works when the incoming call is handled by Kamailio, so I
        know the script gets executed.</p>
      <p>But when the script echo's the needed value the kamailio line
        below does not receive the value in the avp variable:</p>
      <p>    exec_avp("/usr/bin/php /var/lib/kamailio/scripts/test.php
        $var(timeControlId)", "$avp(s:numberid)");<br>
      </p>
      <p>I also have tried it with $avp(i:1), but both options do not
        work.</p>
      <p>I am stil thinking that my php script is not presenting the
        value in the correct manner...</p>
      <p>Should a value presented by an echo command be read by the
        exec_avp command?</p>
      <p>Rgds,</p>
      <p>Gertjan Wolzak<br>
      </p>
      <p><br>
      </p>
      <div class="moz-forward-container"><br>
        -------- Forwarded Message --------
        <table class="moz-email-headers-table" cellspacing="0"
          cellpadding="0" border="0">
          <tbody>
            <tr>
              <th valign="BASELINE" nowrap="nowrap" align="RIGHT">Subject:
              </th>
              <td>Re: [SR-Users] reading php script result with exec_avp</td>
            </tr>
            <tr>
              <th valign="BASELINE" nowrap="nowrap" align="RIGHT">Date:
              </th>
              <td>Thu, 6 Jun 2019 09:16:12 +0200</td>
            </tr>
            <tr>
              <th valign="BASELINE" nowrap="nowrap" align="RIGHT">From:
              </th>
              <td>Gertjan Wolzak <a class="moz-txt-link-rfc2396E"
                  href="mailto:g.wolzak@kazlow.nl"
                  moz-do-not-send="true"><g.wolzak@kazlow.nl></a></td>
            </tr>
            <tr>
              <th valign="BASELINE" nowrap="nowrap" align="RIGHT">To: </th>
              <td>Kamailio (SER) - Users Mailing List <a
                  class="moz-txt-link-rfc2396E"
                  href="mailto:sr-users@lists.kamailio.org"
                  moz-do-not-send="true"><sr-users@lists.kamailio.org></a></td>
            </tr>
          </tbody>
        </table>
        <br>
        <br>
        Goodmorning All,<br>
        <br>
        Daniel, thank you for your feedback.<br>
        <br>
        The relative path was just for example, in the Kamailio config I
        am useing the absolute path.<br>
        <br>
        But the feedback does help me point my nose in the right
        direction.<br>
        <br>
        Rgds,<br>
        <br>
        Gertjan<br>
        <br>
        <br>
        On 6/5/19 2:48 PM, Daniel-Constantin Mierla wrote:<br>
        <blockquote type="cite">Hello,<br>
          <br>
          are you sure that the script is executed? You give a relative
          path and<br>
          kamailio changes working directory to / if you don't give -w
          parameter?<br>
          Try with absolute path.<br>
          <br>
          Cheers,<br>
          Daniel<br>
          <br>
          On 05.06.19 14:10, Gertjan Wolzak wrote:<br>
          <blockquote type="cite">Hello Kamailions,<br>
            <br>
            I have the following challenge.<br>
            <br>
            I want to create a time dependent callerid, based on the
            time of a<br>
            outgoing call a callerid will be set.<br>
            <br>
            I have a php script, that provides me an id number which
            relates to an<br>
            cli.<br>
            <br>
            When I run that php script from the console, the id is shown
            in the<br>
            console.<br>
            <br>
            When I run the script within the kamailio configuration,<br>
            exec_avp("../script.php", "$avp(s:cliId)"); ,no output
            commande is<br>
            saved in the avp variable.<br>
            <br>
            I think I am not presenting the result of the php script
            correctly. I<br>
            have tried with an echo $variable; and with and
            fwrite(STDOUT,<br>
            $variable); but no luck.<br>
            <br>
            I'm not a PHP coder so I am not surprised of the missing
            luck, but<br>
            maybe somebody has a golden tip for me?<br>
            <br>
            Rgds,<br>
            <br>
            Gertjan<br>
            <br>
            <br>
            <br>
            _______________________________________________<br>
            Kamailio (SER) - Users Mailing List<br>
            <a class="moz-txt-link-abbreviated"
              href="mailto:sr-users@lists.kamailio.org"
              moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
            <a class="moz-txt-link-freetext"
              href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
              moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
          </blockquote>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a></pre>
  </body>
</html>