[Asterisk-Users] Re: Problem with Action:Originate with ASterisk Manager

Tony Mountifield tony at softins.clara.co.uk
Tue Jan 10 02:26:27 MST 2006


In article <20060110071059.80919.qmail at web32911.mail.mud.yahoo.com>,
Somesh S Shanbhag <someshss at yahoo.com> 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: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list