[SR-Users] AVPs vs Variables

Alex Balashov abalashov at evaristesys.com
Fri Jan 27 22:13:38 CET 2012


Hi Spencer,

On 01/27/2012 04:08 PM, Spencer Thomason wrote:

> I'm a little confused as to the difference between avps and vars and
> when I would use one or the other. I'm currently using sqlops to
> populate a few avps. Would vars be more suitable?

Your question straddles a generational boundary.  AVPs are an older 
concept that go back to a time before OpenSER had really generic 
database interfaces or endless ways to craft custom business logic, 
many variables facilities, etc.

At this point, the only real difference between them is that $var()s 
only exist for the duration of the processing of a given SIP message 
in the config script.  AVPs are transaction-persistent, so, for 
instance, if you set one in an initial request route, you can also 
access it in the onreply_route, which is often necessary to do CDR 
accounting, etc.  Also, some modules still require use of AVPs.

If you're pulling data out of SQL queries and using it immediately, in 
the course of processing the same SIP message, just use $var()s.

-- 
Alex Balashov - Principal
Evariste Systems LLC
260 Peachtree Street NW
Suite 2200
Atlanta, GA 30303
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web: http://www.evaristesys.com/



More information about the sr-users mailing list