本文整理匯總了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
示例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