[Kamailio-Devel] parse_via()

Francisco Seratti fseratti at gmail.com
Tue Sep 16 19:42:41 CEST 2008


No, i was trying to fill msg->via2 using parse_via() but now, im gonna try
with a pre-script callback function (didnt known of their existence)

Thanks Daniel

On Tue, Sep 16, 2008 at 1:58 PM, Daniel-Constantin Mierla <miconda at gmail.com
> wrote:

>
>
> On 09/16/08 18:42, Francisco Seratti wrote:
>
>> All my work is done in a module, and im parsing the Via header into
>> (struct via_body *)via2 of the struct sip_msg of the reply message. That
>> struct is used when forward_reply() is called:
>>
>> forward.c:568
>>    /* we have to forward the reply stateless, so we need second via
>> -bogdan*/
>>    if (parse_headers( msg, HDR_VIA2_F, 0 )==-1
>>        || (msg->via2==0) || (msg->via2->error!=PARSE_OK))
>>    {
>>        /* no second via => error */
>>        LM_ERR("no 2nd via found in reply\n");
>>        goto error;
>>    }
>>
>
> do you fill msg->via2 by yourself? Do you set the appropriate header flag?
>
> Cheers,
> Daniel
>
>
>>
>> On Tue, Sep 16, 2008 at 12:28 PM, Daniel-Constantin Mierla <
>> miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>>
>>    Hello,
>>
>>
>>    On 09/16/08 18:05, Francisco Seratti wrote:
>>
>>        Hello,
>>         Im trying to hide my network topology by adding/removing Via
>>        headers. I can remove the correct header, but when adding it,
>>        in replies, im having trouble with the parse_via() function
>>        and i cant figure out where's the problem.
>>        To the moment, request are coming out from the proxy with only
>>        one Via (the proxy addr), but when replies come in, they are
>>        discarded because no 2nd via is found. So, im "saving" the
>>        removed Via from the request, to be inserted later in the
>>        response (using parse_via() into  struct via_body *via2 of the
>>        sip_msg).
>>        The point is parse_via() waits 3 args: start of the header,
>>        some "end" pointer, and the via_body struct for saving parsed
>>        data. I think my problem is in that end pointer, as i could
>>        see in msg_parse.c:116 it is the end of the entire msg, but
>>        not sure.
>>        Ive tried many, many ways but i cant finally get via parsing
>>        OK. Im getting "ERROR:core:parse_via:  invalid via - end of
>>        header in state 14" or different states (16). (i guarantee via
>>        header is well formed).
>>
>>        Could someone orientate me, to know where im failiing??
>>        Askme for any extra data if you need, thanks a lot!
>>
>>    the problem is that changes done to sip messages are not effective
>>    in the script. Even if you add a via in the reply message, the
>>    script interpreter works only on the sip message received, which
>>    has only one via, therefore, openser does not have an address
>>    where to forward the reply and discards it.
>>
>>    I assume you develop some module to hide the topology and have the
>>    add/remove via logic there. You can try to register a pre-script
>>    callback and add at least one via there. This callback is executed
>>    before running the config script. There you can modify the
>>    original sip message and re-initiate the entire sip message parsing.
>>
>>    Cheers,
>>    Daniel
>>
>>    --    Daniel-Constantin Mierla
>>    http://www.asipto.com
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Devel mailing list
>> Devel at lists.kamailio.org
>> http://lists.kamailio.org/cgi-bin/mailman/listinfo/devel
>>
>>
>
> --
> Daniel-Constantin Mierla
> http://www.asipto.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kamailio.org/pipermail/devel/attachments/20080916/c9f82812/attachment.htm 


More information about the Devel mailing list