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


Python UA.changeState方法代码示例

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


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

示例1: register_clients

# 需要导入模块: from sippy.UA import UA [as 别名]
# 或者: from sippy.UA.UA import changeState [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.changeState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。