<div dir="ltr">Thanks guys,,<div><br></div><div>ended up doing:</div><div><br></div><div>if ($(re{uri.user}) =~ "\+" + $avp(country_code)) {<br>  $avp(number) = $avp(country_code) + $(fU{s.strip,3});<br>}<br></div><div><br></div><div>where country_code is the actual country code, which as of now it's only 2 digits, but i will have to change that to support more than that.</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 28, 2022 at 7:14 PM Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>Hello,</p>
    <p>if I remember correctly, something similar can be achieved with
      dialplan module (might require a modparam for evaluating variables
      in match expression).</p>
    <p>There is a function to evaluate twice a string with variables,
      but it may lead to leak in some cases. I would avoid using it if
      not proper testing is done.</p>
    <p>Then, I second that KEMI can be a better option for more dynamic
      replacement needs.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div>On 28.03.22 16:44, Igor Olhovskiy
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>David,</div>
        <div><br>
        </div>
        <div>Regexps in Kamailio are precompiled at script load for
          performance reasons. Really limited set of regex operations
          are dynamic, like <a href="http://www.kamailio.net/docs/modules/5.4.x/modules/textops.html#textops.f.is_present_hf_re_pv" target="_blank">http://www.kamailio.net/docs/modules/5.4.x/modules/textops.html#textops.f.is_present_hf_re_pv</a></div>
        <div>I'd recommend to look at KEMI if you need something
          dynamic.<br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">пн, 28 мар. 2022 г. в 13:04,
          David Villasmil <<a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a>>:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div dir="ltr">Hello guys,
            <div><br>
            </div>
            <div>Is it possible to use apvs on regexps like:</div>
            <div><br>
            </div>
            <div>$avp(myvar)=$(re{uri.user}{re.subst,/^\+$avp(some_var)/$avp(some_var)/});</div>
            <div><br>
            </div>
            <div>doesn't seem possible</div>
            <div><br clear="all">
              <div>
                <div dir="ltr">
                  <div dir="ltr">
                    <div>Regards,</div>
                    <div><br>
                    </div>
                    David Villasmil
                    <div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div>
                    <div>phone: +34669448337</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          __________________________________________________________<br>
          Kamailio - Users Mailing List - Non Commercial Discussions<br>
            * <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
          Important: keep the mailing list in the recipients, do not
          reply only to the sender!<br>
          Edit mailing list options or unsubscribe:<br>
            * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
        </blockquote>
      </div>
      <br clear="all">
      <br>
      -- <br>
      <div dir="ltr">
        <div dir="ltr">Best regards,
          <div>Igor</div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <pre>__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
  * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
  March 28-31, 2022 (Europe Timezone)
  * <a href="https://www.asipto.com/sw/kamailio-advanced-training-online/" target="_blank">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
  </div>

__________________________________________________________<br>
Kamailio - Users Mailing List - Non Commercial Discussions<br>
  * <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
Important: keep the mailing list in the recipients, do not reply only to the sender!<br>
Edit mailing list options or unsubscribe:<br>
  * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div>