<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    <div class="moz-cite-prefix">On 29/10/15 09:40, Jonathan Hunter
      wrote:<br>
    </div>
    <blockquote cite="mid:DUB127-W620228907A7E19B242B37ABD200@phx.gbl"
      type="cite">
      <style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
      <div dir="ltr">Sorry Daniel, missed off list!
        <div><br>
        </div>
        <div><span style="color: rgb(68, 68, 68); font-size: 15px;
            line-height: 21.3px; background-color: rgb(255, 255, 255);">Hi
            Daniel,</span>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);"><br
              style="line-height: 21.3px;">
          </div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);">Great
            thanks for that response, I have been working with AVPs and
            Im almost there.</div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);"><br
              style="line-height: 21.3px;">
          </div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);">I
            will certainly check out the jansson module, is that new to
            4.3 as Im currently on 4.2?</div>
        </div>
      </div>
    </blockquote>
    <br>
    iirc, is in 4.3, but probably works to just take the module and run
    it through 4.2 instance.<br>
    <br>
    <blockquote cite="mid:DUB127-W620228907A7E19B242B37ABD200@phx.gbl"
      type="cite">
      <div dir="ltr">
        <div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);"><br
              style="line-height: 21.3px;">
          </div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);">In
            terms of AVPs, if you have an array structure in place, I
            appreciate it pushes entries up the stack, but can you set a
            specific index value to an AVP?</div>
        </div>
      </div>
    </blockquote>
    <br>
    You will need to do copy operations using different names if you use
    AVPs. If you use XAVPs, then you can set a value using index
    directly.<br>
    <br>
    <blockquote cite="mid:DUB127-W620228907A7E19B242B37ABD200@phx.gbl"
      type="cite">
      <div dir="ltr">
        <div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);"><br
              style="line-height: 21.3px;">
          </div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);">As I
            basically want to move the first entry in the Array and move
            it to  the end, ie I have;</div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);"><br
              style="line-height: 21.3px;">
          </div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);">
            <div style="line-height: 21.3px;">$(avp(Pgrp1)[0]);</div>
            <div style="line-height: 21.3px;">$(avp(Pgrp1)[1]);</div>
            <div style="line-height: 21.3px;">$(avp(Pgrp1)[2]);</div>
          </div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);"><br
              style="line-height: 21.3px;">
          </div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);">Can
            I swap <span style="line-height: 22.72px; font-size: 12pt;">[0]
              with </span><span style="line-height: 22.72px; font-size:
              12pt;">[2] without setting  entries to null and rebuilding
              the avp from scratch?</span></div>
        </div>
      </div>
    </blockquote>
    Not with avp, but with xavp -- you can just add x in front of those
    avps in your config file.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <blockquote cite="mid:DUB127-W620228907A7E19B242B37ABD200@phx.gbl"
      type="cite">
      <div dir="ltr">
        <div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);"><span
              style="line-height: 22.72px; font-size: 12pt;"><br
                style="line-height: 22.72px;">
            </span></div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);"><span
              style="line-height: 22.72px; font-size: 12pt;">Thanks</span></div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);"><span
              style="line-height: 22.72px; font-size: 12pt;"><br
                style="line-height: 22.72px;">
            </span></div>
          <div style="line-height: 21.3px; color: rgb(68, 68, 68);
            font-size: 15px; background-color: rgb(255, 255, 255);"><span
              style="line-height: 22.72px; font-size: 12pt;">Jon</span></div>
          <br>
          <div>
            <hr id="stopSpelling">To: <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
            From: <a class="moz-txt-link-abbreviated" href="mailto:miconda@gmail.com">miconda@gmail.com</a><br>
            Date: Wed, 28 Oct 2015 15:39:15 +0100<br>
            Subject: Re: [SR-Users] Multi-Array with AVPs<br>
            <br>
            Hello,<br>
            <br>
            when adding an xavp structure, use:<br>
            <br>
            $xavp(a=>b) = "...";<br>
            <br>
            Now, adding another fieldx to the structure:<br>
            <br>
            $xavp(a[0]=>c) = "...";<br>
            $xavp(a[0]=>d) = "...";<br>
            <br>
            Pushing another new structure means starting from beginning:<br>
            <br>
            $xavp(a=>b) = "...";<br>
            <br>
            The previous structure will be available at index 1:<br>
            <br>
            $xavp(a[1]=>b) = "...";<br>
            <br>
            As alternative, maybe it is easier to return (or pack) all
            those attributes in a json document and then use jansson
            module to navigate through it via json-path mechanism.<br>
            <br>
            Cheers,<br>
            Daniel<br>
            <br>
            <div class="ecxmoz-cite-prefix">On 24/10/15 21:38, Jonathan
              Hunter wrote:<br>
            </div>
            <blockquote
              cite="mid:DUB127-W33480CF7FA2CBBC7691360BD250@phx.gbl">
              <style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
              <div dir="ltr">Hi Alex and guys,
                <div><br>
                </div>
                <div>Are there any further examples of XAVPs used in
                  this manner?</div>
                <div><br>
                </div>
                <div>So associate a number of variables by another
                  variable?</div>
                <div><br>
                </div>
                <div>I am trying with a number of scenarios but the
                  penny is  yet to drop!</div>
                <div><br>
                </div>
                <div>Sorry!</div>
                <div><br>
                </div>
                <div>Jon</div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div> 
                  <div>From: <a moz-do-not-send="true"
                      class="ecxmoz-txt-link-abbreviated"
                      href="mailto:hunterj91@hotmail.com">hunterj91@hotmail.com</a><br>
                    To: <a moz-do-not-send="true"
                      class="ecxmoz-txt-link-abbreviated"
                      href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
                    Date: Fri, 23 Oct 2015 17:13:47 +0000<br>
                    Subject: [SR-Users] Multi-Array with AVPs<br>
                    <br>
                    <style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}


--></style>
                    <div dir="ltr">Alex,
                      <div><br>
                      </div>
                      <div>Thanks for the fast response!</div>
                      <div><br>
                      </div>
                      <div>I dont like hard mode, my lifes tough enough
                        :)</div>
                      <div><br>
                      </div>
                      <div>Will try the XAVPs.</div>
                      <div><br>
                      </div>
                      <div>Thanks</div>
                      <div><br>
                      </div>
                      <div>Jon</div>
                      <div><br>
                        <div>> To: <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
                          > From: <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:abalashov@evaristesys.com">abalashov@evaristesys.com</a><br>
                          > Date: Fri, 23 Oct 2015 13:07:27 -0400<br>
                          > Subject: Re: [SR-Users] Multi-Array with
                          AVPs<br>
                          > <br>
                          > Jon,<br>
                          > <br>
                          > For complex, nonscalar structures where
                          members can be other AVP <br>
                          > nonscalars, you might wish to consider
                          XAVPs instead:<br>
                          > <br>
                          >
                          <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-freetext"
href="http://www.kamailio.org/wiki/cookbooks/4.3.x/pseudovariables#xavp_id_-_xavps"
                            target="_blank">http://www.kamailio.org/wiki/cookbooks/4.3.x/pseudovariables#xavp_id_-_xavps</a><br>
                          > <br>
                          > Otherwise, you're playing life on hard
                          mode. ;-)<br>
                          > <br>
                          > -- Alex<br>
                          > <br>
                          > On 10/23/2015 01:00 PM, Jonathan Hunter
                          wrote:<br>
                          > <br>
                          > > Hi Guys,<br>
                          > ><br>
                          > > Hope all are well?<br>
                          > ><br>
                          > > sorry to post but Im just trying to
                          get something working where Im<br>
                          > > trying to convert a php function
                          script into the kamailio.cfg.<br>
                          > ><br>
                          > > Im getting there but wonder how I
                          can group results of sets of avps with<br>
                          > > another avp.<br>
                          > ><br>
                          > > Say I have these variables;<br>
                          > ><br>
                          > > $(avp(NTgrp)) =<br>
                          > >
                          '<a moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:SB100_000361@1.2.3.4">SB100_000361@1.2.3.4</a>|<a
                            moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:SB100_000213@1.2.3.5"><a class="moz-txt-link-abbreviated" href="mailto:SB100_000213@1.2.3.5">SB100_000213@1.2.3.5</a></a>|<a
                            moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:SB100_000225@1.2.3.6"><a class="moz-txt-link-abbreviated" href="mailto:SB100_000225@1.2.3.6">SB100_000225@1.2.3.6</a></a>|<a
                            moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:SB100_000361@1.2.3.7"><a class="moz-txt-link-abbreviated" href="mailto:SB100_000361@1.2.3.7">SB100_000361@1.2.3.7</a></a>|<a
                            moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:SB100_000213@1.2.3.8"><a class="moz-txt-link-abbreviated" href="mailto:SB100_000213@1.2.3.8">SB100_000213@1.2.3.8</a></a>';<br>
                          > > $(avp(Prio)) = '1|1|1|2|2';<br>
                          > > $(avp(Wgt)) =
                          '10000|10000|80000|30000|70000';<br>
                          > > $(avp(CInc)) = '0|0|1|0|1';<br>
                          > > $(avp(WTot))=
                          '100000|100000|100000|100000|100000';<br>
                          > > I then run a while script to split
                          up their variables via the delimiter<br>
                          > > | in user;<br>
                          > ><br>
                          > > $var(j)=0;<br>
                          > > while($var(j)<$var(count)) {<br>
                          > >
                          $(avp(NTgrpP))=$(avp(NTgrp){s.select,$var(j),|});<br>
                          > >
                          $(avp(PrioP))=$(avp(Prio){s.select,$var(j),|});<br>
                          > >
                          $(avp(WgtP))=$(avp(Wgt){s.select,$var(j),|});<br>
                          > >
                          $(avp(CIncP))=$(avp(CInc){s.select,$var(j),|});<br>
                          > >
                          $(avp(WTotP))=$(avp(WTot){s.select,$var(j),|});<br>
                          > > xlog("L_INFO"," Now Each time we
                          have $(avp(NTgrpP)) $(avp(PrioP))<br>
                          > > $(avp(WgtP)) $(avp(CIncP))
                          $(avp(WTotP))\n");<br>
                          > > $var(j)=$var(j)+1;<br>
                          > > }<br>
                          > ><br>
                          > > This then results in;<br>
                          > > INFO: <script>: Now Each time
                          we have <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:SB100_000223@1.2.3.4">SB100_000223@1.2.3.4</a>
                          1 10000 0 100000<br>
                          > > INFO: <script>: Now Each time
                          we have <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:SB100_000225@1.2.3.5">SB100_000225@1.2.3.5</a>
                          1 10000 0 100000<br>
                          > > INFO: <script>: Now Each time
                          we have <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:SB100_000386@1.2.3.6">SB100_000386@1.2.3.6</a>
                          1 80000 0 100000<br>
                          > > INFO: <script>: Now Each time
                          we have <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:SB100_000213@1.2.3.7">SB100_000213@1.2.3.7</a>
                          2 30000 0 100000<br>
                          > > INFO: <script>: Now Each time
                          we have <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:SB100_000361@1.2.3.8">SB100_000361@1.2.3.8</a>
                          2 70000 0 100000<br>
                          > ><br>
                          > > Now what Id like to do is group them
                          via priorities so I can do some<br>
                          > > further functional checks on them
                          when in same priority group, as you<br>
                          > > can see there are 3 results at
                          priority 1 and 2 at priority 2.<br>
                          > ><br>
                          > > Is there away I can create something
                          of a multi-array using the AVP<br>
                          > > $(avp(PrioP)) I just created so I
                          can group by priority?<br>
                          > ><br>
                          > > As in php I would do something like;<br>
                          > ><br>
                          > > $multi_arr[$prio_arr[$p]][] = array(<br>
                          > > "ntgrp" => $ntgrp_arr[$p],<br>
                          > > "prio" => $prio_arr[$p],<br>
                          > > "wght" => $wght_arr[$p],<br>
                          > > "cinc" => $cinc_arr[$p],<br>
                          > > "wtot" => $wtot_arr[$p],<br>
                          > > );<br>
                          > > }<br>
                          > ><br>
                          > > Any help would be great.<br>
                          > ><br>
                          > > Many thanks<br>
                          > ><br>
                          > > Jon<br>
                          > ><br>
                          > ><br>
                          > ><br>
                          > >
                          _______________________________________________<br>
                          > > SIP Express Router (SER) and
                          Kamailio (OpenSER) - sr-users mailing list<br>
                          > > <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
                          > > <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-freetext"
                            href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                            target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                          > ><br>
                          > <br>
                          > <br>
                          > -- <br>
                          > Alex Balashov | Principal | Evariste
                          Systems LLC<br>
                          > 303 Perimeter Center North, Suite 300<br>
                          > Atlanta, GA 30346<br>
                          > United States<br>
                          > <br>
                          > Tel: +1-800-250-5920 (toll-free) /
                          +1-678-954-0671 (direct)<br>
                          > Web: <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-freetext"
                            href="http://www.evaristesys.com/"
                            target="_blank">http://www.evaristesys.com/</a>,
                          <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-freetext"
                            href="http://www.csrpswitch.com/"
                            target="_blank">http://www.csrpswitch.com/</a><br>
                          > <br>
                          >
                          _______________________________________________<br>
                          > SIP Express Router (SER) and Kamailio
                          (OpenSER) - sr-users mailing list<br>
                          > <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-abbreviated"
                            href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
                          > <a moz-do-not-send="true"
                            class="ecxmoz-txt-link-freetext"
                            href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                            target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                        </div>
                      </div>
                    </div>
                    <br>
                    _______________________________________________ SIP
                    Express Router (SER) and Kamailio (OpenSER) -
                    sr-users mailing list <a moz-do-not-send="true"
                      class="ecxmoz-txt-link-abbreviated"
                      href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
                    <a moz-do-not-send="true"
                      class="ecxmoz-txt-link-freetext"
                      href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                      target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a></div>
                </div>
              </div>
              <br>
              <fieldset class="ecxmimeAttachmentHeader"></fieldset>
              <br>
              <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" class="ecxmoz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
            </blockquote>
            <br>
            <pre class="ecxmoz-signature">-- 
Daniel-Constantin Mierla
<a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
Kamailio Advanced Training, Nov 30-Dec 2, Berlin - <a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://asipto.com/kat" target="_blank">http://asipto.com/kat</a></pre>
            <br>
            _______________________________________________
            SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
            mailing list
            <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a></div>
        </div>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
Kamailio Advanced Training, Nov 30-Dec 2, Berlin - <a class="moz-txt-link-freetext" href="http://asipto.com/kat">http://asipto.com/kat</a></pre>
  </body>
</html>