本文整理汇总了Python中KSR.is_method_in方法的典型用法代码示例。如果您正苦于以下问题:Python KSR.is_method_in方法的具体用法?Python KSR.is_method_in怎么用?Python KSR.is_method_in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KSR
的用法示例。
在下文中一共展示了KSR.is_method_in方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ksr_route_relay
# 需要导入模块: import KSR [as 别名]
# 或者: from KSR import is_method_in [as 别名]
def ksr_route_relay(self, msg):
# enable additional event routes for forwarded requests
# - serial forking, RTP relaying handling, a.s.o.
if KSR.is_method_in("IBSU") :
if KSR.tm.t_is_set("branch_route")<0 :
KSR.tm.t_on_branch("ksr_branch_manage");
if KSR.is_method_in("ISU") :
if KSR.tm.t_is_set("onreply_route")<0 :
KSR.tm.t_on_reply("ksr_onreply_manage");
if KSR.is_INVITE() :
if KSR.tm.t_is_set("failure_route")<0 :
KSR.tm.t_on_failure("ksr_failure_manage");
if KSR.tm.t_relay()<0 :
KSR.sl.sl_reply_error();
return -255;
示例2: ksr_route_auth
# 需要导入模块: import KSR [as 别名]
# 或者: from KSR import is_method_in [as 别名]
def ksr_route_auth(self, msg):
if not KSR.is_REGISTER() :
if KSR.permissions.allow_source_address(1)>0 :
# source IP allowed
return 1;
if KSR.is_REGISTER() or KSR.is_myself_furi() :
# 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 KSR.is_method_in("RP") :
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_furi()) and (not KSR.is_myself_ruri()) :
KSR.sl.sl_send_reply(403,"Not relaying");
return -255;
return 1;
示例3: ksr_request_route
# 需要导入模块: import KSR [as 别名]
# 或者: from KSR import is_method_in [as 别名]
def ksr_request_route(self, msg):
# KSR.info("===== request - from kamailio python script\n");
# KSR.info("===== method [%s] r-uri [%s]\n" % (KSR.pv.get("$rm"),KSR.pv.get("$ru")));
# per request initial checks
if self.ksr_route_reqinit(msg)==-255 :
return 1;
# NAT detection
if self.ksr_route_natdetect(msg)==-255 :
return 1;
# CANCEL processing
if KSR.is_CANCEL() :
if KSR.tm.t_check_trans()>0 :
self.ksr_route_relay(msg);
return 1;
# handle requests within SIP dialogs
if self.ksr_route_withindlg(msg)==-255 :
return 1;
# -- only initial requests (no To tag)
# handle retransmissions
if KSR.tmx.t_precheck_trans()>0 :
KSR.tm.t_check_trans();
return 1;
if KSR.tm.t_check_trans()==0 :
return 1;
# authentication
if self.ksr_route_auth(msg)==-255 :
return 1
# record routing for dialog forming requests (in case they are routed)
# - remove preloaded route headers
KSR.hdr.remove("Route");
if KSR.is_method_in("IS") :
KSR.rr.record_route();
# account only INVITEs
if KSR.pv.get("$rm")=="INVITE" :
KSR.setflag(FLT_ACC); # do accounting
# dispatch requests to foreign domains
if self.ksr_route_sipout(msg)==-255 :
return 1;
# # requests for my local domains
# handle registrations
if self.ksr_route_registrar(msg)==-255 :
return 1;
if KSR.corex.has_ruri_user() < 0 :
# request with no Username in RURI
KSR.sl.sl_send_reply(484,"Address Incomplete");
return 1;
# user location service
self.ksr_route_location(msg);
return 1;