Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#53 access to environment and command line arguments from script

closed
core (12)
5
2010-10-15
2010-05-17
Victor Gamov
No

For example all OPENSIPS_* environmet variables may be accessible as $env[].
All arguments passed as, for example, -o "arg1=var1 arg2=val2" ay be accessible as
$argv[arg1] and $argv[arg2]

It may be useful for example to pass IP-address of upstream provider to set $du or at other situations without using M4.

Discussion

    • assigned_to: nobody --> razvancrainea
     
  • Razvan Crainea
    Razvan Crainea
    2010-10-15

    Hello Victor,

    I have just added two more pseudo-variables that provide the functionalities you requested:
    You can now specify arguments in command line (e.g. -o arg1=val1 -o arg2=val2 ), and read values in the script using 'argv' core pseudo-variable ( $argv(arg1) ). You can find documentation at:
    http://www.opensips.org/Resources/DocsCoreVar#toc13
    Environment variables are also available from the script using 'env' pseudo-variable from cfgutils module.

    Regards,
    Razvan

     
  • Razvan Crainea
    Razvan Crainea
    2010-10-15

    • status: open --> closed