<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Yes, it should be a leading + to make it international, because
      that number can be a local one in Germany -- in many countries the
      phone number length can vary, not like in US where is fixed size.</p>
    <p>phonenum has also some overhead if you just want to see if it is
      a number, maybe next one is better:</p>
    <p>  - <a
href="https://kamailio.org/docs/modules/stable/modules/siputils.html#siputils.f.is_tel_number">https://kamailio.org/docs/modules/stable/modules/siputils.html#siputils.f.is_tel_number</a></p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 01.11.19 10:55, Igor Olhovskiy
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div>That's the main problem here.</div>
      <br>
      <div>I just need to verify, that number came is valid. I don't
        have any info on country code (means I can do a sort of regex
        match, but it will be overkill)</div>
      <br>
      <div>But why number is not in international format? Or should I
        add leading "+"?</div>
      <br>
      <div class="gmail_quote_attribution">On Nov 1 2019, at 10:52 am,
        Daniel-Constantin Mierla <a class="moz-txt-link-rfc2396E" href="mailto:miconda@gmail.com"><miconda@gmail.com></a> wrote:</div>
      <blockquote>
        <div><br>
          <div>Hello,</div>
          <br>
          <div>probably you have to use the function that has the
            country code:</div>
          <br>
          <div>  - <a
href="https://link.getmailspring.com/link/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com/0?redirect=https%3A%2F%2Fkamailio.org%2Fdocs%2Fmodules%2Fstable%2Fmodules%2Fphonenum.html%23phonenum.f.phonenum_match_cn&recipient=bWljb25kYUBnbWFpbC5jb20%3D"
title="https://kamailio.org/docs/modules/stable/modules/phonenum.html#phonenum.f.phonenum_match_cn"
              moz-do-not-send="true">https://kamailio.org/docs/modules/stable/modules/phonenum.html#phonenum.f.phonenum_match_cn</a></div>
          <br>
          <div>Because the number is not in international format.</div>
          <br>
          <div>
            <div>Cheers,</div>
            <div>Daniel</div>
          </div>
          <br>
          <div class="moz-cite-prefix">
            <div>On 01.11.19 10:42, Igor Olhovskiy wrote:</div>
          </div>
          <blockquote><br>
            <div>Tried with doublequotes and without em.</div>
            <br>
            <div>Log string is only</div>
            <div>kamailio_1    | 10(17) exec: ***
              cfgtrace:request_route=[INITIAL_CHECK]
              c=[/etc/kamailio/kamailio.cfg] l=640 a=16 n=if</div>
            <div>kamailio_1    |  9(16) DEBUG: phonenum
              [phonenum_pv.c:332]: phonenum_update_pv(): phonenum PV
              updated for: 380442459966 (0/none/Parsing number failed)</div>
            <div>kamailio_1    |  9(16) exec: ***
              cfgtrace:request_route=[INITIAL_CHECK]
              c=[/etc/kamailio/kamailio.cfg] l=669 a=16 n=if</div>
            <div>kamailio_1    |  9(16) exec: ***
              cfgtrace:request_route=[INITIAL_CHECK]
              c=[/etc/kamailio/kamailio.cfg] l=665 a=26 n=send_reply</div>
            <br>
            <div class="gmail_quote_attribution">On Nov 1 2019, at 10:31
              am, Daniel-Constantin Mierla <a
href="https://link.getmailspring.com/link/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com/1?redirect=mailto%3Amiconda%40gmail.com&recipient=bWljb25kYUBnbWFpbC5jb20%3D"
                title="mailto:miconda@gmail.com" moz-do-not-send="true"><miconda@gmail.com></a>
              wrote:</div>
            <blockquote>
              <div><br>
                <div>Hello,</div>
                <br>
                <div>can you try with the first parameter in between
                  double quotes ("$fU")?</div>
                <br>
                <div>Otherwise, set debug=3 and provide all log messages
                  printed by kamailio when executing the
                  phonenum_match() function.</div>
                <br>
                <div>
                  <div>Cheers,</div>
                  <div>Daniel</div>
                </div>
                <br>
                <div class="moz-cite-prefix">
                  <div>On 01.11.19 10:10, Igor Olhovskiy wrote:</div>
                </div>
                <blockquote><br>
                  <div>Hi!</div>
                  <br>
                  <div>I'm playing around libphonenum to get validation
                    accross e.164 numbers.</div>
                  <br>
                  <br>
                  <div>So, idea is simple</div>
                  <div><font style="font-family:monospace">if
                      (phonenum_match($fU, "src_num")) {</font></div>
                  <div><font style="font-family:monospace">        if
                      ($phn(src_num=>valid) != 1) {</font></div>
                  <div><font style="font-family:monospace">           
                      send_reply("400", "Invalid e.164 format");</font></div>
                  <div><font style="font-family:monospace">           
                      xlog("L_ALERT","ALERT: FU: $fU is not e.164 number
                      $phn(src_num=>error)\n");</font></div>
                  <div><font style="font-family:monospace">           
                      exit;</font></div>
                  <div><font style="font-family:monospace">        }</font></div>
                  <div><font style="font-family:monospace">}</font></div>
                  <br>
                  <div>But on every (actually valid e.164 number like
                    380442459966 or 61388141397) I got  Parsing number
                    failed in error result.</div>
                  <br>
                  <div>Tried both <font style="font-family:monospace">phonenum_match($fU,
                      "src_num") </font>and<font
                      style="font-family:monospace">
                      phonenum_match("$fU", "src_num")</font></div>
                  <br>
                  <div>Actually <font style="font-family:monospace">phonenum_match("380442459966",
                      "src_num") </font>also not working</div>
                  <br>
                  <div>Debian 10 Buster</div>
                  <div>version: kamailio 5.2.5 (x86_64/linux)</div>
                  <div>libphonenumber7 is already the newest version
                    (7.1.0-5+b4).</div>
                  <br>
                  <code>
                    <pre style="background-color:rgba(0,0,0,0.05);padding:0.2em 1em"><code>_______________________________________________
Kamailio (SER) - Users Mailing List
</code><code><a href="https://link.getmailspring.com/link/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com/2?redirect=https%3A%2F%2Flink.getmailspring.com%2Flink%2F1D1DF284-F963-4251-A8F1-C242A43A8ABF%40getmailspring.com%2F0%3Fredirect%3Dmailto%253Asr-users%2540lists.kamailio.org%26recipient%3DbWljb25kYUBnbWFpbC5jb20%253D&recipient=bWljb25kYUBnbWFpbC5jb20%3D" title="https://link.getmailspring.com/link/1D1DF284-F963-4251-A8F1-C242A43A8ABF@getmailspring.com/0?redirect=mailto%3Asr-users%40lists.kamailio.org&recipient=bWljb25kYUBnbWFpbC5jb20%3D" moz-do-not-send="true">sr-users@lists.kamailio.org</a></code><code><a href="https://link.getmailspring.com/link/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com/3?redirect=https%3A%2F%2Flink.getmailspring.com%2Flink%2F1D1DF284-F963-4251-A8F1-C242A43A8ABF%40getmailspring.com%2F1%3Fredirect%3Dhttps%253A%252F%252Flists.kamailio.org%252Fcgi-bin%252Fmailman%252Flistinfo%252Fsr-users%26recipient%3DbWljb25kYUBnbWFpbC5jb20%253D&recipient=bWljb25kYUBnbWFpbC5jb20%3D" title="https://link.getmailspring.com/link/1D1DF284-F963-4251-A8F1-C242A43A8ABF@getmailspring.com/1?redirect=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&recipient=bWljb25kYUBnbWFpbC5jb20%3D" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a></code></pre>
                  </code></blockquote>
                <code>
                  <pre style="background-color:rgba(0,0,0,0.05);padding:0.2em 1em"><code>-- 
Daniel-Constantin Mierla -- </code><code><a href="https://link.getmailspring.com/link/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com/4?redirect=https%3A%2F%2Flink.getmailspring.com%2Flink%2F1D1DF284-F963-4251-A8F1-C242A43A8ABF%40getmailspring.com%2F2%3Fredirect%3Dhttp%253A%252F%252Fwww.asipto.com%26recipient%3DbWljb25kYUBnbWFpbC5jb20%253D&recipient=bWljb25kYUBnbWFpbC5jb20%3D" title="https://link.getmailspring.com/link/1D1DF284-F963-4251-A8F1-C242A43A8ABF@getmailspring.com/2?redirect=http%3A%2F%2Fwww.asipto.com&recipient=bWljb25kYUBnbWFpbC5jb20%3D" moz-do-not-send="true">www.asipto.com</a></code><code><a href="https://link.getmailspring.com/link/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com/5?redirect=https%3A%2F%2Flink.getmailspring.com%2Flink%2F1D1DF284-F963-4251-A8F1-C242A43A8ABF%40getmailspring.com%2F3%3Fredirect%3Dhttp%253A%252F%252Fwww.twitter.com%252Fmiconda%26recipient%3DbWljb25kYUBnbWFpbC5jb20%253D&recipient=bWljb25kYUBnbWFpbC5jb20%3D" title="https://link.getmailspring.com/link/1D1DF284-F963-4251-A8F1-C242A43A8ABF@getmailspring.com/3?redirect=http%3A%2F%2Fwww.twitter.com%2Fmiconda&recipient=bWljb25kYUBnbWFpbC5jb20%3D" moz-do-not-send="true">www.twitter.com/miconda</a></code><code> -- </code><code><a href="https://link.getmailspring.com/link/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com/6?redirect=https%3A%2F%2Flink.getmailspring.com%2Flink%2F1D1DF284-F963-4251-A8F1-C242A43A8ABF%40getmailspring.com%2F4%3Fredirect%3Dhttp%253A%252F%252Fwww.linkedin.com%252Fin%252Fmiconda%26recipient%3DbWljb25kYUBnbWFpbC5jb20%253D&recipient=bWljb25kYUBnbWFpbC5jb20%3D" title="https://link.getmailspring.com/link/1D1DF284-F963-4251-A8F1-C242A43A8ABF@getmailspring.com/4?redirect=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&recipient=bWljb25kYUBnbWFpbC5jb20%3D" moz-do-not-send="true">www.linkedin.com/in/miconda</a></code><code>
Kamailio World Conference - April 27-29, 2020, in Berlin -- </code><code><a href="https://link.getmailspring.com/link/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com/7?redirect=https%3A%2F%2Flink.getmailspring.com%2Flink%2F1D1DF284-F963-4251-A8F1-C242A43A8ABF%40getmailspring.com%2F5%3Fredirect%3Dhttp%253A%252F%252Fwww.kamailioworld.com%26recipient%3DbWljb25kYUBnbWFpbC5jb20%253D&recipient=bWljb25kYUBnbWFpbC5jb20%3D" title="https://link.getmailspring.com/link/1D1DF284-F963-4251-A8F1-C242A43A8ABF@getmailspring.com/5?redirect=http%3A%2F%2Fwww.kamailioworld.com&recipient=bWljb25kYUBnbWFpbC5jb20%3D" moz-do-not-send="true">www.kamailioworld.com</a></code></pre>
                </code></div>
            </blockquote>
          </blockquote>
          <code>
            <pre style="background-color:rgba(0,0,0,0.05);padding:0.2em 1em">-- 
Daniel-Constantin Mierla -- <a href="https://link.getmailspring.com/link/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com/8?redirect=http%3A%2F%2Fwww.asipto.com&recipient=bWljb25kYUBnbWFpbC5jb20%3D" title="http://www.asipto.com" moz-do-not-send="true">www.asipto.com</a><a href="https://link.getmailspring.com/link/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com/9?redirect=http%3A%2F%2Fwww.twitter.com%2Fmiconda&recipient=bWljb25kYUBnbWFpbC5jb20%3D" title="http://www.twitter.com/miconda" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a href="https://link.getmailspring.com/link/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com/10?redirect=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&recipient=bWljb25kYUBnbWFpbC5jb20%3D" title="http://www.linkedin.com/in/miconda" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio World Conference - April 27-29, 2020, in Berlin -- <a href="https://link.getmailspring.com/link/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com/11?redirect=http%3A%2F%2Fwww.kamailioworld.com&recipient=bWljb25kYUBnbWFpbC5jb20%3D" title="http://www.kamailioworld.com" moz-do-not-send="true">www.kamailioworld.com</a></pre>
          </code></div>
      </blockquote>
      <img class="mailspring-open" alt="Sent from Mailspring"
        style="border:0; width:0; height:0;"
src="https://link.getmailspring.com/open/8DDF8210-B25C-424B-8A27-045E24988840@getmailspring.com?me=dd9955d4&recipient=bWljb25kYUBnbWFpbC5jb20%3D"
        moz-do-not-send="true" width="0" height="0">
    </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>
Kamailio World Conference - April 27-29, 2020, in Berlin -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>