Hi everyone !
I have a Yealink SIP T32G , I want to send list of contacts via API Linux Script
I'm using cURL to send the Post request but i'm receiving the error: invalid Contact file in the third cURL and in the fourth cURL say that there is no file.
What i'm doing wrong ?
this is my script:
#!/bin/bash
curl -H "Content-Type: text/html;charset=UTF-8" -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: multipart/form-data" -H "Connection: keep-alive" -H "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.5" -H "Content-Length: 582" -H "Host: xx.xx.xx.xx" -H "Origin:
http://xx.xx.xx.xx" -H "Referer:
http://xx.xx.xx.xx/htm/iframe-upload.htm" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0" --trace-ascii /root/debugdump0.txt -d @/root/ContactData.xml
http://xx.xx.xx.xx/cgi-bin/cgiServer.exx
curl -H "Content-Type: text/html;charset=UTF-8" -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/octet-stream" -H "Connection: keep-alive" -H "Accept: */*" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.5" -H "Content-Length: 60" -H "Host: xx.xx.xx.xx" -H "Origin:
http://xx.xx.xx.xx" -H "Referer:
http://xx.xx.xx.xx/cgi-bin/cgiServer.exx...ntacts.htm" -H "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0" --trace-ascii /root/debugdump1.txt -d @/root/strUploadFile.file
http://xx.xx.xx.xx/cgi-bin/cgiServer.exx
curl -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/octet-stream" -H "Connection: keep-alive" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.5" -H "Accept: */*" -H "Content-Length: 49" -H "Host: xx.xx.xx.xx" -H "Origin:
http://xx.xx.xx.xx" -H "Referer:
http://xx.xx.xx.xx/cgi-bin/cgiServer.exx...ntacts.htm" -H "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0" --trace-ascii /root/debugdump2.txt -d "filterContactValidity(\"/tmp/ContactData.xml\",\"1\")"
http://xx.xx.xx.xx/cgi-bin/cgiServer.exx
curl -H "Content-Type: text/html;charset=UTF-8" -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/octet-stream" -H "Connection: keep-alive" --trace-ascii /root/debugdump3.txt -d @/root/systemFunc.file
http://xx.xx.xx.xx/cgi-bin/cgiServer.exx
the logs:
== Info: Expire in 0 ms for 6 (transfer 0x55dcf5225e80)
== Info: Trying xx.xx.xx.xx...
== Info: TCP_NODELAY set
== Info: Expire in 200 ms for 4 (transfer 0x55dcf5225e80)
== Info: Connected to xx.xx.xx.xx (xx.xx.xx.xx) port 80 (#0)
=> Send header, 441 bytes (0x1b9)
0000: POST /cgi-bin/cgiServer.exx HTTP/1.1
0026: Host: xx.xx.xx.xx
0037: Authorization: Basic YWRtaW46YWRtaW4=
005e: Content-Type: application/octet-stream
0086: Connection: keep-alive
009e: Accept-Encoding: gzip, deflate
00be: Accept-Language: en-US,en;q=0.5
00df: Accept: */*
00ec: Content-Length: 49
0100: Origin:
http://xx.xx.xx.xx
011a: Referer:
http://xx.xx.xx.xx/cgi-bin/cgiServer.exx...ontacts.ht
015a: m
015d: User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gec
019d: ko/20100101 Firefox/70.0
01b7:
=> Send data, 49 bytes (0x31)
0000: filterContactValidity("/tmp/ContactData.xml","1")
== Info: upload completely sent off: 49 out of 49 bytes
== Info: HTTP 1.0, assume close after body
<= Recv header, 17 bytes (0x11)
0000: HTTP/1.0 200 OK
<= Recv header, 38 bytes (0x26)
0000: Content-Type:text/html;charset=UTF-8
<= Recv header, 12 bytes (0xc)
0000: Expires:-1
<= Recv header, 21 bytes (0x15)
0000: Accept-Ranges:bytes
<= Recv header, 17 bytes (0x11)
0000: Server:SIPPhone
<= Recv header, 2 bytes (0x2)
0000:
<= Recv data, 22 bytes (0x16)
0000: Invalid Contact File !
== Info: Closing connection 0
---------------------------------------------------------------------------------------------------
== Info: Expire in 0 ms for 6 (transfer 0x560fc0da7e80)
== Info: Trying xx.xx.xx.xx...
== Info: TCP_NODELAY set
== Info: Expire in 200 ms for 4 (transfer 0x560fc0da7e80)
== Info: Connected to xx.xx.xx.xx (xx.xx.xx.xx) port 80 (#0)
=> Send header, 258 bytes (0x102)
0000: POST /cgi-bin/cgiServer.exx HTTP/1.1
0026: Host: xx.xx.xx.xx
0037: User-Agent: curl/7.64.0
0050: Accept: */*
005d: Content-Type: text/html;charset=UTF-8
0084: Authorization: Basic YWRtaW46YWRtaW4=
00ab: Content-Type: application/octet-stream
00d3: Connection: keep-alive
00eb: Content-Length: 141
0100:
=> Send data, 141 bytes (0x8d)
0000: systemFunc("cp -f /tmp/ContactData.xml /phone/config/ContactData
0040: .xml; rm -f /tmp/ContactData.xml")msgBroadcastPostMessage("0x100
0080: 07","8","0").
== Info: upload completely sent off: 141 out of 141 bytes
== Info: HTTP 1.0, assume close after body
<= Recv header, 17 bytes (0x11)
0000: HTTP/1.0 200 OK
<= Recv header, 66 bytes (0x42)
0000: cp: cannot stat '/tmp/ContactData.xml': No such file or director
0040: y.
<= Recv header, 38 bytes (0x26)
0000: Content-Type:text/html;charset=UTF-8
<= Recv header, 12 bytes (0xc)
0000: Expires:-1
<= Recv header, 21 bytes (0x15)
0000: Accept-Ranges:bytes
<= Recv header, 17 bytes (0x11)
0000: Server:SIPPhone
<= Recv header, 2 bytes (0x2)
0000:
<= Recv data, 2 bytes (0x2)
0000: 0.
== Info: Closing connection 0
Sorry for my english.
thanks in advance.