[OpenSIPS-Users] How to get the name-addr within a From header?

Răzvan Crainea razvan at opensips.org
Tue Mar 31 12:29:25 EST 2020


Hi, Gordon!

name-addr is basically the entire header, and you can access it using 
$hdr(From).
However, it looks like you are looking to get the From header username, 
that, as Grant pointed out, is returned by the $fU variable. Does this 
solve your problem?

Best regards,

Răzvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 3/31/20 1:36 PM, Gordon Yeong wrote:
> Hello Grant, thank you
>   I was thinking of writing a perl module for this if i still cant do it.
> I will try tomorrow :)
> 
> Regards,
> Gordon Yeong
> 
> 
> On Tue, 31 Mar 2020 at 21:20, Grant Bagdasarian 
> <grantbagdasarian at gmail.com <mailto:grantbagdasarian at gmail.com>> wrote:
> 
>     Hi Gordon,
> 
>     I believe you’re looking for the username in the From header.
>     It’s the $fU variable.
> 
>     https://www.opensips.org/Documentation/Script-CoreVar-3-1#toc47
> 
>     That should give you 12345688.
> 
>     On Tue, 31 Mar 2020 at 08:56 Gordon Yeong <anexiole at gmail.com
>     <mailto:anexiole at gmail.com>> wrote:
> 
>         Hi guys,
> 
> 
>         I looked up RFC 3261 <https://tools.ietf.org/html/rfc3261>. and
>         the from-spec (page 229) says:
> 
>         from-spec   =  ( name-addr / addr-spec )
>                         *( SEMI from-param )
> 
> 
>         I have the following FROM tag in a SIP header.
>         "Mr Invite-R-Us <sip:12345688 at 192.168.136.134:5060
>         <http://sip:12345688@192.168.136.134:5060>>;tag=784"
> 
>         In my opensips.cfg, I got the following results using the
>         compact forms, m and f
> 
>         $var(CALLING2)=$hdr(m); --> printed
>         out <sip:sipp at 192.168.136.134:5060;transport=UDP>
>         $var(CALLING3)=$hdr(f);  --> printed out Mr Invite-R-Us
>         <sip:12345688 at 192.168.136.134:5060
>         <http://sip:12345688@192.168.136.134:5060>>;tag=784
> 
> 
>         I have looked through the RFC document again but could not find 
>         how one could get the "name-addr" (ie. " 12345688"). I have also
>         looked through the Opensips Core variable documentation.
> 
> 
>         Can anyone please tell me how to get the name-addr within a From
>         header? What is the attribute name or compact form?
> 
> 
>         Thank you
> 
>         Gordon
>         _______________________________________________
>         Users mailing list
>         Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>         http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 
>     _______________________________________________
>     Users mailing list
>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 



More information about the Users mailing list