Doorphone Audio Widget using jssip, WebRTC and asterisk

Check out Dynamic Background - #3 by ysc or Parsing JSON to a web page - #4 by ysc among others.
Basically you’d want to define an AngularJS controller with your logic in a separate JS file that you put in the html configuration folder, lazy-load it in your template with oh-lazy-load and then reference it using ng-controller.

You may also replace the event listeners that you attach to buttons like acceptCallBtn.addEventListener('click', ... with regular functions on the controller’s scope and simply call them with ng-click directives on the buttons.