Retrieve headers from negative reply

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Retrieve headers from negative reply

Jeff Pyle
Retrieve headers from negative reply Hello,

Is there any way to retrieve headers from a response, rather than the request?  I need the Contact header out of a 302 response.  Both $hdr(Contact) and $ct give me the contact of the request, not the response.

I tried get_redirects(), but because of the formatting of the contact response it crashes Opensips:

CRITICAL:core:qm_free: freeing already freed pointer, first free: parser/msg_parser.c: set_ruri(712) - aborting
INFO:core:handle_sigs: child process 3554 exited by a signal 6
INFO:core:handle_sigs: core was not generated
INFO:core:handle_sigs: terminating due to SIGCHLD

Get_redirects() was a last resort anyway because I really just need a value from the Contact, I don’t want to use it for routing.


Thanks,
Jeff

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Retrieve headers from negative reply

Iñaki Baz Castillo
El Viernes, 13 de Marzo de 2009, Jeff Pyle escribió:
> Is there any way to retrieve headers from a response, rather than the
> request?  I need the Contact header out of a 302 response.  Both
> $hdr(Contact) and $ct give me the contact of the request, not the response.

You must get them into a on_reply_route block.

--
Iñaki Baz Castillo

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Retrieve headers from negative reply

Ovidiu Sas
Or in 1.5 using the new T_rpl pv:
http://www.kamailio.net/dokuwiki/doku.php/pseudovariables:devel#t_rpl_pv

In your example: $T_rpl($ct) (inside the failure route).


Regards,
Ovidiu Sas

On Fri, Mar 13, 2009 at 5:06 PM, Iñaki Baz Castillo <[hidden email]> wrote:

> El Viernes, 13 de Marzo de 2009, Jeff Pyle escribió:
>> Is there any way to retrieve headers from a response, rather than the
>> request?  I need the Contact header out of a 302 response.  Both
>> $hdr(Contact) and $ct give me the contact of the request, not the response.
>
> You must get them into a on_reply_route block.
>
> --
> Iñaki Baz Castillo
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Retrieve headers from negative reply

Ovidiu Sas
Ooops, this is an opensips mailing list.
Sorry for misleading (to many mailing lists).
Inaki's solution will work ok.

Regards,
Ovidiu Sas

On Fri, Mar 13, 2009 at 5:36 PM, Ovidiu Sas <[hidden email]> wrote:

> Or in 1.5 using the new T_rpl pv:
> http://www.kamailio.net/dokuwiki/doku.php/pseudovariables:devel#t_rpl_pv
>
> In your example: $T_rpl($ct) (inside the failure route).
>
>
> Regards,
> Ovidiu Sas
>
> On Fri, Mar 13, 2009 at 5:06 PM, Iñaki Baz Castillo <[hidden email]> wrote:
>> El Viernes, 13 de Marzo de 2009, Jeff Pyle escribió:
>>> Is there any way to retrieve headers from a response, rather than the
>>> request?  I need the Contact header out of a 302 response.  Both
>>> $hdr(Contact) and $ct give me the contact of the request, not the response.
>>
>> You must get them into a on_reply_route block.
>>
>> --
>> Iñaki Baz Castillo
>>
>> _______________________________________________
>> Users mailing list
>> [hidden email]
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Retrieve headers from negative reply

Jeff Pyle
In reply to this post by Iñaki Baz Castillo
Rockstar.  That's fantastic.  Oddly enough, I couldn't get any of the string
transformations to work in the reply route.  I continued the processing in
the failure route and it worked there.  So, all is well.  Thanks Iñaki.


On 3/13/09 5:06 PM, "Iñaki Baz Castillo" <[hidden email]> wrote:

> You must get them into an on_reply_route block.




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Retrieve headers from negative reply

Bogdan-Andrei Iancu
In reply to this post by Jeff Pyle
Hi Jeff,

Do you get this crash all the time when using the get_redirect() function ?

Regards,
Bogdan

Jeff Pyle wrote:

> Hello,
>
> Is there any way to retrieve headers from a response, rather than the
> request? I need the Contact header out of a 302 response. Both
> $hdr(Contact) and $ct give me the contact of the request, not the
> response.
>
> I tried get_redirects(), but because of the formatting of the contact
> response it crashes Opensips:
>
> CRITICAL:core:qm_free: freeing already freed pointer, first free:
> parser/msg_parser.c: set_ruri(712) - aborting
> INFO:core:handle_sigs: child process 3554 exited by a signal 6
> INFO:core:handle_sigs: core was not generated
> INFO:core:handle_sigs: terminating due to SIGCHLD
>
> Get_redirects() was a last resort anyway because I really just need a
> value from the Contact, I don’t want to use it for routing.
>
>
> Thanks,
> Jeff
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Retrieve headers from negative reply

Jeff Pyle
Hi Bogdan,

It turned out it wasn't the get_redirect() function but t_relay trying to
route based on some bad Contact information that
serialize_branches/next_branches had loaded into the RURI.

I didn't spend much time on it because I leared to access to reply Contact
header directly in the reply route.

In this particular case, the 302 that came back wasn't a routable URI but
rather ported number information from the North American porting database
"almost" in the form of a URI, enough so that it could be stored in the
Contact header.  I haven't looked into it but I'm sure it violated at least
one RFC.  Garbage in, garbage out.


- Jeff



On 3/16/09 4:03 AM, "Bogdan-Andrei Iancu" <[hidden email]> wrote:

> Hi Jeff,
>
> Do you get this crash all the time when using the get_redirect() function ?
>
> Regards,
> Bogdan
>
> Jeff Pyle wrote:
>> Hello,
>>
>> Is there any way to retrieve headers from a response, rather than the
>> request? I need the Contact header out of a 302 response. Both
>> $hdr(Contact) and $ct give me the contact of the request, not the
>> response.
>>
>> I tried get_redirects(), but because of the formatting of the contact
>> response it crashes Opensips:
>>
>> CRITICAL:core:qm_free: freeing already freed pointer, first free:
>> parser/msg_parser.c: set_ruri(712) - aborting
>> INFO:core:handle_sigs: child process 3554 exited by a signal 6
>> INFO:core:handle_sigs: core was not generated
>> INFO:core:handle_sigs: terminating due to SIGCHLD
>>
>> Get_redirects() was a last resort anyway because I really just need a
>> value from the Contact, I don¹t want to use it for routing.
>>
>>
>> Thanks,
>> Jeff
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Users mailing list
>> [hidden email]
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>  
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Retrieve headers from negative reply

Bogdan-Andrei Iancu
Hi Jeff,

I see, but if you still have the entire log of the crash (or if you can
get a new one or explain the logic in order to reproduce it) it will be
great, as I want to fix this bug (even if you use something else now).

Thanks and regards,
Bogdan

Jeff Pyle wrote:

> Hi Bogdan,
>
> It turned out it wasn't the get_redirect() function but t_relay trying to
> route based on some bad Contact information that
> serialize_branches/next_branches had loaded into the RURI.
>
> I didn't spend much time on it because I leared to access to reply Contact
> header directly in the reply route.
>
> In this particular case, the 302 that came back wasn't a routable URI but
> rather ported number information from the North American porting database
> "almost" in the form of a URI, enough so that it could be stored in the
> Contact header.  I haven't looked into it but I'm sure it violated at least
> one RFC.  Garbage in, garbage out.
>
>
> - Jeff
>
>
>
> On 3/16/09 4:03 AM, "Bogdan-Andrei Iancu" <[hidden email]> wrote:
>
>  
>> Hi Jeff,
>>
>> Do you get this crash all the time when using the get_redirect() function ?
>>
>> Regards,
>> Bogdan
>>
>> Jeff Pyle wrote:
>>    
>>> Hello,
>>>
>>> Is there any way to retrieve headers from a response, rather than the
>>> request? I need the Contact header out of a 302 response. Both
>>> $hdr(Contact) and $ct give me the contact of the request, not the
>>> response.
>>>
>>> I tried get_redirects(), but because of the formatting of the contact
>>> response it crashes Opensips:
>>>
>>> CRITICAL:core:qm_free: freeing already freed pointer, first free:
>>> parser/msg_parser.c: set_ruri(712) - aborting
>>> INFO:core:handle_sigs: child process 3554 exited by a signal 6
>>> INFO:core:handle_sigs: core was not generated
>>> INFO:core:handle_sigs: terminating due to SIGCHLD
>>>
>>> Get_redirects() was a last resort anyway because I really just need a
>>> value from the Contact, I don¹t want to use it for routing.
>>>
>>>
>>> Thanks,
>>> Jeff
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Users mailing list
>>> [hidden email]
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>  
>>>      
>
>
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Retrieve headers from negative reply

Bogdan-Andrei Iancu
In reply to this post by Jeff Pyle
Hi Jeff,

Thanks a lot for the info - it was very useful - I was able to reproduce
the crash and eventually to fix it.

Best regards,
Bogdan

Jeff Pyle wrote:

> Hi Bogdan,
>
> Writing you privately...
>
> [XXXXXXXXXX]
>
> Hopefully that's helpful for you.  Let me know if you need anything else.
>
>
> - Jeff
>
>
>
>
> On 3/16/09 8:04 AM, "Bogdan-Andrei Iancu" <[hidden email]> wrote:
>
>  
>> Hi Jeff,
>>
>> I see, but if you still have the entire log of the crash (or if you can
>> get a new one or explain the logic in order to reproduce it) it will be
>> great, as I want to fix this bug (even if you use something else now).
>>
>> Thanks and regards,
>> Bogdan
>>
>> Jeff Pyle wrote:
>>    
>>> Hi Bogdan,
>>>
>>> It turned out it wasn't the get_redirect() function but t_relay trying to
>>> route based on some bad Contact information that
>>> serialize_branches/next_branches had loaded into the RURI.
>>>
>>> I didn't spend much time on it because I leared to access to reply Contact
>>> header directly in the reply route.
>>>
>>> In this particular case, the 302 that came back wasn't a routable URI but
>>> rather ported number information from the North American porting database
>>> "almost" in the form of a URI, enough so that it could be stored in the
>>> Contact header.  I haven't looked into it but I'm sure it violated at least
>>> one RFC.  Garbage in, garbage out.
>>>
>>>
>>> - Jeff
>>>
>>>
>>>
>>> On 3/16/09 4:03 AM, "Bogdan-Andrei Iancu" <[hidden email]> wrote:
>>>
>>>  
>>>      
>>>> Hi Jeff,
>>>>
>>>> Do you get this crash all the time when using the get_redirect() function ?
>>>>
>>>> Regards,
>>>> Bogdan
>>>>
>>>> Jeff Pyle wrote:
>>>>    
>>>>        
>>>>> Hello,
>>>>>
>>>>> Is there any way to retrieve headers from a response, rather than the
>>>>> request? I need the Contact header out of a 302 response. Both
>>>>> $hdr(Contact) and $ct give me the contact of the request, not the
>>>>> response.
>>>>>
>>>>> I tried get_redirects(), but because of the formatting of the contact
>>>>> response it crashes Opensips:
>>>>>
>>>>> CRITICAL:core:qm_free: freeing already freed pointer, first free:
>>>>> parser/msg_parser.c: set_ruri(712) - aborting
>>>>> INFO:core:handle_sigs: child process 3554 exited by a signal 6
>>>>> INFO:core:handle_sigs: core was not generated
>>>>> INFO:core:handle_sigs: terminating due to SIGCHLD
>>>>>
>>>>> Get_redirects() was a last resort anyway because I really just need a
>>>>> value from the Contact, I don¹t want to use it for routing.
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Jeff
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> [hidden email]
>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>  
>>>>>      
>>>>>          
>>>  
>>>      
>
>
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users