本文整理汇总了Python中KSR.is_myself方法的典型用法代码示例。如果您正苦于以下问题:Python KSR.is_myself方法的具体用法?Python KSR.is_myself怎么用?Python KSR.is_myself使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KSR
的用法示例。
在下文中一共展示了KSR.is_myself方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ksr_route_auth
# 需要导入模块: import KSR [as 别名]
# 或者: from KSR import is_myself [as 别名]
def ksr_route_auth(self, msg):
if KSR.pv.get("$rm") != "REGISTER" :
if KSR.permissions.allow_source_address(1)>0 :
# source IP allowed
return 1;
if KSR.pv.get("$rm")=="REGISTER" or KSR.is_myself(KSR.pv.get("$fu")) :
# authenticate requests
if KSR.auth_db.auth_check(KSR.pv.get("$fd"), "subscriber", 1)<0 :
KSR.auth.auth_challenge(KSR.pv.get("$fd"), 0);
return -255;
# user authenticated - remove auth header
if not "REGISTER,PUBLISH".find(KSR.pv.get("$rm"))!=-1 :
KSR.auth.consume_credentials();
# if caller is not local subscriber, then check if it calls
# a local destination, otherwise deny, not an open relay here
if (not KSR.is_myself(KSR.pv.get("$fu"))
and (not KSR.is_myself(KSR.pv.get("$ru")))) :
KSR.sl.sl_send_reply(403,"Not relaying");
return -255;
return 1;
示例2: ksr_route_sipout
# 需要导入模块: import KSR [as 别名]
# 或者: from KSR import is_myself [as 别名]
def ksr_route_sipout(self, msg):
if KSR.is_myself(KSR.pv.get("$ru")) :
return 1;
KSR.hdr.append("P-Hint: outbound\r\n");
self.ksr_route_relay(msg);
return -255;
示例3: ksr_route_reqinit
# 需要导入模块: import KSR [as 别名]
# 或者: from KSR import is_myself [as 别名]
def ksr_route_reqinit(self, msg):
if not KSR.is_myself(KSR.pv.get("$si")) :
if not KSR.pv.is_null("$sht(ipban=>$si)") :
# ip is already blocked
KSR.dbg("request from blocked IP - " + KSR.pv.get("$rm")
+ " from " + KSR.pv.get("$fu") + " (IP:"
+ KSR.pv.get("$si") + ":" + str(KSR.pv.get("$sp")) + ")\n");
return -255;
if KSR.pike.pike_check_req()<0 :
KSR.err("ALERT: pike blocking " + KSR.pv.get("$rm")
+ " from " + KSR.pv.get("$fu") + " (IP:"
+ KSR.pv.get("$si") + ":" + str(KSR.pv.get("$sp")) + ")\n");
KSR.pv.seti("$sht(ipban=>$si)", 1);
return -255;
if not KSR.pv.is_null("$ua") :
if (KSR.pv.get("$ua").find("friendly-scanner")!=-1
or KSR.pv.get("$ua").find("sipcli")!=-1) :
KSR.sl.sl_send_reply(200, "Processed");
return -255;
if KSR.maxfwd.process_maxfwd(10) < 0 :
KSR.sl.sl_send_reply(483,"Too Many Hops");
return -255;
if (KSR.pv.get("$rm")=="OPTIONS"
and KSR.is_myself(KSR.pv.get("$ru"))
and KSR.pv.is_null("$rU")) :
KSR.sl.sl_send_reply(200,"Keepalive");
return -255;
if KSR.sanity.sanity_check(1511, 7)<0 :
KSR.err("Malformed SIP message from "
+ KSR.pv.get("$si") + ":" + str(KSR.pv.get("$sp")) +"\n");
return -255;