Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
res_respoke: Support dynamic endpoint creation
Using ARI, endpoints managed by Asterisk's sorcery "ORM" can be dynamically created/destroyed. Unfortunately, a bug in res_respoke kept this functionality from working; in fact, attempting to create an endpoint backed by a realtime or AstDB wizard would crash. This crash occurred due to an infinite recursive call in respoke_endpoint_alloc. Objects in Sorcery that are managed by certain wizards are explicitly immutable, which necessitates that all Sorcery objects be treated as immutable. res_respoke was storing a pointer to the endpoint registration state on the endpoint Sorcery object. In order to determine if the state already existed, a call to Sorcery's 'retrieve_by_id' function was made; in the AstDB and other wizards, this creates a new instance of the endpoint object, which would attempt to retrieve the endpoint object, etc. The solution is to not store mutable state on the immutable object. A global ao2 container now holds the endpoint states. This allows endpoints created via Sorcery to query that container to see if they have any state on object creation/deletion. In order to manage this process, Sorcery observers have been added for object type registration and for object deletion. The result of this patch is that ARI PUT/DELETE commands now work with res_respoke, and endpoints can be created on the fly dynamically.
- Loading branch information