# ![«Image: Homemade applications»](images/homemade-applications-logo.png "Homemade applications") Homemade applications The following code enables `controller.py` to be used in a homemade application. ```python from controller import libjamiCtrl class MyController(libjamiCtrl): # # Signal handling # def onIncomingCall_cb(self, callId): app.onIncomingCall(callId) def onCallHangup_cb(self, callId): app.onCallHangup(callId) def onCallConnecting_cb(self, callId): app.onCallConnecting(callId) def onCallRinging_cb(self, callId): app.onCallRinging(callId) def onCallHold_cb(self): app.onCallHold() def onCallInactive_cb(self): app.onCallInactive() def onCallCurrent_cb(self): app.onCallCurrent() def onCallBusy_cb(self): app.onCallBusy() def onCallFailure_cb(self): app.onCallFailure() def onCallOver_cb(self): app.onCallOver() class MainApp(App): @mainthread def onIncomingCall(self, callId): self.feedback.text += "\nCall from %s" % str(ctrl.activeCalls[callId]['To']) @mainthread def onCallStateChanged(self, account, callId, state, code): self.feedback.text += "\n(%s) %s…" % (callId, state) @mainthread def onCallHangup(self, callId): self.feedback.text += "\nEnd call" @mainthread def onCallConnecting(self, callId): self.feedback.text += "\nConnecting…" @mainthread def onCallRinging(self, callId): self.feedback.text += "\nRinging %s…" % str(ctrl.activeCalls[callId]['To']) @mainthread def onCallHold(self): self.feedback.text += "\nCall on hold…" @mainthread def onCallInactive(self): self.feedback.text += "\nDring! Dring!" @mainthread def onCallCurrent(self): self.feedback.text += "\nCurrent call…" @mainthread def onCallBusy(self): self.feedback.text += "\nBusy" @mainthread def onCallFailure(self): self.feedback.text += "\nCall failed" @mainthread def onCallOver(self): self.feedback.text += "\nCall ended" if __name__ == "__main__": ctrl = MyController("demo", False) app = MainApp() ctrl.start() app.run() ```