Somesh S Shanbhag
2006-Jan-10 00:10 UTC
[Asterisk-Users] Problem with Action:Originate with ASterisk Manager
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 Later I enabled the DEBUG Log in Asterisk I can see the following - >>>>>> During the Login >>>>>>>>>>>>>> *CLI> Jan 10 12:26:33 DEBUG[24230]: manager.c:1253 process_message: Manager received command 'Login' == Parsing '/etc/asterisk/manager.conf': Found == Manager 'admin' logged on from 172.16.25.17 >>>>>>>>>> During the Action Originate >>>>>>>>>>>>>>>>>>>> Jan 10 12:26:33 DEBUG[24230]: manager.c:1253 process_message: Manager received command '' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> My sip.conf [101] type=friend username=101 host=dynamic nat=yes canreinvite=yes disallow=all allow=ulaw allow=alaw dtmfmode=inband [102] type=friend username=102 host=dynamic nat=yes canreinvite=yes disallow=all allow=ulaw allow=alaw dtmfmode=inband My extesions.conf [default] exten=>101,1,Dial(SIP/101,30,Ttrf) exten=>102,1,Dial(SIP/102,30,Ttrf) What is the actual problem here? Am I doing some mistake? Please help me in this regard. Thanks & regards, Somesh S. Shanbhag --------------------------------- Yahoo! Photos ? Showcase holiday pictures in hardcover Photo Books. You design it and we?ll bind it! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060110/5af8cb89/attachment.htm
Tony Mountifield
2006-Jan-10 02:26 UTC
[Asterisk-Users] Re: Problem with Action:Originate with ASterisk Manager
In article <20060110071059.80919.qmail@web32911.mail.mud.yahoo.com>, Somesh S Shanbhag <someshss@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 requestYour 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@softins.co.uk - http://www.softins.co.uk Play: tony@mountifield.org - http://tony.mountifield.org
Tzafrir Cohen
2006-Jan-10 03:12 UTC
[Asterisk-Users] Problem with Action:Originate with ASterisk Manager
On Mon, Jan 09, 2006 at 11:10:59PM -0800, Somesh S Shanbhag 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);You can save yourself a bounch of troubles by using: telnet localhost 5038 and type that. You'll be able to see whatever is returned. Or, alternatively, create a text file, and: cat text_file | nc localhost 5038 Or pipe in the output of a simple shell script Or maybe even: cat text_file > /dev/tcp/localhost/5038 (this fake device is "generated" by bash. Debian turns this feature off in the package bash) And as a rule of thumb: no need to do in C whatever you could easily do in the shell. You can also file unix2dos handy . -- Tzafrir Cohen | tzafrir@jbr.cohens.org.il | VIM is http://tzafrir.org.il | | a Mutt's tzafrir@cohens.org.il | | best ICQ# 16849755 | | friend
Seemingly Similar Threads
- utils.c: fwrite() returned error: Broken pipe how to solve it ???
- Problem setting up TDM22B card
- --- Problem with queues.conf and extensions.conf ---
- Configuring Meeting Room from Asterisk Manager API
- MeetMe - Party's are not exchanging Audio - Is this BUG?