Home » Multimedia » Sending AVTransport commands to UPNP DMR using command line

Sending AVTransport commands to UPNP DMR using command line

If you are working on developing DMR (Digital Media Renderer) or DMC ( Digital Media Controller) for UPNP, its possible that we need to emulate the communication between two during the development. We tried to do the same by trying to send the HTTP Post commands to our DMR in our Sony TV from the command line. ( These same commands will be sent by DMC to DMR )

Follow the steps from “Script to find UPNP devices / servers in a network” to run the upnp_info.py python script to identify the UPNP devices available in your network.

Although our network right now has 5 active UPNP devices, in this post we will just try to send UPNP commands to DMR using command line, and as can be seen below, our DMR details are at

$ python upnp_info.py 
[+] Discovering UPnP locations
[+] Discovery complete
[+] 5 locations found:

[+] Loading
	-> Server String: Linux/2.6 UPnP/1.0 KDL-32W600A/1.7
	==== XML Attributes ===
	-> Device Type: urn:schemas-upnp-org:device:MediaRenderer:1
	-> Friendly Name: BRAVIA KDL-32W600A
	-> Manufacturer: Sony Corporation
	-> Manufacturer URL: http://www.sony.net/
	-> Model Name: KDL-32W600A
	-> Model Number: MINT1.7.0.1
	-> Services:
		=> Service Type: urn:schemas-upnp-org:service:RenderingControl:1
		=> Control: /upnp/control/RenderingControl
		=> Events: /upnp/event/RenderingControl
		=> API:
			- ListPresets
			- SelectPreset
			- GetMute
			- SetMute
			- GetVolume
			- SetVolume
		=> Service Type: urn:schemas-upnp-org:service:ConnectionManager:1
		=> Control: /upnp/control/ConnectionManager
		=> Events: /upnp/event/ConnectionManager
		=> API:
			- GetProtocolInfo
			- GetCurrentConnectionIDs
			- GetCurrentConnectionInfo
		=> Service Type: urn:schemas-upnp-org:service:AVTransport:1
		=> Control: /upnp/control/AVTransport
		=> Events: /upnp/event/AVTransport
		=> API:
			- SetAVTransportURI
			- SetNextAVTransportURI
			- GetMediaInfo
			- GetTransportInfo
			- GetPositionInfo
			- GetDeviceCapabilities
			- GetTransportSettings
			- Stop
			- Play
			- Pause
			- Seek
			- Next
			- Previous
			- GetCurrentTransportActions
			- X_DLNA_GetBytePositionInfo
		=> Service Type: urn:dial-multiscreen-org:service:dial:1
		=> Control: /upnp/control/DIAL
		=> Events: None
		=> API:
		=> Service Type: urn:schemas-sony-com:service:IRCC:1
		=> Control:
		=> Events: None
		=> API:
			- X_SendIRCC
			- X_GetStatus
		=> Service Type: urn:schemas-sony-com:service:ScalarWebAPI:1
		=> Control: /upnp/control/ScalarAPI
		=> Events: None
		=> API:

When we opened the dmr.xml from we can see that details of AVTransport service are available at as can be seen from “< SCPDURL >” and the controlURL is “/upnp/control/AVTransport”


Now, with this much details with us, we can check the different actions supported by the AVTransport service for this DMR from

Sending commands to this DMR from command line using http post

As we know from above “” is the IP address of DMR, “52323” is the Port (as can be seen from ) on which DMR is running and “/upnp/control/AVTransport” is the control URL to which we can send the commands to get the action details.

Below script just send “GetTransportInfo” command from AVTransport service,

$ vim getTransportInfo.sh
#OUR DMR is at

curl -X POST -i -H "Content-type: text/xml; charset=\"utf-8\"" -H "SOAPACTION: \"urn:schemas-upnp-org:service:AVTransport:1#$UPNP_COMMAND\"" http://$IP_ADDR:$PORT/$AVTransport_PATH -v -d "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body><u:$UPNP_COMMAND xmlns:u=\"urn:schemas-upnp-org:service:AVTransport:1\"><InstanceID>0</InstanceID></u:$UPNP_COMMAND></s:Body></s:Envelope>"

when we run this script as,

$ bash getTransportInfo.sh

we will get the details as,

$ bash getTransportInfo.sh 
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying
* Connected to ( port 52323 (#0)
> POST /upnp/control/AVTransport HTTP/1.1
> Host:
> User-Agent: curl/7.58.0
> Accept: */*
> Content-type: text/xml; charset="utf-8"
> SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#GetTransportInfo"
> Content-Length: 274
* upload completely sent off: 274 out of 274 bytes
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Length: 420
Content-Length: 420
< Content-Type: text/xml; charset="utf-8"
Content-Type: text/xml; charset="utf-8"
< EXT: 
< Connection: Keep-Alive
Connection: Keep-Alive
< Date: Sun, 31 May 2020 09:50:55 GMT
Date: Sun, 31 May 2020 09:50:55 GMT
< Server: Linux/2.6 UPnP/1.0 KDL-32W600A/1.7
Server: Linux/2.6 UPnP/1.0 KDL-32W600A/1.7
< X-AV-Server-Info: av=5.0; cn="Sony Corporation"; mn="BRAVIA KDL-32W600A"; mv="1.7";
X-AV-Server-Info: av=5.0; cn="Sony Corporation"; mn="BRAVIA KDL-32W600A"; mv="1.7";
< X-AV-Physical-Unit-Info: pa="BRAVIA KDL-32W600A";
X-AV-Physical-Unit-Info: pa="BRAVIA KDL-32W600A";

* Connection #0 to host left intact
<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetTransportInfoResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><CurrentTransportState>STOPPED</CurrentTransportState><CurrentTransportStatus>OK</CurrentTransportStatus><CurrentSpeed>1</CurrentSpeed></u:GetTransportInfoResponse></s:Body></s:Envelope>

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment