[Kamailio-Users] Generate INVITE from Openser

Alex Balashov abalashov at evaristesys.com
Thu Aug 13 16:03:39 CEST 2009


karhu wrote:

> I've been trying to play with set_dlg_profile("caller", "$fu") but i don't
> get the point of this function..

The point of the function is to associate the current dialog with a profile.

Think of a profile as a "container" of dialogs open at any given moment 
that have a common characteristic;  they are united by the profile.  The 
profile name is statically set in the configuration.

In most applications of profiles, you cannot anticipate the appropriate 
profile criteria.  For example, you could create a profile called 
"globalcalls" and just put all calls going through the system in it. 
But, if you'd like to be able to count only calls initiated by a 
particular user, you'd have to use a "key" within that profile - this is 
like a FROM clause in an SQL SELECT statement.

The second argument to set_dlg_profile() is the key.  So, for example, 
if you have a custom header that contains an account ID for a user, say:

    X-Account-ID: 4

Then, you can use that account ID as a key:

    set_dlg_profile("callsperaccount", "$hdr(X-Account-Id)");

Then, when you want to see how many calls are up for account ID X, use 
get_profile_size() with a specific key value:

    get_profile_size("callsperaccount", "4", "$var(s:calls_up)");

-- Alex

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




More information about the sr-users mailing list