Hi!
I want to change METHOD on a SIP message from UPDATE to INVITE or REGISTER to INFO.
Seems like $rm is read-only. Any other known way to change a requests method?
/O
Hi Olle,
Glad to help you, man!
You can create a new synthetic transaction on the script.
I did this as part of the following tutorial to scale asterisk and kamailio: http://kb.asipto.com/asterisk:realtime:kamailio-3.3.x-asterisk-10.7.0-astdb
Maybe it is a long shot, but it's worth trying.
Cheers! Uriel
On Wed, Dec 19, 2012 at 10:04 AM, Olle E. Johansson oej@edvina.net wrote:
Hi!
I want to change METHOD on a SIP message from UPDATE to INVITE or REGISTER to INFO.
Seems like $rm is read-only. Any other known way to change a requests method?
/O _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
19 dec 2012 kl. 14:18 skrev Uriel Rozenbaum uriel.rozenbaum@gmail.com:
Hi Olle,
Glad to help you, man!
You can create a new synthetic transaction on the script.
I did this as part of the following tutorial to scale asterisk and kamailio: http://kb.asipto.com/asterisk:realtime:kamailio-3.3.x-asterisk-10.7.0-astdb
Maybe it is a long shot, but it's worth trying.
Thanks for the pointer, Uriel!
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!
/O ;-)
Cheers! Uriel
On Wed, Dec 19, 2012 at 10:04 AM, Olle E. Johansson oej@edvina.net wrote: Hi!
I want to change METHOD on a SIP message from UPDATE to INVITE or REGISTER to INFO.
Seems like $rm is read-only. Any other known way to change a requests method?
/O _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
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!
You could try using msg_apply_changes() from http://kamailio.org/docs/modules/stable/modules/textopsx.html#textopsx.msg_a... 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
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.
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.
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_a... 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@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
19 dec 2012 kl. 19:35 skrev Daniel-Constantin Mierla miconda@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.
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?
/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_a... 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@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@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On 12/19/12 10:28 PM, Olle E. Johansson wrote:
19 dec 2012 kl. 19:35 skrev Daniel-Constantin Mierla miconda@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_a... 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@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@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
19 dec 2012 kl. 23:14 skrev Daniel-Constantin Mierla miconda@gmail.com:
On 12/19/12 10:28 PM, Olle E. Johansson wrote:
19 dec 2012 kl. 19:35 skrev Daniel-Constantin Mierla miconda@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?
Will try testing a bit more later.
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.
Match which transaction if I'm stateless ?? :-)
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.
Ok.
Thanks for all the feedback!
/O
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_a... 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@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@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
On 12/20/12 8:05 AM, Olle E. Johansson wrote:
19 dec 2012 kl. 23:14 skrev Daniel-Constantin Mierla miconda@gmail.com:
On 12/19/12 10:28 PM, Olle E. Johansson wrote:
19 dec 2012 kl. 19:35 skrev Daniel-Constantin Mierla miconda@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?
Will try testing a bit more later.
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.
Match which transaction if I'm stateless ?? :-)
if everything from Alice to Bob is stateless, then should be ok.
Cheers, Daniel