<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>I haven't tried and I am not the developer of jansson module, but
      of you control how the json doc is written in redis, then you can
      try to store the value as number (not enclosed in quotes) and
      maybe jansson store its value directly as int in the kamailio.cfg
      variable.</p>
    <p>Otherwise, using {s.int} is the recommended way. I would just
      store first in a $var(x) as string value and then move it to
      $avp(...) converted to int.</p>
    <p>If you store first to $avp(val) and then do:</p>
    <p>$avp(val) = $(avp(val){s.int});</p>
    <p>you end up with two $avp(val) -- AVPs work as a multi-value
      stack, an assignment adds to the top of the stack. Overall, it
      should be fine, this is more like a cosmetic change.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 21.05.19 09:34, Stephen Bucklin
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CABfoWXUQcJaiWD4Hd0bsutkPu=1H6CEXO4FSRBRHCyyvT2eC5A@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div>
        <div>
          <div dir="auto">Daniel,</div>
        </div>
      </div>
      <div dir="auto">Sorry, I did not see your reply as well. I
        struggle with mobile email! :-)</div>
      <div dir="auto">Yes, as above I used the <a href="http://s.int"
          moz-do-not-send="true">s.int</a> but was possibly looking at a
        more elegantly constructed methid when moving the value into the
        avp at the start. </div>
      <div dir="auto">Steve</div>
      <div>
        <div><br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Tue, 21 May 2019 at
              07:50, Stephen Bucklin <<a
                href="mailto:steve@telcoelectronics.uk" target="_blank"
                moz-do-not-send="true">steve@telcoelectronics.uk</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div>
                <div dir="auto">Hi,</div>
              </div>
              <div dir="auto">I would like to set is an an integer.
                Forgive me as I am on mobile so this is from memory. I
                am getting a string using REDIS something like:</div>
              <div dir="auto"><br>
              </div>
              <div dir="auto">Redis_cmd("dB","GET key:xyz","r")</div>
              <div dir="auto"><br>
              </div>
              <div dir="auto">I now have some string in
                $redus(r=>value) say </div>
              <div dir="auto"><br>
              </div>
              <div dir="auto">{"this":"that","mum":"3","other":"here"}</div>
              <div dir="auto"><br>
              </div>
              <div dir="auto">I have used the jansson_get to move the
                value of the specific key into an AVP for use. If I move
                the value 3 that is keyed by "num" from the Jason into
                the AVP it is a string. I can use $avp(val) =
                $(avp(val){<a href="http://s.int" target="_blank"
                  moz-do-not-send="true">s.int</a>}) and that will work
                but was wondering if there was a more elegant solution
                to this?</div>
              <div dir="auto">Just finding my way around this new
                landscape :-)</div>
              <div dir="auto"><br>
              </div>
              <div dir="auto">Steve</div>
              <div dir="auto"><br>
              </div>
              <div><br>
                <div class="gmail_quote">
                  <div dir="ltr" class="gmail_attr">On Mon, 20 May 2019
                    at 18:14, Alex Balashov <<a
                      href="mailto:abalashov@evaristesys.com"
                      target="_blank" moz-do-not-send="true">abalashov@evaristesys.com</a>>
                    wrote:<br>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">You
                    want to validate that the value is an integer, or
                    coerce the internal type of the AVP to integer?<br>
                    <br>
                    —<br>
                    Sent from mobile, with due apologies for brevity and
                    errors.<br>
                    <br>
                    > On May 20, 2019, at 7:52 AM, Stephen Bucklin
                    <<a href="mailto:steve@telcoelectronics.uk"
                      target="_blank" moz-do-not-send="true">steve@telcoelectronics.uk</a>>
                    wrote:<br>
                    > <br>
                    > Hi,<br>
                    > Any quick thoughts. I am using a REDIS "GET" to
                    retrieve a JSON obj as a string from REDIS and then
                    the JANSSON get value to extract a key value from
                    the string and pop it into an AVP ($avp(val)) and
                    wish to ensure the value is an integer in the AVP.
                    New to this, be kind :-)<br>
                    > Steve<br>
                    > _______________________________________________<br>
                    > Kamailio (SER) - Users Mailing List<br>
                    > <a href="mailto:sr-users@lists.kamailio.org"
                      target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
                    > <a
                      href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                    <br>
                    _______________________________________________<br>
                    Kamailio (SER) - Users Mailing List<br>
                    <a href="mailto:sr-users@lists.kamailio.org"
                      target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
                    <a
                      href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                  </blockquote>
                </div>
              </div>
            </blockquote>
          </div>
        </div>
      </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>