[OpenSIPS-Users] remove trailing white space

Jeff Pyle jpyle at fidelityvoice.com
Tue Nov 11 19:19:23 CET 2014


That is magic, Liviu.  Even in v1.6!


- Jeff


On Tue, Nov 11, 2014 at 1:13 PM, Liviu Chircu <liviu at opensips.org> wrote:

>  On second thoughts, my regex is utterly broken if the vars contain SIP
> headers. This one will work much better:
>
> avp_subst("$avp(str)", "/[\t ]+$//");
>
>
> On 11/11/2014 08:07 PM, Liviu Chircu wrote:
>
> Hello Jeff,
>
> You could do something like:
>
> ...
> loadmodule "avpops.so"
> ...
> startup_route
> {
>     $var(str) = "foofoo      ";
>     $avp(str) = $var(str);
>     avp_subst("$avp(str)", "/([^ ]*) *$/\1/");
>     xlog("Replacement for '$var(str)' is '$avp(str)'\n");
> }
>
> Best regards,
>
> Liviu Chircu
> OpenSIPS Developerhttp://www.opensips-solutions.com
>
> On 11/11/2014 06:54 PM, Jeff Pyle wrote:
>
> Hello,
>
>  How might one remove trailing white space from a script variable or avp
> from within the OpenSIPS script?
>
>
>
>  - Jeff
>
>
>
> _______________________________________________
> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
> _______________________________________________
> Users mailing listUsers at lists.opensips.orghttp://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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20141111/d5c019a4/attachment.htm>


More information about the Users mailing list