#!/bin/bash
accountsid="a4462df20ed7f530be9f61ad4e65252e"
authtoken="7748bffdd06f44cbd584919491b0ea46"
timestamp=$(date +%Y%m%d%H%M%S)
echo $timestamp
timess=$(date +%s)001
echo $timess
sig=`echo -n ${accountsid}${authtoken}${timestamp} |openssl dgst -sha1 |awk '{print $2}'`
Authorization=`echo -n ${accountsid}:${timestamp} |openssl enc -base64`
echo $Authorization
Accept="application/json;charset=utf-8"
Content_Type="application/json;charset=utf-8"
Content_Length="131"
appid="2f2f6da928b74959a4c894ceb1cba497"
templateID="20001"
url="http://192.168.110.145:10000/api/v1.0.0/voice/notify?sig=${sig}";
date="{\"info\":{\"appID\":\"$appid\"},\"timestamp\":\"$timess\",\"data\":\"abc123\",\"subject\":{\"playTimes\":10,\"params\":[\"$2\"],\"called\":\"$1\",\"calledDisplay\":\"10001\",\"templateID\":\"$templateID\"}}"
echo $date
recust=`curl -H "Authorization: $Authorization" -H "Accept: $Accept" -H "Content-Type: $Accept" -H "Content-Length: ${#date}" -s -X POST --data $date $url`
echo $recust