[OpenSIPS-Users] fetch username from the URI

Prathibha B prathibhab.tvm at gmail.com
Thu Mar 21 13:22:34 UTC 2024


Issue resolved

Sent from Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Prathibha B <prathibhab.tvm at gmail.com>
Sent: Thursday, March 21, 2024 5:36:47 PM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: fetch username from the URI

I am getting the source and destination URI from $fu and $ru.  How to fetch the SIP username from the source and destination URI.

What I've tried and not working:
# Extract destination URI from the R-URI (Request-URI)
            $var(destination_uri) = $(ru);

            # Find the position of "@" character in the URI
            $var(at_position) = strstr($(ru), "@");

            # If "@" is found, extract the substring before it as the SIP username
            if ($var(at_position) != -1) {
                $var(destination_username) = substr($var(destination_uri), 4, $var(at_position) - 5);
            } else {
                $var(destination_username) = "Unknown";
            }

--
Regards,
B.Prathibha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20240321/bcf35c4c/attachment.html>


More information about the Users mailing list