本文整理匯總了Python中sippy.UA.UA.recvRequest方法的典型用法代碼示例。如果您正苦於以下問題:Python UA.recvRequest方法的具體用法?Python UA.recvRequest怎麽用?Python UA.recvRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sippy.UA.UA
的用法示例。
在下文中一共展示了UA.recvRequest方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: recvRequest
# 需要導入模塊: from sippy.UA import UA [as 別名]
# 或者: from sippy.UA.UA import recvRequest [as 別名]
def recvRequest(self, req, sip_t):
if req.getMethod() in ('NOTIFY', 'PING'):
# Whynot?
return (req.genResponse(200, 'OK'), None, None)
if req.getMethod() == 'INVITE':
if self.rserv != None:
return (req.genResponse(486, 'Busy Here'), None, None)
# New dialog
uaA = UA(self.global_config, self.recvEvent, disc_cbs = (self.sess_term,))
uaA.recvRequest(req, sip_t)
return
return (req.genResponse(501, 'Not Implemented'), None, None)
示例2: answer
# 需要導入模塊: from sippy.UA import UA [as 別名]
# 或者: from sippy.UA.UA import recvRequest [as 別名]
def answer(self, global_config, body, req, sip_t):
in_body = req.getBody()
in_body.parse()
if not checkhostport(in_body, self.portrange, self.atype):
self.nerrs += 1
raise ValueError('Bob(%s): hostport validation has failed' % str(self.__class__))
# New dialog
uaA = UA(global_config, self.recvEvent, disc_cbs = (self.disconnected,), \
fail_cbs = (self.disconnected,), dead_cbs = (self.alldone,))
uaA.godead_timeout = 10
uaA.compact_sip = self.compact_sip
Timeout(self.ring, self.ring_ival, 1, uaA)
self.body = body
return uaA.recvRequest(req, sip_t)