Hi,<br><br>I am writing a C code which will help will help me to connect with AMI and query from it to obtain furthur results. The code that I am using is as given below:<br><br>sd = socket(AF_INET, SOCK_STREAM, 0);<br>bind(sd,(struct sockaddr *) &cliaddr, sizeof(cliaddr));<br>
connect(sd,(struct sockaddr *) &seraddr, sizeof(seraddr));<br>strcpy(msg,"Action: Login\r\nUsername: md\r\nSecret: md5\r\n\r\n");<br>send(sd,msg,strlen(msg)+1,0);<br>recv(sd,rec,sizeof rec,0);<br>printf("%s",rec);<br>
strcpy(msg,"Action: Ping\r\n\r\n");<br>send(sd,msg,strlen(msg)+1,0);<br>recv(sd,rec,sizeof rec,0);<br>
printf("%s",rec);<br><br>On executing the code, in the asterisk console I am getting the messege that md is logging from xxx.xxx.xxx.xxx. But, the problem that I am facing is after executing this code of authentication when I send action: ping to AMI using the same socket descriptor then I am receiving an error, that is I get Response: Error, there is no action.<br>
<br>What should I do to make it happen. Please dont reffer me libami cause I dont want to use any library to access AMI. I want to use just C code to access AMI.<br><br>Thank you.<br>