Пример #1
0
 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)
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
    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))
Пример #5
0
    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)
Пример #6
0
 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)
Пример #7
0
 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)
Пример #8
0
 def endCall(self,line,callId):
     message = SCCPSoftKeyEvent(SKINNY_LBL_ENDCALL,line,callId)
     self.client.sendSccpMessage(message)
Пример #9
0
 def dial(self,numberToDial):
     self.log('dialing : '+numberToDial)
     self.client.sendSccpMessage(SCCPSoftKeyEvent(SKINNY_LBL_NEWCALL))
     for digit in numberToDial:
         self.onDialPadButtonPushed(digit)