當前位置: 首頁>>代碼示例>>Python>>正文


Python UA.rUri方法代碼示例

本文整理匯總了Python中sippy.UA.UA.rUri方法的典型用法代碼示例。如果您正苦於以下問題:Python UA.rUri方法的具體用法?Python UA.rUri怎麽用?Python UA.rUri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sippy.UA.UA的用法示例。


在下文中一共展示了UA.rUri方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: register_clients

# 需要導入模塊: from sippy.UA import UA [as 別名]
# 或者: from sippy.UA.UA import rUri [as 別名]
def register_clients(ud):
	# For each record in UserData list create a registrar UA
	for (InternalUserId, ExtDisplayName, ExtName, ExtLogin, ExtPassword, ExtDomain, ExtPort) in ud.Data:
		Ua = UA(
				global_config,
				event_cb = recvEvent,
				username = ExtLogin,
				password = ExtPassword,
				conn_cbs = (recvConnect,),
				disc_cbs = (recvDisconnect,),
				fail_cbs = (recvDisconnect,),
				dead_cbs = (recvDead,),
				nh_address = (global_config['proxy_address'], global_config['proxy_port'])
			)

		if ExtPort == None:
			Ua.rTarget = SipURL(url = "sip:" + ExtName + "@" + ExtDomain)
			Ua.rUri = SipTo(body = "<sip:" + ExtName + "@" + ExtDomain + ">")
			Ua.lUri = SipFrom(body = ExtDisplayName + " <sip:" + ExtName + "@" + ExtDomain + ">")
		else:
			Ua.rTarget = SipURL(url = "sip:" + ExtName + "@" + ExtDomain + ":" + ExtPort)
			Ua.rUri = SipTo(body = "<sip:" + ExtName + "@" + ExtDomain + ":" + ExtPort + ">")
			Ua.lUri = SipFrom(body = ExtDisplayName + " <sip:" + ExtName + "@" + ExtDomain + ":" + ExtPort + ">")
		Ua.lUri.parse()
		Ua.lUri.genTag()
		Ua.lContact = SipContact(body = "<sip:" + InternalUserId + "@" + global_config['proxy_address'] + ">")
		Ua.routes = ()
		Ua.lCSeq = 1
		Ua.rCSeq = 1
		Ua.cId = SipCallId()
		req = Ua.genRequest("REGISTER")
		Ua.changeState((UacStateTrying,))
		global_config['_sip_tm'].regConsumer(Ua, str(Ua.cId))
		Ua.tr = global_config['_sip_tm'].newTransaction(req, Ua.recvResponse)
開發者ID:lemenkov,項目名稱:registrar_agent,代碼行數:36,代碼來源:registrar_agent.py


注:本文中的sippy.UA.UA.rUri方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。