<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div dir="auto">Issue resolved</div>
<div id="ms-outlook-mobile-signature" dir="auto">
<div><br>
</div>
Sent from <a href="https://aka.ms/AAb9ysg">Outlook for Android</a></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Prathibha B <prathibhab.tvm@gmail.com><br>
<b>Sent:</b> Thursday, March 21, 2024 5:36:47 PM<br>
<b>To:</b> OpenSIPS users mailling list <users@lists.opensips.org><br>
<b>Subject:</b> fetch username from the URI</font>
<div> </div>
</div>
<div>
<div dir="ltr">I am getting the source and destination URI from $fu and $ru.  How to fetch the SIP username from the source and destination URI. 
<div><br>
</div>
<div>What I've tried and not working:</div>
<div># Extract destination URI from the R-URI (Request-URI)<br>
            $var(destination_uri) = $(ru);<br>
<br>
            # Find the position of "@" character in the URI<br>
            $var(at_position) = strstr($(ru), "@");<br>
<br>
            # If "@" is found, extract the substring before it as the SIP username<br>
            if ($var(at_position) != -1) {<br>
                $var(destination_username) = substr($var(destination_uri), 4, $var(at_position) - 5);<br>
            } else {<br>
                $var(destination_username) = "Unknown";<br>
            }<br>
<div><br>
</div>
<span class="x_gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="x_gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>Regards,</div>
<div>B.Prathibha<br>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>