tropo / tropo-agitate

Script for Tropo that emulates the Asterisk AGI
http://tropo.com
MIT License
20 stars 15 forks source link

'failed' metacall and better REST origination handling #19

Closed bklang closed 13 years ago

bklang commented 13 years ago

Using the HTTP REST API for call origination via AGItate, I needed a way to get feedback from Tropo whether the call was successful. Fortunately, Asterisk has a special extension called 'failed' that can be used to signal a failed origination attempt. This pull request implements the necessary plumbing to generated these 'failed' meta-calls.

To get this to work I needed to create a mock class called DeadCall providing the same interface as Tropo::TropoCall (usually presented as $currentCall). This is because Tropo does not provide an active $currentCall instance when there is no real active call, yet I needed to be able to store and retrieve channel variables.

While adding unit tests for this new feature, I also restructured the tests to namespace the mocked objects to a Tropo class, just like the real thing. Also, the unit tests now cover the HTTP REST origination logic, both success and failure.

jsgoecke commented 13 years ago

Great stuff, thanks!