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:[email protected]\r\nTo: sip:[email protected]\r\n"], "id": 1}' 
http://<YOUR_IP>:8080/<YOUR_ENPOINT>

Regards,

Markus

> Am 16.12.2021 um 22:04 schrieb Steve Sether <[email protected]>:
> 
> 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:[email protected]:5060 
> <mailto:sip:[email protected]:5060> . . "From: <sip:[email protected]> 
> <mailto:sip:[email protected]>;tag=d27ca05e-1789-4774-a698-dcfe91dec9b4\r\nTo:
>  <sip:[email protected]> <mailto:sip:[email protected]>"\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
>  * [email protected]
> 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

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * [email protected]
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

Reply via email to