Exemplo n.º 1
0
 def testDialogAddsSDP(self):
     """
     Previously, there was a bug where no SDP was attached to
     certain INVITEs.  This ensures that it gets added.
     """
     uac = useragent.UserAgent.server(sip.IVoiceSystem(self.us2), "10.0.0.1", FakeMediaController())
     d = useragent.Dialog.forClient(uac, sip.URL(uac.host, "clicktocall"), sip.URL("10.0.0.2", "bob"), None, False, '')
     def invite(dlg):
         return dlg._generateInvite(sip.URL("localhost", "clicktocall"), "", sip.URL("10.0.0.2", "bob"), False)
     def test(dlg):
         sdplines = dlg.msg.body.split('\r\n')
         #There needs to be a m= line at a minimum, probably some other stuff.
         self.failIfEqual([line for line in sdplines if line.startswith("m=")], [])
     return d.addCallback(invite).addCallback(test)
Exemplo n.º 2
0
 def parseURLorPhoneNum(self, val):
     pstn = self.original.store.parent.findUnique(SIPServer).pstn
     if '@' in val:
         if not val.startswith("sip:"):
             val = "sip:" + val
         return sip.parseURL(val)
     elif pstn:
         pstnurl = sip.parseURL(pstn)
         num = ''.join([c for c in val if c.isdigit()])
         pstn = self.original.store.parent.findUnique(SIPServer).pstn
         if len(num) == 10:
             return sip.URL(host=pstnurl.host,
                            username="******" + num,
                            port=pstnurl.port)
         elif len(num) == 11 and num[0] == '1':
             return sip.URL(host=pstnurl.host,
                            username=num,
                            port=pstnurl.port)
         else:
             raise liveform.InvalidInput(
                 "Please enter a SIP URL or a North American ten-digit phone number."
             )
     else:
         raise liveform.InvalidInput("Please enter a SIP URL.")
Exemplo n.º 3
0
    def setupCallBetween(self, partyA, partyB):
        """
        Set up a call between party A and party B, and control the
        signalling for the call.  Either URL may refer to any SIP
        address, there is no requirement that either participant be
        registered with this proxy.

        @param partyA: a SIP address (a three-tuple of (name, URL,
        parameters)) that represents the party initiating the call,
        i.e. the SIP address of the user who is logged in to the web
        UI and pushing the button to place the call. (Specifically,
        this is the user who will be called first and will have to
        wait for the other user to pick up the call.)

        @param partyB: a SIP address that represents the party receiving
        the call.

        @return: None
        """
        # XXX TODO should probably return a deferred which
        # fires... something... that would let us take advantage of
        # the intermediary call signalling, such as ending the call
        # early...
        localpart = "clicktocall"
        host = getHostnames(self.store)[0]
        controller = tpcc.ThirdPartyCallController(self.dispatcher, localpart,
                                                   host, self.mediaController,
                                                   partyA[0], partyB[1])
        uac = useragent.UserAgent.client(controller, localpart, host,
                                         self.mediaController,
                                         self.dispatcher.dialogs)
        uac.transport = self.dispatcher.transport
        self.dispatcher.installTemporaryProcessor(sip.URL(host, localpart),
                                                  uac)

        uac._doCall(partyA[1], fromName="Divmod")
Exemplo n.º 4
0
 def invite(dlg):
     return dlg._generateInvite(sip.URL("localhost", "clicktocall"), "", sip.URL("10.0.0.2", "bob"), False)
Exemplo n.º 5
0
 def getRegistrationInfo(self, caller):
     return [(sip.URL(self.targethost,
                      port=self.targetport,
                      username=self.id), 0)]
Exemplo n.º 6
0
 def startService(self):
     print "YAY"
     self.dispatcherSvc.setupCallBetween(
         ("Confession Hotline (watt)", sip.URL("watt.divmod.com", "confession"), {},),
         ("Some Bozo", sip.URL("divmod.com", "washort"), {}),
         )