本文整理匯總了Python中sippy.UA.UA.lContact方法的典型用法代碼示例。如果您正苦於以下問題:Python UA.lContact方法的具體用法?Python UA.lContact怎麽用?Python UA.lContact使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sippy.UA.UA
的用法示例。
在下文中一共展示了UA.lContact方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: register_clients
# 需要導入模塊: from sippy.UA import UA [as 別名]
# 或者: from sippy.UA.UA import lContact [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)