[SR-Users] Using kamcmd tm.t_uac_start to send SIP REGISTER messages in Kamailio 5.5

Steve Sether ssether at usinternet.com
Thu Dec 16 22:04:03 CET 2021


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 . . 
"From: 
<sip:example at 192.168.0.1>;tag=d27ca05e-1789-4774-a698-dcfe91dec9b4\r\nTo: 
<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!

-- 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20211216/c713e866/attachment.htm>


More information about the sr-users mailing list