<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>logs indicates that processing went ok, can you print all the
      avps after the exec_avp() - use:</p>
    <p><a
href="https://www.kamailio.org/docs/modules/stable/modules/avpops.html#avpops.f.avp_print">https://www.kamailio.org/docs/modules/stable/modules/avpops.html#avpops.f.avp_print</a></p>
    <p>Keep debug=3.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 07.06.19 09:44, Gertjan Wolzak
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:2a220f8d-a716-864c-4830-d0c942fc83f0@kazlow.nl">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>Thanks again Daniel,</p>
      <p>Ive run the scenario with debug enabled:</p>
      <p>{1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) exec: *** cfgtrace:request_route=[FROMUPDATE_EXTERN]
        c=[/etc/kamailio/kamailio.cfg] l=1688 a=63 n=assign<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) exec: *** cfgtrace:request_route=[FROMUPDATE_EXTERN]
        c=[/etc/kamailio/kamailio.cfg] l=1689 a=25 n=sql_result_free<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) exec: *** cfgtrace:request_route=[FROMUPDATE_EXTERN]
        c=[/etc/kamailio/kamailio.cfg] l=1690 a=26 n=xlog<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) INFO: <script>: timecontrolID is 3{1 2 INVITE <a
          class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) exec: *** cfgtrace:request_route=[FROMUPDATE_EXTERN]
        c=[/etc/kamailio/kamailio.cfg] l=1708 a=16 n=if<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) exec: *** cfgtrace:request_route=[FROMUPDATE_EXTERN]
        c=[/etc/kamailio/kamailio.cfg] l=1695 a=26 n=xlog<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) INFO: <script>: Start time_cli.php{1 2 INVITE <a
          class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) exec: *** cfgtrace:request_route=[FROMUPDATE_EXTERN]
        c=[/etc/kamailio/kamailio.cfg] l=1696 a=26 n=exec_avp<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: <core> [core/md5utils.c:67]:
        MD5StringArray(): MD5 calculated:
        8c2e9a582ac4c995578e3d044bfcb29f<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var():
        SIP_HF_CONTENT_LENGTH=306<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var():
        SIP_HF_SUPPORTED=replaces<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var():
        SIP_HF_ALLOW_EVENTS=talk,hold,conference,refer,check-sync<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var():
        SIP_HF_USER_AGENT=Yealink SIP-T19P_E2 53.81.188.7 0015659a9931<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var():
        SIP_HF_MAX_FORWARDS=69<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var():
        SIP_HF_ALLOW=INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS,
        NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var():
        SIP_HF_CONTENT_TYPE=application/sdp<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var():
        SIP_HF_PROXY_AUTHORIZATION=Digest username="0015659a9931",
        realm="10.88.77.172", nonce="XPoVyVz6FJ0/jlPlCWRW53kunxvJVCRE",
        uri=<a class="moz-txt-link-rfc2396E"
          href="sip:0105623656@10.88.77.172:5060" moz-do-not-send="true">"sip:0105623656@10.88.77.172:5060"</a>,
        response="af5ba0e31bc2ad9e4e04e62d4a51d79b", algorithm=MD5<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var():
        SIP_HF_CONTACT=<a class="moz-txt-link-rfc2396E"
          href="sip:0015659a9931@10.88.77.184:5060"
          moz-do-not-send="true"><sip:0015659a9931@10.88.77.184:5060></a><br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var():
        SIP_HF_CSEQ=2 INVITE<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var(): <a
          class="moz-txt-link-abbreviated"
          href="mailto:SIP_HF_CALLID=0_3892118735@10.88.77.184"
          moz-do-not-send="true">SIP_HF_CALLID=0_3892118735@10.88.77.184</a><br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var(): SIP_HF_TO=<a
          class="moz-txt-link-rfc2396E"
          href="sip:0105623656@10.88.77.172:5060" moz-do-not-send="true"><sip:0105623656@10.88.77.172:5060></a><br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var():
        SIP_HF_FROM="0015659a9931" <a class="moz-txt-link-rfc2396E"
          href="sip:0015659a9931@10.88.77.172:5060"
          moz-do-not-send="true"><sip:0015659a9931@10.88.77.172:5060></a>;tag=1505301176<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_hf.c:293]: print_hf_var():
        SIP_HF_VIA=SIP/2.0/UDP
        10.88.77.184:5060;branch=z9hG4bK3089829295<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: exec [exec_mod.c:215]: w_exec_avp_helper():
        executing [/usr/bin/php /var/lib/kamailio/scripts/test.php 3]<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: <core> [main.c:867]: sig_usr(): SIGCHLD
        received: we do not worry about grand-children<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) exec: *** cfgtrace:request_route=[FROMUPDATE_EXTERN]
        c=[/etc/kamailio/kamailio.cfg] l=1697 a=26 n=xlog<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) INFO: <script>: CLI number id is <null>{1 2
        INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) exec: *** cfgtrace:request_route=[FROMUPDATE_EXTERN]
        c=[/etc/kamailio/kamailio.cfg] l=1705 a=16 n=if<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) exec: *** cfgtrace:request_route=[FROMUPDATE_EXTERN]
        c=[/etc/kamailio/kamailio.cfg] l=1708 a=26 n=uac_replace_from<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: uac [uac.c:422]: ki_replace_from():
        dsp=0x7ffe4637b080 (len=11) , uri=0x7ffe4637b090 (len=33)<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: uac [replace.c:319]: replace_uri(): removing
        display ["0015659a9931"]<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: uac [replace.c:331]: replace_uri(): adding new
        display [+3156666000]<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: uac [replace.c:361]: replace_uri(): uri to
        replace [<a class="moz-txt-link-freetext"
          href="sip:0015659a9931@10.88.77.172:5060"
          moz-do-not-send="true">sip:0015659a9931@10.88.77.172:5060</a>]<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: uac [replace.c:362]: replace_uri(): replacement
        uri is [<a class="moz-txt-link-freetext"
          href="sip:+3156666000@10.88.77.172:5060"
          moz-do-not-send="true">sip:+3156666000@10.88.77.172:5060</a>]<br>
        {1 2 INVITE <a class="moz-txt-link-abbreviated"
          href="mailto:0_3892118735@10.88.77.184" moz-do-not-send="true">0_3892118735@10.88.77.184</a>} 
        6(71459) DEBUG: uac [replace.c:506]: replace_uri(): encode
        is=<AAAAABsDAAAAAw9XCQkDcXEBHhYAFhkAGR8GBQgPBQYGMA-->
        len=48</p>
      <p>You can see that after the script is run there is a message
        about grand-children, then the info about the CLI number id
        being empty...</p>
      <p>So I still feel if I am not presenting the value correct..</p>
      <p>The php script just echo's  a value:  echo $TIME_CLI;</p>
      <p>Rgds,</p>
      <p>Gertjan<br>
      </p>
      <p><br>
      </p>
      <p><br>
      </p>
      <p><br>
      </p>
      <div class="moz-cite-prefix">On 6/6/19 2:29 PM, Daniel-Constantin
        Mierla wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:a297f618-4f03-81f5-9d68-99f7b7348f4d@gmail.com">
        <meta http-equiv="Content-Type" content="text/html;
          charset=UTF-8">
        <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" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
<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>
</pre>
        </blockquote>
        <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com" moz-do-not-send="true">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" moz-do-not-send="true">www.linkedin.com/in/miconda</a></pre>
      </blockquote>
      <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>