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 <[EMAIL PROTECTED]>/* 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@openser.org
> http://openser.org/cgi-bin/mailman/listinfo/devel
>
------------------------------------------------------------------------
Be a better Heartthrob. Get better relationship answers
<http://us.rd.yahoo.com/evt=48255/*http://answers.yahoo.com/dir/_ylc=X3oDMTI5MGx2aThyBF9TAzIxMTU1MDAzNTIEX3MDMzk2NTQ1MTAzBHNlYwNCQUJwaWxsYXJfTklfMzYwBHNsawNQcm9kdWN0X3F1ZXN0aW9uX3BhZ2U-?link=list&sid=396545433>from
someone who knows.
Yahoo! Answers - Check it out.
_______________________________________________
Devel mailing list
Devel@openser.org
http://openser.org/cgi-bin/mailman/listinfo/devel