a simple perl question

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

a simple perl question

rob1485
Hi,

How can I return a string value from perl function in openSER?

return $x;   is not working.

Thanks,
RR

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: a simple perl question

Chris Stone
On Wednesday 12 November 2008 1:50:59 pm Robert R wrote:
> How can I return a string value from perl function in openSER?
>
> return $x;   is not working.

Here's the way I'm doing it...from my Perl script code:

if ($routeid) {
        # set AVP variable with the destination route ID to route call to
      OpenSIPS::AVP::add(369,$routeid);
}

And then  in the OpenSIPS script opensips.cfg, I can read it:

if ($avp(i:369) == "whatever") {
        ......
}



Chris

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: a simple perl question

Alex Balashov
Chris wrote:

> On Wednesday 12 November 2008 1:50:59 pm Robert R wrote:
>> How can I return a string value from perl function in openSER?
>>
>> return $x;   is not working.
>
> Here's the way I'm doing it...from my Perl script code:
>
> if ($routeid) {
> # set AVP variable with the destination route ID to route call to
>       OpenSIPS::AVP::add(369,$routeid);
> }
>
> And then  in the OpenSIPS script opensips.cfg, I can read it:
>
> if ($avp(i:369) == "whatever") {
> ......
> }

Ditto.  That is the only way I have gotten it to work.


--
Alex Balashov
Evariste Systems
Web    : http://www.evaristesys.com/
Tel    : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: a simple perl question

Alex R.S.M
I've tried it before

# perl
OpenSIPS::AVP::add(4,$x);

#config file
xlog ("$avp(i:4)");

but I am getting error:
perl error: Undefined subroutine &OpenSIPS::AVP::add called line 84. 

Also: is there any list with all pseudo-variables in OpenSIPS ?


> Date: Wed, 12 Nov 2008 16:11:57 -0500
> From: [hidden email]
> To: [hidden email]
> CC: [hidden email]
> Subject: Re: [OpenSIPS-Users] a simple perl question
>
> Chris wrote:
> > On Wednesday 12 November 2008 1:50:59 pm Robert R wrote:
> >> How can I return a string value from perl function in openSER?
> >>
> >> return $x; is not working.
> >
> > Here's the way I'm doing it...from my Perl script code:
> >
> > if ($routeid) {
> > # set AVP variable with the destination route ID to route call to
> > OpenSIPS::AVP::add(369,$routeid);
> > }
> >
> > And then in the OpenSIPS script opensips.cfg, I can read it:
> >
> > if ($avp(i:369) == "whatever") {
> > ......
> > }
>
> Ditto. That is the only way I have gotten it to work.
>
>
> --
> Alex Balashov
> Evariste Systems
> Web : http://www.evaristesys.com/
> Tel : (+1) (678) 954-0670
> Direct : (+1) (678) 954-0671
> Mobile : (+1) (706) 338-8599
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Windows Live Hotmail now works up to 70% faster. Sign up today.
_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: a simple perl question

Alex Balashov
Alex R.S.M wrote:

> I've tried it before
>
> # perl
> OpenSIPS::AVP::add(4,$x);
>
> #config file
> xlog ("$avp(i:4)");
>
> but I am getting error:
> perl error: Undefined subroutine &OpenSIPS::AVP::add called line 84.

Are you 'use'ing OpenSIPS::AVP?

>
> Also: is there any list with all pseudo-variables in OpenSIPS ?

Yes.  Google "opensips pseudovariables."  :-)

--
Alex Balashov
Evariste Systems
Web    : http://www.evaristesys.com/
Tel    : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: a simple perl question

Chris Stone
On Wednesday 12 November 2008 2:22:36 pm Alex Balashov wrote:

> Alex R.S.M wrote:
> > I've tried it before
> >
> > # perl
> > OpenSIPS::AVP::add(4,$x);
> >
> > #config file
> > xlog ("$avp(i:4)");
> >
> > but I am getting error:
> > perl error: Undefined subroutine &OpenSIPS::AVP::add called line 84.
>
> Are you 'use'ing OpenSIPS::AVP?

The only 'uses' I have in my working perl script is:

use strict;
use warnings;
use OpenSIPS qw ( log );
use OpenSIPS::Constants;
use DBI;

seems like, when I wrote it, I tried using OpenSIPS::AVP, or something to that
effect and got errors. Works with the above fine though and the AVP functions
are available in my perl script.



Chris

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users