[SR-Users] Using kamcmd tm.t_uac_start to send SIP REGISTER messages in Kamailio 5.5
Markus Bönke
mb at tenios.de
Mon Dec 20 17:27:35 CET 2021
Hello Steve,
I also couldn’t find a way to pass CRLF with Kamcmd. However if it it an alternative for you, you can use jsonrpc instead (https://kamailio.org/docs/modules/5.5.x/modules/jsonrpcs.html). Then you can use e.g. curl to trigger a registration like
curl --header 'Content-Type: application/json' --data-binary '{"jsonrpc":"2.0", "method": "tm.t_uac_start", "params":["REGISTER","sip:test.net","sip:<YOUR_IP>:5060","udp:<YOUR_IP>:5060","From: sip:test2 at test.net\r\nTo: sip:test at .test.net\r\n"], "id": 1}' http://<YOUR_IP>:8080/<YOUR_ENPOINT>
Regards,
Markus
> Am 16.12.2021 um 22:04 schrieb Steve Sether <ssether at usinternet.com>:
>
> I'm trying to use the kamcmd tml.tc_uac_start command to send raw SIP messages in Kamailio 5.5, but I always get a error: 400 - Invalid headers. I've also tried sending OPTIONS messages with the same result. I've looked for examples of sending SIP messages via kamcmd, but can't find any.
>
> kamcmd help tm.t_uac_start specifies the following:
>
> kamcmd> help tm.t_uac_start
> starts a tm uac using a list of string parameters: method, ruri, dst_uri, send_sock, headers (CRLF separated) and body (optional)
>
> Essentially my problem is I don't really know how to properly encode these headers. How do I send special characters? Do I need to use double quotes, single quotes, etc around the whole header? Which characters are special? How do I encode the CRLF? I tried \r\n, but I still get this error. It says only From: and To: are required. It's a bit hard trying to make progress when all I ever get is one error message. The kamailio logs are a little more helpful, and largely point me down the road that it doesn't understand the CRLF encoding, and says my From: header includes the To: line, so it's not separating them.
>
> For example, I'm trying things like this:
>
> kamcmd -v tm.t_uac_start OPTIONS sip:200 at exampleserver.com:5060 <mailto:sip:200 at exampleserver.com:5060> . . "From: <sip:example at 192.168.0.1> <mailto:sip:example at 192.168.0.1>;tag=d27ca05e-1789-4774-a698-dcfe91dec9b4\r\nTo: <sip:example at 192.168.0.2> <mailto:sip:example at 192.168.0.2>"\r\nExpires: 1200\r\nContent-Length: 0"
>
> Nothing seems to work, so whatever the syntax I'm using must be wrong.
>
> Just providing an example of sending SIP via kamcmd tm.t_uac_start would likely help a huge amount.
>
> Thanks!
>
> --
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
> * sr-users at lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the sender!
> Edit mailing list options or unsubscribe:
> * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20211220/2a7fd672/attachment.htm>
More information about the sr-users
mailing list