[OpenSIPS-Devel] Enable inclusion of #define #ifdef instructinos in opensips.cfg file

Dror Wald dror at jajah.com
Sun Sep 14 14:48:29 CEST 2008


Hi,

It might be nice to have an option to preprocess the opensips.cfg file and to be able to include a #define, #ifdef, #else, #endif instructions in it.
Please let me know if you like this idea.

Following is an example of how it can make it simple for the user to use presence.


#define USE_PRESENCE

#ifdef USE_PRESENCE
loadmodule "presence.so"
loadmodule "presence_xml.so"
#endif

#ifdef USE_PRESENCE
modparam("presence|presence_xml", "db_url",
      "mysql://opensips:opensipsrw@localhost/opensips")
modparam("presence_xml", "force_active", 1)
modparam("presence", "server_address", "sip:192.168.1.2:5060")
#endif

#ifdef USE_PRESENCE
                        if (is_method("SUBSCRIBE") && $rd == "your.server.ip.address") {
                              # in-dialog subscribe requests
                              route(2);
                              exit;
                        }
#endif

#ifdef USE_PRESENCE
        if( is_method("PUBLISH|SUBSCRIBE"))
                      route(2);
#endif

#ifdef USE_PRESENCE
route[2]
{
     if (!t_newtran())
     {
             sl_reply_error();
             exit;
     };

     if(is_method("PUBLISH"))
     {
             handle_publish();
             t_release();
     }
     else
     if( is_method("SUBSCRIBE"))
     {
             handle_subscribe();
             t_release();
     }

     exit;
#endif



Comments are welcome.

Dror Wald
A developer, VoIP team, Jajah Inc
E-mail: dror at jajah.com<mailto:dror at jajah.com>






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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/devel/attachments/20080914/369adee8/attachment.htm 


More information about the Devel mailing list