def onSoftKey(self,event): self.log('on soft key '+`event`) if (event != SKINNY_LBL_NEWCALL): message = SCCPSoftKeyEvent(event,self.currentLine,self.currentCallId) else: message = SCCPSoftKeyEvent(event) self.client.sendSccpMessage(message)
def testOnSoftKeyNewCall(self): networkClient = Mock() self.sccpPhone.client = networkClient newCallMessage = SCCPSoftKeyEvent(SKINNY_LBL_NEWCALL) self.sccpPhone.onSoftKey(SKINNY_LBL_NEWCALL) networkClient.sendSccpMessage.assert_was_called_with(newCallMessage)
def testHangupCall(self): networkClient = Mock() self.sccpPhone.client = networkClient endCallMessage = SCCPSoftKeyEvent(SKINNY_LBL_ENDCALL, 3, 54) self.sccpPhone.endCall(3, 54) networkClient.sendSccpMessage.assert_was_called_with(endCallMessage)
def testDial(self): networkClient = Mock() self.sccpPhone.client = networkClient newCallMessage = SCCPSoftKeyEvent(SKINNY_LBL_NEWCALL) self.sccpPhone.dial('12') networkClient.sendSccpMessage.assert_was_called_with(newCallMessage) networkClient.sendSccpMessage.assert_was_called_with( SCCPKeyPadButton(1)) networkClient.sendSccpMessage.assert_was_called_with( SCCPKeyPadButton(2))
def testAnswerCall(self): networkClient = Mock() self.sccpPhone.client = networkClient callState = SCCPCallState() callState.callId = 43 callState.line = 2 callState.callState = SCCPCallState.SCCP_CHANNELSTATE_RINGING self.sccpPhone.onCallState(callState) answerCallMessage = SCCPSoftKeyEvent(SKINNY_LBL_ANSWER, 2, 43) self.sccpPhone.answerCall() networkClient.sendSccpMessage.assert_was_called_with(answerCallMessage)
def testPack(self): softKeyEvent = SCCPSoftKeyEvent(9,1,54) bufferToSend ='\x00\x00\x00\x00\x26\x00\x00\x00\x09\x00\x00\x00\x01\x00\x00\x00\x36\x00\x00\x00' self.assertEquals(softKeyEvent.pack(),bufferToSend)
def testPack(self): softKeyEvent = SCCPSoftKeyEvent(9, 1, 54) bufferToSend = '\x00\x00\x00\x00\x26\x00\x00\x00\x09\x00\x00\x00\x01\x00\x00\x00\x36\x00\x00\x00' self.assertEquals(softKeyEvent.pack(), bufferToSend)
def endCall(self,line,callId): message = SCCPSoftKeyEvent(SKINNY_LBL_ENDCALL,line,callId) self.client.sendSccpMessage(message)
def dial(self,numberToDial): self.log('dialing : '+numberToDial) self.client.sendSccpMessage(SCCPSoftKeyEvent(SKINNY_LBL_NEWCALL)) for digit in numberToDial: self.onDialPadButtonPushed(digit)