[NEW] Per-dialog flags and attributes

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

[NEW] Per-dialog flags and attributes

Bogdan-Andrei Iancu
Hi,

The dialog module from OpenSIPS 1.5 provides now new features, like the possibility to have flags and attributes persistent across the entire dialog. These flags and attributes can be operated during the whole dialog life.

They can be used to store information across the dialog, without relying on the SIP signalling itself (like storing info in RR headers, or contact, etc). When processing the original INVITE, you can store in the dialog all the info you learned and use it later at re-INVITEs or BYE requests. Information like NAT status, accounting type, uids of involved parties, etc.


1) dialog persistent flags
Available functions:
        - set_dlg_flag("n");
        - reset_dlg_flag("n");
        - is_dlg_flag_set("n");
Available PVs:
        - $DLG_flags  (can be used directly from script via bitwise ops)


2) dialog persistent attributes. These attribute are visible for all the requests that belong to the sae dialog; they can be manipulated (added,fetched) during the dialog lifetime.
Available functions:
        - store_dlg_value("attr_name","attr_val");  // attr_val may contain PVs
        - fetch_dlg_value("attr_name","pv");  // pv is $var or $avp
Available PVs:
        - $dlg_val(attr_name);  // set and get capabilities


store_dlg_value("attr_name","some_string") is the same with $dlg_val(attr_name) = "some_string";

fetch_dlg_value("attr_name","$var(x)") is the same with $var(x) = $dlg_val(attr_name);



Ex:

....
if (is_method("INVITE") {
        store_dlg_value("real_caller","$hdr(p-asserted-identity)");
};
....
if (is_method("BYE") {
        xlog("real caller for this BYE is $dlg_val(real_caller)");
};
...


Regards,
Bogdan


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

Re: [OpenSIPS-Devel] [NEW] Per-dialog flags and attributes

Iñaki Baz Castillo
El Miércoles, 14 de Enero de 2009, Bogdan-Andrei Iancu escribió:
> Hi,
>
> The dialog module from OpenSIPS 1.5 provides now new features, like the
> possibility to have flags and attributes persistent across the entire
> dialog. These flags and attributes can be operated during the whole dialog
> life.

This is really useful feature!

> 1) dialog persistent flags
> Available functions:
> - set_dlg_flag("n");
> - reset_dlg_flag("n");
> - is_dlg_flag_set("n");

Just a question: why not:
- setdflag(int);
- resetdflag(int);
- issetdflag(int);
?


--
Iñaki Baz Castillo

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

Re: [OpenSIPS-Devel] [NEW] Per-dialog flags and attributes

Alex Massover
In reply to this post by Bogdan-Andrei Iancu

That's really cool feature!

--
Best Regards,
Alex Massover

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Bogdan-Andrei Iancu
Sent: Wednesday, January 14, 2009 8:57 PM
To: [hidden email]; [hidden email]
Subject: [OpenSIPS-Devel] [NEW] Per-dialog flags and attributes

Hi,

The dialog module from OpenSIPS 1.5 provides now new features, like the possibility to have flags and attributes persistent across the entire dialog. These flags and attributes can be operated during the whole dialog life.

They can be used to store information across the dialog, without relying on the SIP signalling itself (like storing info in RR headers, or contact, etc). When processing the original INVITE, you can store in the dialog all the info you learned and use it later at re-INVITEs or BYE requests. Information like NAT status, accounting type, uids of involved parties, etc.


1) dialog persistent flags
Available functions:
        - set_dlg_flag("n");
        - reset_dlg_flag("n");
        - is_dlg_flag_set("n");
Available PVs:
        - $DLG_flags  (can be used directly from script via bitwise ops)


2) dialog persistent attributes. These attribute are visible for all the requests that belong to the sae dialog; they can be manipulated (added,fetched) during the dialog lifetime.
Available functions:
        - store_dlg_value("attr_name","attr_val");  // attr_val may contain PVs
        - fetch_dlg_value("attr_name","pv");  // pv is $var or $avp
Available PVs:
        - $dlg_val(attr_name);  // set and get capabilities


store_dlg_value("attr_name","some_string") is the same with $dlg_val(attr_name) = "some_string";

fetch_dlg_value("attr_name","$var(x)") is the same with $var(x) = $dlg_val(attr_name);



Ex:

....
if (is_method("INVITE") {
        store_dlg_value("real_caller","$hdr(p-asserted-identity)");
};
....
if (is_method("BYE") {
        xlog("real caller for this BYE is $dlg_val(real_caller)");
};
...


Regards,
Bogdan


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



******************************************************************************

 This footnote confirms that this email message has been scanned by Jajah Inc. Mail system for the presence of malicious code, vandals & computer viruses.

******************************************************************************




******************************************************************************
 This footnote confirms that this email message has been scanned by Jajah Inc. Mail system for the presence of malicious code, vandals & computer viruses.
******************************************************************************

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

Re: [OpenSIPS-Devel] [NEW] Per-dialog flags and attributes

Bogdan-Andrei Iancu
In reply to this post by Iñaki Baz Castillo
Hi Inaki,

Iñaki Baz Castillo wrote:

>> 1) dialog persistent flags
>> Available functions:
>> - set_dlg_flag("n");
>> - reset_dlg_flag("n");
>> - is_dlg_flag_set("n");
>>    
>
> Just a question: why not:
> - setdflag(int);
> - resetdflag(int);
> - issetdflag(int);
>  
The param must be a string as this is mandatory for all module functions
(the setXflag(n) are core functions ). If I had to follow the prototypes
for module functions, I prefered to align also the function naming with
the existing functions in module....

Regards,
Bogdan


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