In article <[EMAIL PROTECTED]>, Somesh S Shanbhag <[EMAIL PROTECTED]> wrote: > Hi Asterisk-users, > > I am working with Aterisk Manager API's. > I can login successfuly with the following. > > char buff[256]; > strcpy(buff, "Action: Login\r\nUsername: admin\r\nSecret: unix\r\n\r\n"); > send(msock, buff, 255); > > Now I want to try Action: Originate, therefore I tried the following > > char buff1[256]; > strcpy(buff1, "Action: Originate\r\nChannel: SIP/101\r\nExten: > 102\r\nPriority: > 1\r\nContext: default\r\n\r\n"); > send(msock, buff1, 255); > > But I get the following error response from Asterisk-Manager > Response: Error > Message: Missing action in request
Your problem is the third argument to send(), in both cases. It should not be 255, but instead should be strlen(buff) or strlen(buff1), so that you only send the part of the buffer you have used, not the whole of it. The Manager is complaining about the empty message (NUL byte) that is immediately after the final \r\n\r\n. You also don't need to use two different buffers: you can re-use the same one for the second message. Cheers Tony -- Tony Mountifield Work: [EMAIL PROTECTED] - http://www.softins.co.uk Play: [EMAIL PROTECTED] - http://tony.mountifield.org _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
