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

Richard Revels rrevels at bandwidth.com
Sun Sep 14 18:09:27 CEST 2008


M4. Does what you want and yes it Rocks.

Sent from my iPhone

On Sep 14, 2008, at 8:48 AM, Dror Wald <dror at jajah.com> wrote:

> 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
>
>
>
>
>
>
>
>
>
> *** 
> *** 
> *** 
> *** 
> *** 
> *********************************************************************
> This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals &  
> computer viruses.
> *** 
> *** 
> *** 
> *** 
> *** 
> *********************************************************************
>
>
> D'text-align:left;direction:ltr;unicode-bidi: embed'>
>
>
>
>
> *** 
> *** 
> *** 
> *** 
> *** 
> *********************************************************************
> This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals &  
> computer viruses.
> *** 
> *** 
> *** 
> *** 
> *** 
> *********************************************************************
>
>
> ****
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/devel/attachments/20080914/f635bc44/attachment.htm 


More information about the Devel mailing list