本文整理汇总了Python中sippy.UA.UA.genRequest方法的典型用法代码示例。如果您正苦于以下问题:Python UA.genRequest方法的具体用法?Python UA.genRequest怎么用?Python UA.genRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sippy.UA.UA
的用法示例。
在下文中一共展示了UA.genRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: register_clients
# 需要导入模块: from sippy.UA import UA [as 别名]
# 或者: from sippy.UA.UA import genRequest [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)