summaryrefslogtreecommitdiff
path: root/lib/freeswitch_event.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/freeswitch_event.rb')
-rw-r--r--lib/freeswitch_event.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/freeswitch_event.rb b/lib/freeswitch_event.rb
index 6745bef..5f961be 100644
--- a/lib/freeswitch_event.rb
+++ b/lib/freeswitch_event.rb
@@ -129,8 +129,12 @@ class FreeswitchAPI
event.command("api #{command} #{arguments.join(' ')}")
result = event.result()
content_length = result['Content-Length'].to_i
- if content_length > 0 && result['_BODY'].blank?
- result['_BODY'] = event.read(content_length);
+ while content_length > result['_BODY'].to_s.length
+ body = event.read(content_length - result['_BODY'].to_s.length)
+ if body.blank?
+ break
+ end
+ result['_BODY'] = result['_BODY'].to_s + body;
end
event.close()
return result