AMI hangs waiting for response
-
dimas
OMG how the plaintext was formatted... Will try repeating the last buffer dump in PRE tags:
############################# Asterisk Call Manager/1.0\r\n Response: Success\r\n ActionID: T4A02kpR-g1hq-kHAr-GvBN-U0Jk7QZ1tpKO\r\n Message: Authentication accepted\r\n \r\n Response: Follows\r\n Privilege: Command\r\n ActionID: OPZFbpxz-huMN-qhZn-UEVg-tHCWuYsWvJRU\r\n Peer User/ANR Call ID Seq (Tx/Rx) Format Hold Last Message \n 0 active SIP channels\n --END COMMAND--\r\n \r\n ^ #############################
-
bodhi
- Tag set to ami, ragel
I think this is due to a bug in the ami protocol lexer definition. The definition states that before
--END COMMAND--\r\nthere is\r\n, but in reality only the\nis transmitted.Try applying the patch in the attached file, it might fix it for you. But then you'll probably run into problem #72 AMI lexer buffer offset ;)
-
dimas
The patch seems to fix the problem thanks.
I had to install lots of other gems and Ragel in order to rebuild the lexer though... I wish this fix would be brought by "gem install adhearsion" when it will be time to install it on other boxes :)
I'm not hitting #72 AMI lexer buffer offset yet because responses are short (i'm just trying out ruby/adhearsion, not doing anything serious in production).
Thanks again.
-
Jay Phillips
- State changed from new to open
Hey bodhi,
Thanks for submitting a patch! Do you have a Github account? I'd love your patch to be credited in the public timeline by you doing a fork, patching, and sending a pull request.
Also, as a note:
- text = @data[@last_seen_value_end..(@current_pointer - "\r\n--END COMMAND--".size)] + text = @data[@last_seen_value_end..@current_pointer] + text.sub! /\r?\n--END COMMAND--/, ""
I think there is a way to get around the ending issue without doing String#sub!(). I tried to avoid modifications like that because it places logic outside of the Ragel realm and, if this is ported to other languages (Java or C) for use with Adhearsion as interpreter extensions, that code will have to replicate all the little hacks like that too.
-
Ben Klang
- State changed from open to resolved
- Milestone order changed from 0 to 0
This appears to have been fixed in commit 573348a9957547ad8a12f7e394b4cad1e6693f3a. My testing confirms that the example command works successfully (even with the missing \r from Asterisk).
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
