[SR-Users] Changing METHOD

Daniel-Constantin Mierla miconda at gmail.com
Wed Dec 19 23:14:17 CET 2012


On 12/19/12 10:28 PM, Olle E. Johansson wrote:
> 19 dec 2012 kl. 19:35 skrev Daniel-Constantin Mierla <miconda at gmail.com>:
>
>> On 12/19/12 7:20 PM, Andreas Granig wrote:
>>> Hi Olle,
>>>
>>> On 12/19/2012 02:43 PM, Olle E. Johansson wrote:
>>>> Yeah, I already have Kamailio sending all kinds of crazy stuff while
>>>> testing a new platform,
>>>> using the UAC module. But I wanted to be lazy and change on the fly...
>>>>
>>>> Evil stuff happening here. Kamailio is a good test-tool.
>>>>
>>>> Now I fail to change Contact: headers. The docs for textops say that
>>>> remove_hf can remove
>>>> contact and Remove_hf(Contact) returns true - but the old contact is
>>>> still there!
>> Is this about generic operation of removing the contact header, or in the context of taking it from old request and adding it to the new one generated by uac_req()? For the second, Andreas pointed to the right direction.
> No, changing one and send it away. Like changing a Contact: in a register that's forwarded.
So, you do: remove_hf("Contact"); t_relay(); -- and the Contact header 
is still there? Can you get the ngrep and logs printed by debugger 
module with cfgtrace parameter set to 1?

>> I wanted to make the remark about changing the method on the fly directly to the incoming request, that is not straight as it seems, because it has impact on transaction management, the method being part of CSeq header and has to be restored for the reply.
> Ouch. But if I'm totally and utterly stateless, would it work?

You'd still have to revert back for replies, otherwise the previous hop 
will not match its transactions.

Anyhow, there is no function in config that can change the method in 
first line of request, should not be hard to add one though (it is a 
function that can change the reply code). The cseq can be changed with 
header related functions.

Cheers,
Daniel

>
> /O
>> With uac you can create a new transaction, but it will be in a new dialog.
>>
>> Cheers,
>> Daniel
>>> You could try using msg_apply_changes() from http://kamailio.org/docs/modules/stable/modules/textopsx.html#textopsx.msg_apply_changes after remove_hf and before actually building your new request with $uac_req, but this is really dangerous.
>>>
>>> One thing I know for sure is that you better not call record_route() anywhere before msg_apply_changes(), as record_route() only adds a hint to the message and the value is filled in once the sending socket is known (manually setting $fs doesn't seem to help). If you call msg_apply_changes() after record_route(), you'll get errors and will end up with a broken Record-Route header.
>>>
>>> Hope this helps,
>>> Andreas
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>> sr-users at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>> -- 
>> Daniel-Constantin Mierla - http://www.asipto.com
>> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda




More information about the sr-users mailing list