[OpenSER-Devel] config file question

Ioan-Paul Pirau ioanpaulpirau at yahoo.com
Thu Aug 23 11:35:51 CEST 2007


Hi Daniel, you are right. calling get_body() solves the problem and the verify function works perfectly... but after it's flawless execution the process does not return to the .cfg file to execute the next commands inside the config script. here's the config :
   
  route{
    ...
    if(ValidateMessage()) {
       sl_send_reply("200", "OK") ;
       HandleMessage();
    }
      else {
         sl_send_reply("400","Bad Request");
    }
  ...
  }

  200 OK never gets sent. Before I was doing get_body() this worked. Any Ideeas why this could be so ?
   
  Thanx
  BR,
  JP.
  
Daniel-Constantin Mierla <daniel at voice-system.ro> wrote:
  Hello,

you have to call the header parsing functions.

In m_store(), calling get_body() results in parsing all headers. If you 
want From header first, call parse_from_header() and then check the 
content of the structure in sip_msg.

Cheers,
Daniel

On 08/23/07 10:58, Ioan-Paul Pirau wrote:
> Hi Daniel and thanks for the promt response. I've looked over 
> m_store() in the msilo module, very nicely made validations, but in my 
> case the to and from are NULL in the sip_msg struct... so I can't even 
> check the ->parsed member.
> 
> BR,
> JP.
>
> */Daniel-Constantin Mierla /* wrote:
>
> Hello,
>
> in your functions you have to be sure that the From header is
> parsed and
> the body as well. OpenSER does not parse the whole message, only
> what is
> needed for processing. A good function to look at is m_store() from
> msilo module.
>
> Cheers,
> Daniel
>
> On 08/23/07 10:29, Ioan-Paul Pirau wrote:
> > Hello,
> >
> > My name is John Paul Pirau and I'm trying to use openser to
> create a
> > sip proxy server that gets and forwards incomming "MESSAGE"
> > sip messages. And I encountered a problem while trying to
> process an
> > incoming message. My module exports 2 functions :
> >
> > int ValidateMessage(sip_msg* sip, char*, char*) and
> > int HandleMessage(sip_msg* sip, char*, char*)
> >
> > the ideea is that I want to make a validation before I send back
> the
> > 200 OK response. And if the message does not have the required
> > information then I want to send back the 400 Bad Request
> response. So
> > I figured out that a script in the openser config file should do
> the
> > trick. Here it is :
> >
> > route{
> > ...
> > if(ValidateMessage()){
> > sl_send_reply("200", "OK") ;
> > HandleMessage();
> > }
> > else {
> > sl_send_reply("400","Bad Request");
> > }
> > ...
> > }
> >
> > ..well it doesn't work because the ValidateMessage() gets an
> invalid
> > sip_msg structure as parameter. After some debug I figured out
> that te
> > from, to and message body is not present in the sip_msg
> structure. On
> > the contrary in the HandleMessage function I get a perfectly valid
> > sip_msg struct
> >
> > Any ideea on what's going on ?
> >
> >
> > ...
> >
> > And I also tryed a different aproach.. Here it is :
> >
> > route{
> > ...
> > sl_send_reply("182", "Queued") ;
> > if(ValidateMessage()){
> > sl_send_reply("200", "OK") ;
> > HandleMessage();
> > }
> > else {
> > sl_send_reply("400","Bad Request");
> > }
> > ...
> > }
> >
> > The big difference is that with this .cfg I get a valid sip_msg
> struct
> > in ValidateMessage() but HandleMessage() never gets called ???. Any
> > ideeas ?
> >
> >
> > Best Regards,
> > __________________
> > Ioan-Paul Pirau.
> > Software Engineer
> > www.spectral.go.ro
> > __________________
> >
> >
> ------------------------------------------------------------------------
> > Pinpoint customers
> > who
> > are looking for what you sell.
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Devel mailing list
> > Devel at openser.org
> > http://openser.org/cgi-bin/mailman/listinfo/devel
> >
>
>
> ------------------------------------------------------------------------
> Be a better Heartthrob. Get better relationship answers 
> from 
> someone who knows.
> Yahoo! Answers - Check it out. 


       
---------------------------------
Be a better Globetrotter. Get better travel answers from someone who knows.
Yahoo! Answers - Check it out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openser.org/pipermail/devel/attachments/20070823/c9a6471c/attachment.htm


More information about the Devel mailing list