<div dir="ltr">I'm using a webserver response rather than cache_fetch but this may help.<div><br></div><div><div> #we got a valid response from the web server. convert from string to json object</div><div> $json(resp-obj) := $avp(router-resp);</div><div> if( $avp(ok_log_this) == "true" )</div><div> xlog("L_INFO", "the whole object returned is $json(resp-obj) and the json route first choice is $json(resp-obj/routes[0]/ruri) \n");</div><div><br></div><div>...</div><div><div> if( $json(resp-obj/lang) )</div><div> {</div><div> $avp(jsonLangPref) := $json(resp-obj/lang);</div><div> $avp(jsonStatus) := $json(resp-obj/status);</div><div> $avp(jsonSID) := $json(resp-obj/sid);</div><div> $avp(jsonDashAddress) := $json(resp-obj/caller_id);</div></div><div>...</div><div>and so on.</div><div><br></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><span><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"> </p><div dir="ltr" style="margin-left:0pt"><br></div></span></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 2, 2018 at 6:44 PM J E H A N Z A I B <<a href="mailto:jehanzaib.kiani@gmail.com">jehanzaib.kiani@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent">Hi team,</div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent"><br style="margin:0px;padding-bottom:0px;font-size:12.8px;direction:ltr"></div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent">I have another application storing the json encoded object in the redis cache.</div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent"><br style="margin:0px;padding-bottom:0px;font-size:12.8px;direction:ltr"></div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent">I read we can fetch using cache_fetch by passing the key. This is perfect but I cant find a function to decode the json I have since my other application is encoding the json object and putting into the redis. I need a function to decode it first.</div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent"><br style="margin:0px;padding-bottom:0px;font-size:12.8px;direction:ltr"></div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent">Second question is, after the decode the object is like </div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent"><br style="margin:0px;padding-bottom:0px;font-size:12.8px;direction:ltr"></div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent">Object</div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent">(<br style="margin:0px;padding-bottom:0px;font-size:12.8px;direction:ltr"> [id] => 161<br style="margin:0px;padding-bottom:0px;font-size:12.8px;direction:ltr"> [user] => xxx<br style="margin:0px;padding-bottom:0px;font-size:12.8px;direction:ltr"> [xx] => xxxx<br style="margin:0px;padding-bottom:0px;font-size:12.8px;direction:ltr"> [xxxx] => xxxx<br style="margin:0px;padding-bottom:0px;font-size:12.8px;direction:ltr">)<br style="margin:0px;padding-bottom:0px;font-size:12.8px;direction:ltr"></div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent"><br style="margin:0px;padding-bottom:0px;font-size:12.8px;direction:ltr"></div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent">How to access user for example ? </div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent"><br style="margin:0px;padding-bottom:0px;font-size:12.8px;direction:ltr"></div><div style="margin:0px;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;padding-bottom:0px;font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;white-space:normal;direction:ltr;background-color:transparent">Thank you </div><br clear="all"><br>-- <br><div class="m_34478744025256889gmail_signature"><div>Regards,</div>
<div>Jehanzaib</div></div>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>