当前位置: 首页>>代码示例>>Python>>正文


Python UA.on_local_sdp_change方法代码示例

本文整理汇总了Python中sippy.UA.UA.on_local_sdp_change方法的典型用法代码示例。如果您正苦于以下问题:Python UA.on_local_sdp_change方法的具体用法?Python UA.on_local_sdp_change怎么用?Python UA.on_local_sdp_change使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sippy.UA.UA的用法示例。


在下文中一共展示了UA.on_local_sdp_change方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: placeOriginate

# 需要导入模块: from sippy.UA import UA [as 别名]
# 或者: from sippy.UA.UA import on_local_sdp_change [as 别名]
 def placeOriginate(self, args, conn_cbs):
     cId, cGUID, cli, cld, body, auth, caller_name = self.eTry.getData()
     rnum, host, cld, credit_time, expires, no_progress_expires, forward_on_fail, user, passw, cli, \
       parameters = args
     self.huntstop_scodes = parameters.get('huntstop_scodes', ())
     if self.global_config.has_key('static_tr_out'):
         cld = re_replace(self.global_config['static_tr_out'], cld)
     if host == 'sip-ua':
         host = self.source[0]
         port = self.source[1]
     else:
         host = host.split(':', 1)
         if len(host) > 1:
             port = int(host[1])
         else:
             port = SipConf.default_port
         host = host[0]
     disc_cbs = []
     if not forward_on_fail and self.global_config['acct_enable']:
         self.acctO = RadiusAccounting(self.global_config, 'originate', send_start = self.global_config['start_acct_enable'])
         self.acctO.setParams(parameters.get('bill-to', self.username), parameters.get('bill-cli', cli), \
           parameters.get('bill-cld', cld), self.cGUID, self.cId, host, credit_time)
         print 'adding acct stop cb'
         disc_cbs.append(self.acctO.disc)
     else:
         self.acctO = None
     self.acctA.credit_time = credit_time
     ua = UA(self.global_config, self.recvEvent, user, passw, (host, port), credit_time, \
       (conn_cbs,), tuple(disc_cbs), tuple(disc_cbs), dead_cbs = (self.oDead,), \
       expire_time = expires, no_progress_time = no_progress_expires, \
       extra_headers = parameters.get('extra_headers', None))
     if self.rtp_proxy_session and parameters.get('rtpp', True):
         ua.on_local_sdp_change = self.rtp_proxy_session.on_caller_sdp_change
         ua.on_remote_sdp_change = self.rtp_proxy_session.on_callee_sdp_change
         body = body.getCopy()
         body.content += 'a=nortpproxy:yes\r\n'
         self.proxied = True
     ua.kaInterval = self.global_config['ka_orig']
     if parameters.has_key('group_timeout'):
         timeout, skipto = parameters['group_timeout']
         Timeout(self.group_expires, timeout, 1, skipto)
     ua.recvEvent(CCEventTry((cId + '-b2b_%d' % rnum, cGUID, cli, cld, body, auth, \
       parameters.get('caller_name', self.caller_name))))
     return ua
开发者ID:gtkiller,项目名称:b2bua,代码行数:46,代码来源:b2bua_radius.py

示例2: placeAnswer

# 需要导入模块: from sippy.UA import UA [as 别名]
# 或者: from sippy.UA.UA import on_local_sdp_change [as 别名]
 def placeAnswer(self, args):
     cId, cGUID, cli, cld, body, auth, caller_name = self.eTry.getData() #TODO: move to a subroutine
     rnum, host, cld, credit_time, expires, no_progress_expires, forward_on_fail, user, passw, cli, \
       parameters = args
     self.huntstop_scodes = parameters.get('huntstop_scodes', ())
     if self.global_config.has_key('static_tr_out'):
         cld = re_replace(self.global_config['static_tr_out'], cld)
     if host == 'sip-ua':
         host = self.source[0]
         port = self.source[1]
     else:
         host = host.split(':', 1)
         if len(host) > 1:
             port = int(host[1])
         else:
             port = SipConf.default_port
         host = host[0]
     if not forward_on_fail and self.global_config['acct_enable']:
         self.acctA = RadiusAccounting(self.global_config, 'answer', send_start = self.global_config['start_acct_enable'])
         self.acctA.setParams(parameters.get('bill-to', self.username), parameters.get('bill-cli', cli), \
           parameters.get('bill-cld', cld), self.cGUID, self.cId, host, credit_time)
         print 'adding acct stop cb'
     else:
         self.acctA = FakeAccounting()
     ua = UA(self.global_config, self.recvEvent, user, passw, (host, port), credit_time, \
       (self.aConnA,), (self.aDisc,), (self.aDisc,), dead_cbs = (self.aDead,), \
       expire_time = expires, no_progress_time = no_progress_expires, \
       extra_headers = parameters.get('extra_headers', None))
     if self.rtp_proxy_session and parameters.get('rtpp', True):
         print 'placeAnswer() registering on sdp change callbacks'
         ua.on_local_sdp_change = self.rtp_proxy_session.on_callee_sdp_change
         ua.on_remote_sdp_change = self.rtp_proxy_session.on_caller_sdp_change
         body = body.getCopy()
         body.content += 'a=nortpproxy:yes\r\n'
         self.proxied = True
     ua.kaInterval = self.global_config['ka_ans'] #TODO: is this okay for uaA?
     if parameters.has_key('group_timeout'):
         timeout, skipto = parameters['group_timeout']
         Timeout(self.group_expires, timeout, 1, skipto)
     ua.recvEvent(CCEventTry((cId + '-b2b_%d' % rnum, cGUID, cli, cld, body, auth, \
       parameters.get('caller_name', self.caller_name))))
     return ua
开发者ID:gtkiller,项目名称:b2bua,代码行数:44,代码来源:b2bua_radius.py


注:本文中的sippy.UA.UA.on_local_sdp_change方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。